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 S$=Object.defineProperty;var T$=(e,t,n)=>t in e?S$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ue=(e,t,n)=>T$(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Xg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ky(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cE={exports:{}},Sy={};/**
 * @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 C$=Symbol.for("react.transitional.element"),A$=Symbol.for("react.fragment");function uE(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var s in t)s!=="key"&&(n[s]=t[s])}else n=t;return t=n.ref,{$$typeof:C$,type:e,key:r,ref:t!==void 0?t:null,props:n}}Sy.Fragment=A$;Sy.jsx=uE;Sy.jsxs=uE;cE.exports=Sy;var h=cE.exports,dE={exports:{}},Xt={};/**
 * @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 W3=Symbol.for("react.transitional.element"),E$=Symbol.for("react.portal"),M$=Symbol.for("react.fragment"),I$=Symbol.for("react.strict_mode"),N$=Symbol.for("react.profiler"),R$=Symbol.for("react.consumer"),L$=Symbol.for("react.context"),j$=Symbol.for("react.forward_ref"),D$=Symbol.for("react.suspense"),O$=Symbol.for("react.memo"),hE=Symbol.for("react.lazy"),B$=Symbol.for("react.activity"),$6=Symbol.iterator;function P$(e){return e===null||typeof e!="object"?null:(e=$6&&e[$6]||e["@@iterator"],typeof e=="function"?e:null)}var fE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mE=Object.assign,pE={};function Rh(e,t,n){this.props=e,this.context=t,this.refs=pE,this.updater=n||fE}Rh.prototype.isReactComponent={};Rh.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")};Rh.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gE(){}gE.prototype=Rh.prototype;function G3(e,t,n){this.props=e,this.context=t,this.refs=pE,this.updater=n||fE}var K3=G3.prototype=new gE;K3.constructor=G3;mE(K3,Rh.prototype);K3.isPureReactComponent=!0;var z6=Array.isArray;function Bv(){}var ur={H:null,A:null,T:null,S:null},yE=Object.prototype.hasOwnProperty;function Y3(e,t,n){var r=n.ref;return{$$typeof:W3,type:e,key:t,ref:r!==void 0?r:null,props:n}}function $$(e,t){return Y3(e.type,t,e.props)}function X3(e){return typeof e=="object"&&e!==null&&e.$$typeof===W3}function z$(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var F6=/\/+/g;function r2(e,t){return typeof e=="object"&&e!==null&&e.key!=null?z$(""+e.key):t.toString(36)}function F$(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Bv,Bv):(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 yd(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case W3:case E$:o=!0;break;case hE:return o=e._init,yd(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+r2(e,0):r,z6(s)?(n="",o!=null&&(n=o.replace(F6,"$&/")+"/"),yd(s,t,n,"",function(c){return c})):s!=null&&(X3(s)&&(s=$$(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(F6,"$&/")+"/")+o)),t.push(s)),1;o=0;var a=r===""?".":r+":";if(z6(e))for(var l=0;l<e.length;l++)r=e[l],i=a+r2(r,l),o+=yd(r,t,n,i,s);else if(l=P$(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=a+r2(r,l++),o+=yd(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return yd(F$(e),t,n,r,s);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function rp(e,t,n){if(e==null)return e;var r=[],s=0;return yd(e,r,"","",function(i){return t.call(n,i,s++)}),r}function U$(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 U6=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)},q$={map:rp,forEach:function(e,t,n){rp(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return rp(e,function(){t++}),t},toArray:function(e){return rp(e,function(t){return t})||[]},only:function(e){if(!X3(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Xt.Activity=B$;Xt.Children=q$;Xt.Component=Rh;Xt.Fragment=M$;Xt.Profiler=N$;Xt.PureComponent=G3;Xt.StrictMode=I$;Xt.Suspense=D$;Xt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ur;Xt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return ur.H.useMemoCache(e)}};Xt.cache=function(e){return function(){return e.apply(null,arguments)}};Xt.cacheSignal=function(){return null};Xt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=mE({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!yE.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];r.children=o}return Y3(e.type,s,r)};Xt.createContext=function(e){return e={$$typeof:L$,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:R$,_context:e},e};Xt.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)yE.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];s.children=a}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)s[r]===void 0&&(s[r]=o[r]);return Y3(e,i,s)};Xt.createRef=function(){return{current:null}};Xt.forwardRef=function(e){return{$$typeof:j$,render:e}};Xt.isValidElement=X3;Xt.lazy=function(e){return{$$typeof:hE,_payload:{_status:-1,_result:e},_init:U$}};Xt.memo=function(e,t){return{$$typeof:O$,type:e,compare:t===void 0?null:t}};Xt.startTransition=function(e){var t=ur.T,n={};ur.T=n;try{var r=e(),s=ur.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(Bv,U6)}catch(i){U6(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),ur.T=t}};Xt.unstable_useCacheRefresh=function(){return ur.H.useCacheRefresh()};Xt.use=function(e){return ur.H.use(e)};Xt.useActionState=function(e,t,n){return ur.H.useActionState(e,t,n)};Xt.useCallback=function(e,t){return ur.H.useCallback(e,t)};Xt.useContext=function(e){return ur.H.useContext(e)};Xt.useDebugValue=function(){};Xt.useDeferredValue=function(e,t){return ur.H.useDeferredValue(e,t)};Xt.useEffect=function(e,t){return ur.H.useEffect(e,t)};Xt.useEffectEvent=function(e){return ur.H.useEffectEvent(e)};Xt.useId=function(){return ur.H.useId()};Xt.useImperativeHandle=function(e,t,n){return ur.H.useImperativeHandle(e,t,n)};Xt.useInsertionEffect=function(e,t){return ur.H.useInsertionEffect(e,t)};Xt.useLayoutEffect=function(e,t){return ur.H.useLayoutEffect(e,t)};Xt.useMemo=function(e,t){return ur.H.useMemo(e,t)};Xt.useOptimistic=function(e,t){return ur.H.useOptimistic(e,t)};Xt.useReducer=function(e,t,n){return ur.H.useReducer(e,t,n)};Xt.useRef=function(e){return ur.H.useRef(e)};Xt.useState=function(e){return ur.H.useState(e)};Xt.useSyncExternalStore=function(e,t,n){return ur.H.useSyncExternalStore(e,t,n)};Xt.useTransition=function(){return ur.H.useTransition()};Xt.version="19.2.4";dE.exports=Xt;var g=dE.exports;const H$=ky(g);var bE={exports:{}},Ty={},vE={exports:{}},wE={};/**
 * @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(R,V){var J=R.length;R.push(V);e:for(;0<J;){var ee=J-1>>>1,N=R[ee];if(0<s(N,V))R[ee]=V,R[J]=N,J=ee;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var V=R[0],J=R.pop();if(J!==V){R[0]=J;e:for(var ee=0,N=R.length,G=N>>>1;ee<G;){var B=2*(ee+1)-1,k=R[B],Q=B+1,ce=R[Q];if(0>s(k,J))Q<N&&0>s(ce,k)?(R[ee]=ce,R[Q]=J,ee=Q):(R[ee]=k,R[B]=J,ee=B);else if(Q<N&&0>s(ce,J))R[ee]=ce,R[Q]=J,ee=Q;else break e}}return V}function s(R,V){var J=R.sortIndex-V.sortIndex;return J!==0?J:R.id-V.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=[],u=1,d=null,f=3,m=!1,p=!1,y=!1,w=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function S(R){for(var V=n(c);V!==null;){if(V.callback===null)r(c);else if(V.startTime<=R)r(c),V.sortIndex=V.expirationTime,t(l,V);else break;V=n(c)}}function C(R){if(y=!1,S(R),!p)if(n(l)!==null)p=!0,E||(E=!0,I());else{var V=n(c);V!==null&&q(C,V.startTime-R)}}var E=!1,M=-1,D=5,O=-1;function A(){return w?!0:!(e.unstable_now()-O<D)}function j(){if(w=!1,E){var R=e.unstable_now();O=R;var V=!0;try{e:{p=!1,y&&(y=!1,v(M),M=-1),m=!0;var J=f;try{t:{for(S(R),d=n(l);d!==null&&!(d.expirationTime>R&&A());){var ee=d.callback;if(typeof ee=="function"){d.callback=null,f=d.priorityLevel;var N=ee(d.expirationTime<=R);if(R=e.unstable_now(),typeof N=="function"){d.callback=N,S(R),V=!0;break t}d===n(l)&&r(l),S(R)}else r(l);d=n(l)}if(d!==null)V=!0;else{var G=n(c);G!==null&&q(C,G.startTime-R),V=!1}}break e}finally{d=null,f=J,m=!1}V=void 0}}finally{V?I():E=!1}}}var I;if(typeof x=="function")I=function(){x(j)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,F=P.port2;P.port1.onmessage=j,I=function(){F.postMessage(null)}}else I=function(){b(j,0)};function q(R,V){M=b(function(){R(e.unstable_now())},V)}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(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(R){switch(f){case 1:case 2:case 3:var V=3;break;default:V=f}var J=f;f=V;try{return R()}finally{f=J}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(R,V){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var J=f;f=R;try{return V()}finally{f=J}},e.unstable_scheduleCallback=function(R,V,J){var ee=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ee+J:ee):J=ee,R){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=J+N,R={id:u++,callback:V,priorityLevel:R,startTime:J,expirationTime:N,sortIndex:-1},J>ee?(R.sortIndex=J,t(c,R),n(l)===null&&R===n(c)&&(y?(v(M),M=-1):y=!0,q(C,J-ee))):(R.sortIndex=N,t(l,R),p||m||(p=!0,E||(E=!0,I()))),R},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(R){var V=f;return function(){var J=f;f=V;try{return R.apply(this,arguments)}finally{f=J}}}})(wE);vE.exports=wE;var V$=vE.exports,xE={exports:{}},ei={};/**
 * @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 W$=g;function _E(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 Sl(){}var Xs={d:{f:Sl,r:function(){throw Error(_E(522))},D:Sl,C:Sl,L:Sl,m:Sl,X:Sl,S:Sl,M:Sl},p:0,findDOMNode:null},G$=Symbol.for("react.portal");function K$(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:G$,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Jf=W$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Cy(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}ei.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Xs;ei.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(_E(299));return K$(e,t,null,n)};ei.flushSync=function(e){var t=Jf.T,n=Xs.p;try{if(Jf.T=null,Xs.p=2,e)return e()}finally{Jf.T=t,Xs.p=n,Xs.d.f()}};ei.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Xs.d.C(e,t))};ei.prefetchDNS=function(e){typeof e=="string"&&Xs.d.D(e)};ei.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=Cy(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Xs.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Xs.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};ei.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Cy(t.as,t.crossOrigin);Xs.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&&Xs.d.M(e)};ei.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=Cy(n,t.crossOrigin);Xs.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};ei.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Cy(t.as,t.crossOrigin);Xs.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 Xs.d.m(e)};ei.requestFormReset=function(e){Xs.d.r(e)};ei.unstable_batchedUpdates=function(e,t){return e(t)};ei.useFormState=function(e,t,n){return Jf.H.useFormState(e,t,n)};ei.useFormStatus=function(){return Jf.H.useHostTransitionStatus()};ei.version="19.2.4";function kE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kE)}catch(e){console.error(e)}}kE(),xE.exports=ei;var Ay=xE.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 rs=V$,SE=g,Y$=Ay;function _e(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 TE(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function gm(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 CE(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 AE(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 q6(e){if(gm(e)!==e)throw Error(_e(188))}function X$(e){var t=e.alternate;if(!t){if(t=gm(e),t===null)throw Error(_e(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return q6(s),e;if(i===r)return q6(s),t;i=i.sibling}throw Error(_e(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(_e(189))}}if(n.alternate!==r)throw Error(_e(190))}if(n.tag!==3)throw Error(_e(188));return n.stateNode.current===n?e:t}function EE(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=EE(e),t!==null)return t;e=e.sibling}return null}var hr=Object.assign,Q$=Symbol.for("react.element"),sp=Symbol.for("react.transitional.element"),Df=Symbol.for("react.portal"),Sd=Symbol.for("react.fragment"),ME=Symbol.for("react.strict_mode"),Pv=Symbol.for("react.profiler"),IE=Symbol.for("react.consumer"),Wa=Symbol.for("react.context"),Q3=Symbol.for("react.forward_ref"),$v=Symbol.for("react.suspense"),zv=Symbol.for("react.suspense_list"),J3=Symbol.for("react.memo"),Rl=Symbol.for("react.lazy"),Fv=Symbol.for("react.activity"),J$=Symbol.for("react.memo_cache_sentinel"),H6=Symbol.iterator;function uf(e){return e===null||typeof e!="object"?null:(e=H6&&e[H6]||e["@@iterator"],typeof e=="function"?e:null)}var Z$=Symbol.for("react.client.reference");function Uv(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Z$?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Sd:return"Fragment";case Pv:return"Profiler";case ME:return"StrictMode";case $v:return"Suspense";case zv:return"SuspenseList";case Fv:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Df:return"Portal";case Wa:return e.displayName||"Context";case IE:return(e._context.displayName||"Context")+".Consumer";case Q3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J3:return t=e.displayName||null,t!==null?t:Uv(e.type)||"Memo";case Rl:t=e._payload,e=e._init;try{return Uv(e(t))}catch{}}return null}var Of=Array.isArray,Ft=SE.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,jn=Y$.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,bu={pending:!1,data:null,method:null,action:null},qv=[],Td=-1;function ba(e){return{current:e}}function ps(e){0>Td||(e.current=qv[Td],qv[Td]=null,Td--)}function ir(e,t){Td++,qv[Td]=e.current,e.current=t}var pa=ba(null),M0=ba(null),nc=ba(null),Qg=ba(null);function Jg(e,t){switch(ir(nc,t),ir(M0,e),ir(pa,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?X8(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=X8(t),e=XI(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ps(pa),ir(pa,e)}function ih(){ps(pa),ps(M0),ps(nc)}function Hv(e){e.memoizedState!==null&&ir(Qg,e);var t=pa.current,n=XI(t,e.type);t!==n&&(ir(M0,e),ir(pa,n))}function Zg(e){M0.current===e&&(ps(pa),ps(M0)),Qg.current===e&&(ps(Qg),z0._currentValue=bu)}var s2,V6;function Zc(e){if(s2===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);s2=t&&t[1]||"",V6=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+s2+e+V6}var i2=!1;function o2(e,t){if(!e||i2)return"";i2=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var f=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){f=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){f=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&f&&typeof m.stack=="string")return[m.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var l=o.split(`
`),c=a.split(`
`);for(s=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;if(r===l.length||s===c.length)for(r=l.length-1,s=c.length-1;1<=r&&0<=s&&l[r]!==c[s];)s--;for(;1<=r&&0<=s;r--,s--)if(l[r]!==c[s]){if(r!==1||s!==1)do if(r--,s--,0>s||l[r]!==c[s]){var u=`
`+l[r].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=r&&0<=s);break}}}finally{i2=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Zc(n):""}function ez(e,t){switch(e.tag){case 26:case 27:case 5:return Zc(e.type);case 16:return Zc("Lazy");case 13:return e.child!==t&&t!==null?Zc("Suspense Fallback"):Zc("Suspense");case 19:return Zc("SuspenseList");case 0:case 15:return o2(e.type,!1);case 11:return o2(e.type.render,!1);case 1:return o2(e.type,!0);case 31:return Zc("Activity");default:return""}}function W6(e){try{var t="",n=null;do t+=ez(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var Vv=Object.prototype.hasOwnProperty,Z3=rs.unstable_scheduleCallback,a2=rs.unstable_cancelCallback,tz=rs.unstable_shouldYield,nz=rs.unstable_requestPaint,Oi=rs.unstable_now,rz=rs.unstable_getCurrentPriorityLevel,NE=rs.unstable_ImmediatePriority,RE=rs.unstable_UserBlockingPriority,e1=rs.unstable_NormalPriority,sz=rs.unstable_LowPriority,LE=rs.unstable_IdlePriority,iz=rs.log,oz=rs.unstable_setDisableYieldValue,ym=null,Bi=null;function Wl(e){if(typeof iz=="function"&&oz(e),Bi&&typeof Bi.setStrictMode=="function")try{Bi.setStrictMode(ym,e)}catch{}}var Pi=Math.clz32?Math.clz32:cz,az=Math.log,lz=Math.LN2;function cz(e){return e>>>=0,e===0?32:31-(az(e)/lz|0)|0}var ip=256,op=262144,ap=4194304;function eu(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 Ey(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=r&134217727;return a!==0?(r=a&~i,r!==0?s=eu(r):(o&=a,o!==0?s=eu(o):n||(n=a&~e,n!==0&&(s=eu(n))))):(a=r&~i,a!==0?s=eu(a):o!==0?s=eu(o):n||(n=r&~e,n!==0&&(s=eu(n)))),s===0?0:t!==0&&t!==s&&!(t&i)&&(i=s&-s,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:s}function bm(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function uz(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 jE(){var e=ap;return ap<<=1,!(ap&62914560)&&(ap=4194304),e}function l2(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vm(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function dz(e,t,n,r,s,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var a=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Pi(n),d=1<<u;a[u]=0,l[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var m=f[u];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&DE(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function DE(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Pi(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function OE(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Pi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function BE(e,t){var n=t&-t;return n=n&42?1:e_(n),n&(e.suspendedLanes|t)?0:n}function e_(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 t_(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function PE(){var e=jn.p;return e!==0?e:(e=window.event,e===void 0?32:aN(e.type))}function G6(e,t){var n=jn.p;try{return jn.p=e,t()}finally{jn.p=n}}var Mc=Math.random().toString(36).slice(2),xs="__reactFiber$"+Mc,vi="__reactProps$"+Mc,Lh="__reactContainer$"+Mc,Wv="__reactEvents$"+Mc,hz="__reactListeners$"+Mc,fz="__reactHandles$"+Mc,K6="__reactResources$"+Mc,wm="__reactMarker$"+Mc;function n_(e){delete e[xs],delete e[vi],delete e[Wv],delete e[hz],delete e[fz]}function Cd(e){var t=e[xs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Lh]||n[xs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=tS(e);e!==null;){if(n=e[xs])return n;e=tS(e)}return t}e=n,n=e.parentNode}return null}function jh(e){if(e=e[xs]||e[Lh]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Bf(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(_e(33))}function qd(e){var t=e[K6];return t||(t=e[K6]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function fs(e){e[wm]=!0}var $E=new Set,zE={};function qu(e,t){oh(e,t),oh(e+"Capture",t)}function oh(e,t){for(zE[e]=t,e=0;e<t.length;e++)$E.add(t[e])}var mz=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]*$"),Y6={},X6={};function pz(e){return Vv.call(X6,e)?!0:Vv.call(Y6,e)?!1:mz.test(e)?X6[e]=!0:(Y6[e]=!0,!1)}function pg(e,t,n){if(pz(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function lp(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 Na(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function no(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function FE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gz(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gv(e){if(!e._valueTracker){var t=FE(e)?"checked":"value";e._valueTracker=gz(e,t,""+e[t])}}function UE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=FE(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function t1(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 yz=/[\n"\\]/g;function lo(e){return e.replace(yz,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Kv(e,t,n,r,s,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=""+no(t)):e.value!==""+no(t)&&(e.value=""+no(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?Yv(e,o,no(t)):n!=null?Yv(e,o,no(n)):r!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+no(a):e.removeAttribute("name")}function qE(e,t,n,r,s,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)){Gv(e);return}n=n!=null?""+no(n):"",t=t!=null?""+no(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}r=r??s,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=a?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Gv(e)}function Yv(e,t,n){t==="number"&&t1(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Hd(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+no(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function HE(e,t,n){if(t!=null&&(t=""+no(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+no(n):""}function VE(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(_e(92));if(Of(r)){if(1<r.length)throw Error(_e(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=no(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),Gv(e)}function ah(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var bz=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 Q6(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||bz.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function WE(e,t,n){if(t!=null&&typeof t!="object")throw Error(_e(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var s in t)r=t[s],t.hasOwnProperty(s)&&n[s]!==r&&Q6(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&Q6(e,i,t[i])}function r_(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 vz=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"]]),wz=/^[\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 gg(e){return wz.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ga(){}var Xv=null;function s_(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ad=null,Vd=null;function J6(e){var t=jh(e);if(t&&(e=t.stateNode)){var n=e[vi]||null;e:switch(e=t.stateNode,t.type){case"input":if(Kv(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="'+lo(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[vi]||null;if(!s)throw Error(_e(90));Kv(r,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&UE(r)}break e;case"textarea":HE(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Hd(e,!!n.multiple,t,!1)}}}var c2=!1;function GE(e,t,n){if(c2)return e(t,n);c2=!0;try{var r=e(t);return r}finally{if(c2=!1,(Ad!==null||Vd!==null)&&(zy(),Ad&&(t=Ad,e=Vd,Vd=Ad=null,J6(t),e)))for(t=0;t<e.length;t++)J6(e[t])}}function I0(e,t){var n=e.stateNode;if(n===null)return null;var r=n[vi]||null;if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(_e(231,t,typeof n));return n}var sl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qv=!1;if(sl)try{var df={};Object.defineProperty(df,"passive",{get:function(){Qv=!0}}),window.addEventListener("test",df,df),window.removeEventListener("test",df,df)}catch{Qv=!1}var Gl=null,i_=null,yg=null;function KE(){if(yg)return yg;var e,t=i_,n=t.length,r,s="value"in Gl?Gl.value:Gl.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return yg=s.slice(e,1<r?1-r:void 0)}function bg(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 cp(){return!0}function Z6(){return!1}function _i(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var 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)?cp:Z6,this.isPropagationStopped=Z6,this}return hr(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=cp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=cp)},persist:function(){},isPersistent:cp}),t}var Hu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},My=_i(Hu),xm=hr({},Hu,{view:0,detail:0}),xz=_i(xm),u2,d2,hf,Iy=hr({},xm,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:o_,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!==hf&&(hf&&e.type==="mousemove"?(u2=e.screenX-hf.screenX,d2=e.screenY-hf.screenY):d2=u2=0,hf=e),u2)},movementY:function(e){return"movementY"in e?e.movementY:d2}}),e8=_i(Iy),_z=hr({},Iy,{dataTransfer:0}),kz=_i(_z),Sz=hr({},xm,{relatedTarget:0}),h2=_i(Sz),Tz=hr({},Hu,{animationName:0,elapsedTime:0,pseudoElement:0}),Cz=_i(Tz),Az=hr({},Hu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ez=_i(Az),Mz=hr({},Hu,{data:0}),t8=_i(Mz),Iz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nz={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"},Rz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lz(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Rz[e])?!!t[e]:!1}function o_(){return Lz}var jz=hr({},xm,{key:function(e){if(e.key){var t=Iz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bg(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Nz[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:o_,charCode:function(e){return e.type==="keypress"?bg(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bg(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Dz=_i(jz),Oz=hr({},Iy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),n8=_i(Oz),Bz=hr({},xm,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:o_}),Pz=_i(Bz),$z=hr({},Hu,{propertyName:0,elapsedTime:0,pseudoElement:0}),zz=_i($z),Fz=hr({},Iy,{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}),Uz=_i(Fz),qz=hr({},Hu,{newState:0,oldState:0}),Hz=_i(qz),Vz=[9,13,27,32],a_=sl&&"CompositionEvent"in window,Zf=null;sl&&"documentMode"in document&&(Zf=document.documentMode);var Wz=sl&&"TextEvent"in window&&!Zf,YE=sl&&(!a_||Zf&&8<Zf&&11>=Zf),r8=" ",s8=!1;function XE(e,t){switch(e){case"keyup":return Vz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function QE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ed=!1;function Gz(e,t){switch(e){case"compositionend":return QE(t);case"keypress":return t.which!==32?null:(s8=!0,r8);case"textInput":return e=t.data,e===r8&&s8?null:e;default:return null}}function Kz(e,t){if(Ed)return e==="compositionend"||!a_&&XE(e,t)?(e=KE(),yg=i_=Gl=null,Ed=!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 YE&&t.locale!=="ko"?null:t.data;default:return null}}var Yz={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 i8(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Yz[e.type]:t==="textarea"}function JE(e,t,n,r){Ad?Vd?Vd.push(r):Vd=[r]:Ad=r,t=v1(t,"onChange"),0<t.length&&(n=new My("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var e0=null,N0=null;function Xz(e){GI(e,0)}function Ny(e){var t=Bf(e);if(UE(t))return e}function o8(e,t){if(e==="change")return t}var ZE=!1;if(sl){var f2;if(sl){var m2="oninput"in document;if(!m2){var a8=document.createElement("div");a8.setAttribute("oninput","return;"),m2=typeof a8.oninput=="function"}f2=m2}else f2=!1;ZE=f2&&(!document.documentMode||9<document.documentMode)}function l8(){e0&&(e0.detachEvent("onpropertychange",eM),N0=e0=null)}function eM(e){if(e.propertyName==="value"&&Ny(N0)){var t=[];JE(t,N0,e,s_(e)),GE(Xz,t)}}function Qz(e,t,n){e==="focusin"?(l8(),e0=t,N0=n,e0.attachEvent("onpropertychange",eM)):e==="focusout"&&l8()}function Jz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ny(N0)}function Zz(e,t){if(e==="click")return Ny(t)}function eF(e,t){if(e==="input"||e==="change")return Ny(t)}function tF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ui=typeof Object.is=="function"?Object.is:tF;function R0(e,t){if(Ui(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Vv.call(t,s)||!Ui(e[s],t[s]))return!1}return!0}function c8(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function u8(e,t){var n=c8(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=c8(n)}}function tM(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?tM(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function nM(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=t1(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=t1(e.document)}return t}function l_(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 nF=sl&&"documentMode"in document&&11>=document.documentMode,Md=null,Jv=null,t0=null,Zv=!1;function d8(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Zv||Md==null||Md!==t1(r)||(r=Md,"selectionStart"in r&&l_(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),t0&&R0(t0,r)||(t0=r,r=v1(Jv,"onSelect"),0<r.length&&(t=new My("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Md)))}function Vc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Id={animationend:Vc("Animation","AnimationEnd"),animationiteration:Vc("Animation","AnimationIteration"),animationstart:Vc("Animation","AnimationStart"),transitionrun:Vc("Transition","TransitionRun"),transitionstart:Vc("Transition","TransitionStart"),transitioncancel:Vc("Transition","TransitionCancel"),transitionend:Vc("Transition","TransitionEnd")},p2={},rM={};sl&&(rM=document.createElement("div").style,"AnimationEvent"in window||(delete Id.animationend.animation,delete Id.animationiteration.animation,delete Id.animationstart.animation),"TransitionEvent"in window||delete Id.transitionend.transition);function Vu(e){if(p2[e])return p2[e];if(!Id[e])return e;var t=Id[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in rM)return p2[e]=t[n];return e}var sM=Vu("animationend"),iM=Vu("animationiteration"),oM=Vu("animationstart"),rF=Vu("transitionrun"),sF=Vu("transitionstart"),iF=Vu("transitioncancel"),aM=Vu("transitionend"),lM=new Map,ew="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(" ");ew.push("scrollEnd");function Do(e,t){lM.set(e,t),qu(t,[e])}var n1=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)},to=[],Nd=0,c_=0;function Ry(){for(var e=Nd,t=c_=Nd=0;t<e;){var n=to[t];to[t++]=null;var r=to[t];to[t++]=null;var s=to[t];to[t++]=null;var i=to[t];if(to[t++]=null,r!==null&&s!==null){var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}i!==0&&cM(n,s,i)}}function Ly(e,t,n,r){to[Nd++]=e,to[Nd++]=t,to[Nd++]=n,to[Nd++]=r,c_|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function u_(e,t,n,r){return Ly(e,t,n,r),r1(e)}function Wu(e,t){return Ly(e,null,null,t),r1(e)}function cM(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var s=!1,i=e.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-Pi(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function r1(e){if(50<u0)throw u0=0,xw=null,Error(_e(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Rd={};function oF(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(e,t,n,r){return new oF(e,t,n,r)}function d_(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ja(e,t){var n=e.alternate;return n===null?(n=Ri(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 uM(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 vg(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")d_(e)&&(o=1);else if(typeof e=="string")o=dU(e,n,pa.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Fv:return e=Ri(31,n,t,s),e.elementType=Fv,e.lanes=i,e;case Sd:return vu(n.children,s,i,t);case ME:o=8,s|=24;break;case Pv:return e=Ri(12,n,t,s|2),e.elementType=Pv,e.lanes=i,e;case $v:return e=Ri(13,n,t,s),e.elementType=$v,e.lanes=i,e;case zv:return e=Ri(19,n,t,s),e.elementType=zv,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wa:o=10;break e;case IE:o=9;break e;case Q3:o=11;break e;case J3:o=14;break e;case Rl:o=16,r=null;break e}o=29,n=Error(_e(130,e===null?"null":typeof e,"")),r=null}return t=Ri(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function vu(e,t,n,r){return e=Ri(7,e,r,t),e.lanes=n,e}function g2(e,t,n){return e=Ri(6,e,null,t),e.lanes=n,e}function dM(e){var t=Ri(18,null,null,0);return t.stateNode=e,t}function y2(e,t,n){return t=Ri(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var h8=new WeakMap;function co(e,t){if(typeof e=="object"&&e!==null){var n=h8.get(e);return n!==void 0?n:(t={value:e,source:t,stack:W6(t)},h8.set(e,t),t)}return{value:e,source:t,stack:W6(t)}}var Ld=[],jd=0,s1=null,L0=0,ro=[],so=0,mc=null,la=1,ca="";function za(e,t){Ld[jd++]=L0,Ld[jd++]=s1,s1=e,L0=t}function hM(e,t,n){ro[so++]=la,ro[so++]=ca,ro[so++]=mc,mc=e;var r=la;e=ca;var s=32-Pi(r)-1;r&=~(1<<s),n+=1;var i=32-Pi(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,la=1<<32-Pi(t)+s|n<<s|r,ca=i+e}else la=1<<i|n<<s|r,ca=e}function h_(e){e.return!==null&&(za(e,1),hM(e,1,0))}function f_(e){for(;e===s1;)s1=Ld[--jd],Ld[jd]=null,L0=Ld[--jd],Ld[jd]=null;for(;e===mc;)mc=ro[--so],ro[so]=null,ca=ro[--so],ro[so]=null,la=ro[--so],ro[so]=null}function fM(e,t){ro[so++]=la,ro[so++]=ca,ro[so++]=mc,la=t.id,ca=t.overflow,mc=e}var _s=null,cr=null,wn=!1,rc=null,uo=!1,tw=Error(_e(519));function pc(e){var t=Error(_e(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw j0(co(t,e)),tw}function f8(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[xs]=e,t[vi]=r,n){case"dialog":un("cancel",t),un("close",t);break;case"iframe":case"object":case"embed":un("load",t);break;case"video":case"audio":for(n=0;n<P0.length;n++)un(P0[n],t);break;case"source":un("error",t);break;case"img":case"image":case"link":un("error",t),un("load",t);break;case"details":un("toggle",t);break;case"input":un("invalid",t),qE(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":un("invalid",t);break;case"textarea":un("invalid",t),VE(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||YI(t.textContent,n)?(r.popover!=null&&(un("beforetoggle",t),un("toggle",t)),r.onScroll!=null&&un("scroll",t),r.onScrollEnd!=null&&un("scrollend",t),r.onClick!=null&&(t.onclick=Ga),t=!0):t=!1,t||pc(e,!0)}function m8(e){for(_s=e.return;_s;)switch(_s.tag){case 5:case 31:case 13:uo=!1;return;case 27:case 3:uo=!0;return;default:_s=_s.return}}function cd(e){if(e!==_s)return!1;if(!wn)return m8(e),wn=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Cw(e.type,e.memoizedProps)),n=!n),n&&cr&&pc(e),m8(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_e(317));cr=eS(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_e(317));cr=eS(e)}else t===27?(t=cr,Ic(e.type)?(e=Iw,Iw=null,cr=e):cr=t):cr=_s?yo(e.stateNode.nextSibling):null;return!0}function Mu(){cr=_s=null,wn=!1}function b2(){var e=rc;return e!==null&&(di===null?di=e:di.push.apply(di,e),rc=null),e}function j0(e){rc===null?rc=[e]:rc.push(e)}var nw=ba(null),Gu=null,Ka=null;function zl(e,t,n){ir(nw,t._currentValue),t._currentValue=n}function Za(e){e._currentValue=nw.current,ps(nw)}function rw(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function sw(e,t,n,r){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var o=s.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=s;for(var l=0;l<t.length;l++)if(a.context===t[l]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),rw(i.return,n,e),r||(o=null);break e}i=a.next}}else if(s.tag===18){if(o=s.return,o===null)throw Error(_e(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),rw(o,n,e),o=null}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}}function Dh(e,t,n,r){e=null;for(var s=t,i=!1;s!==null;){if(!i){if(s.flags&524288)i=!0;else if(s.flags&262144)break}if(s.tag===10){var o=s.alternate;if(o===null)throw Error(_e(387));if(o=o.memoizedProps,o!==null){var a=s.type;Ui(s.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(s===Qg.current){if(o=s.alternate,o===null)throw Error(_e(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(z0):e=[z0])}s=s.return}e!==null&&sw(t,e,n,r),t.flags|=262144}function i1(e){for(e=e.firstContext;e!==null;){if(!Ui(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Iu(e){Gu=e,Ka=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ks(e){return mM(Gu,e)}function up(e,t){return Gu===null&&Iu(e),mM(e,t)}function mM(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ka===null){if(e===null)throw Error(_e(308));Ka=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ka=Ka.next=t;return n}var aF=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},lF=rs.unstable_scheduleCallback,cF=rs.unstable_NormalPriority,Fr={$$typeof:Wa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function m_(){return{controller:new aF,data:new Map,refCount:0}}function _m(e){e.refCount--,e.refCount===0&&lF(cF,function(){e.controller.abort()})}var n0=null,iw=0,lh=0,Wd=null;function uF(e,t){if(n0===null){var n=n0=[];iw=0,lh=$_(),Wd={status:"pending",value:void 0,then:function(r){n.push(r)}}}return iw++,t.then(p8,p8),t}function p8(){if(--iw===0&&n0!==null){Wd!==null&&(Wd.status="fulfilled");var e=n0;n0=null,lh=0,Wd=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function dF(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(r.status="rejected",r.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),r}var g8=Ft.S;Ft.S=function(e,t){EI=Oi(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&uF(e,t),g8!==null&&g8(e,t)};var wu=ba(null);function p_(){var e=wu.current;return e!==null?e:Zn.pooledCache}function wg(e,t){t===null?ir(wu,wu.current):ir(wu,t.pool)}function pM(){var e=p_();return e===null?null:{parent:Fr._currentValue,pool:e}}var Oh=Error(_e(460)),g_=Error(_e(474)),jy=Error(_e(542)),o1={then:function(){}};function y8(e){return e=e.status,e==="fulfilled"||e==="rejected"}function gM(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ga,Ga),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,v8(e),e;default:if(typeof t.status=="string")t.then(Ga,Ga);else{if(e=Zn,e!==null&&100<e.shellSuspendCounter)throw Error(_e(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=r}},function(r){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,v8(e),e}throw xu=t,Oh}}function tu(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(xu=n,Oh):n}}var xu=null;function b8(){if(xu===null)throw Error(_e(459));var e=xu;return xu=null,e}function v8(e){if(e===Oh||e===jy)throw Error(_e(483))}var Gd=null,D0=0;function dp(e){var t=D0;return D0+=1,Gd===null&&(Gd=[]),gM(Gd,e,t)}function ff(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function hp(e,t){throw t.$$typeof===Q$?Error(_e(525)):(e=Object.prototype.toString.call(t),Error(_e(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function yM(e){function t(b,v){if(e){var x=b.deletions;x===null?(b.deletions=[v],b.flags|=16):x.push(v)}}function n(b,v){if(!e)return null;for(;v!==null;)t(b,v),v=v.sibling;return null}function r(b){for(var v=new Map;b!==null;)b.key!==null?v.set(b.key,b):v.set(b.index,b),b=b.sibling;return v}function s(b,v){return b=Ja(b,v),b.index=0,b.sibling=null,b}function i(b,v,x){return b.index=x,e?(x=b.alternate,x!==null?(x=x.index,x<v?(b.flags|=67108866,v):x):(b.flags|=67108866,v)):(b.flags|=1048576,v)}function o(b){return e&&b.alternate===null&&(b.flags|=67108866),b}function a(b,v,x,S){return v===null||v.tag!==6?(v=g2(x,b.mode,S),v.return=b,v):(v=s(v,x),v.return=b,v)}function l(b,v,x,S){var C=x.type;return C===Sd?u(b,v,x.props.children,S,x.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Rl&&tu(C)===v.type)?(v=s(v,x.props),ff(v,x),v.return=b,v):(v=vg(x.type,x.key,x.props,null,b.mode,S),ff(v,x),v.return=b,v)}function c(b,v,x,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=y2(x,b.mode,S),v.return=b,v):(v=s(v,x.children||[]),v.return=b,v)}function u(b,v,x,S,C){return v===null||v.tag!==7?(v=vu(x,b.mode,S,C),v.return=b,v):(v=s(v,x),v.return=b,v)}function d(b,v,x){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=g2(""+v,b.mode,x),v.return=b,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case sp:return x=vg(v.type,v.key,v.props,null,b.mode,x),ff(x,v),x.return=b,x;case Df:return v=y2(v,b.mode,x),v.return=b,v;case Rl:return v=tu(v),d(b,v,x)}if(Of(v)||uf(v))return v=vu(v,b.mode,x,null),v.return=b,v;if(typeof v.then=="function")return d(b,dp(v),x);if(v.$$typeof===Wa)return d(b,up(b,v),x);hp(b,v)}return null}function f(b,v,x,S){var C=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return C!==null?null:a(b,v,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case sp:return x.key===C?l(b,v,x,S):null;case Df:return x.key===C?c(b,v,x,S):null;case Rl:return x=tu(x),f(b,v,x,S)}if(Of(x)||uf(x))return C!==null?null:u(b,v,x,S,null);if(typeof x.then=="function")return f(b,v,dp(x),S);if(x.$$typeof===Wa)return f(b,v,up(b,x),S);hp(b,x)}return null}function m(b,v,x,S,C){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return b=b.get(x)||null,a(v,b,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case sp:return b=b.get(S.key===null?x:S.key)||null,l(v,b,S,C);case Df:return b=b.get(S.key===null?x:S.key)||null,c(v,b,S,C);case Rl:return S=tu(S),m(b,v,x,S,C)}if(Of(S)||uf(S))return b=b.get(x)||null,u(v,b,S,C,null);if(typeof S.then=="function")return m(b,v,x,dp(S),C);if(S.$$typeof===Wa)return m(b,v,x,up(v,S),C);hp(v,S)}return null}function p(b,v,x,S){for(var C=null,E=null,M=v,D=v=0,O=null;M!==null&&D<x.length;D++){M.index>D?(O=M,M=null):O=M.sibling;var A=f(b,M,x[D],S);if(A===null){M===null&&(M=O);break}e&&M&&A.alternate===null&&t(b,M),v=i(A,v,D),E===null?C=A:E.sibling=A,E=A,M=O}if(D===x.length)return n(b,M),wn&&za(b,D),C;if(M===null){for(;D<x.length;D++)M=d(b,x[D],S),M!==null&&(v=i(M,v,D),E===null?C=M:E.sibling=M,E=M);return wn&&za(b,D),C}for(M=r(M);D<x.length;D++)O=m(M,b,D,x[D],S),O!==null&&(e&&O.alternate!==null&&M.delete(O.key===null?D:O.key),v=i(O,v,D),E===null?C=O:E.sibling=O,E=O);return e&&M.forEach(function(j){return t(b,j)}),wn&&za(b,D),C}function y(b,v,x,S){if(x==null)throw Error(_e(151));for(var C=null,E=null,M=v,D=v=0,O=null,A=x.next();M!==null&&!A.done;D++,A=x.next()){M.index>D?(O=M,M=null):O=M.sibling;var j=f(b,M,A.value,S);if(j===null){M===null&&(M=O);break}e&&M&&j.alternate===null&&t(b,M),v=i(j,v,D),E===null?C=j:E.sibling=j,E=j,M=O}if(A.done)return n(b,M),wn&&za(b,D),C;if(M===null){for(;!A.done;D++,A=x.next())A=d(b,A.value,S),A!==null&&(v=i(A,v,D),E===null?C=A:E.sibling=A,E=A);return wn&&za(b,D),C}for(M=r(M);!A.done;D++,A=x.next())A=m(M,b,D,A.value,S),A!==null&&(e&&A.alternate!==null&&M.delete(A.key===null?D:A.key),v=i(A,v,D),E===null?C=A:E.sibling=A,E=A);return e&&M.forEach(function(I){return t(b,I)}),wn&&za(b,D),C}function w(b,v,x,S){if(typeof x=="object"&&x!==null&&x.type===Sd&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case sp:e:{for(var C=x.key;v!==null;){if(v.key===C){if(C=x.type,C===Sd){if(v.tag===7){n(b,v.sibling),S=s(v,x.props.children),S.return=b,b=S;break e}}else if(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Rl&&tu(C)===v.type){n(b,v.sibling),S=s(v,x.props),ff(S,x),S.return=b,b=S;break e}n(b,v);break}else t(b,v);v=v.sibling}x.type===Sd?(S=vu(x.props.children,b.mode,S,x.key),S.return=b,b=S):(S=vg(x.type,x.key,x.props,null,b.mode,S),ff(S,x),S.return=b,b=S)}return o(b);case Df:e:{for(C=x.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(b,v.sibling),S=s(v,x.children||[]),S.return=b,b=S;break e}else{n(b,v);break}else t(b,v);v=v.sibling}S=y2(x,b.mode,S),S.return=b,b=S}return o(b);case Rl:return x=tu(x),w(b,v,x,S)}if(Of(x))return p(b,v,x,S);if(uf(x)){if(C=uf(x),typeof C!="function")throw Error(_e(150));return x=C.call(x),y(b,v,x,S)}if(typeof x.then=="function")return w(b,v,dp(x),S);if(x.$$typeof===Wa)return w(b,v,up(b,x),S);hp(b,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(b,v.sibling),S=s(v,x),S.return=b,b=S):(n(b,v),S=g2(x,b.mode,S),S.return=b,b=S),o(b)):n(b,v)}return function(b,v,x,S){try{D0=0;var C=w(b,v,x,S);return Gd=null,C}catch(M){if(M===Oh||M===jy)throw M;var E=Ri(29,M,null,b.mode);return E.lanes=S,E.return=b,E}finally{}}}var Nu=yM(!0),bM=yM(!1),Ll=!1;function y_(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ow(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 sc(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ic(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rn&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=r1(e),cM(e,null,n),t}return Ly(e,r,t,n),r1(e)}function r0(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,OE(e,n)}}function v2(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var aw=!1;function s0(){if(aw){var e=Wd;if(e!==null)throw e}}function i0(e,t,n,r){aw=!1;var s=e.updateQueue;Ll=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=s.baseState;o=0,u=c=l=null,a=i;do{var f=a.lane&-536870913,m=f!==a.lane;if(m?(pn&f)===f:(r&f)===f){f!==0&&f===lh&&(aw=!0),u!==null&&(u=u.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var p=e,y=a;f=t;var w=n;switch(y.tag){case 1:if(p=y.payload,typeof p=="function"){d=p.call(w,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,f=typeof p=="function"?p.call(w,d,f):p,f==null)break e;d=hr({},d,f);break e;case 2:Ll=!0}}f=a.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=s.callbacks,m===null?s.callbacks=[f]:m.push(f))}else m={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=d):u=u.next=m,o|=f;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;m=a,a=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);u===null&&(l=d),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,i===null&&(s.shared.lanes=0),yc|=o,e.lanes=o,e.memoizedState=d}}function vM(e,t){if(typeof e!="function")throw Error(_e(191,e));e.call(t)}function wM(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)vM(n[e],t)}var ch=ba(null),a1=ba(0);function w8(e,t){e=ll,ir(a1,e),ir(ch,t),ll=e|t.baseLanes}function lw(){ir(a1,ll),ir(ch,ch.current)}function b_(){ll=a1.current,ps(ch),ps(a1)}var qi=ba(null),go=null;function Fl(e){var t=e.alternate;ir(Rr,Rr.current&1),ir(qi,e),go===null&&(t===null||ch.current!==null||t.memoizedState!==null)&&(go=e)}function cw(e){ir(Rr,Rr.current),ir(qi,e),go===null&&(go=e)}function xM(e){e.tag===22?(ir(Rr,Rr.current),ir(qi,e),go===null&&(go=e)):Ul()}function Ul(){ir(Rr,Rr.current),ir(qi,qi.current)}function Ni(e){ps(qi),go===e&&(go=null),ps(Rr)}var Rr=ba(0);function l1(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Ew(n)||Mw(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 il=0,Zt=null,qn=null,Pr=null,c1=!1,Kd=!1,Ru=!1,u1=0,O0=0,Yd=null,hF=0;function Tr(){throw Error(_e(321))}function v_(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ui(e[n],t[n]))return!1;return!0}function w_(e,t,n,r,s,i){return il=i,Zt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ft.H=e===null||e.memoizedState===null?JM:N_,Ru=!1,i=n(r,s),Ru=!1,Kd&&(i=kM(t,n,r,s)),_M(e),i}function _M(e){Ft.H=B0;var t=qn!==null&&qn.next!==null;if(il=0,Pr=qn=Zt=null,c1=!1,O0=0,Yd=null,t)throw Error(_e(300));e===null||Ur||(e=e.dependencies,e!==null&&i1(e)&&(Ur=!0))}function kM(e,t,n,r){Zt=e;var s=0;do{if(Kd&&(Yd=null),O0=0,Kd=!1,25<=s)throw Error(_e(301));if(s+=1,Pr=qn=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Ft.H=ZM,i=t(n,r)}while(Kd);return i}function fF(){var e=Ft.H,t=e.useState()[0];return t=typeof t.then=="function"?km(t):t,e=e.useState()[0],(qn!==null?qn.memoizedState:null)!==e&&(Zt.flags|=1024),t}function x_(){var e=u1!==0;return u1=0,e}function __(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function k_(e){if(c1){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}c1=!1}il=0,Pr=qn=Zt=null,Kd=!1,O0=u1=0,Yd=null}function Hs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pr===null?Zt.memoizedState=Pr=e:Pr=Pr.next=e,Pr}function Lr(){if(qn===null){var e=Zt.alternate;e=e!==null?e.memoizedState:null}else e=qn.next;var t=Pr===null?Zt.memoizedState:Pr.next;if(t!==null)Pr=t,qn=e;else{if(e===null)throw Zt.alternate===null?Error(_e(467)):Error(_e(310));qn=e,e={memoizedState:qn.memoizedState,baseState:qn.baseState,baseQueue:qn.baseQueue,queue:qn.queue,next:null},Pr===null?Zt.memoizedState=Pr=e:Pr=Pr.next=e}return Pr}function Dy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function km(e){var t=O0;return O0+=1,Yd===null&&(Yd=[]),e=gM(Yd,e,t),t=Zt,(Pr===null?t.memoizedState:Pr.next)===null&&(t=t.alternate,Ft.H=t===null||t.memoizedState===null?JM:N_),e}function Oy(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return km(e);if(e.$$typeof===Wa)return ks(e)}throw Error(_e(438,String(e)))}function S_(e){var t=null,n=Zt.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Zt.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Dy(),Zt.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=J$;return t.index++,n}function ol(e,t){return typeof t=="function"?t(e):t}function xg(e){var t=Lr();return T_(t,qn,e)}function T_(e,t,n){var r=e.queue;if(r===null)throw Error(_e(311));r.lastRenderedReducer=n;var s=e.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}t.baseQueue=s=i,r.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var a=o=null,l=null,c=t,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(pn&d)===d:(il&d)===d){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}),d===lh&&(u=!0);else if((il&f)===f){c=c.next,f===lh&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=d,o=i):l=l.next=d,Zt.lanes|=f,yc|=f;d=c.action,Ru&&n(i,d),i=c.hasEagerState?c.eagerState:n(i,d)}else f={lane:d,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,Zt.lanes|=d,yc|=d;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!Ui(i,e.memoizedState)&&(Ur=!0,u&&(n=Wd,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=l,r.lastRenderedState=i}return s===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function w2(e){var t=Lr(),n=t.queue;if(n===null)throw Error(_e(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Ui(i,t.memoizedState)||(Ur=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function SM(e,t,n){var r=Zt,s=Lr(),i=wn;if(i){if(n===void 0)throw Error(_e(407));n=n()}else n=t();var o=!Ui((qn||s).memoizedState,n);if(o&&(s.memoizedState=n,Ur=!0),s=s.queue,C_(AM.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||Pr!==null&&Pr.memoizedState.tag&1){if(r.flags|=2048,uh(9,{destroy:void 0},CM.bind(null,r,s,n,t),null),Zn===null)throw Error(_e(349));i||il&127||TM(r,t,n)}return n}function TM(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Zt.updateQueue,t===null?(t=Dy(),Zt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function CM(e,t,n,r){t.value=n,t.getSnapshot=r,EM(t)&&MM(e)}function AM(e,t,n){return n(function(){EM(t)&&MM(e)})}function EM(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ui(e,n)}catch{return!0}}function MM(e){var t=Wu(e,2);t!==null&&yi(t,e,2)}function uw(e){var t=Hs();if(typeof e=="function"){var n=e;if(e=n(),Ru){Wl(!0);try{n()}finally{Wl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:e},t}function IM(e,t,n,r){return e.baseState=n,T_(e,qn,typeof r=="function"?r:ol)}function mF(e,t,n,r,s){if(Py(e))throw Error(_e(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};Ft.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,NM(t,i)):(i.next=n.next,t.pending=n.next=i)}}function NM(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=Ft.T,o={};Ft.T=o;try{var a=n(s,r),l=Ft.S;l!==null&&l(o,a),x8(e,t,a)}catch(c){dw(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),Ft.T=i}}else try{i=n(s,r),x8(e,t,i)}catch(c){dw(e,t,c)}}function x8(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){_8(e,t,r)},function(r){return dw(e,t,r)}):_8(e,t,n)}function _8(e,t,n){t.status="fulfilled",t.value=n,RM(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,NM(e,n)))}function dw(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,RM(t),t=t.next;while(t!==r)}e.action=null}function RM(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function LM(e,t){return t}function k8(e,t){if(wn){var n=Zn.formState;if(n!==null){e:{var r=Zt;if(wn){if(cr){t:{for(var s=cr,i=uo;s.nodeType!==8;){if(!i){s=null;break t}if(s=yo(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){cr=yo(s.nextSibling),r=s.data==="F!";break e}}pc(r)}r=!1}r&&(t=n[0])}}return n=Hs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:LM,lastRenderedState:t},n.queue=r,n=YM.bind(null,Zt,r),r.dispatch=n,r=uw(!1),i=I_.bind(null,Zt,!1,r.queue),r=Hs(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=mF.bind(null,Zt,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function S8(e){var t=Lr();return jM(t,qn,e)}function jM(e,t,n){if(t=T_(e,t,LM)[0],e=xg(ol)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=km(t)}catch(o){throw o===Oh?jy:o}else r=t;t=Lr();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(Zt.flags|=2048,uh(9,{destroy:void 0},pF.bind(null,s,n),null)),[r,i,e]}function pF(e,t){e.action=t}function T8(e){var t=Lr(),n=qn;if(n!==null)return jM(t,n,e);Lr(),t=t.memoizedState,n=Lr();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function uh(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Zt.updateQueue,t===null&&(t=Dy(),Zt.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function DM(){return Lr().memoizedState}function _g(e,t,n,r){var s=Hs();Zt.flags|=e,s.memoizedState=uh(1|t,{destroy:void 0},n,r===void 0?null:r)}function By(e,t,n,r){var s=Lr();r=r===void 0?null:r;var i=s.memoizedState.inst;qn!==null&&r!==null&&v_(r,qn.memoizedState.deps)?s.memoizedState=uh(t,i,n,r):(Zt.flags|=e,s.memoizedState=uh(1|t,i,n,r))}function C8(e,t){_g(8390656,8,e,t)}function C_(e,t){By(2048,8,e,t)}function gF(e){Zt.flags|=4;var t=Zt.updateQueue;if(t===null)t=Dy(),Zt.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function OM(e){var t=Lr().memoizedState;return gF({ref:t,nextImpl:e}),function(){if(Rn&2)throw Error(_e(440));return t.impl.apply(void 0,arguments)}}function BM(e,t){return By(4,2,e,t)}function PM(e,t){return By(4,4,e,t)}function $M(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 zM(e,t,n){n=n!=null?n.concat([e]):null,By(4,4,$M.bind(null,t,e),n)}function A_(){}function FM(e,t){var n=Lr();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&v_(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function UM(e,t){var n=Lr();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&v_(t,r[1]))return r[0];if(r=e(),Ru){Wl(!0);try{e()}finally{Wl(!1)}}return n.memoizedState=[r,t],r}function E_(e,t,n){return n===void 0||il&1073741824&&!(pn&261930)?e.memoizedState=t:(e.memoizedState=n,e=II(),Zt.lanes|=e,yc|=e,n)}function qM(e,t,n,r){return Ui(n,t)?n:ch.current!==null?(e=E_(e,n,r),Ui(e,t)||(Ur=!0),e):!(il&42)||il&1073741824&&!(pn&261930)?(Ur=!0,e.memoizedState=n):(e=II(),Zt.lanes|=e,yc|=e,t)}function HM(e,t,n,r,s){var i=jn.p;jn.p=i!==0&&8>i?i:8;var o=Ft.T,a={};Ft.T=a,I_(e,!1,t,n);try{var l=s(),c=Ft.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=dF(l,r);o0(e,t,u,$i(e))}else o0(e,t,r,$i(e))}catch(d){o0(e,t,{then:function(){},status:"rejected",reason:d},$i())}finally{jn.p=i,o!==null&&a.types!==null&&(o.types=a.types),Ft.T=o}}function yF(){}function hw(e,t,n,r){if(e.tag!==5)throw Error(_e(476));var s=VM(e).queue;HM(e,s,t,bu,n===null?yF:function(){return WM(e),n(r)})}function VM(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:bu,baseState:bu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:bu},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function WM(e){var t=VM(e);t.next===null&&(t=e.alternate.memoizedState),o0(e,t.next.queue,{},$i())}function M_(){return ks(z0)}function GM(){return Lr().memoizedState}function KM(){return Lr().memoizedState}function bF(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=$i();e=sc(n);var r=ic(t,e,n);r!==null&&(yi(r,t,n),r0(r,t,n)),t={cache:m_()},e.payload=t;return}t=t.return}}function vF(e,t,n){var r=$i();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Py(e)?XM(t,n):(n=u_(e,t,n,r),n!==null&&(yi(n,e,r),QM(n,t,r)))}function YM(e,t,n){var r=$i();o0(e,t,n,r)}function o0(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Py(e))XM(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Ui(a,o))return Ly(e,t,s,0),Zn===null&&Ry(),!1}catch{}finally{}if(n=u_(e,t,s,r),n!==null)return yi(n,e,r),QM(n,t,r),!0}return!1}function I_(e,t,n,r){if(r={lane:2,revertLane:$_(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Py(e)){if(t)throw Error(_e(479))}else t=u_(e,n,r,2),t!==null&&yi(t,e,2)}function Py(e){var t=e.alternate;return e===Zt||t!==null&&t===Zt}function XM(e,t){Kd=c1=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function QM(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,OE(e,n)}}var B0={readContext:ks,use:Oy,useCallback:Tr,useContext:Tr,useEffect:Tr,useImperativeHandle:Tr,useLayoutEffect:Tr,useInsertionEffect:Tr,useMemo:Tr,useReducer:Tr,useRef:Tr,useState:Tr,useDebugValue:Tr,useDeferredValue:Tr,useTransition:Tr,useSyncExternalStore:Tr,useId:Tr,useHostTransitionStatus:Tr,useFormState:Tr,useActionState:Tr,useOptimistic:Tr,useMemoCache:Tr,useCacheRefresh:Tr};B0.useEffectEvent=Tr;var JM={readContext:ks,use:Oy,useCallback:function(e,t){return Hs().memoizedState=[e,t===void 0?null:t],e},useContext:ks,useEffect:C8,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,_g(4194308,4,$M.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _g(4194308,4,e,t)},useInsertionEffect:function(e,t){_g(4,2,e,t)},useMemo:function(e,t){var n=Hs();t=t===void 0?null:t;var r=e();if(Ru){Wl(!0);try{e()}finally{Wl(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Hs();if(n!==void 0){var s=n(t);if(Ru){Wl(!0);try{n(t)}finally{Wl(!1)}}}else s=t;return r.memoizedState=r.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},r.queue=e,e=e.dispatch=vF.bind(null,Zt,e),[r.memoizedState,e]},useRef:function(e){var t=Hs();return e={current:e},t.memoizedState=e},useState:function(e){e=uw(e);var t=e.queue,n=YM.bind(null,Zt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:A_,useDeferredValue:function(e,t){var n=Hs();return E_(n,e,t)},useTransition:function(){var e=uw(!1);return e=HM.bind(null,Zt,e.queue,!0,!1),Hs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Zt,s=Hs();if(wn){if(n===void 0)throw Error(_e(407));n=n()}else{if(n=t(),Zn===null)throw Error(_e(349));pn&127||TM(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,C8(AM.bind(null,r,i,e),[e]),r.flags|=2048,uh(9,{destroy:void 0},CM.bind(null,r,i,n,t),null),n},useId:function(){var e=Hs(),t=Zn.identifierPrefix;if(wn){var n=ca,r=la;n=(r&~(1<<32-Pi(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=u1++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=hF++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:M_,useFormState:k8,useActionState:k8,useOptimistic:function(e){var t=Hs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=I_.bind(null,Zt,!0,n),n.dispatch=t,[e,t]},useMemoCache:S_,useCacheRefresh:function(){return Hs().memoizedState=bF.bind(null,Zt)},useEffectEvent:function(e){var t=Hs(),n={impl:e};return t.memoizedState=n,function(){if(Rn&2)throw Error(_e(440));return n.impl.apply(void 0,arguments)}}},N_={readContext:ks,use:Oy,useCallback:FM,useContext:ks,useEffect:C_,useImperativeHandle:zM,useInsertionEffect:BM,useLayoutEffect:PM,useMemo:UM,useReducer:xg,useRef:DM,useState:function(){return xg(ol)},useDebugValue:A_,useDeferredValue:function(e,t){var n=Lr();return qM(n,qn.memoizedState,e,t)},useTransition:function(){var e=xg(ol)[0],t=Lr().memoizedState;return[typeof e=="boolean"?e:km(e),t]},useSyncExternalStore:SM,useId:GM,useHostTransitionStatus:M_,useFormState:S8,useActionState:S8,useOptimistic:function(e,t){var n=Lr();return IM(n,qn,e,t)},useMemoCache:S_,useCacheRefresh:KM};N_.useEffectEvent=OM;var ZM={readContext:ks,use:Oy,useCallback:FM,useContext:ks,useEffect:C_,useImperativeHandle:zM,useInsertionEffect:BM,useLayoutEffect:PM,useMemo:UM,useReducer:w2,useRef:DM,useState:function(){return w2(ol)},useDebugValue:A_,useDeferredValue:function(e,t){var n=Lr();return qn===null?E_(n,e,t):qM(n,qn.memoizedState,e,t)},useTransition:function(){var e=w2(ol)[0],t=Lr().memoizedState;return[typeof e=="boolean"?e:km(e),t]},useSyncExternalStore:SM,useId:GM,useHostTransitionStatus:M_,useFormState:T8,useActionState:T8,useOptimistic:function(e,t){var n=Lr();return qn!==null?IM(n,qn,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:S_,useCacheRefresh:KM};ZM.useEffectEvent=OM;function x2(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:hr({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fw={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=$i(),s=sc(r);s.payload=t,n!=null&&(s.callback=n),t=ic(e,s,r),t!==null&&(yi(t,e,r),r0(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=$i(),s=sc(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=ic(e,s,r),t!==null&&(yi(t,e,r),r0(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=$i(),r=sc(n);r.tag=2,t!=null&&(r.callback=t),t=ic(e,r,n),t!==null&&(yi(t,e,n),r0(t,e,n))}};function A8(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!R0(n,r)||!R0(s,i):!0}function E8(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&fw.enqueueReplaceState(t,t.state,null)}function Lu(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=hr({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function eI(e){n1(e)}function tI(e){console.error(e)}function nI(e){n1(e)}function d1(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function M8(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function mw(e,t,n){return n=sc(n),n.tag=3,n.payload={element:null},n.callback=function(){d1(e,t)},n}function rI(e){return e=sc(e),e.tag=3,e}function sI(e,t,n,r){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var i=r.value;e.payload=function(){return s(i)},e.callback=function(){M8(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){M8(t,n,r),typeof s!="function"&&(oc===null?oc=new Set([this]):oc.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}function wF(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&Dh(t,n,s,!0),n=qi.current,n!==null){switch(n.tag){case 31:case 13:return go===null?g1():n.alternate===null&&Ar===0&&(Ar=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===o1?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),R2(e,r,s)),!1;case 22:return n.flags|=65536,r===o1?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),R2(e,r,s)),!1}throw Error(_e(435,n.tag))}return R2(e,r,s),g1(),!1}if(wn)return t=qi.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==tw&&(e=Error(_e(422),{cause:r}),j0(co(e,n)))):(r!==tw&&(t=Error(_e(423),{cause:r}),j0(co(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=co(r,n),s=mw(e.stateNode,r,s),v2(e,s),Ar!==4&&(Ar=2)),!1;var i=Error(_e(520),{cause:r});if(i=co(i,n),c0===null?c0=[i]:c0.push(i),Ar!==4&&(Ar=2),t===null)return!0;r=co(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=mw(n.stateNode,r,e),v2(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"&&(oc===null||!oc.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=rI(s),sI(s,e,n,r),v2(n,s),!1}n=n.return}while(n!==null);return!1}var R_=Error(_e(461)),Ur=!1;function bs(e,t,n,r){t.child=e===null?bM(t,null,n,r):Nu(t,e.child,n,r)}function I8(e,t,n,r,s){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var a in r)a!=="ref"&&(o[a]=r[a])}else o=r;return Iu(t),r=w_(e,t,n,o,i,s),a=x_(),e!==null&&!Ur?(__(e,t,s),al(e,t,s)):(wn&&a&&h_(t),t.flags|=1,bs(e,t,r,s),t.child)}function N8(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!d_(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,iI(e,t,i,r,s)):(e=vg(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!L_(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:R0,n(o,r)&&e.ref===t.ref)return al(e,t,s)}return t.flags|=1,e=Ja(i,r),e.ref=t.ref,e.return=t,t.child=e}function iI(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(R0(i,r)&&e.ref===t.ref)if(Ur=!1,t.pendingProps=r=i,L_(e,s))e.flags&131072&&(Ur=!0);else return t.lanes=e.lanes,al(e,t,s)}return pw(e,t,n,r,s)}function oI(e,t,n,r){var s=r.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(r=t.child=e.child,s=0;r!==null;)s=s|r.lanes|r.childLanes,r=r.sibling;r=s&~i}else r=0,t.child=null;return R8(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&wg(t,i!==null?i.cachePool:null),i!==null?w8(t,i):lw(),xM(t);else return r=t.lanes=536870912,R8(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(wg(t,i.cachePool),w8(t,i),Ul(),t.memoizedState=null):(e!==null&&wg(t,null),lw(),Ul());return bs(e,t,s,n),t.child}function Pf(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function R8(e,t,n,r,s){var i=p_();return i=i===null?null:{parent:Fr._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&wg(t,null),lw(),xM(t),e!==null&&Dh(e,t,r,!0),t.childLanes=s,null}function kg(e,t){return t=h1({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function L8(e,t,n){return Nu(t,e.child,null,n),e=kg(t,t.pendingProps),e.flags|=2,Ni(t),t.memoizedState=null,e}function xF(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(wn){if(r.mode==="hidden")return e=kg(t,r),t.lanes=536870912,Pf(null,e);if(cw(t),(e=cr)?(e=JI(e,uo),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mc!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},n=dM(e),n.return=t,t.child=n,_s=t,cr=null)):e=null,e===null)throw pc(t);return t.lanes=536870912,null}return kg(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(cw(t),s)if(t.flags&256)t.flags&=-257,t=L8(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(_e(558));else if(Ur||Dh(e,t,n,!1),s=(n&e.childLanes)!==0,Ur||s){if(r=Zn,r!==null&&(o=BE(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Wu(e,o),yi(r,e,o),R_;g1(),t=L8(e,t,n)}else e=i.treeContext,cr=yo(o.nextSibling),_s=t,wn=!0,rc=null,uo=!1,e!==null&&fM(t,e),t=kg(t,r),t.flags|=4096;return t}return e=Ja(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Sg(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(_e(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pw(e,t,n,r,s){return Iu(t),n=w_(e,t,n,r,void 0,s),r=x_(),e!==null&&!Ur?(__(e,t,s),al(e,t,s)):(wn&&r&&h_(t),t.flags|=1,bs(e,t,n,s),t.child)}function j8(e,t,n,r,s,i){return Iu(t),t.updateQueue=null,n=kM(t,r,n,s),_M(e),r=x_(),e!==null&&!Ur?(__(e,t,i),al(e,t,i)):(wn&&r&&h_(t),t.flags|=1,bs(e,t,n,i),t.child)}function D8(e,t,n,r,s){if(Iu(t),t.stateNode===null){var i=Rd,o=n.contextType;typeof o=="object"&&o!==null&&(i=ks(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=fw,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},y_(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?ks(o):Rd,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(x2(t,n,o,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&fw.enqueueReplaceState(i,i.state,null),i0(t,r,i,s),s0(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,l=Lu(n,a);i.props=l;var c=i.context,u=n.contextType;o=Rd,typeof u=="object"&&u!==null&&(o=ks(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||c!==o)&&E8(t,i,r,o),Ll=!1;var f=t.memoizedState;i.state=f,i0(t,r,i,s),s0(),c=t.memoizedState,a||f!==c||Ll?(typeof d=="function"&&(x2(t,n,d,r),c=t.memoizedState),(l=Ll||A8(t,n,l,r,f,c,o))?(u||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=o,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,ow(e,t),o=t.memoizedProps,u=Lu(n,o),i.props=u,d=t.pendingProps,f=i.context,c=n.contextType,l=Rd,typeof c=="object"&&c!==null&&(l=ks(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==d||f!==l)&&E8(t,i,r,l),Ll=!1,f=t.memoizedState,i.state=f,i0(t,r,i,s),s0();var m=t.memoizedState;o!==d||f!==m||Ll||e!==null&&e.dependencies!==null&&i1(e.dependencies)?(typeof a=="function"&&(x2(t,n,a,r),m=t.memoizedState),(u=Ll||A8(t,n,u,r,f,m,l)||e!==null&&e.dependencies!==null&&i1(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,m,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,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=r,t.memoizedState=m),i.props=r,i.state=m,i.context=l,r=u):(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),r=!1)}return i=r,Sg(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=Nu(t,e.child,null,s),t.child=Nu(t,null,n,s)):bs(e,t,n,s),t.memoizedState=i.state,e=t.child):e=al(e,t,s),e}function O8(e,t,n,r){return Mu(),t.flags|=256,bs(e,t,n,r),t.child}var _2={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function k2(e){return{baseLanes:e,cachePool:pM()}}function S2(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=ji),e}function aI(e,t,n){var r=t.pendingProps,s=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(Rr.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(wn){if(s?Fl(t):Ul(),(e=cr)?(e=JI(e,uo),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mc!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},n=dM(e),n.return=t,t.child=n,_s=t,cr=null)):e=null,e===null)throw pc(t);return Mw(e)?t.lanes=32:t.lanes=536870912,null}var a=r.children;return r=r.fallback,s?(Ul(),s=t.mode,a=h1({mode:"hidden",children:a},s),r=vu(r,s,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=k2(n),r.childLanes=S2(e,o,n),t.memoizedState=_2,Pf(null,r)):(Fl(t),gw(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(Fl(t),t.flags&=-257,t=T2(e,t,n)):t.memoizedState!==null?(Ul(),t.child=e.child,t.flags|=128,t=null):(Ul(),a=r.fallback,s=t.mode,r=h1({mode:"visible",children:r.children},s),a=vu(a,s,n,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,Nu(t,e.child,null,n),r=t.child,r.memoizedState=k2(n),r.childLanes=S2(e,o,n),t.memoizedState=_2,t=Pf(null,r));else if(Fl(t),Mw(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,r=Error(_e(419)),r.stack="",r.digest=o,j0({value:r,source:null,stack:null}),t=T2(e,t,n)}else if(Ur||Dh(e,t,n,!1),o=(n&e.childLanes)!==0,Ur||o){if(o=Zn,o!==null&&(r=BE(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Wu(e,r),yi(o,e,r),R_;Ew(a)||g1(),t=T2(e,t,n)}else Ew(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,cr=yo(a.nextSibling),_s=t,wn=!0,rc=null,uo=!1,e!==null&&fM(t,e),t=gw(t,r.children),t.flags|=4096);return t}return s?(Ul(),a=r.fallback,s=t.mode,l=e.child,c=l.sibling,r=Ja(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=Ja(c,a):(a=vu(a,s,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,Pf(null,r),r=t.child,a=e.child.memoizedState,a===null?a=k2(n):(s=a.cachePool,s!==null?(l=Fr._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=pM(),a={baseLanes:a.baseLanes|n,cachePool:s}),r.memoizedState=a,r.childLanes=S2(e,o,n),t.memoizedState=_2,Pf(e.child,r)):(Fl(t),n=e.child,e=n.sibling,n=Ja(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function gw(e,t){return t=h1({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function h1(e,t){return e=Ri(22,e,null,t),e.lanes=0,e}function T2(e,t,n){return Nu(t,e.child,null,n),e=gw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function B8(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),rw(e.return,t,n)}function C2(e,t,n,r,s,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s,o.treeForkCount=i)}function lI(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=Rr.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,ir(Rr,o),bs(e,t,r,n),r=wn?L0:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&B8(e,n,t);else if(e.tag===19)B8(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&l1(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),C2(t,!1,s,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&l1(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}C2(t,!0,n,null,i,r);break;case"together":C2(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function al(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yc|=t.lanes,!(n&t.childLanes))if(e!==null){if(Dh(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(_e(153));if(t.child!==null){for(e=t.child,n=Ja(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ja(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function L_(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&i1(e)))}function _F(e,t,n){switch(t.tag){case 3:Jg(t,t.stateNode.containerInfo),zl(t,Fr,e.memoizedState.cache),Mu();break;case 27:case 5:Hv(t);break;case 4:Jg(t,t.stateNode.containerInfo);break;case 10:zl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,cw(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Fl(t),t.flags|=128,null):n&t.child.childLanes?aI(e,t,n):(Fl(t),e=al(e,t,n),e!==null?e.sibling:null);Fl(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(Dh(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return lI(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ir(Rr,Rr.current),r)break;return null;case 22:return t.lanes=0,oI(e,t,n,t.pendingProps);case 24:zl(t,Fr,e.memoizedState.cache)}return al(e,t,n)}function cI(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ur=!0;else{if(!L_(e,n)&&!(t.flags&128))return Ur=!1,_F(e,t,n);Ur=!!(e.flags&131072)}else Ur=!1,wn&&t.flags&1048576&&hM(t,L0,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=tu(t.elementType),t.type=e,typeof e=="function")d_(e)?(r=Lu(e,r),t.tag=1,t=D8(null,t,e,r,n)):(t.tag=0,t=pw(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===Q3){t.tag=11,t=I8(null,t,e,r,n);break e}else if(s===J3){t.tag=14,t=N8(null,t,e,r,n);break e}}throw t=Uv(e)||e,Error(_e(306,t,""))}}return t;case 0:return pw(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=Lu(r,t.pendingProps),D8(e,t,r,s,n);case 3:e:{if(Jg(t,t.stateNode.containerInfo),e===null)throw Error(_e(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,ow(e,t),i0(t,r,null,n);var o=t.memoizedState;if(r=o.cache,zl(t,Fr,r),r!==i.cache&&sw(t,[Fr],n,!0),s0(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=O8(e,t,r,n);break e}else if(r!==s){s=co(Error(_e(424)),t),j0(s),t=O8(e,t,r,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(cr=yo(e.firstChild),_s=t,wn=!0,rc=null,uo=!0,n=bM(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Mu(),r===s){t=al(e,t,n);break e}bs(e,t,r,n)}t=t.child}return t;case 26:return Sg(e,t),e===null?(n=rS(t.type,null,t.pendingProps,null))?t.memoizedState=n:wn||(n=t.type,e=t.pendingProps,r=w1(nc.current).createElement(n),r[xs]=t,r[vi]=e,Ts(r,n,e),fs(r),t.stateNode=r):t.memoizedState=rS(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Hv(t),e===null&&wn&&(r=t.stateNode=ZI(t.type,t.pendingProps,nc.current),_s=t,uo=!0,s=cr,Ic(t.type)?(Iw=s,cr=yo(r.firstChild)):cr=s),bs(e,t,t.pendingProps.children,n),Sg(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&wn&&((s=r=cr)&&(r=JF(r,t.type,t.pendingProps,uo),r!==null?(t.stateNode=r,_s=t,cr=yo(r.firstChild),uo=!1,s=!0):s=!1),s||pc(t)),Hv(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,Cw(s,i)?r=null:o!==null&&Cw(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=w_(e,t,fF,null,null,n),z0._currentValue=s),Sg(e,t),bs(e,t,r,n),t.child;case 6:return e===null&&wn&&((e=n=cr)&&(n=ZF(n,t.pendingProps,uo),n!==null?(t.stateNode=n,_s=t,cr=null,e=!0):e=!1),e||pc(t)),null;case 13:return aI(e,t,n);case 4:return Jg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Nu(t,null,r,n):bs(e,t,r,n),t.child;case 11:return I8(e,t,t.type,t.pendingProps,n);case 7:return bs(e,t,t.pendingProps,n),t.child;case 8:return bs(e,t,t.pendingProps.children,n),t.child;case 12:return bs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,zl(t,t.type,r.value),bs(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,Iu(t),s=ks(s),r=r(s),t.flags|=1,bs(e,t,r,n),t.child;case 14:return N8(e,t,t.type,t.pendingProps,n);case 15:return iI(e,t,t.type,t.pendingProps,n);case 19:return lI(e,t,n);case 31:return xF(e,t,n);case 22:return oI(e,t,n,t.pendingProps);case 24:return Iu(t),r=ks(Fr),e===null?(s=p_(),s===null&&(s=Zn,i=m_(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},y_(t),zl(t,Fr,s)):(e.lanes&n&&(ow(e,t),i0(t,null,null,n),s0()),s=e.memoizedState,i=t.memoizedState,s.parent!==r?(s={parent:r,cache:r},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),zl(t,Fr,r)):(r=i.cache,zl(t,Fr,r),r!==s.cache&&sw(t,[Fr],n,!0))),bs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(_e(156,t.tag))}function Ra(e){e.flags|=4}function A2(e,t,n,r,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(LI())e.flags|=8192;else throw xu=o1,g_}else e.flags&=-16777217}function P8(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!nN(t))if(LI())e.flags|=8192;else throw xu=o1,g_}function fp(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?jE():536870912,e.lanes|=t,dh|=t)}function mf(e,t){if(!wn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function lr(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&65011712,r|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function kF(e,t,n){var r=t.pendingProps;switch(f_(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lr(t),null;case 1:return lr(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Za(Fr),ih(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(cd(t)?Ra(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,b2())),lr(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(Ra(t),i!==null?(lr(t),P8(t,i)):(lr(t),A2(t,s,null,r,n))):i?i!==e.memoizedState?(Ra(t),lr(t),P8(t,i)):(lr(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ra(t),lr(t),A2(t,s,e,r,n)),null;case 27:if(Zg(t),n=nc.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ra(t);else{if(!r){if(t.stateNode===null)throw Error(_e(166));return lr(t),null}e=pa.current,cd(t)?f8(t):(e=ZI(s,r,n),t.stateNode=e,Ra(t))}return lr(t),null;case 5:if(Zg(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ra(t);else{if(!r){if(t.stateNode===null)throw Error(_e(166));return lr(t),null}if(i=pa.current,cd(t))f8(t);else{var o=w1(nc.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(s,{is:r.is}):o.createElement(s)}}i[xs]=t,i[vi]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(Ts(i,s,r),s){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ra(t)}}return lr(t),A2(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ra(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(_e(166));if(e=nc.current,cd(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=_s,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[xs]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||YI(e.nodeValue,n)),e||pc(t,!0)}else e=w1(e).createTextNode(r),e[xs]=t,t.stateNode=e}return lr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=cd(t),n!==null){if(e===null){if(!r)throw Error(_e(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_e(557));e[xs]=t}else Mu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lr(t),e=!1}else n=b2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ni(t),t):(Ni(t),null);if(t.flags&128)throw Error(_e(558))}return lr(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=cd(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(_e(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(_e(317));s[xs]=t}else Mu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lr(t),s=!1}else s=b2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Ni(t),t):(Ni(t),null)}return Ni(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,s=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(s=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==s&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),fp(t,t.updateQueue),lr(t),null);case 4:return ih(),e===null&&z_(t.stateNode.containerInfo),lr(t),null;case 10:return Za(t.type),lr(t),null;case 19:if(ps(Rr),r=t.memoizedState,r===null)return lr(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)mf(r,!1);else{if(Ar!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=l1(e),i!==null){for(t.flags|=128,mf(r,!1),e=i.updateQueue,t.updateQueue=e,fp(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)uM(n,e),n=n.sibling;return ir(Rr,Rr.current&1|2),wn&&za(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Oi()>m1&&(t.flags|=128,s=!0,mf(r,!1),t.lanes=4194304)}else{if(!s)if(e=l1(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,fp(t,e),mf(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!wn)return lr(t),null}else 2*Oi()-r.renderingStartTime>m1&&n!==536870912&&(t.flags|=128,s=!0,mf(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Oi(),e.sibling=null,n=Rr.current,ir(Rr,s?n&1|2:n&1),wn&&za(t,r.treeForkCount),e):(lr(t),null);case 22:case 23:return Ni(t),b_(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(lr(t),t.subtreeFlags&6&&(t.flags|=8192)):lr(t),n=t.updateQueue,n!==null&&fp(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ps(wu),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Za(Fr),lr(t),null;case 25:return null;case 30:return null}throw Error(_e(156,t.tag))}function SF(e,t){switch(f_(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Za(Fr),ih(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Zg(t),null;case 31:if(t.memoizedState!==null){if(Ni(t),t.alternate===null)throw Error(_e(340));Mu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ni(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_e(340));Mu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ps(Rr),null;case 4:return ih(),null;case 10:return Za(t.type),null;case 22:case 23:return Ni(t),b_(),e!==null&&ps(wu),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Za(Fr),null;case 25:return null;default:return null}}function uI(e,t){switch(f_(t),t.tag){case 3:Za(Fr),ih();break;case 26:case 27:case 5:Zg(t);break;case 4:ih();break;case 31:t.memoizedState!==null&&Ni(t);break;case 13:Ni(t);break;case 19:ps(Rr);break;case 10:Za(t.type);break;case 22:case 23:Ni(t),b_(),e!==null&&ps(wu);break;case 24:Za(Fr)}}function Sm(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==s)}}catch(a){Fn(t,t.return,a)}}function gc(e,t,n){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var i=s.next;r=i;do{if((r.tag&e)===e){var o=r.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,s=t;var l=n,c=a;try{c()}catch(u){Fn(s,l,u)}}}r=r.next}while(r!==i)}}catch(u){Fn(t,t.return,u)}}function dI(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{wM(t,n)}catch(r){Fn(e,e.return,r)}}}function hI(e,t,n){n.props=Lu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Fn(e,t,r)}}function a0(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(s){Fn(e,t,s)}}function ua(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){Fn(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){Fn(e,t,s)}else n.current=null}function fI(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(s){Fn(e,e.return,s)}}function E2(e,t,n){try{var r=e.stateNode;WF(r,e.type,n,t),r[vi]=t}catch(s){Fn(e,e.return,s)}}function mI(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ic(e.type)||e.tag===4}function M2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mI(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&&Ic(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 yw(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ga));else if(r!==4&&(r===27&&Ic(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(yw(e,t,n),e=e.sibling;e!==null;)yw(e,t,n),e=e.sibling}function f1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Ic(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(f1(e,t,n),e=e.sibling;e!==null;)f1(e,t,n),e=e.sibling}function pI(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Ts(t,r,n),t[xs]=e,t[vi]=n}catch(i){Fn(e,e.return,i)}}var qa=!1,$r=!1,I2=!1,$8=typeof WeakSet=="function"?WeakSet:Set,hs=null;function TF(e,t){if(e=e.containerInfo,Sw=S1,e=nM(e),l_(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var m;d!==n||s!==0&&d.nodeType!==3||(a=o+s),d!==i||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++c===s&&(a=o),f===i&&++u===r&&(l=o),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tw={focusedElem:e,selectionRange:n},S1=!1,hs=t;hs!==null;)if(t=hs,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,hs=e;else for(;hs!==null;){switch(t=hs,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,s=i.memoizedProps,i=i.memoizedState,r=n.stateNode;try{var p=Lu(n.type,s);e=r.getSnapshotBeforeUpdate(p,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(y){Fn(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Aw(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Aw(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(_e(163))}if(e=t.sibling,e!==null){e.return=t.return,hs=e;break}hs=t.return}}function gI(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ja(e,n),r&4&&Sm(5,n);break;case 1:if(ja(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Fn(n,n.return,o)}else{var s=Lu(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Fn(n,n.return,o)}}r&64&&dI(n),r&512&&a0(n,n.return);break;case 3:if(ja(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{wM(e,t)}catch(o){Fn(n,n.return,o)}}break;case 27:t===null&&r&4&&pI(n);case 26:case 5:ja(e,n),t===null&&r&4&&fI(n),r&512&&a0(n,n.return);break;case 12:ja(e,n);break;case 31:ja(e,n),r&4&&vI(e,n);break;case 13:ja(e,n),r&4&&wI(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=jF.bind(null,n),eU(e,n))));break;case 22:if(r=n.memoizedState!==null||qa,!r){t=t!==null&&t.memoizedState!==null||$r,s=qa;var i=$r;qa=r,($r=t)&&!i?$a(e,n,(n.subtreeFlags&8772)!==0):ja(e,n),qa=s,$r=i}break;case 30:break;default:ja(e,n)}}function yI(e){var t=e.alternate;t!==null&&(e.alternate=null,yI(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&n_(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 fr=null,ci=!1;function La(e,t,n){for(n=n.child;n!==null;)bI(e,t,n),n=n.sibling}function bI(e,t,n){if(Bi&&typeof Bi.onCommitFiberUnmount=="function")try{Bi.onCommitFiberUnmount(ym,n)}catch{}switch(n.tag){case 26:$r||ua(n,t),La(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$r||ua(n,t);var r=fr,s=ci;Ic(n.type)&&(fr=n.stateNode,ci=!1),La(e,t,n),d0(n.stateNode),fr=r,ci=s;break;case 5:$r||ua(n,t);case 6:if(r=fr,s=ci,fr=null,La(e,t,n),fr=r,ci=s,fr!==null)if(ci)try{(fr.nodeType===9?fr.body:fr.nodeName==="HTML"?fr.ownerDocument.body:fr).removeChild(n.stateNode)}catch(i){Fn(n,t,i)}else try{fr.removeChild(n.stateNode)}catch(i){Fn(n,t,i)}break;case 18:fr!==null&&(ci?(e=fr,J8(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ph(e)):J8(fr,n.stateNode));break;case 4:r=fr,s=ci,fr=n.stateNode.containerInfo,ci=!0,La(e,t,n),fr=r,ci=s;break;case 0:case 11:case 14:case 15:gc(2,n,t),$r||gc(4,n,t),La(e,t,n);break;case 1:$r||(ua(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&hI(n,t,r)),La(e,t,n);break;case 21:La(e,t,n);break;case 22:$r=(r=$r)||n.memoizedState!==null,La(e,t,n),$r=r;break;default:La(e,t,n)}}function vI(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ph(e)}catch(n){Fn(t,t.return,n)}}}function wI(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ph(e)}catch(n){Fn(t,t.return,n)}}function CF(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $8),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $8),t;default:throw Error(_e(435,e.tag))}}function mp(e,t){var n=CF(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=DF.bind(null,e,r);r.then(s,s)}})}function ii(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(Ic(a.type)){fr=a.stateNode,ci=!1;break e}break;case 5:fr=a.stateNode,ci=!1;break e;case 3:case 4:fr=a.stateNode.containerInfo,ci=!0;break e}a=a.return}if(fr===null)throw Error(_e(160));bI(i,o,s),fr=null,ci=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xI(t,e),t=t.sibling}var Mo=null;function xI(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ii(t,e),oi(e),r&4&&(gc(3,e,e.return),Sm(3,e),gc(5,e,e.return));break;case 1:ii(t,e),oi(e),r&512&&($r||n===null||ua(n,n.return)),r&64&&qa&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var s=Mo;if(ii(t,e),oi(e),r&512&&($r||n===null||ua(n,n.return)),r&4){var i=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(r){case"title":i=s.getElementsByTagName("title")[0],(!i||i[wm]||i[xs]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),Ts(i,r,n),i[xs]=e,fs(i),r=i;break e;case"link":var o=iS("link","href",s).get(r+(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=s.createElement(r),Ts(i,r,n),s.head.appendChild(i);break;case"meta":if(o=iS("meta","content",s).get(r+(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=s.createElement(r),Ts(i,r,n),s.head.appendChild(i);break;default:throw Error(_e(468,r))}i[xs]=e,fs(i),r=i}e.stateNode=r}else oS(s,e.type,e.stateNode);else e.stateNode=sS(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?oS(s,e.type,e.stateNode):sS(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&E2(e,e.memoizedProps,n.memoizedProps)}break;case 27:ii(t,e),oi(e),r&512&&($r||n===null||ua(n,n.return)),n!==null&&r&4&&E2(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ii(t,e),oi(e),r&512&&($r||n===null||ua(n,n.return)),e.flags&32){s=e.stateNode;try{ah(s,"")}catch(p){Fn(e,e.return,p)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,E2(e,s,n!==null?n.memoizedProps:s)),r&1024&&(I2=!0);break;case 6:if(ii(t,e),oi(e),r&4){if(e.stateNode===null)throw Error(_e(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(p){Fn(e,e.return,p)}}break;case 3:if(Ag=null,s=Mo,Mo=x1(t.containerInfo),ii(t,e),Mo=s,oi(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ph(t.containerInfo)}catch(p){Fn(e,e.return,p)}I2&&(I2=!1,_I(e));break;case 4:r=Mo,Mo=x1(e.stateNode.containerInfo),ii(t,e),oi(e),Mo=r;break;case 12:ii(t,e),oi(e);break;case 31:ii(t,e),oi(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mp(e,r)));break;case 13:ii(t,e),oi(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&($y=Oi()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mp(e,r)));break;case 22:s=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=qa,u=$r;if(qa=c||s,$r=u||l,ii(t,e),$r=u,qa=c,oi(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||l||qa||$r||nu(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,s)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var d=l.memoizedProps.style,f=d!=null&&d.hasOwnProperty("display")?d.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(p){Fn(l,l.return,p)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(p){Fn(l,l.return,p)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;s?Z8(m,!0):Z8(l.stateNode,!1)}catch(p){Fn(l,l.return,p)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,mp(e,n))));break;case 19:ii(t,e),oi(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mp(e,r)));break;case 30:break;case 21:break;default:ii(t,e),oi(e)}}function oi(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(mI(r)){n=r;break}r=r.return}if(n==null)throw Error(_e(160));switch(n.tag){case 27:var s=n.stateNode,i=M2(e);f1(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&(ah(o,""),n.flags&=-33);var a=M2(e);f1(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=M2(e);yw(e,c,l);break;default:throw Error(_e(161))}}catch(u){Fn(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _I(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_I(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ja(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gI(e,t.alternate,t),t=t.sibling}function nu(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:gc(4,t,t.return),nu(t);break;case 1:ua(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&hI(t,t.return,n),nu(t);break;case 27:d0(t.stateNode);case 26:case 5:ua(t,t.return),nu(t);break;case 22:t.memoizedState===null&&nu(t);break;case 30:nu(t);break;default:nu(t)}e=e.sibling}}function $a(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,s=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:$a(s,i,n),Sm(4,i);break;case 1:if($a(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){Fn(r,r.return,c)}if(r=i,s=r.updateQueue,s!==null){var a=r.stateNode;try{var l=s.shared.hiddenCallbacks;if(l!==null)for(s.shared.hiddenCallbacks=null,s=0;s<l.length;s++)vM(l[s],a)}catch(c){Fn(r,r.return,c)}}n&&o&64&&dI(i),a0(i,i.return);break;case 27:pI(i);case 26:case 5:$a(s,i,n),n&&r===null&&o&4&&fI(i),a0(i,i.return);break;case 12:$a(s,i,n);break;case 31:$a(s,i,n),n&&o&4&&vI(s,i);break;case 13:$a(s,i,n),n&&o&4&&wI(s,i);break;case 22:i.memoizedState===null&&$a(s,i,n),a0(i,i.return);break;case 30:break;default:$a(s,i,n)}t=t.sibling}}function j_(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&&_m(n))}function D_(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_m(e))}function To(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kI(e,t,n,r),t=t.sibling}function kI(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:To(e,t,n,r),s&2048&&Sm(9,t);break;case 1:To(e,t,n,r);break;case 3:To(e,t,n,r),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_m(e)));break;case 12:if(s&2048){To(e,t,n,r),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){Fn(t,t.return,l)}}else To(e,t,n,r);break;case 31:To(e,t,n,r);break;case 13:To(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?To(e,t,n,r):l0(e,t):i._visibility&2?To(e,t,n,r):(i._visibility|=2,bd(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&j_(o,t);break;case 24:To(e,t,n,r),s&2048&&D_(t.alternate,t);break;default:To(e,t,n,r)}}function bd(e,t,n,r,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,l=r,c=o.flags;switch(o.tag){case 0:case 11:case 15:bd(i,o,a,l,s),Sm(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState!==null?u._visibility&2?bd(i,o,a,l,s):l0(i,o):(u._visibility|=2,bd(i,o,a,l,s)),s&&c&2048&&j_(o.alternate,o);break;case 24:bd(i,o,a,l,s),s&&c&2048&&D_(o.alternate,o);break;default:bd(i,o,a,l,s)}t=t.sibling}}function l0(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,s=r.flags;switch(r.tag){case 22:l0(n,r),s&2048&&j_(r.alternate,r);break;case 24:l0(n,r),s&2048&&D_(r.alternate,r);break;default:l0(n,r)}t=t.sibling}}var $f=8192;function ud(e,t,n){if(e.subtreeFlags&$f)for(e=e.child;e!==null;)SI(e,t,n),e=e.sibling}function SI(e,t,n){switch(e.tag){case 26:ud(e,t,n),e.flags&$f&&e.memoizedState!==null&&hU(n,Mo,e.memoizedState,e.memoizedProps);break;case 5:ud(e,t,n);break;case 3:case 4:var r=Mo;Mo=x1(e.stateNode.containerInfo),ud(e,t,n),Mo=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=$f,$f=16777216,ud(e,t,n),$f=r):ud(e,t,n));break;default:ud(e,t,n)}}function TI(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 pf(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];hs=r,AI(r,e)}TI(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)CI(e),e=e.sibling}function CI(e){switch(e.tag){case 0:case 11:case 15:pf(e),e.flags&2048&&gc(9,e,e.return);break;case 3:pf(e);break;case 12:pf(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Tg(e)):pf(e);break;default:pf(e)}}function Tg(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];hs=r,AI(r,e)}TI(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:gc(8,t,t.return),Tg(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Tg(t));break;default:Tg(t)}e=e.sibling}}function AI(e,t){for(;hs!==null;){var n=hs;switch(n.tag){case 0:case 11:case 15:gc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:_m(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,hs=r;else e:for(n=e;hs!==null;){r=hs;var s=r.sibling,i=r.return;if(yI(r),r===n){hs=null;break e}if(s!==null){s.return=i,hs=s;break e}hs=i}}}var AF={getCacheForType:function(e){var t=ks(Fr),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ks(Fr).controller.signal}},EF=typeof WeakMap=="function"?WeakMap:Map,Rn=0,Zn=null,dn=null,pn=0,$n=0,Mi=null,Kl=!1,Bh=!1,O_=!1,ll=0,Ar=0,yc=0,_u=0,B_=0,ji=0,dh=0,c0=null,di=null,bw=!1,$y=0,EI=0,m1=1/0,p1=null,oc=null,ts=0,ac=null,hh=null,el=0,vw=0,ww=null,MI=null,u0=0,xw=null;function $i(){return Rn&2&&pn!==0?pn&-pn:Ft.T!==null?$_():PE()}function II(){if(ji===0)if(!(pn&536870912)||wn){var e=op;op<<=1,!(op&3932160)&&(op=262144),ji=e}else ji=536870912;return e=qi.current,e!==null&&(e.flags|=32),ji}function yi(e,t,n){(e===Zn&&($n===2||$n===9)||e.cancelPendingCommit!==null)&&(fh(e,0),Yl(e,pn,ji,!1)),vm(e,n),(!(Rn&2)||e!==Zn)&&(e===Zn&&(!(Rn&2)&&(_u|=n),Ar===4&&Yl(e,pn,ji,!1)),va(e))}function NI(e,t,n){if(Rn&6)throw Error(_e(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||bm(e,t),s=r?NF(e,t):N2(e,t,!0),i=r;do{if(s===0){Bh&&!r&&Yl(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!MF(n)){s=N2(e,t,!1),i=!1;continue}if(s===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;s=c0;var l=a.current.memoizedState.isDehydrated;if(l&&(fh(a,o).flags|=256),o=N2(a,o,!1),o!==2){if(O_&&!l){a.errorRecoveryDisabledLanes|=i,_u|=i,s=4;break e}i=di,di=s,i!==null&&(di===null?di=i:di.push.apply(di,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){fh(e,0),Yl(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(_e(345));case 4:if((t&4194048)!==t)break;case 6:Yl(r,t,ji,!Kl);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(_e(329))}if((t&62914560)===t&&(s=$y+300-Oi(),10<s)){if(Yl(r,t,ji,!Kl),Ey(r,0,!0)!==0)break e;el=t,r.timeoutHandle=QI(z8.bind(null,r,n,di,p1,bw,t,ji,_u,dh,Kl,i,"Throttled",-0,0),s);break e}z8(r,n,di,p1,bw,t,ji,_u,dh,Kl,i,null,-0,0)}}break}while(!0);va(e)}function z8(e,t,n,r,s,i,o,a,l,c,u,d,f,m){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ga},SI(t,i,d);var p=(i&62914560)===i?$y-Oi():(i&4194048)===i?EI-Oi():0;if(p=fU(d,p),p!==null){el=i,e.cancelPendingCommit=p(U8.bind(null,e,t,i,n,r,s,o,a,l,u,d,null,f,m)),Yl(e,i,o,!c);return}}U8(e,t,i,n,r,s,o,a,l)}function MF(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Ui(i(),s))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Yl(e,t,n,r){t&=~B_,t&=~_u,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-Pi(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&DE(e,n,t)}function zy(){return Rn&6?!0:(Tm(0),!1)}function P_(){if(dn!==null){if($n===0)var e=dn.return;else e=dn,Ka=Gu=null,k_(e),Gd=null,D0=0,e=dn;for(;e!==null;)uI(e.alternate,e),e=e.return;dn=null}}function fh(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,YF(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),el=0,P_(),Zn=e,dn=n=Ja(e.current,null),pn=t,$n=0,Mi=null,Kl=!1,Bh=bm(e,t),O_=!1,dh=ji=B_=_u=yc=Ar=0,di=c0=null,bw=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-Pi(r),i=1<<s;t|=e[s],r&=~i}return ll=t,Ry(),n}function RI(e,t){Zt=null,Ft.H=B0,t===Oh||t===jy?(t=b8(),$n=3):t===g_?(t=b8(),$n=4):$n=t===R_?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Mi=t,dn===null&&(Ar=1,d1(e,co(t,e.current)))}function LI(){var e=qi.current;return e===null?!0:(pn&4194048)===pn?go===null:(pn&62914560)===pn||pn&536870912?e===go:!1}function jI(){var e=Ft.H;return Ft.H=B0,e===null?B0:e}function DI(){var e=Ft.A;return Ft.A=AF,e}function g1(){Ar=4,Kl||(pn&4194048)!==pn&&qi.current!==null||(Bh=!0),!(yc&134217727)&&!(_u&134217727)||Zn===null||Yl(Zn,pn,ji,!1)}function N2(e,t,n){var r=Rn;Rn|=2;var s=jI(),i=DI();(Zn!==e||pn!==t)&&(p1=null,fh(e,t)),t=!1;var o=Ar;e:do try{if($n!==0&&dn!==null){var a=dn,l=Mi;switch($n){case 8:P_(),o=6;break e;case 3:case 2:case 9:case 6:qi.current===null&&(t=!0);var c=$n;if($n=0,Mi=null,Dd(e,a,l,c),n&&Bh){o=0;break e}break;default:c=$n,$n=0,Mi=null,Dd(e,a,l,c)}}IF(),o=Ar;break}catch(u){RI(e,u)}while(!0);return t&&e.shellSuspendCounter++,Ka=Gu=null,Rn=r,Ft.H=s,Ft.A=i,dn===null&&(Zn=null,pn=0,Ry()),o}function IF(){for(;dn!==null;)OI(dn)}function NF(e,t){var n=Rn;Rn|=2;var r=jI(),s=DI();Zn!==e||pn!==t?(p1=null,m1=Oi()+500,fh(e,t)):Bh=bm(e,t);e:do try{if($n!==0&&dn!==null){t=dn;var i=Mi;t:switch($n){case 1:$n=0,Mi=null,Dd(e,t,i,1);break;case 2:case 9:if(y8(i)){$n=0,Mi=null,F8(t);break}t=function(){$n!==2&&$n!==9||Zn!==e||($n=7),va(e)},i.then(t,t);break e;case 3:$n=7;break e;case 4:$n=5;break e;case 7:y8(i)?($n=0,Mi=null,F8(t)):($n=0,Mi=null,Dd(e,t,i,7));break;case 5:var o=null;switch(dn.tag){case 26:o=dn.memoizedState;case 5:case 27:var a=dn;if(o?nN(o):a.stateNode.complete){$n=0,Mi=null;var l=a.sibling;if(l!==null)dn=l;else{var c=a.return;c!==null?(dn=c,Fy(c)):dn=null}break t}}$n=0,Mi=null,Dd(e,t,i,5);break;case 6:$n=0,Mi=null,Dd(e,t,i,6);break;case 8:P_(),Ar=6;break e;default:throw Error(_e(462))}}RF();break}catch(u){RI(e,u)}while(!0);return Ka=Gu=null,Ft.H=r,Ft.A=s,Rn=n,dn!==null?0:(Zn=null,pn=0,Ry(),Ar)}function RF(){for(;dn!==null&&!tz();)OI(dn)}function OI(e){var t=cI(e.alternate,e,ll);e.memoizedProps=e.pendingProps,t===null?Fy(e):dn=t}function F8(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=j8(n,t,t.pendingProps,t.type,void 0,pn);break;case 11:t=j8(n,t,t.pendingProps,t.type.render,t.ref,pn);break;case 5:k_(t);default:uI(n,t),t=dn=uM(t,ll),t=cI(n,t,ll)}e.memoizedProps=e.pendingProps,t===null?Fy(e):dn=t}function Dd(e,t,n,r){Ka=Gu=null,k_(t),Gd=null,D0=0;var s=t.return;try{if(wF(e,s,t,n,pn)){Ar=1,d1(e,co(n,e.current)),dn=null;return}}catch(i){if(s!==null)throw dn=s,i;Ar=1,d1(e,co(n,e.current)),dn=null;return}t.flags&32768?(wn||r===1?e=!0:Bh||pn&536870912?e=!1:(Kl=e=!0,(r===2||r===9||r===3||r===6)&&(r=qi.current,r!==null&&r.tag===13&&(r.flags|=16384))),BI(t,e)):Fy(t)}function Fy(e){var t=e;do{if(t.flags&32768){BI(t,Kl);return}e=t.return;var n=kF(t.alternate,t,ll);if(n!==null){dn=n;return}if(t=t.sibling,t!==null){dn=t;return}dn=t=e}while(t!==null);Ar===0&&(Ar=5)}function BI(e,t){do{var n=SF(e.alternate,e);if(n!==null){n.flags&=32767,dn=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){dn=e;return}dn=e=n}while(e!==null);Ar=6,dn=null}function U8(e,t,n,r,s,i,o,a,l){e.cancelPendingCommit=null;do Uy();while(ts!==0);if(Rn&6)throw Error(_e(327));if(t!==null){if(t===e.current)throw Error(_e(177));if(i=t.lanes|t.childLanes,i|=c_,dz(e,n,i,o,a,l),e===Zn&&(dn=Zn=null,pn=0),hh=t,ac=e,el=n,vw=i,ww=s,MI=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,OF(e1,function(){return UI(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=Ft.T,Ft.T=null,s=jn.p,jn.p=2,o=Rn,Rn|=4;try{TF(e,t,n)}finally{Rn=o,jn.p=s,Ft.T=r}}ts=1,PI(),$I(),zI()}}function PI(){if(ts===1){ts=0;var e=ac,t=hh,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ft.T,Ft.T=null;var r=jn.p;jn.p=2;var s=Rn;Rn|=4;try{xI(t,e);var i=Tw,o=nM(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&tM(a.ownerDocument.documentElement,a)){if(l!==null&&l_(a)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(u,a.value.length);else{var d=a.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var m=f.getSelection(),p=a.textContent.length,y=Math.min(l.start,p),w=l.end===void 0?y:Math.min(l.end,p);!m.extend&&y>w&&(o=w,w=y,y=o);var b=u8(a,y),v=u8(a,w);if(b&&v&&(m.rangeCount!==1||m.anchorNode!==b.node||m.anchorOffset!==b.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var x=d.createRange();x.setStart(b.node,b.offset),m.removeAllRanges(),y>w?(m.addRange(x),m.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),m.addRange(x))}}}}for(d=[],m=a;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<d.length;a++){var S=d[a];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}S1=!!Sw,Tw=Sw=null}finally{Rn=s,jn.p=r,Ft.T=n}}e.current=t,ts=2}}function $I(){if(ts===2){ts=0;var e=ac,t=hh,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ft.T,Ft.T=null;var r=jn.p;jn.p=2;var s=Rn;Rn|=4;try{gI(e,t.alternate,t)}finally{Rn=s,jn.p=r,Ft.T=n}}ts=3}}function zI(){if(ts===4||ts===3){ts=0,nz();var e=ac,t=hh,n=el,r=MI;t.subtreeFlags&10256||t.flags&10256?ts=5:(ts=0,hh=ac=null,FI(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(oc=null),t_(n),t=t.stateNode,Bi&&typeof Bi.onCommitFiberRoot=="function")try{Bi.onCommitFiberRoot(ym,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=Ft.T,s=jn.p,jn.p=2,Ft.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var a=r[o];i(a.value,{componentStack:a.stack})}}finally{Ft.T=t,jn.p=s}}el&3&&Uy(),va(e),s=e.pendingLanes,n&261930&&s&42?e===xw?u0++:(u0=0,xw=e):u0=0,Tm(0)}}function FI(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_m(t)))}function Uy(){return PI(),$I(),zI(),UI()}function UI(){if(ts!==5)return!1;var e=ac,t=vw;vw=0;var n=t_(el),r=Ft.T,s=jn.p;try{jn.p=32>n?32:n,Ft.T=null,n=ww,ww=null;var i=ac,o=el;if(ts=0,hh=ac=null,el=0,Rn&6)throw Error(_e(331));var a=Rn;if(Rn|=4,CI(i.current),kI(i,i.current,o,n),Rn=a,Tm(0,!1),Bi&&typeof Bi.onPostCommitFiberRoot=="function")try{Bi.onPostCommitFiberRoot(ym,i)}catch{}return!0}finally{jn.p=s,Ft.T=r,FI(e,t)}}function q8(e,t,n){t=co(n,t),t=mw(e.stateNode,t,2),e=ic(e,t,2),e!==null&&(vm(e,2),va(e))}function Fn(e,t,n){if(e.tag===3)q8(e,e,n);else for(;t!==null;){if(t.tag===3){q8(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(oc===null||!oc.has(r))){e=co(n,e),n=rI(2),r=ic(t,n,2),r!==null&&(sI(n,r,t,e),vm(r,2),va(r));break}}t=t.return}}function R2(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new EF;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(O_=!0,s.add(n),e=LF.bind(null,e,t,n),t.then(e,e))}function LF(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Zn===e&&(pn&n)===n&&(Ar===4||Ar===3&&(pn&62914560)===pn&&300>Oi()-$y?!(Rn&2)&&fh(e,0):B_|=n,dh===pn&&(dh=0)),va(e)}function qI(e,t){t===0&&(t=jE()),e=Wu(e,t),e!==null&&(vm(e,t),va(e))}function jF(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qI(e,n)}function DF(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(_e(314))}r!==null&&r.delete(t),qI(e,n)}function OF(e,t){return Z3(e,t)}var y1=null,vd=null,_w=!1,b1=!1,L2=!1,Xl=0;function va(e){e!==vd&&e.next===null&&(vd===null?y1=vd=e:vd=vd.next=e),b1=!0,_w||(_w=!0,PF())}function Tm(e,t){if(!L2&&b1){L2=!0;do for(var n=!1,r=y1;r!==null;){if(e!==0){var s=r.pendingLanes;if(s===0)var i=0;else{var o=r.suspendedLanes,a=r.pingedLanes;i=(1<<31-Pi(42|e)+1)-1,i&=s&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,H8(r,i))}else i=pn,i=Ey(r,r===Zn?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||bm(r,i)||(n=!0,H8(r,i));r=r.next}while(n);L2=!1}}function BF(){HI()}function HI(){b1=_w=!1;var e=0;Xl!==0&&KF()&&(e=Xl);for(var t=Oi(),n=null,r=y1;r!==null;){var s=r.next,i=VI(r,t);i===0?(r.next=null,n===null?y1=s:n.next=s,s===null&&(vd=n)):(n=r,(e!==0||i&3)&&(b1=!0)),r=s}ts!==0&&ts!==5||Tm(e),Xl!==0&&(Xl=0)}function VI(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Pi(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=uz(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=Zn,n=pn,n=Ey(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&($n===2||$n===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&a2(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||bm(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&a2(r),t_(n)){case 2:case 8:n=RE;break;case 32:n=e1;break;case 268435456:n=LE;break;default:n=e1}return r=WI.bind(null,e),n=Z3(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&a2(r),e.callbackPriority=2,e.callbackNode=null,2}function WI(e,t){if(ts!==0&&ts!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uy()&&e.callbackNode!==n)return null;var r=pn;return r=Ey(e,e===Zn?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(NI(e,r,t),VI(e,Oi()),e.callbackNode!=null&&e.callbackNode===n?WI.bind(null,e):null)}function H8(e,t){if(Uy())return null;NI(e,t,!0)}function PF(){XF(function(){Rn&6?Z3(NE,BF):HI()})}function $_(){if(Xl===0){var e=lh;e===0&&(e=ip,ip<<=1,!(ip&261888)&&(ip=256)),Xl=e}return Xl}function V8(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:gg(""+e)}function W8(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 $F(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=V8((s[vi]||null).action),o=r.submitter;o&&(t=(t=o[vi]||null)?V8(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new My("action","action",null,r,s);e.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Xl!==0){var l=o?W8(s,o):new FormData(s);hw(n,{pending:!0,data:l,method:s.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?W8(s,o):new FormData(s),hw(n,{pending:!0,data:l,method:s.method,action:i},i,l))},currentTarget:s}]})}}for(var j2=0;j2<ew.length;j2++){var D2=ew[j2],zF=D2.toLowerCase(),FF=D2[0].toUpperCase()+D2.slice(1);Do(zF,"on"+FF)}Do(sM,"onAnimationEnd");Do(iM,"onAnimationIteration");Do(oM,"onAnimationStart");Do("dblclick","onDoubleClick");Do("focusin","onFocus");Do("focusout","onBlur");Do(rF,"onTransitionRun");Do(sF,"onTransitionStart");Do(iF,"onTransitionCancel");Do(aM,"onTransitionEnd");oh("onMouseEnter",["mouseout","mouseover"]);oh("onMouseLeave",["mouseout","mouseover"]);oh("onPointerEnter",["pointerout","pointerover"]);oh("onPointerLeave",["pointerout","pointerover"]);qu("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));qu("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));qu("onBeforeInput",["compositionend","keypress","textInput","paste"]);qu("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));qu("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));qu("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var P0="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(" "),UF=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(P0));function GI(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=c;try{i(s)}catch(u){n1(u)}s.currentTarget=null,i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=c;try{i(s)}catch(u){n1(u)}s.currentTarget=null,i=l}}}}function un(e,t){var n=t[Wv];n===void 0&&(n=t[Wv]=new Set);var r=e+"__bubble";n.has(r)||(KI(t,e,2,!1),n.add(r))}function O2(e,t,n){var r=0;t&&(r|=4),KI(n,e,r,t)}var pp="_reactListening"+Math.random().toString(36).slice(2);function z_(e){if(!e[pp]){e[pp]=!0,$E.forEach(function(n){n!=="selectionchange"&&(UF.has(n)||O2(n,!1,e),O2(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[pp]||(t[pp]=!0,O2("selectionchange",!1,t))}}function KI(e,t,n,r){switch(aN(t)){case 2:var s=gU;break;case 8:s=yU;break;default:s=H_}n=s.bind(null,t,n,e),s=void 0,!Qv||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function B2(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===s)return;o=o.return}for(;a!==null;){if(o=Cd(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=i=o;continue e}a=a.parentNode}}r=r.return}GE(function(){var c=i,u=s_(n),d=[];e:{var f=lM.get(e);if(f!==void 0){var m=My,p=e;switch(e){case"keypress":if(bg(n)===0)break e;case"keydown":case"keyup":m=Dz;break;case"focusin":p="focus",m=h2;break;case"focusout":p="blur",m=h2;break;case"beforeblur":case"afterblur":m=h2;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=e8;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=kz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Pz;break;case sM:case iM:case oM:m=Cz;break;case aM:m=zz;break;case"scroll":case"scrollend":m=xz;break;case"wheel":m=Uz;break;case"copy":case"cut":case"paste":m=Ez;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=n8;break;case"toggle":case"beforetoggle":m=Hz}var y=(t&4)!==0,w=!y&&(e==="scroll"||e==="scrollend"),b=y?f!==null?f+"Capture":null:f;y=[];for(var v=c,x;v!==null;){var S=v;if(x=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||x===null||b===null||(S=I0(v,b),S!=null&&y.push($0(v,S,x))),w)break;v=v.return}0<y.length&&(f=new m(f,p,null,n,u),d.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==Xv&&(p=n.relatedTarget||n.fromElement)&&(Cd(p)||p[Lh]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?Cd(p):null,p!==null&&(w=gm(p),y=p.tag,p!==w||y!==5&&y!==27&&y!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=e8,S="onMouseLeave",b="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=n8,S="onPointerLeave",b="onPointerEnter",v="pointer"),w=m==null?f:Bf(m),x=p==null?f:Bf(p),f=new y(S,v+"leave",m,n,u),f.target=w,f.relatedTarget=x,S=null,Cd(u)===c&&(y=new y(b,v+"enter",p,n,u),y.target=x,y.relatedTarget=w,S=y),w=S,m&&p)t:{for(y=qF,b=m,v=p,x=0,S=b;S;S=y(S))x++;S=0;for(var C=v;C;C=y(C))S++;for(;0<x-S;)b=y(b),x--;for(;0<S-x;)v=y(v),S--;for(;x--;){if(b===v||v!==null&&b===v.alternate){y=b;break t}b=y(b),v=y(v)}y=null}else y=null;m!==null&&G8(d,f,m,y,!1),p!==null&&w!==null&&G8(d,w,p,y,!0)}}e:{if(f=c?Bf(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var E=o8;else if(i8(f))if(ZE)E=eF;else{E=Jz;var M=Qz}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&r_(c.elementType)&&(E=o8):E=Zz;if(E&&(E=E(e,c))){JE(d,E,n,u);break e}M&&M(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&Yv(f,"number",f.value)}switch(M=c?Bf(c):window,e){case"focusin":(i8(M)||M.contentEditable==="true")&&(Md=M,Jv=c,t0=null);break;case"focusout":t0=Jv=Md=null;break;case"mousedown":Zv=!0;break;case"contextmenu":case"mouseup":case"dragend":Zv=!1,d8(d,n,u);break;case"selectionchange":if(nF)break;case"keydown":case"keyup":d8(d,n,u)}var D;if(a_)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else Ed?XE(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(YE&&n.locale!=="ko"&&(Ed||O!=="onCompositionStart"?O==="onCompositionEnd"&&Ed&&(D=KE()):(Gl=u,i_="value"in Gl?Gl.value:Gl.textContent,Ed=!0)),M=v1(c,O),0<M.length&&(O=new t8(O,e,null,n,u),d.push({event:O,listeners:M}),D?O.data=D:(D=QE(n),D!==null&&(O.data=D)))),(D=Wz?Gz(e,n):Kz(e,n))&&(O=v1(c,"onBeforeInput"),0<O.length&&(M=new t8("onBeforeInput","beforeinput",null,n,u),d.push({event:M,listeners:O}),M.data=D)),$F(d,e,c,n,u)}GI(d,t)})}function $0(e,t,n){return{instance:e,listener:t,currentTarget:n}}function v1(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=I0(e,n),s!=null&&r.unshift($0(e,s,i)),s=I0(e,t),s!=null&&r.push($0(e,s,i))),e.tag===3)return r;e=e.return}return[]}function qF(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function G8(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===r)break;a!==5&&a!==26&&a!==27||c===null||(l=c,s?(c=I0(n,i),c!=null&&o.unshift($0(n,c,l))):s||(c=I0(n,i),c!=null&&o.push($0(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var HF=/\r\n?/g,VF=/\u0000|\uFFFD/g;function K8(e){return(typeof e=="string"?e:""+e).replace(HF,`
`).replace(VF,"")}function YI(e,t){return t=K8(t),K8(e)===t}function Un(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ah(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ah(e,""+r);break;case"className":lp(e,"class",r);break;case"tabIndex":lp(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":lp(e,n,r);break;case"style":WE(e,r,i);break;case"data":if(t!=="object"){lp(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=gg(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(t!=="input"&&Un(e,t,"name",s.name,s,null),Un(e,t,"formEncType",s.formEncType,s,null),Un(e,t,"formMethod",s.formMethod,s,null),Un(e,t,"formTarget",s.formTarget,s,null)):(Un(e,t,"encType",s.encType,s,null),Un(e,t,"method",s.method,s,null),Un(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=gg(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Ga);break;case"onScroll":r!=null&&un("scroll",e);break;case"onScrollEnd":r!=null&&un("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(_e(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(_e(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=gg(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":un("beforetoggle",e),un("toggle",e),pg(e,"popover",r);break;case"xlinkActuate":Na(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Na(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Na(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Na(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Na(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Na(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Na(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Na(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Na(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":pg(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=vz.get(n)||n,pg(e,n,r))}}function kw(e,t,n,r,s,i){switch(n){case"style":WE(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(_e(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(_e(60));e.innerHTML=n}}break;case"children":typeof r=="string"?ah(e,r):(typeof r=="number"||typeof r=="bigint")&&ah(e,""+r);break;case"onScroll":r!=null&&un("scroll",e);break;case"onScrollEnd":r!=null&&un("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Ga);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zE.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),i=e[vi]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof r=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,s);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):pg(e,n,r)}}}function Ts(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":un("error",e),un("load",e);var r=!1,s=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(_e(137,t));default:Un(e,t,i,o,n,null)}}s&&Un(e,t,"srcSet",n.srcSet,n,null),r&&Un(e,t,"src",n.src,n,null);return;case"input":un("invalid",e);var a=i=o=s=null,l=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":s=u;break;case"type":o=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":i=u;break;case"defaultValue":a=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(_e(137,t));break;default:Un(e,t,r,u,n,null)}}qE(e,i,a,l,c,o,s,!1);return;case"select":un("invalid",e),r=o=i=null;for(s in n)if(n.hasOwnProperty(s)&&(a=n[s],a!=null))switch(s){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:Un(e,t,s,a,n,null)}t=i,n=o,e.multiple=!!r,t!=null?Hd(e,!!r,t,!1):n!=null&&Hd(e,!!r,n,!0);return;case"textarea":un("invalid",e),i=s=r=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":r=a;break;case"defaultValue":s=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(_e(91));break;default:Un(e,t,o,a,n,null)}VE(e,r,s,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Un(e,t,l,r,n,null)}return;case"dialog":un("beforetoggle",e),un("toggle",e),un("cancel",e),un("close",e);break;case"iframe":case"object":un("load",e);break;case"video":case"audio":for(r=0;r<P0.length;r++)un(P0[r],e);break;case"image":un("error",e),un("load",e);break;case"details":un("toggle",e);break;case"embed":case"source":case"link":un("error",e),un("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)&&(r=n[c],r!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(_e(137,t));default:Un(e,t,c,r,n,null)}return;default:if(r_(t)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&kw(e,t,u,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&Un(e,t,a,r,n,null))}function WF(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,o=null,a=null,l=null,c=null,u=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(m)||Un(e,t,m,null,r,d)}}for(var f in r){var m=r[f];if(d=n[f],r.hasOwnProperty(f)&&(m!=null||d!=null))switch(f){case"type":i=m;break;case"name":s=m;break;case"checked":c=m;break;case"defaultChecked":u=m;break;case"value":o=m;break;case"defaultValue":a=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(_e(137,t));break;default:m!==d&&Un(e,t,f,m,r,d)}}Kv(e,o,a,l,c,u,i,s);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:r.hasOwnProperty(i)||Un(e,t,i,null,r,l)}for(s in r)if(i=r[s],l=n[s],r.hasOwnProperty(s)&&(i!=null||l!=null))switch(s){case"value":f=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&Un(e,t,s,i,r,l)}t=a,n=o,r=m,f!=null?Hd(e,!!n,f,!1):!!r!=!!n&&(t!=null?Hd(e,!!n,t,!0):Hd(e,!!n,n?[]:"",!1));return;case"textarea":m=f=null;for(a in n)if(s=n[a],n.hasOwnProperty(a)&&s!=null&&!r.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:Un(e,t,a,null,r,s)}for(o in r)if(s=r[o],i=n[o],r.hasOwnProperty(o)&&(s!=null||i!=null))switch(o){case"value":f=s;break;case"defaultValue":m=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(_e(91));break;default:s!==i&&Un(e,t,o,s,r,i)}HE(e,f,m);return;case"option":for(var p in n)if(f=n[p],n.hasOwnProperty(p)&&f!=null&&!r.hasOwnProperty(p))switch(p){case"selected":e.selected=!1;break;default:Un(e,t,p,null,r,f)}for(l in r)if(f=r[l],m=n[l],r.hasOwnProperty(l)&&f!==m&&(f!=null||m!=null))switch(l){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Un(e,t,l,f,r,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&&!r.hasOwnProperty(y)&&Un(e,t,y,null,r,f);for(c in r)if(f=r[c],m=n[c],r.hasOwnProperty(c)&&f!==m&&(f!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(_e(137,t));break;default:Un(e,t,c,f,r,m)}return;default:if(r_(t)){for(var w in n)f=n[w],n.hasOwnProperty(w)&&f!==void 0&&!r.hasOwnProperty(w)&&kw(e,t,w,void 0,r,f);for(u in r)f=r[u],m=n[u],!r.hasOwnProperty(u)||f===m||f===void 0&&m===void 0||kw(e,t,u,f,r,m);return}}for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!=null&&!r.hasOwnProperty(b)&&Un(e,t,b,null,r,f);for(d in r)f=r[d],m=n[d],!r.hasOwnProperty(d)||f===m||f==null&&m==null||Un(e,t,d,f,r,m)}function Y8(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function GF(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var s=n[r],i=s.transferSize,o=s.initiatorType,a=s.duration;if(i&&a&&Y8(o)){for(o=0,a=s.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>a)break;var u=l.transferSize,d=l.initiatorType;u&&Y8(d)&&(l=l.responseEnd,o+=u*(l<a?1:(a-c)/(l-c)))}if(--r,t+=8*(i+o)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Sw=null,Tw=null;function w1(e){return e.nodeType===9?e:e.ownerDocument}function X8(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 XI(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 Cw(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 P2=null;function KF(){var e=window.event;return e&&e.type==="popstate"?e===P2?!1:(P2=e,!0):(P2=null,!1)}var QI=typeof setTimeout=="function"?setTimeout:void 0,YF=typeof clearTimeout=="function"?clearTimeout:void 0,Q8=typeof Promise=="function"?Promise:void 0,XF=typeof queueMicrotask=="function"?queueMicrotask:typeof Q8<"u"?function(e){return Q8.resolve(null).then(e).catch(QF)}:QI;function QF(e){setTimeout(function(){throw e})}function Ic(e){return e==="head"}function J8(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(s),ph(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")d0(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,d0(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[wm]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&d0(e.ownerDocument.body);n=s}while(n);ph(t)}function Z8(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function Aw(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":Aw(n),n_(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function JF(e,t,n,r){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[wm])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=yo(e.nextSibling),e===null)break}return null}function ZF(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=yo(e.nextSibling),e===null))return null;return e}function JI(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=yo(e.nextSibling),e===null))return null;return e}function Ew(e){return e.data==="$?"||e.data==="$~"}function Mw(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function eU(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function yo(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 Iw=null;function eS(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return yo(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function tS(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 ZI(e,t,n){switch(t=w1(n),e){case"html":if(e=t.documentElement,!e)throw Error(_e(452));return e;case"head":if(e=t.head,!e)throw Error(_e(453));return e;case"body":if(e=t.body,!e)throw Error(_e(454));return e;default:throw Error(_e(451))}}function d0(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);n_(e)}var vo=new Map,nS=new Set;function x1(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var fl=jn.d;jn.d={f:tU,r:nU,D:rU,C:sU,L:iU,m:oU,X:lU,S:aU,M:cU};function tU(){var e=fl.f(),t=zy();return e||t}function nU(e){var t=jh(e);t!==null&&t.tag===5&&t.type==="form"?WM(t):fl.r(e)}var Ph=typeof document>"u"?null:document;function eN(e,t,n){var r=Ph;if(r&&typeof t=="string"&&t){var s=lo(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),nS.has(s)||(nS.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),Ts(t,"link",e),fs(t),r.head.appendChild(t)))}}function rU(e){fl.D(e),eN("dns-prefetch",e,null)}function sU(e,t){fl.C(e,t),eN("preconnect",e,t)}function iU(e,t,n){fl.L(e,t,n);var r=Ph;if(r&&e&&t){var s='link[rel="preload"][as="'+lo(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+lo(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+lo(n.imageSizes)+'"]')):s+='[href="'+lo(e)+'"]';var i=s;switch(t){case"style":i=mh(e);break;case"script":i=$h(e)}vo.has(i)||(e=hr({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),vo.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(Cm(i))||t==="script"&&r.querySelector(Am(i))||(t=r.createElement("link"),Ts(t,"link",e),fs(t),r.head.appendChild(t)))}}function oU(e,t){fl.m(e,t);var n=Ph;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+lo(r)+'"][href="'+lo(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=$h(e)}if(!vo.has(i)&&(e=hr({rel:"modulepreload",href:e},t),vo.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Am(i)))return}r=n.createElement("link"),Ts(r,"link",e),fs(r),n.head.appendChild(r)}}}function aU(e,t,n){fl.S(e,t,n);var r=Ph;if(r&&e){var s=qd(r).hoistableStyles,i=mh(e);t=t||"default";var o=s.get(i);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(Cm(i)))a.loading=5;else{e=hr({rel:"stylesheet",href:e,"data-precedence":t},n),(n=vo.get(i))&&F_(e,n);var l=o=r.createElement("link");fs(l),Ts(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,Cg(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:a},s.set(i,o)}}}function lU(e,t){fl.X(e,t);var n=Ph;if(n&&e){var r=qd(n).hoistableScripts,s=$h(e),i=r.get(s);i||(i=n.querySelector(Am(s)),i||(e=hr({src:e,async:!0},t),(t=vo.get(s))&&U_(e,t),i=n.createElement("script"),fs(i),Ts(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function cU(e,t){fl.M(e,t);var n=Ph;if(n&&e){var r=qd(n).hoistableScripts,s=$h(e),i=r.get(s);i||(i=n.querySelector(Am(s)),i||(e=hr({src:e,async:!0,type:"module"},t),(t=vo.get(s))&&U_(e,t),i=n.createElement("script"),fs(i),Ts(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function rS(e,t,n,r){var s=(s=nc.current)?x1(s):null;if(!s)throw Error(_e(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=mh(n.href),n=qd(s).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=mh(n.href);var i=qd(s).hoistableStyles,o=i.get(e);if(o||(s=s.ownerDocument||s,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=s.querySelector(Cm(e)))&&!i._p&&(o.instance=i,o.state.loading=5),vo.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},vo.set(e,n),i||uU(s,e,n,o.state))),t&&r===null)throw Error(_e(528,""));return o}if(t&&r!==null)throw Error(_e(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$h(n),n=qd(s).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(_e(444,e))}}function mh(e){return'href="'+lo(e)+'"'}function Cm(e){return'link[rel="stylesheet"]['+e+"]"}function tN(e){return hr({},e,{"data-precedence":e.precedence,precedence:null})}function uU(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Ts(t,"link",n),fs(t),e.head.appendChild(t))}function $h(e){return'[src="'+lo(e)+'"]'}function Am(e){return"script[async]"+e}function sS(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+lo(n.href)+'"]');if(r)return t.instance=r,fs(r),r;var s=hr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),fs(r),Ts(r,"style",s),Cg(r,n.precedence,e),t.instance=r;case"stylesheet":s=mh(n.href);var i=e.querySelector(Cm(s));if(i)return t.state.loading|=4,t.instance=i,fs(i),i;r=tN(n),(s=vo.get(s))&&F_(r,s),i=(e.ownerDocument||e).createElement("link"),fs(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ts(i,"link",r),t.state.loading|=4,Cg(i,n.precedence,e),t.instance=i;case"script":return i=$h(n.src),(s=e.querySelector(Am(i)))?(t.instance=s,fs(s),s):(r=n,(s=vo.get(i))&&(r=hr({},n),U_(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),fs(s),Ts(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(_e(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Cg(r,n.precedence,e));return t.instance}function Cg(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=r.length?r[r.length-1]:null,i=s,o=0;o<r.length;o++){var a=r[o];if(a.dataset.precedence===t)i=a;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function F_(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function U_(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ag=null;function iS(e,t,n){if(Ag===null){var r=new Map,s=Ag=new Map;s.set(n,r)}else s=Ag,r=s.get(n),r||(r=new Map,s.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var i=n[s];if(!(i[wm]||i[xs]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=r.get(o);a?a.push(i):r.set(o,[i])}}return r}function oS(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function dU(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 nN(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function hU(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var s=mh(r.href),i=t.querySelector(Cm(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=_1.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,fs(i);return}i=t.ownerDocument||t,r=tN(r),(s=vo.get(s))&&F_(r,s),i=i.createElement("link"),fs(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ts(i,"link",r),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=_1.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var $2=0;function fU(e,t){return e.stylesheets&&e.count===0&&Eg(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Eg(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&$2===0&&($2=62500*GF());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Eg(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>$2?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function _1(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Eg(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var k1=null;function Eg(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,k1=new Map,t.forEach(mU,e),k1=null,_1.call(e))}function mU(e,t){if(!(t.state.loading&4)){var n=k1.get(e);if(n)var r=n.get(null);else{n=new Map,k1.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var o=s[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}s=t.instance,o=s.getAttribute("data-precedence"),i=n.get(o)||r,i===r&&n.set(null,s),n.set(o,s),this.count++,r=_1.bind(this),s.addEventListener("load",r),s.addEventListener("error",r),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var z0={$$typeof:Wa,Provider:null,Consumer:null,_currentValue:bu,_currentValue2:bu,_threadCount:0};function pU(e,t,n,r,s,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=l2(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=l2(0),this.hiddenUpdates=l2(null),this.identifierPrefix=r,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function rN(e,t,n,r,s,i,o,a,l,c,u,d){return e=new pU(e,t,n,o,l,c,u,d,a),t=1,i===!0&&(t|=24),i=Ri(3,null,null,t),e.current=i,i.stateNode=e,t=m_(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},y_(i),e}function sN(e){return e?(e=Rd,e):Rd}function iN(e,t,n,r,s,i){s=sN(s),r.context===null?r.context=s:r.pendingContext=s,r=sc(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=ic(e,r,t),n!==null&&(yi(n,e,t),r0(n,e,t))}function aS(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function q_(e,t){aS(e,t),(e=e.alternate)&&aS(e,t)}function oN(e){if(e.tag===13||e.tag===31){var t=Wu(e,67108864);t!==null&&yi(t,e,67108864),q_(e,67108864)}}function lS(e){if(e.tag===13||e.tag===31){var t=$i();t=e_(t);var n=Wu(e,t);n!==null&&yi(n,e,t),q_(e,t)}}var S1=!0;function gU(e,t,n,r){var s=Ft.T;Ft.T=null;var i=jn.p;try{jn.p=2,H_(e,t,n,r)}finally{jn.p=i,Ft.T=s}}function yU(e,t,n,r){var s=Ft.T;Ft.T=null;var i=jn.p;try{jn.p=8,H_(e,t,n,r)}finally{jn.p=i,Ft.T=s}}function H_(e,t,n,r){if(S1){var s=Nw(r);if(s===null)B2(e,t,r,T1,n),cS(e,r);else if(vU(s,e,t,n,r))r.stopPropagation();else if(cS(e,r),t&4&&-1<bU.indexOf(e)){for(;s!==null;){var i=jh(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=eu(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Pi(o);a.entanglements[1]|=l,o&=~l}va(i),!(Rn&6)&&(m1=Oi()+500,Tm(0))}}break;case 31:case 13:a=Wu(i,2),a!==null&&yi(a,i,2),zy(),q_(i,2)}if(i=Nw(r),i===null&&B2(e,t,r,T1,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else B2(e,t,r,null,n)}}function Nw(e){return e=s_(e),V_(e)}var T1=null;function V_(e){if(T1=null,e=Cd(e),e!==null){var t=gm(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=CE(t),e!==null)return e;e=null}else if(n===31){if(e=AE(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 T1=e,null}function aN(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(rz()){case NE:return 2;case RE:return 8;case e1:case sz:return 32;case LE:return 268435456;default:return 32}default:return 32}}var Rw=!1,lc=null,cc=null,uc=null,F0=new Map,U0=new Map,ql=[],bU="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 cS(e,t){switch(e){case"focusin":case"focusout":lc=null;break;case"dragenter":case"dragleave":cc=null;break;case"mouseover":case"mouseout":uc=null;break;case"pointerover":case"pointerout":F0.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":U0.delete(t.pointerId)}}function gf(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=jh(t),t!==null&&oN(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function vU(e,t,n,r,s){switch(t){case"focusin":return lc=gf(lc,e,t,n,r,s),!0;case"dragenter":return cc=gf(cc,e,t,n,r,s),!0;case"mouseover":return uc=gf(uc,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return F0.set(i,gf(F0.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,U0.set(i,gf(U0.get(i)||null,e,t,n,r,s)),!0}return!1}function lN(e){var t=Cd(e.target);if(t!==null){var n=gm(t);if(n!==null){if(t=n.tag,t===13){if(t=CE(n),t!==null){e.blockedOn=t,G6(e.priority,function(){lS(n)});return}}else if(t===31){if(t=AE(n),t!==null){e.blockedOn=t,G6(e.priority,function(){lS(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 Mg(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Nw(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xv=r,n.target.dispatchEvent(r),Xv=null}else return t=jh(n),t!==null&&oN(t),e.blockedOn=n,!1;t.shift()}return!0}function uS(e,t,n){Mg(e)&&n.delete(t)}function wU(){Rw=!1,lc!==null&&Mg(lc)&&(lc=null),cc!==null&&Mg(cc)&&(cc=null),uc!==null&&Mg(uc)&&(uc=null),F0.forEach(uS),U0.forEach(uS)}function gp(e,t){e.blockedOn===t&&(e.blockedOn=null,Rw||(Rw=!0,rs.unstable_scheduleCallback(rs.unstable_NormalPriority,wU)))}var yp=null;function dS(e){yp!==e&&(yp=e,rs.unstable_scheduleCallback(rs.unstable_NormalPriority,function(){yp===e&&(yp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],s=e[t+2];if(typeof r!="function"){if(V_(r||n)===null)continue;break}var i=jh(n);i!==null&&(e.splice(t,3),t-=3,hw(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function ph(e){function t(l){return gp(l,e)}lc!==null&&gp(lc,e),cc!==null&&gp(cc,e),uc!==null&&gp(uc,e),F0.forEach(t),U0.forEach(t);for(var n=0;n<ql.length;n++){var r=ql[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<ql.length&&(n=ql[0],n.blockedOn===null);)lN(n),n.blockedOn===null&&ql.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var s=n[r],i=n[r+1],o=s[vi]||null;if(typeof i=="function")o||dS(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[vi]||null)a=o.formAction;else if(V_(s)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),dS(n)}}}function cN(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return s=o})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function W_(e){this._internalRoot=e}qy.prototype.render=W_.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(_e(409));var n=t.current,r=$i();iN(n,r,e,t,null,null)};qy.prototype.unmount=W_.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;iN(e.current,2,null,e,null,null),zy(),t[Lh]=null}};function qy(e){this._internalRoot=e}qy.prototype.unstable_scheduleHydration=function(e){if(e){var t=PE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ql.length&&t!==0&&t<ql[n].priority;n++);ql.splice(n,0,e),n===0&&lN(e)}};var hS=SE.version;if(hS!=="19.2.4")throw Error(_e(527,hS,"19.2.4"));jn.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(_e(188)):(e=Object.keys(e).join(","),Error(_e(268,e)));return e=X$(t),e=e!==null?EE(e):null,e=e===null?null:e.stateNode,e};var xU={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Ft,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bp.isDisabled&&bp.supportsFiber)try{ym=bp.inject(xU),Bi=bp}catch{}}Ty.createRoot=function(e,t){if(!TE(e))throw Error(_e(299));var n=!1,r="",s=eI,i=tI,o=nI;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=rN(e,1,!1,null,null,n,r,null,s,i,o,cN),e[Lh]=t.current,z_(e),new W_(t)};Ty.hydrateRoot=function(e,t,n){if(!TE(e))throw Error(_e(299));var r=!1,s="",i=eI,o=tI,a=nI,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=rN(e,1,!0,t,n??null,r,s,l,i,o,a,cN),t.context=sN(null),n=t.current,r=$i(),r=e_(r),s=sc(r),s.callback=null,ic(n,s,r),n=r,t.current.lanes=n,vm(t,n),va(t),e[Lh]=t.current,z_(e),new qy(t)};Ty.version="19.2.4";function uN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uN)}catch(e){console.error(e)}}uN(),bE.exports=Ty;var _U=bE.exports;const kU=ky(_U);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const SU="agent";function TU(e){return e===SU}var CU=3e4,AU=new Set(["authorized","expired","error","cancelled"]),EU=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(r={})=>await MU(n,t,e.clientId,r)}}status(e,t){return this.client.getDeviceFlow(e,t)}cancel(e,t){return this.client.cancelDeviceFlow(e,t)}};async function MU(e,t,n,r){return await IU(e,t,n,r)}async function fS(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof ju&&s.status===404)return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,status:"error",errorKind:"not_found_or_evicted",hint:"device-flow not found on daemon (evicted past terminal grace, daemon restart, or unknown deviceFlowId)",createdAt:Date.now()};throw s}}function mS(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function IU(e,t,n,r){var u;let s=r.signal,i=mS(r.timeoutMs,{allowZero:!0}),o=mS(r.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+CU,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(s!=null&&s.aborted)throw Lw(s);if(Date.now()>=a)return await fS(e,t,n,s);let d=await fS(e,t,n,s);if(d.intervalMs&&d.intervalMs!==c&&(c=d.intervalMs,l=d.intervalMs,(u=r.onThrottled)==null||u.call(r,d.intervalMs)),AU.has(d.status))return d;await NU(l,s)}}async function NU(e,t){if(t!=null&&t.aborted)throw Lw(t);await new Promise((n,r)=>{let s=setTimeout(()=>{o(),n()},e),i=()=>{o(),r(Lw(t))};function o(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function Lw(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var ju=class extends Error{constructor(n,r,s){super(s);ue(this,"status");ue(this,"body");this.name="DaemonHttpError",this.status=n,this.body=r}},pS=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},RU=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},gS=16*1024*1024;async function*LU(e,t){let n=e.getReader(),r=new TextDecoder,s="",i;t&&(i=()=>{n.cancel().catch(()=>{})},t.aborted?i():t.addEventListener("abort",i,{once:!0}));try{for(;;){if(t!=null&&t.aborted)return;let o,a;try{({value:o,done:a}=await n.read())}catch(c){if(t!=null&&t.aborted)return;throw c}if(a){if(s+=r.decode(),s.length>0){let c=yS(s);for(let u of c.frames){let d=z2(u);d&&(yield d)}if(c.tail.length>0){let u=z2(c.tail);u&&(yield u)}}return}if(s+=r.decode(o,{stream:!0}),s.length>gS)throw new RU(`parseSseStream: unread buffer exceeded ${gS} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=yS(s);if(l.frames.length>0)for(let c of l.frames){let u=z2(c);u&&(yield u)}s=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function yS(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`

`,n);if(r===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let s=e.slice(n,r).indexOf(`\r
\r
`);if(s!==-1){let i=n+s;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,r)),n=r+2}return{frames:t,tail:e.slice(n)}}function z2(e){if(!e)return;let t=[];for(let r of e.split(/\r?\n/)){if(!r.startsWith("data:"))continue;let s=r.slice(5);t.push(s.startsWith(" ")?s.slice(1):s)}if(t.length===0)return;let n=t.join(`
`);try{let r=JSON.parse(n);if(typeof r!="object"||r===null||Array.isArray(r)||r.v!==1||typeof r.type!="string")return;let s=r.id;return s!==void 0&&(!Number.isSafeInteger(s)||s<1)?void 0:r}catch{return}}var jU=class{constructor(e,t,n){ue(this,"baseUrl");ue(this,"token");ue(this,"_fetch");ue(this,"_disposed",!1);ue(this,"type","rest");ue(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 pS;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var u;if(this._disposed)throw new pS;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 r=new AbortController,s,i=t.connectTimeoutMs;i&&Number.isFinite(i)&&(s=setTimeout(()=>r.abort(new DOMException("Initial connect timed out","TimeoutError")),i),typeof s=="object"&&s&&"unref"in s&&s.unref());let o=t.signal?DU([t.signal,r.signal]):r.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{s!==void 0&&clearTimeout(s)}if(!l.ok){let d;try{let m=await l.text();try{d=JSON.parse(m)}catch{d=m}}catch{}let f=d&&typeof d=="object"&&"error"in d?String(d.error):`HTTP ${l.status}`;throw new ju(l.status,d,`GET /session/:id/events: ${f}`)}let c=l.headers.get("content-type")??"";if(!c.toLowerCase().includes("text/event-stream")){try{await((u=l.body)==null?void 0:u.cancel())}catch{}throw new ju(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*LU(l.body,t.signal)}dispose(){this._disposed=!0}};function DU(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}var vp="/workspace/memory/remember",wp="/workspace/memory/forget",xp="/workspace/memory/dream",bS=20,OU=3e4,BU=65e3,PU=9e4,$U=5,yf=33e4,zU="X-Qwen-Client-Id";function vS(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function dN(e){if(e===void 0)return $U;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 FU(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function UU(){var e,t;try{let n=(t=(e=globalThis.process)==null?void 0:e.env)==null?void 0:t.QWEN_SERVER_TOKEN;if(typeof n!="string")return;let r=n.trim();return r.length===0?void 0:r}catch{return}}var wS=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 hN(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var jw=class{constructor(e){ue(this,"baseUrl");ue(this,"token");ue(this,"_fetch");ue(this,"fetchTimeoutMs");ue(this,"promptLimit");ue(this,"promptCounts",Object.create(null));ue(this,"transport");ue(this,"_authFlow");this.baseUrl=FU(e.baseUrl),this.token=e.token??UU(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??OU;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=dN(e.maxPendingPromptsPerSession),this.transport=e.transport??new jU(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new EU(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,r=n[e]??0;if(r>=t)throw new wS(e,t,r);n[e]=r+1;let s;return()=>{s||(s=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,r,s="transport"){let i=this.fetchTimeoutMs;if(r!==void 0&&Number.isFinite(r)&&r>=0&&(i=r),!i||!Number.isFinite(i)){let u=s==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(u):u}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?xS([l,o.signal]):o.signal;try{let u=s==="rest"?await this._fetch(e,{...t,signal:c}):await this.transport.fetch(e,{...t,signal:c});return n?await n(u):u}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[zU]=t),n}async failOnError(e,t,n){let r;try{let i=await e.text();if(i.length>0)try{r=JSON.parse(i)}catch{r=i}}catch{}let s=r&&typeof r=="object"&&"error"in r?String(r.error):`HTTP ${e.status}`;if(n&&e.status===503&&r&&typeof r=="object"){let i=r;if(i.code==="prompt_queue_full")return new wS(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new ju(e.status,r,`${t}: ${s}`)}async jsonRequest(e,t,n={}){let r=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(r?{"Content-Type":"application/json"}:{},n.clientId),...r?{body:JSON.stringify(n.body)}:{}},async s=>{if(!s.ok)throw await this.failOnError(s,t);return await s.json()},n.timeoutMs)}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 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/${encodeURIComponent(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/${encodeURIComponent(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 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/${encodeURIComponent(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/${encodeURIComponent(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/${encodeURIComponent(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t})}async readWorkspaceFile(e,t={},n){let r=new URL(`${this.baseUrl}/file`);return r.searchParams.set("path",e),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&r.searchParams.set("line",String(t.line)),t.limit!==void 0&&r.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file");return await s.json()})}async readWorkspaceFileBytes(e,t={},n){let r=new URL(`${this.baseUrl}/file/bytes`);return r.searchParams.set("path",e),t.offset!==void 0&&r.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file/bytes");return await s.json()})}async fileStat(e){let t=new URL(`${this.baseUrl}/stat`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(e){let t=new URL(`${this.baseUrl}/list`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async 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(vp,`POST ${vp}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${vp}/${encodeURIComponent(e)}`,`GET ${vp}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(wp,`POST ${wp}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${wp}/${encodeURIComponent(e)}`,`GET ${wp}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(xp,`POST ${xp}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${xp}/${encodeURIComponent(e)}`,`GET ${xp}/: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()},yf)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${encodeURIComponent(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={},r){let s=n.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}?scope=${encodeURIComponent(n.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`;return await this.fetchWithTimeout(s,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t)},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/agents/:agentType");return await i.json()})}async deleteWorkspaceAgent(e,t={},n){let r=t.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}?scope=${encodeURIComponent(t.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`;return await this.fetchWithTimeout(r,{method:"DELETE",headers:this.headers({},n)},async s=>{var i;if(s.status===204){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return}if(s.status===404){let o=await this.failOnError(s,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(s,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/env");return await e.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/preflight");return await e.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/tools");return await e.json()})}async createOrAttachSession(e,t){return 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}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(e,t){let n=(t==null?void 0:t.pageSize)??bS,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:bS))),s=new URLSearchParams({size:String(r)});return(t==null?void 0:t.archiveState)!==void 0&&s.set("archiveState",t.archiveState),(await this.jsonRequest(`/workspace/${encodeURIComponent(e)}/sessions?${s.toString()}`,"GET /workspace/sessions")).sessions}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/branch");return await r.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/fork");return await r.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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 sessionContextUsage(e,t={},n){let r=new URLSearchParams;t.detail===!0&&r.set("detail","true");let s=r.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/context-usage${s?`?${s}`:""}`,{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /session/:id/context-usage");return await i.json()})}async sessionSupportedCommands(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(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/${encodeURIComponent(e)}/lsp`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/lsp");return await n.json()})}async sessionTaskCancel(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({kind:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/tasks/:taskId/cancel");return await s.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(e)}/stats`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({cwd:n.workspaceCwd})},async s=>{if(!s.ok)throw await this.failOnError(s,`POST /session/:id/${e}`);return await s.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:t,...(n==null?void 0:n.persist)===!0?{persist:!0}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/approval-mode");return await r.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(e)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:t,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/rewind");return await r.json()})}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(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 r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/btw");return await r.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:t}),signal:n==null?void 0:n.signal},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/mid-turn-message");return await r.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(e)}/pending-prompts/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async r=>{if(!r.ok)throw await this.failOnError(r,"DELETE /session/:id/pending-prompts/:promptId");return await r.json()})}async shellCommand(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/shell");return await r.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${encodeURIComponent(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/tools/:name/enable");return await r.json()})}async workspaceSettings(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/settings");return await t.json()})}async setWorkspaceSetting(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r==null?void 0:r.clientId),body:JSON.stringify({scope:e,key:t,value:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/settings");return await s.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 r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/voice/transcribe");return await r.json()},BU,"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,r){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:r==null?void 0:r.clientId})}async addWorkspacePermissionRule(e,t,n,r){let s=vS(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?i:await this.setWorkspacePermissionRules(e,t,[...o,s],r)}async removeWorkspacePermissionRule(e,t,n,r){let s=vS(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==s),r):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${encodeURIComponent(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/restart");return await r.json()},(t==null?void 0:t.timeoutMs)??yf)}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 manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/:action");return await r.json()},(n==null?void 0:n.timeoutMs)??yf)}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)??yf)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${encodeURIComponent(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)??yf)}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:PU})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/model");return await r.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:t,syncOutputLanguage:(n==null?void 0:n.syncOutputLanguage)??!1})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/language");return await r.json()})}async prompt(e,t,n,r){n==null||n.throwIfAborted();let s=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),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,r)}finally{s()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&s()}}async promptNonBlocking(e,t,n,r){let s=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t),signal:n});if(s.status===202)return await s.json();if(!s.ok)throw await this.failOnError(s,"POST /session/:id/prompt",e);return await s.json()}async _awaitTurnComplete(e,t,n,r,s){let i=new AbortController,o=r?xS([r,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=G_(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(a){throw r!=null&&r.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,s).catch(()=>{}),a}finally{i.signal.aborted||i.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var r;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((r=n.body)==null?void 0:r.cancel())}catch{}})}async*subscribeEvents(e,t={}){yield*this.transport.subscribeEvents(e,{lastEventId:t.lastEventId,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${encodeURIComponent(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{var s,i;if(r.status===200){try{await((s=r.body)==null?void 0:s.cancel())}catch{}return!0}if(r.status===404){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/permission/${encodeURIComponent(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(n)},async s=>{var i,o;if(s.status===200){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!0}if(s.status===404){try{await((o=s.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/detach`,{method:"POST",headers:this.headers({},t)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"POST /session/:id/detach")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${encodeURIComponent(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/${encodeURIComponent(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /workspace/auth/device-flow/:id")})}async getAuthStatus(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/status");return await t.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/providers");return await e.json()})}async installAuthProvider(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/auth/provider");return await t.json()})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${encodeURIComponent(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${encodeURIComponent(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{if(r.status===200){let s=await r.json();return typeof s.displayName=="string"?{displayName:s.displayName}:{}}throw await this.failOnError(r,"PATCH /session/:id/metadata")})}};function xS(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}function G_(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 ju(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function _S(e){return"promptId"in e&&"lastEventId"in e}var bf=class Ig{constructor(t){ue(this,"client");ue(this,"session");ue(this,"state");ue(this,"replaySnapshot");ue(this,"hasActivePrompt");ue(this,"lastSeenEventId");ue(this,"subscriptionActive",!1);ue(this,"reattaching");ue(this,"promptLimit");ue(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=_p(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:dN(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},r){let s=await t.createOrAttachSession(n,r),i=!s.attached||n.modelServiceId?0:void 0;return new Ig({client:t,session:s,hasActivePrompt:s.hasActivePrompt,lastEventId:i})}static async load(t,n,r={},s){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:l,lastEventId:c,...u}=await t.loadSession(n,r,s);return new Ig({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:c??0,replaySnapshot:{compactedReplay:a??[],liveJournal:l??[]}})}static async resume(t,n,r={},s){let{state:i,hasActivePrompt:o,lastEventId:a,...l}=await t.resumeSession(n,r,s);return new Ig({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=_p(t)}async prompt(t,n){if(n==null||n.throwIfAborted(),!this.subscriptionActive)return await this.withClientIdSelfHeal(()=>this.client.prompt(this.sessionId,t,n,this.clientId));let r=this.client.reservePromptSlot(this.sessionId,this.promptLimit),s;try{if(s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!_S(s))return r(),s;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw r(),i}return new Promise((i,o)=>{let a=()=>{let c=this._pendingPrompts.get(s.promptId);c&&this._pendingPrompts.delete(s.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(s.promptId,{resolve:c=>{l(),r(),i(c)},reject:c=>{l(),r(),o(c)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!_S(r))throw new Error("Expected non-blocking prompt acceptance");return r}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!qU(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 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=_p(t.lastEventId),r=!1,s=!1,i=()=>{s||(s=!0,this.subscriptionActive=!1)},o=()=>{if(!r){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,r=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async l=>(s||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:r=!0,...s}=t,i=s.lastEventId??(r?this.lastSeenEventId:void 0);for await(let o of this.client.subscribeEvents(this.sessionId,{...s,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,_p(o.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var s;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(s=t.data)==null?void 0:s.promptId;if(!n)return;let r=this._pendingPrompts.get(n);if(r){this._pendingPrompts.delete(n);try{let i=G_(t,n);i!==void 0&&r.resolve(i)}catch(i){r.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function _p(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function qU(e){return e instanceof ju&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var fN="mid_turn_message_injected",K_="pending_prompt_added",Y_="pending_prompt_started",X_="pending_prompt_completed",HU=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated","artifact_changed",fN,K_,Y_,X_,"client_evicted","slow_client_warning","stream_error","state_resync_required","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(HU);var VU=["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"],Hy=["plan","default","auto-edit","auto","yolo"],Dw="daemon-plan";function wt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ce(e,t){if(!wt(e))return;let n=e[t];return typeof n=="string"?n:void 0}function In(e,t){if(wt(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function bc(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 cl(e){return bc(Ya(e))}function Ya(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Ya(n,t+1)):wt(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,mN(n)?"[redacted]":Ya(r,t+1)])):e}function mN(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 F2(e){if(typeof e=="string")return e;if(!wt(e))return"";let t=e.text;return typeof t=="string"?t:""}function WU(e){if(typeof e=="string")return{kind:"text",text:e};if(!wt(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=wt(e.source)?e.source:void 0,r,s;return n&&(r=typeof n.url=="string"?n.url:void 0,s=typeof n.data=="string"?n.data:void 0),!r&&!s&&(s=typeof e.data=="string"?e.data:void 0,r=typeof e.url=="string"?e.url:void 0),!r&&!s?void 0:{kind:"image",mediaType:(typeof e.mediaType=="string"?e.mediaType:void 0)??(typeof e.mimeType=="string"?e.mimeType:void 0)??(typeof e.media_type=="string"?e.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...r?{url:r}:{},...s?{data:s}:{}}}}if(t==="audio"){let n=wt(e.source)?e.source:void 0;if(!n)return;let r=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",s=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!s&&!i?void 0:{kind:"audio",mediaType:r,source:{...s?{url:s}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let r=typeof e.mediaType=="string"?e.mediaType:void 0,s=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...r?{mediaType:r}:{},...s?{description:s}:{}}}}var GU=64;function C1(e,t=0){if(t>GU)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>C1(r,t+1)).filter(Boolean).join(`
`);if(!wt(e))return e===void 0?"":bc(e);for(let r of["text","output","stdout","stderr","rawOutput"]){let s=e[r];if(typeof s=="string")return s}let n=e.content;if(n!==void 0){let r=C1(n,t+1);if(r)return r}return bc(e)}var KU=new Set(VU),pN=new Set(["qwen","qwen-oauth"]),YU=new Set(["in_flight","disabled","budget_would_exceed"]),kS="malformed memory_changed payload",SS=4096;function XU(e,t={}){let n=nq(e,t);switch(e.type){case"session_update":return rq(e,n,t);case"shell_output":{let r=C1(e.data),s=Bw(e.data),i=Pw(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return dq(e,n);case"permission_resolved":case"permission_already_resolved":return hq(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:Ce(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Ce(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=CS(Ce(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:Ce(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Ce(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Ce(e.data,"reason")??"SSE client evicted (no details available)"}];case"slow_client_warning":return[{...n,type:"status",text:"SSE stream is lagging"}];case"stream_error":{let r=CS(Ce(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:Ce(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=Ce(e.data,"code"),s=Ce(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{promptId:s}:{},text:Ce(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return QU(e,n);case"session_rewound":return JU(e,n);case"session_branched":return ZU(e,n);case"prompt_cancelled":{let r=Bq(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return eq(e,n);case"mid_turn_message_injected":return tq(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let r=Ce(e.data,"command"),s=Ce(e.data,"cwd");return r?[{...n,type:"user.shell.command",command:r,...s?{cwd:s}:{}},{...n,type:"user.text.delta",text:`$ ${r}`}]:[]}case"user_shell_result":{let r=pr(e.data,"exitCode"),s=wt(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${r??"unknown"}`;return[{...n,type:"status",text:s}]}case"replay_complete":{let r=pr(e.data,"replayedCount")??0,s=pr(e.data,"lastReplayedEventId")??pr(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return yq(e,n);case"approval_mode_changed":return bq(e,n);case"memory_changed":return vq(e,n);case"agent_changed":return wq(e,n);case"tool_toggled":return xq(e,n);case"settings_changed":return _q(e,n);case"trust_change_requested":return Sq(e,n);case"workspace_initialized":return kq(e,n);case"github_setup_completed":return Tq(e,n);case"mcp_budget_warning":return Cq(e,n);case"mcp_child_refused_batch":return Aq(e,n);case"mcp_server_restarted":return Eq(e,n);case"mcp_server_restart_refused":return Mq(e,n);case"extensions_changed":return Iq(e,n);case"auth_device_flow_started":return Nq(e,n);case"auth_device_flow_throttled":return Rq(e,n);case"auth_device_flow_authorized":return Lq(e,n);case"auth_device_flow_failed":return jq(e,n);case"auth_device_flow_cancelled":return Oq(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${cl(e.data)}`}]}}function QU(e,t){let n=Ce(e.data,"reason"),r=pr(e.data,"lastDeliveredId"),s=pr(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?Vn(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function JU(e,t){let n=Ce(e.data,"promptId"),r=pr(e.data,"targetTurnIndex");if(!n||r===void 0)return Vn(e,t,"malformed session_rewound payload");let s=Ce(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function ZU(e,t){let n=Ce(e.data,"sourceSessionId"),r=Ce(e.data,"newSessionId"),s=Ce(e.data,"displayName");return!n||!r||!s?Vn(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function eq(e,t){let n=Ce(e.data,"sessionId"),r=Ce(e.data,"suggestion"),s=Ce(e.data,"promptId");return!n||!r||!s?Vn(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function tq(e,t){if(!wt(e.data))return Vn(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(r=>typeof r=="string"&&r.length>0):[];return n.length===0?Vn(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function nq(e,t){let n=gN(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Ya(e.data)}}:{}}}function gN(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(wt(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(wt(e.data)){let r=e.data._meta;if(wt(r)){let i=r.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let s=e.data.update;if(wt(s)){let i=s._meta;if(wt(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 rq(e,t,n){let r=fq(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${cl(e.data)}`}];let s=Ce(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=r.content,o=WU(i);if(o){if(o.kind==="image"){let l=o.source.data,c=o.mediaType||"image/*";if(c==="image/*"&&l){let u=(l.startsWith("data:")?l.split(",")[1]??"":l).slice(0,10);u.startsWith("iVBORw0KGg")?c="image/png":u.startsWith("/9j/")?c="image/jpeg":u.startsWith("R0lGOD")?c="image/gif":u.startsWith("UklGR")&&(c="image/webp")}return l?[{...t,type:"user.image.delta",data:l,mimeType:c}]:[]}return o.kind==="text"?o.text?[{...t,type:"user.text.delta",text:o.text}]:[]:[]}let a=F2(i);return a?[{...t,type:"user.text.delta",text:a}]:[]}case"agent_message_chunk":{let i=F2(r.content),o=TS(r),a=sq(r),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=iq(r);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=F2(r.content);if(!i)return[];let o=TS(r);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[oq(r,t)];case"shell_output":case"tool_output":{let i=C1(r),o=Bw(r)??Bw(e.data),a=Pw(r)??Pw(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(r.availableCommands)?r.availableCommands:[]).filter(wt);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[aq(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${cl(r)}`}]}}function TS(e){let t=wt(e._meta)?e._meta:void 0;return t?Ce(t,"parentToolCallId"):void 0}function sq(e){let t=wt(e._meta)?e._meta:void 0;return t?{...t}:void 0}function iq(e){let t=wt(e._meta)?e._meta:void 0,n=t&&wt(t.usage)?t.usage:void 0;if(!n)return;let r=pr(n,"inputTokens"),s=pr(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=pr(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function oq(e,t){let n=wt(e._meta)?e._meta:void 0,r=Ce(e,"toolName")??Ce(e,"name")??(n?Ce(n,"toolName"):void 0)??(n?Ce(n,"name"):void 0),s=Ce(e,"kind"),i=Ce(e,"title")??r??s,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?Ya(o):void 0,c=a!==void 0?Ya(a):void 0,u=e.content!==void 0?Ya(e.content):void 0,d=e.locations!==void 0?Ya(e.locations):void 0,f=Ce(e,"toolCallId"),m=Ce(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:p,serverId:y}=uq(e,r),w=Ce(e,"parentToolCallId")??(n?Ce(n,"parentToolCallId"):void 0),b=w&&w!==f?w:void 0,v=Ce(e,"subagentType")??(n?Ce(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:f,...m?{status:m}:{},...i?{title:i}:{},...r?{toolName:r}:{},...s?{toolKind:s}:{},...u!==void 0?{content:u}:{},...d!==void 0?{locations:d}:{},...p?{provenance:p}:{},...y?{serverId:y}:{},...b?{parentToolCallId:b}:{},...v?{subagentType:v}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:Ow(cl(l))}:c!==void 0?{details:Ow(cl(c))}:{}}}function aq(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=Ow(lq(n)),s=t.eventId!==void 0?`${Dw}-${t.eventId}`:Dw,i=wt(e._meta)?e._meta:void 0,o=i&&wt(i.stats)?i.stats:void 0;return{...t,type:"tool.update",toolCallId:s,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:r}}],rawOutput:o?{entries:n,stats:o}:{entries:n}}}function lq(e){return e.flatMap(t=>{if(!wt(t))return[];let n=Ce(t,"content");return n?[`- [${cq(Ce(t,"status"))}] ${n}`]:[]}).join(`
`)}function cq(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function uq(e,t){let n=Ce(e,"provenance"),r=Ce(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&r?{serverId:r}:{}};if(t&&t.startsWith("mcp__")){let s=t.slice(5),i=s.indexOf("__");if(i>0)return{provenance:"mcp",serverId:s.slice(0,i)}}return{}}function CS(e){if(e)return KU.has(e)?e:void 0}function Ow(e){return e.length<=SS?e:`${e.slice(0,SS)}... [truncated]`}function dq(e,t){if(!wt(e.data))return[{...t,type:"debug",text:`permission_request: ${cl(e.data)}`}];let n=Ce(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${cl(e.data)}`}];let r=e.data.toolCall!==void 0?Ya(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:Ce(e.data,"sessionId"),title:gq(r),options:mq(e.data.options),toolCall:r}]}function hq(e,t){let n=Ce(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${cl(e.data)}`}];let r=Ce(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:pq(e.data),...r?{voterClientId:r}:{}}]}function fq(e){if(!wt(e))return;let t=e.update;return wt(t)?t:e}function mq(e){return Array.isArray(e)?e.flatMap(t=>{if(!wt(t))return[];let n=Ce(t,"optionId");return n?[{optionId:n,label:Ce(t,"label")??Ce(t,"title")??Ce(t,"name")??n,...Ce(t,"description")?{description:Ce(t,"description")}:{},raw:t}]:[]}):[]}function pq(e){if(!wt(e))return bc(e);let t=e.outcome;if(typeof t=="string")return t;if(wt(t)){let n=Ce(t,"outcome")??"selected",r=Ce(t,"optionId");return r?`${n}:${r}`:n}return In(e,["status","reason"])??bc(e)}function gq(e){return wt(e)?Ce(e,"title")??Ce(e,"name")??Ce(e,"kind")??Ce(e,"toolName")??"Tool permission":"Tool permission"}function Bw(e){let t=Ce(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function Pw(e){if(!wt(e))return;let t=Ce(e,"source");if(t)return t;let n=e._meta;return wt(n)?Ce(n,"source"):void 0}function Vn(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function yq(e,t){let n=Ce(e.data,"sessionId");if(!n)return Vn(e,t,"missing sessionId");let r=Ce(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function bq(e,t){let n=Ce(e.data,"sessionId"),r=Ce(e.data,"previous"),s=Ce(e.data,"next");if(!n||!r||!s)return Vn(e,t,"missing sessionId / previous / next");let i=wt(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:r,next:s,persisted:i}]}function vq(e,t){var o;let n=Ce(e.data,"scope");if(n==="managed"){let a=Ce(e.data,"source"),l=Ce(e.data,"taskId"),c=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(c))||c.some(u=>u!=="user"&&u!=="project")?Vn(e,t,kS):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:c}]}let r=Ce(e.data,"filePath"),s=Ce(e.data,"mode"),i=pr(wt(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?Vn(e,t,kS):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function wq(e,t){let n=Ce(e.data,"change"),r=Ce(e.data,"name"),s=Ce(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?Vn(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function xq(e,t){let n=Ce(e.data,"toolName"),r=wt(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?Vn(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function _q(e,t){let n=Ce(e.data,"key"),r=Ce(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:wt(e.data)?e.data.value:void 0}]:Vn(e,t,"malformed settings_changed payload")}function kq(e,t){let n=Ce(e.data,"path"),r=Ce(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?Vn(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function Sq(e,t){let n=Ce(e.data,"workspaceCwd"),r=Ce(e.data,"desiredState"),s=Ce(e.data,"reason");return!n||r!=="trusted"&&r!=="untrusted"?Vn(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:r,...s!==void 0?{reason:s}:{}}]}function Tq(e,t){let n=Ce(e.data,"releaseTag"),r=Ce(e.data,"readmeUrl");if(!n||!r||!wt(e.data))return Vn(e,t,"malformed github_setup_completed payload");let s=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:r,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(s)?s:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function Cq(e,t){if(!wt(e.data))return Vn(e,t,"non-object payload");let n=pr(e.data,"liveCount"),r=pr(e.data,"reservedCount"),s=pr(e.data,"budget"),i=pr(e.data,"thresholdRatio"),o=Ce(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Vn(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:o}]}function Aq(e,t){if(!wt(e.data))return Vn(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(wt).map(o=>{let a=Ce(o,"name"),l=Ce(o,"transport"),c=Ce(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],r=pr(e.data,"budget"),s=pr(e.data,"liveCount"),i=pr(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?Vn(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function Eq(e,t){let n=Ce(e.data,"serverName"),r=pr(e.data,"durationMs");return!n||r===void 0?Vn(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function Mq(e,t){let n=Ce(e.data,"serverName"),r=Ce(e.data,"reason");return!n||!r||!YU.has(r)?Vn(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function Iq(e,t){let n=pr(e.data,"refreshed"),r=pr(e.data,"failed"),s=Ce(e.data,"status"),i=Ce(e.data,"source"),o=Ce(e.data,"name"),a=Ce(e.data,"version"),l=Ce(e.data,"error");return n===void 0||r===void 0||s!==void 0&&s!=="installed"&&s!=="enabled"&&s!=="disabled"&&s!=="updated"&&s!=="uninstalled"&&s!=="failed"?Vn(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:r,...s?{status:s}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...l?{error:l}:{}}]}function Nq(e,t){let n=Ce(e.data,"deviceFlowId"),r=Ce(e.data,"providerId"),s=pr(e.data,"expiresAt");return!n||!r||!pN.has(r)||s===void 0?Vn(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function Rq(e,t){let n=Ce(e.data,"deviceFlowId"),r=pr(e.data,"intervalMs");return!n||r===void 0?Vn(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function Lq(e,t){let n=Ce(e.data,"deviceFlowId"),r=Ce(e.data,"providerId");if(!n||!r||!pN.has(r))return Vn(e,t,"malformed auth_device_flow_authorized payload");let s=pr(e.data,"expiresAt"),i=Ce(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function jq(e,t){let n=Ce(e.data,"deviceFlowId"),r=Ce(e.data,"errorKind");if(!n||!Dq(r))return Vn(e,t,"malformed auth_device_flow_failed payload");let s=Ce(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function Dq(e){return typeof e=="string"&&e.trim().length>0}function Oq(e,t){let n=Ce(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Vn(e,t,"malformed auth_device_flow_cancelled payload")}function pr(e,t){if(!wt(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Bq(e,t){if(!wt(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Pq=8;function A1(e,t={},n=0){if(n>Pq){let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(wt(e)){let p=e.rawInput??e.input??e.args;if(p!==void 0&&p!==e){let y=A1(p,{title:t.title??In(e,["title"]),toolName:t.toolName??In(e,["toolName","name"]),toolKind:t.toolKind??In(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let r=qq(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=Uq(e,t);if(s)return s;let i=Gq(e,t);if(i)return i;let o=Kq(e,t);if(o)return o;let a=Yq(e,t);if(a)return a;let l=$q(e,t);if(l)return l;let c=zq(e,t);if(c)return c;let u=Fq(e);if(u)return u;let d=Xq(e,t);if(d)return d;let f=Qq(e);if(f)return f;if(wt(e)){let p=In(e,["command","cmd"]);if(p){let w=In(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...w?{cwd:w}:{}}}let y=Vq(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 $q(e,t={}){if(!wt(e))return;let n=In(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=In(e,["oldText","old_text","old_str","oldString"]),s=In(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!r,a=s===void 0&&o?In(e,["content"]):void 0,l=s??a,c=In(e,["patch","diff","unified_diff"]);if(!(!r&&!l&&!c))return{kind:"file_diff",path:n,...r?{oldText:r}:{},...l?{newText:l}:{},...c?{patch:c}:{}}}function zq(e,t){if(!wt(e))return;let n=In(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??In(e,["toolName","name"]),s=r!==void 0&&/read|view|cat/i.test(r),i=e.lineRange??e.line_range??e.range,o;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")o=[i[0],i[1]];else{let a=e.offset,l=e.limit;typeof a=="number"&&typeof l=="number"&&l>0&&(o=[a+1,a+l])}if(!(!s&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function Fq(e){if(!wt(e))return;let t=In(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=In(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Uq(e,t){let n=t.toolName??(wt(e)?In(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let r=n.slice(5),s=r.indexOf("__");if(s<=0)return;let i=r.slice(0,s),o=r.slice(s+2),a;if(wt(e)){let l=e.arguments??e.args??e;if(wt(l)){let c=Object.entries(l).filter(([u])=>u!=="name"&&u!=="toolName").slice(0,1).map(([u,d])=>{let f=typeof d=="string"?d:JSON.stringify(d),m=f.length>60?`${f.slice(0,60)}…`:f;return`${u}=${m}`})[0];c&&(a=c)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function qq(e){return!wt(e)||!Array.isArray(e.questions)?[]:e.questions.filter(wt).map(t=>{let n=In(t,["header","title","label"]),r=In(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(wt).map(Hq):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function Hq(e){let t=In(e,["label","title","value"])??"Option",n=In(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function Vq(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[r,s]of n){let i=In(e,s);i&&t.push({label:r,value:i})}if(t.length>0)return t;for(let[r,s]of Object.entries(e).slice(0,4))s==null||Array.isArray(s)||wt(s)||t.push({label:r,value:mN(r)?"[redacted]":cl(s)});return t}var AS=50,Wq=5;function Gq(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!wt(e))return;let r=In(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=In(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=In(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function Kq(e,t){if(!wt(e))return;let n=In(e,["query","pattern","search","q"]);if(!n)return;let r=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(r)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let s=typeof e.resultCount=="number"?e.resultCount:typeof e.total=="number"?e.total:Array.isArray(e.results)?e.results.length:Array.isArray(e.matches)?e.matches.length:void 0,i,o=e.results??e.matches;return Array.isArray(o)&&(i=o.slice(0,Wq).map(a=>typeof a=="string"?a:wt(a)?In(a,["path","file","name","title","text"])??bc(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...s!==void 0?{resultCount:s}:{},...i?{top:i}:{}}}function Yq(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!wt(e))return;let r=In(e,["prompt","description","query"]);if(!r)return;let s=In(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=In(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function Xq(e,t){if(!wt(e))return;let n=In(e,["code","snippet","source"]);if(!n)return;let r=In(e,["language","lang","codeLanguage","syntax"]),s=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(s);if(!r&&!i)return;let o=In(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...o?{origin:o}:{}}}function Qq(e){if(!wt(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let s=t.filter(o=>typeof o=="string").slice(0,30);if(s.length===0)return;let i=n.slice(0,AS).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:bc(a).slice(0,80)):[]);return{kind:"tabular",columns:s,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let r=e.data??e.records;if(Array.isArray(r)&&r.length>0&&wt(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,AS).map(o=>{let a=o;return s.map(l=>{let c=a[l];return typeof c=="string"?c:bc(c).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var Jq=1e3,ku="__trimmed_tool_block__",Vy="__trimmed_permission_block__",$w=1e5,ES=`
[truncated]
`,Zq=16;function eH(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??Jq}}var Q_=new Set(["pending","confirming","running","in_progress"]),tH=new Set(["completed","success","failed","error","canceled","cancelled"]),nH=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function rH(e,t,n={}){let r=wN(e,n);t5(r);let s=n5(r,"user",t);return n.images&&n.images.length>0&&(s.images=[...n.images]),wa(r,s),r.activeUserBlockId=s.id,xN(r)}function sH(e,t,n={}){if(t.length===0)return e;let r=wN(e,n);for(let i of t)iH(r,i);let s=xN(r);return Object.freeze(s.blocks),s}function J_(e){let t={};return e.forEach((n,r)=>{t[n.id]=r}),t}function iH(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!nH.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),U2(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let r=wo(e,e.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:t.data,mimeType:t.mimeType}])}else{let r=n5(e,"user","");r.images=[{data:t.data,mimeType:t.mimeType}],wa(e,r),e.activeUserBlockId=r.id}break}case"assistant.text.delta":U2(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":t5(e,t),(t.reason==="cancelled"||t.reason==="error")&&zw(e);break;case"assistant.usage":lH(e,t);break;case"thought.text.delta":U2(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":vN(e,t);break;case"shell.output":dH(e,t);break;case"user.shell.output":hH(e,t);break;case"permission.request":fH(e,t);break;case"permission.resolved":mH(e,t);break;case"model.changed":h0(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":h0(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":oH(e,t);break;case"prompt.cancelled":zw(e),t.reason!=="forward_failed"&&pH(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":yH(e,t.targetTurnIndex);break;case"session.branched":h0(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function oH(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},zw(e),h0(e,"error",`State resync required: ${aH(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function aH(e,t){let n=e+1,r=t-1;return r<n?"no events lost (resync requested without gap)":r===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${r}`}function Wy(e,t,n){let r=wo(e,t);((r==null?void 0:r.kind)==="assistant"||(r==null?void 0:r.kind)==="thought")&&(r.streaming=!1,r.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(r.eventId=n.eventId),r.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(r.serverTimestamp=n.serverTimestamp))}function yN(e,t){Wy(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function lH(e,t){let n=wo(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let r=n.usage;n.usage={inputTokens:((r==null?void 0:r.inputTokens)??0)+t.usage.inputTokens,outputTokens:((r==null?void 0:r.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((r==null?void 0:r.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function bN(e,t){Wy(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function Z_(e,t,n){Wy(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function e5(e,t,n){Wy(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function U2(e,t,n,r,s){let i=t!=="user"&&"parentToolCallId"in s?s.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,a=o&&i!=null?o[i]:e[n],l=wo(e,a);if(l&&l.kind===t&&cH(l,s)){l.text=s5(l.text,r),l.updatedAt=e.now,s.eventId!==void 0&&(l.eventId=s.eventId),s.serverTimestamp!==void 0&&(l.serverTimestamp=s.serverTimestamp),"meta"in s&&s.meta&&(l.meta={...l.meta,...s.meta}),(t==="assistant"||t==="thought")&&(l.streaming=!0);return}let c=n5(e,t,r,s.eventId,s.serverTimestamp,"meta"in s?s.meta:void 0);(t==="assistant"||t==="thought")&&(c.streaming=!0),t==="thought"&&(c.collapsed=!0),i!=null&&(c.parentToolCallId=i),wa(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&e5(e,i),t==="thought"&&Z_(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&yN(e),t!=="thought"&&bN(e))}function cH(e,t){var n,r;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0?!1:!("meta"in t)||((r=t.meta)==null?void 0:r.qwenDiscreteMessage)!==!0}function t5(e,t){yN(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))Z_(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))e5(e,n,t);bN(e,t)}function vN(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===ku){if(gH(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],vN(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,h0(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let r=wo(e,n);if((r==null?void 0:r.kind)==="tool"){if(t.title!==void 0&&(r.title=t.title),t.status!==void 0&&(r.status=t.status),t.rawInput!==void 0&&(r.preview=A1(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId),t.details&&(r.details=t.details),t.content!==void 0&&(r.content=t.content),t.locations!==void 0&&(r.locations=t.locations),t.rawInput!==void 0&&(r.rawInput=t.rawInput),t.rawOutput!==void 0&&(r.rawOutput=t.rawOutput),t.toolName&&(r.toolName=t.toolName),t.toolKind&&(r.toolKind=t.toolKind),t.parentToolCallId&&!r.parentToolCallId&&(r.parentToolCallId=t.parentToolCallId),r.parentToolCallId&&!r.parentBlockId){let o=e.toolBlockByCallId[r.parentToolCallId];o&&o!==ku&&(r.parentBlockId=o)}t.subagentType&&!r.subagentType&&(r.subagentType=t.subagentType),MS(e,t.toolCallId,t.status);return}let s=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==ku?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:Nc(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:A1(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}:{},...s?{parentBlockId:s}:{}};wa(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=wo(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}MS(e,t.toolCallId,t.status??"pending"),Ku(e,t.parentToolCallId)}function MS(e,t,n){if(n!==void 0){if(Q_.has(n)){e.currentToolCallId=t;return}if(tH.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=uH(e));return}}}function uH(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"&&Q_.has(n.status))return n.toolCallId}}function zw(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===ku)continue;let n=wo(e,t);!n||n.kind!=="tool"||Q_.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function dH(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 s=wo(e,n.id);(s==null?void 0:s.kind)==="shell"&&(s.text=s5(s.text,t.text),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId));return}let r={id:Nc(e,"shell"),kind:"shell",text:Em(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}:{}};wa(e,r),Ku(e)}function hH(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=wo(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=s5(o.text,t.text),o.updatedAt=e.now,t.eventId!==void 0&&(o.eventId=t.eventId));return}let r=e.pendingUserShellCommand,s=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:Nc(e,"user-shell"),kind:"user_shell",text:Em(t.text),command:(r==null?void 0:r.command)??(s==null?void 0:s.command)??"",...r!=null&&r.cwd||s!=null&&s.cwd?{cwd:(r==null?void 0:r.cwd)??(s==null?void 0:s.cwd)}:{},clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};e.pendingUserShellCommand=void 0,wa(e,i),Ku(e)}function fH(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===Vy)return;let r=wo(e,n),s=A1(t.toolCall,{title:t.title});if((r==null?void 0:r.kind)==="permission"){r.title=t.title,r.options=t.options.map(o=>({...o})),r.toolCall=t.toolCall,r.preview=s,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let i={id:Nc(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:s,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCall!==void 0?{toolCall:t.toolCall}:{}};wa(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,Ku(e)}function mH(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===Vy)return;let r=wo(e,n);if((r==null?void 0:r.kind)==="permission"){r.resolved=t.outcome,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let s={id:Nc(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}:{}};wa(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,Ku(e)}function h0(e,t,n,r,s={}){let i={id:Nc(e,t),kind:t,text:Em(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(r==null?void 0:r.eventId)!==void 0?{eventId:r.eventId}:{},...(r==null?void 0:r.serverTimestamp)!==void 0?{serverTimestamp:r.serverTimestamp}:{},...(r==null?void 0:r.type)==="error"&&r.code?{code:r.code}:{},...(r==null?void 0:r.type)==="error"&&r.promptId?{promptId:r.promptId}:{},...(r==null?void 0:r.type)==="error"&&r.source?{source:r.source}:{},...((r==null?void 0:r.type)==="status"||(r==null?void 0:r.type)==="debug")&&r.source?{source:r.source}:{},...((r==null?void 0:r.type)==="status"||(r==null?void 0:r.type)==="debug")&&r.data!==void 0?{data:r.data}:{},...(r==null?void 0:r.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:r.sourceSessionId,newSessionId:r.newSessionId,displayName:r.displayName}}:{}};wa(e,i),s.clearActiveText!==!1&&Ku(e)}function pH(e,t){let n={id:Nc(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}:{}};wa(e,n),Ku(e)}function n5(e,t,n,r,s,i){return{id:Nc(e,t),kind:t,text:Em(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...i?{meta:{...i}}:{}}}function wN(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,r])=>[n,{...r}])),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion}}function xN(e){if(e.blocks.length<=e.maxBlocks)return e;let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(r=>r.id));e.blocks=t,e.blockIndexById=J_(t),E1.set(e,e.blocks);for(let[r,s]of Object.entries(e.toolBlockByCallId))n.has(s)||(e.toolBlockByCallId[r]=ku);wH(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==ku&&delete e.trimmedToolNotificationByCallId[r];for(let[r,s]of Object.entries(e.permissionBlockByRequestId))n.has(s)||(e.permissionBlockByRequestId[r]=Vy);xH(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let s=wo(e,r.id);(s==null?void 0:s.kind)==="tool"&&(s.parentBlockId=void 0)}n.has(e.activeUserBlockId??"")||(e.activeUserBlockId=void 0),n.has(e.activeAssistantBlockId??"")||(e.activeAssistantBlockId=void 0),n.has(e.activeThoughtBlockId??"")||(e.activeThoughtBlockId=void 0);for(let[r,s]of Object.entries(e.activeAssistantBlockByParent))n.has(s)||delete e.activeAssistantBlockByParent[r];for(let[r,s]of Object.entries(e.activeThoughtBlockByParent))n.has(s)||delete e.activeThoughtBlockByParent[r];return e}function gH(e){return e.toolCallId===Dw||e.toolKind==="updated_plan"}var E1=new WeakMap;function r5(e){E1.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},E1.set(e,e.blocks))}function yH(e,t){var s;let n=0,r=-1;for(let i=0;i<e.blocks.length;i+=1)if(((s=e.blocks[i])==null?void 0:s.kind)==="user"){if(r=i,n===t){IS(e,i);return}n+=1}r>=0&&t>=n&&IS(e,r)}function IS(e,t){r5(e),e.blocks=e.blocks.slice(0,t),E1.set(e,e.blocks),bH(e)}function bH(e){e.blockIndexById=J_(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 wa(e,t){r5(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function wo(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let r=e.blocks[n];if(!r||r.id!==t)return;let s=vH(r);return r5(e),e.blocks[n]=s,s}function vH(e){return e.kind==="permission"?{...e,options:e.options.map(t=>na(t)),toolCall:na(e.toolCall),preview:na(e.preview)}:e.kind==="tool"?{...e,preview:na(e.preview),content:na(e.content),locations:na(e.locations),rawInput:na(e.rawInput),rawOutput:na(e.rawOutput)}:{...e}}function Nc(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function Ku(e,t){t?(Z_(e,t),e5(e,t)):(t5(e),e.activeUserBlockId=void 0)}function s5(e,t){return e.length>=$w?e:Em(e+t)}function Em(e){if(e.length<=$w)return e;let t=Math.max(0,$w-ES.length);return`${e.slice(0,t)}${ES}`}function wH(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===ku).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.toolBlockByCallId[s],delete e.trimmedToolNotificationByCallId[s]}function xH(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===Vy).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function na(e,t=0){return t>Zq?e:Array.isArray(e)?e.map(n=>na(n,t+1)):wt(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,na(r,t+1)])):e}function _H(e={}){let t=NS(e),n=new Set,r=!1,s=()=>{for(let o of n)try{o()}catch(a){kH(a)}},i=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,s()}))};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=sH(t,a),i())},appendLocalUserMessage(o,a){t=rH(t,o,{images:a}),i()},reset(o={}){t=NS({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 kH(e){var r;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(r=globalThis.console)==null?void 0:r.error;typeof n=="function"&&n.call(globalThis.console,e)}function NS(e){let t=e.blocks?[...e.blocks]:[];return{...eH({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:J_(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 SH="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function RS(e,t){var n;if(!e)return{models:[]};const r=new Set,s=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let 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 u=[l.authType,c.modelId,c.baseUrl??"",c.envKey??""].join("\0");r.has(u)||(r.add(u),s.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:s,currentModel:i,currentMode:o,contextWindow:a}}function TH(e){var t;const n=Ns((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=zr(n,"currentModelId")??zr(n,"currentModel"),s=n.availableModels,i=[];let o;if(Array.isArray(s))for(const a of s){const l=Ns(a),c=zr(l,"modelId")??zr(l,"id")??zr(l,"value");if(!c)continue;const u=Ns(l==null?void 0:l._meta),d=zf(u,"contextLimit")??zf(u,"contextWindow")??zf(l,"contextLimit")??zf(l,"contextWindow");o===void 0&&r!==void 0&&c===r&&(o=d),i.push({id:c,baseModelId:zr(l,"baseModelId")??NH(c),label:zr(l,"name")??zr(l,"label")??c,...d!==void 0?{contextWindow:d}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:o}}function _N(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(r=>{var s;return{name:r.name,description:r.description||"",...(s=r.input)!=null&&s.hint?{argumentHint:r.input.hint}:{},...TN(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:kN(t,n),skills:e.availableSkills}}function CH(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(r=>r.status==="ok");return{commands:t.map(r=>({name:r.name,description:r.description||"",...r.argumentHint?{argumentHint:r.argumentHint}:{},raw:{name:r.name,description:r.description||"",input:r.argumentHint?{hint:r.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(r=>r.name)}}function kN(...e){const t=new Map;for(const n of e)for(const r of n){const s=t.get(r.name);s?t.set(r.name,{...s,...r,description:r.description||s.description,argumentHint:r.argumentHint??s.argumentHint,raw:r.raw}):t.set(r.name,r)}return[...t.values()]}function AH(e,t){var n;if(e.type==="session_update"){const r=Ns((n=Ns(e.data))==null?void 0:n.update),s=SN(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:i5(s)})),zr(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=IH(r);t(a=>({...a,commands:i.length>0?i:a.commands,skills:o}))}return}switch(e.type){case"session_metadata_updated":{const r=Ns(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:zr(r,"displayName")}));break}case"model_switched":{const r=zr(Ns(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=Ns(e.data),s=zr(r,"next")??zr(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function LS(e){const t=zr(e,"displayName");return t!=null&&t.trim()?t:void 0}function EH(e){var t;const n=Ns((t=e==null?void 0:e.state)==null?void 0:t.modes);return zr(n,"currentModeId")??zr(n,"currentMode")}function i5(e){const t=(e==null?void 0:e.inputTokens)??(e==null?void 0:e.totalTokens);if(t!==void 0&&t>0)return t;if(!e)return;const n=Object.values(e).reduce((r,s)=>r+(typeof s=="number"?s:0),0);return n>0?n:void 0}function MH(e){var t;for(let n=e.length-1;n>=0;n--)try{const r=e[n];if(r.type!=="session_update")continue;const s=Ns((t=Ns(r.data))==null?void 0:t.update),i=SN(s);if(i)return i}catch{}}function SN(e){const t=Ns(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=Ns(t==null?void 0:t.usage),r={...vf(n,"inputTokens"),...vf(n,"outputTokens"),...vf(n,"totalTokens"),...vf(n,"thoughtTokens"),...vf(n,"cachedReadTokens")};return i5(r)!==void 0?r:void 0}function vf(e,t){const n=zf(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function IH(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=Ns(i),l=zr(a,"name");if(!l)return[];const c=Ns(a==null?void 0:a.input),u={name:l,description:zr(a,"description")??"",input:c?{hint:zr(c,"hint")??""}:null,_meta:Ns(a==null?void 0:a._meta)??null};return[{name:l,description:u.description??"",...(o=u.input)!=null&&o.hint?{argumentHint:u.input.hint}:{},...TN(u._meta),raw:u}]}),r=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],s=r.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:kN(n,s),skills:r}}function TN(e){const n=zr(e??void 0,"source");return{...n?{source:n}:{}}}function Ns(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function zr(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function zf(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function NH(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 jS(e,t=[]){const n=[{type:"text",text:e}];for(const r of t){const s=r.mimeType??r.mediaType??r.media_type;s&&s!=="image/*"?n.push({type:"image",data:r.data,mimeType:s}):n.push({type:"image",data:r.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const RH=3e4;function LH(e,t,n){const r=Number.isFinite(t)&&t>0?t:1e3,s=Number.isFinite(n)&&n>0?Math.max(r,n):r,i=r*2**Math.max(0,e-1),o=Math.min(i,s),a=.8+Math.random()*.4;return Math.min(s,Math.max(1,Math.round(o*a)))}async function nt(e,t,n=RH){let r;try{return await Promise.race([e,new Promise((s,i)=>{r=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{r!==void 0&&clearTimeout(r)}}function jH(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const r=setTimeout(s,e);function s(){clearTimeout(r),t.removeEventListener("abort",s),n()}t.addEventListener("abort",s,{once:!0})})}function Or(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function DH(e,t,n="replay",r=80,s){Or(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),s==null||s())},r)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const OH="qwen-code-webui-client-id:session:";function q2(e,t){if(e)return e;if(typeof window>"u")return H2();try{if(t){const n=window.sessionStorage.getItem(CN(t));if(n)return n}return H2()}catch{return H2()}}function Ng(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(CN(t),e)}catch{}}async function DS(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${BH(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,r=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(r.status===204||r.status===404))throw new Error(`Detach client failed (${r.status})`)}function H2(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function CN(e){return`${OH}${encodeURIComponent(e)}`}function BH(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 PH(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.commands,delete n.skills,delete n.supportedCommands,delete n.context),{...n,status:"connected",loadingTranscript:void 0,catchingUp:void 0,error:void 0}}function $H({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:l,passiveAssistantDoneTimerRef:c,getCreateSessionRequest:u,createDetachedSession:d,getConnection:f,hasSessionActivePrompt:m,resetCurrentSessionActivePrompt:p,addNotice:y,setConnection:w,setPromptStatus:b,setRestoreSessionId:v,setRestoreMode:x,setRestoreSessionNonce:S,setAttachSessionNonce:C,setNewSessionNonce:E}){function M(){for(const[,A]of n.current)A.controller.abort();n.current.clear(),r.current.clear(),b("idle"),Or(c),s.current&&(l.current===s.current.sessionId&&(l.current=void 0),clearTimeout(s.current.timeout),s.current.reject(new DOMException("Session cleared","AbortError")),s.current=void 0),e.reset(),v(void 0)}function D(A,j){const I=i.current+1;return i.current=I,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${j} superseded by a newer request`,"AbortError"))),new Promise((F,q)=>{const R=setTimeout(()=>{var V;((V=s.current)==null?void 0:V.id)===I&&(s.current=void 0,q(On(y,`${HH(j)} session failed`,new Error(`Session ${j} timed out`),VH(j))))},3e4);s.current={id:I,sessionId:A,mode:j,timeout:R,resolve:F,reject:q}})}function O(A,j){var I;a.current=!1;const P=D(A,j),F=t.current,q=F==null?void 0:F.sessionId,R=q?n.current.get(q):void 0;return(I=R==null?void 0:R.reject)==null||I.call(R,new DOMException("Session switch interrupted prompt wait","AbortError")),q&&n.current.delete(q),p(),F&&F.detach().catch(V=>{console.warn("[DaemonSessionActions] detach before session switch failed:",V)}),t.current=void 0,w(V=>({...V,status:"connecting",sessionId:A,clientId:void 0,displayName:void 0,error:void 0,loadingTranscript:!0,catchingUp:void 0})),b("idle"),r.current.clear(),Or(c),e.reset(),x(j),v(A),S(V=>V+1),P.catch(V=>{throw Ff(V)||w(J=>({...J,loadingTranscript:void 0,catchingUp:void 0})),V})}return{async sendPrompt(A,j){var I,P,F;const q=rr(y,t.current,"Prompt failed","send_prompt"),R=q.sessionId;if(n.current.has(R))throw On(y,"Prompt failed","A prompt is already in progress","send_prompt");Or(c),b("waiting");const V=new AbortController;n.current.set(R,{controller:V});try{const J=((j==null?void 0:j.images)??[]).map(G=>({data:G.data,mimeType:G.mimeType||G.mediaType||G.media_type||"image/*"}));(j==null?void 0:j.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(A,J);const ee={prompt:jS(A,J)};j!=null&&j.retry&&(ee.retry=!0);const N=await q.submitPrompt(ee,V.signal);return await zH(n.current,r.current,R,V,N.promptId)}catch(J){if(Ff(J))return((I=t.current)==null?void 0:I.sessionId)===R&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw hN(J)?J:(((P=t.current)==null?void 0:P.sessionId)===R&&e.dispatch({type:"assistant.done",reason:"error"}),On(y,"Prompt failed",J,"send_prompt"))}finally{const J=n.current.get(R);(J==null?void 0:J.controller)===V&&n.current.delete(R),((F=t.current)==null?void 0:F.sessionId)===R&&!m()&&b("idle")}},async submitPrompt(A,j){var I;const P=rr(y,t.current,"Prompt failed","send_prompt");if(j!=null&&j.sessionId&&P.sessionId!==j.sessionId)throw new Error("Session changed before prompt submission");const F=((j==null?void 0:j.images)??[]).map(V=>({data:V.data,mimeType:V.mimeType||V.mediaType||V.media_type||"image/*"}));(j==null?void 0:j.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(A,F);const q={prompt:jS(A,F)};j!=null&&j.retry&&(q.retry=!0);const R=await P.submitPrompt(q);if((I=j==null?void 0:j.signal)!=null&&I.aborted)throw await P.removePendingPrompt(R.promptId).catch(V=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",V),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:V instanceof Error?V.message:String(V),recoverable:!0})}),j.signal.reason??new DOMException("Aborted","AbortError");return{promptId:R.promptId}},async cancel(){var A,j;const I=rr(y,t.current,"Cancel failed","cancel_prompt"),P=n.current.get(I.sessionId);P==null||P.controller.abort(),Or(c);const F=P?new AbortController:void 0;F&&n.current.set(I.sessionId,{controller:F});try{await nt(I.cancel(),"Cancel timed out")}catch(q){throw On(y,"Cancel failed",q,"cancel_prompt")}finally{F&&((A=n.current.get(I.sessionId))==null?void 0:A.controller)===F&&n.current.delete(I.sessionId),((j=t.current)==null?void 0:j.sessionId)===I.sessionId&&!m()&&b("idle")}},async setModel(A){const j=rr(y,t.current,"Set model failed","switch_model");try{const I=await nt(j.setModel(A),"Set model timed out");return w(P=>({...P,currentModel:A})),I}catch(I){throw On(y,"Set model failed",I,"switch_model")}},async setApprovalMode(A,j){const I=rr(y,t.current,"Set approval mode failed","set_approval_mode");try{const P=await nt(I.client.setSessionApprovalMode(I.sessionId,A,{persist:j==null?void 0:j.persist,clientId:I.clientId}),"Set approval mode timed out");return w(F=>({...F,currentMode:P.mode||A})),P}catch(P){throw On(y,"Set approval mode failed",P,"set_approval_mode")}},async respondToPermission(A,j){const I=rr(y,t.current,"Permission response failed","submit_permission");try{return await nt(I.respondToSessionPermission(A,j),"Permission response timed out")}catch(P){throw On(y,"Permission response failed",P,"submit_permission")}},async submitPermission(A,j,I){const P=rr(y,t.current,"Permission response failed","submit_permission"),F=j!==void 0&&j.length>0?{outcome:{outcome:"selected",optionId:j},...I?{answers:I}:{}}:{outcome:{outcome:"cancelled"},...I?{answers:I}:{}};try{return await nt(P.respondToSessionPermission(A,F),"Permission response timed out")}catch(q){throw On(y,"Permission response failed",q,"submit_permission")}},async heartbeat(){const A=t.current;if(!(!A||!o.current))return nt(A.heartbeat(),"Heartbeat timed out")},async listSessions(A){const j=t.current;if(!j)return[];try{return await nt(j.client.listWorkspaceSessions(j.workspaceCwd,A),"List sessions timed out")}catch(I){throw On(y,"List sessions failed",I,"list_sessions")}},async loadSession(A){return O(A,"load")},async resumeSession(A){return O(A,"resume")},async createSession(){try{a.current=!1;const A=t.current,j=A&&f().sessionId===A.sessionId?A:void 0;if(j){const P=await nt(j.client.createOrAttachSession(u()),"Create session timed out");return Ng(P.clientId,P.sessionId),P}const I=await nt(d(),"Create session timed out");if(a.current){try{await nt(I.detach(),"Detach cleared session timed out")}catch(P){console.warn("[DaemonSessionActions] detach after interrupted create failed:",P)}throw new DOMException("Session creation interrupted","AbortError")}return Ng(I.clientId,I.sessionId),t.current=I,l.current=I.sessionId,w(P=>({...P,status:"connected",sessionId:I.sessionId,...I.clientId?{clientId:I.clientId}:{},workspaceCwd:I.workspaceCwd,error:void 0})),I}catch(A){throw On(y,"Create session failed",A,"create_session")}},async attachSession(){const A=rr(y,t.current,"Attach session failed","attach_session"),j=D(A.sessionId,"attach");return C(I=>I+1),j},async clearSession(){const A=t.current;if(a.current=!0,M(),t.current=void 0,w(j=>PH(j,A==null?void 0:A.sessionId)),A)try{await nt(A.detach(),"Clear session timed out")}catch(j){console.warn("[DaemonSessionActions] detach on clear failed:",j)}},async newSession(){a.current=!1,M(),E(A=>A+1)},async releaseSession(A){try{const j=rr(y,t.current,"Release session failed","release_session");await nt(j.client.closeSession(A),"Release session timed out")}catch(j){throw On(y,"Release session failed",j,"release_session")}},async closeSession(){const A=rr(y,t.current,"Close session failed","close_session");try{await nt(A.close(),"Close session timed out")}catch(j){throw On(y,"Close session failed",j,"close_session")}},async refreshCommands(){const A=rr(y,t.current,"Refresh commands failed","refresh_commands");try{const j=await nt(A.supportedCommands(),"Refresh commands timed out"),{commands:I,skills:P}=_N(j);w(F=>({...F,commands:I,skills:P,supportedCommands:j}))}catch(j){throw On(y,"Refresh commands failed",j,"refresh_commands")}},async getContext(){const A=rr(y,t.current,"Load context failed","load_context");try{const j=await nt(A.context(),"Load context timed out");return w(I=>({...I,context:j,currentMode:FH(j)??I.currentMode,currentModel:UH(j)??I.currentModel})),j}catch(j){throw On(y,"Load context failed",j,"load_context")}},async getContextUsage(A){const j=rr(y,t.current,"Load context usage failed","load_context_usage");try{return await nt(j.contextUsage(A),"Load context usage timed out")}catch(I){throw On(y,"Load context usage failed",I,"load_context_usage")}},async renameSession(A){const j=rr(y,t.current,"Rename session failed","rename_session");try{return await nt(j.updateMetadata({displayName:A}),"Rename session timed out")}catch(I){throw On(y,"Rename session failed",I,"rename_session")}},async recapSession(){const A=rr(y,t.current,"Recap session failed","recap_session");try{return await nt(A.recap(),"Recap session timed out")}catch(j){throw On(y,"Recap session failed",j,"recap_session")}},async getRewindSnapshots(){const A=rr(y,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await nt(A.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(j){throw On(y,"Load rewind snapshots failed",j,"rewind_snapshots")}},async rewindSession(A,j){const I=rr(y,t.current,"Rewind session failed","rewind_session");try{return await nt(I.rewind(A,j),"Rewind session timed out")}catch(P){throw On(y,"Rewind session failed",P,"rewind_session")}},async btwSession(A,j){var I;const P=rr(y,t.current,"Side question failed","btw_session");try{return await nt(P.btw(A,j),"Side question timed out")}catch(F){throw(I=j==null?void 0:j.signal)!=null&&I.aborted||Ff(F)?F:On(y,"Side question failed",F,"btw_session")}},async enqueueMidTurnMessage(A,j){const I=t.current;if(!I)return{accepted:!1};try{return await I.enqueueMidTurnMessage(A,j)}catch(P){return P instanceof DOMException&&P.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",P),{accepted:!1}}},async getPendingPrompts(A){const j=t.current;if(!j)return{pendingPrompts:[]};if(A!=null&&A.sessionId&&j.sessionId!==A.sessionId)throw new Error("Session changed before pending prompts refresh");return await j.getPendingPrompts()},async removePendingPrompt(A,j){const I=t.current;return I?j!=null&&j.sessionId&&I.sessionId!==j.sessionId?await I.client.removePendingPrompt(j.sessionId,A):await I.removePendingPrompt(A):{removed:!1}},async sendShellCommand(A){var j,I;const P=rr(y,t.current,"Shell command failed","send_shell_command"),F=`${P.sessionId}:shell`;b("waiting");const q=new AbortController;n.current.set(F,{controller:q});try{return await P.shellCommand(A,q.signal)}catch(R){throw On(y,"Shell command failed",R,"send_shell_command")}finally{((j=n.current.get(F))==null?void 0:j.controller)===q&&n.current.delete(F),((I=t.current)==null?void 0:I.sessionId)===P.sessionId&&!m()&&b("idle")}},async getTasks(){const A=rr(y,t.current,"Get tasks failed","load_tasks");try{return await nt(A.tasks(),"Get tasks timed out")}catch(j){throw On(y,"Get tasks failed",j,"load_tasks")}},async cancelTask(A,j){const I=rr(y,t.current,"Cancel task failed","cancel_task");try{return await nt(I.cancelTask(A,j),"Cancel task timed out")}catch(P){throw On(y,"Cancel task failed",P,"cancel_task")}},async clearGoal(){const A=rr(y,t.current,"Clear goal failed","clear_goal");try{return await nt(A.clearGoal(),"Clear goal timed out")}catch(j){throw On(y,"Clear goal failed",j,"clear_goal")}},async getStats(){const A=rr(y,t.current,"Load stats failed","load_stats");try{return await nt(A.stats(),"Load stats timed out")}catch(j){throw On(y,"Load stats failed",j,"load_stats")}},async respondToGlobalPermission(A,j){const I=rr(y,t.current,"Global permission response failed","submit_permission");try{return await nt(I.client.respondToPermission(A,j),"Global permission response timed out")}catch(P){throw On(y,"Global permission response failed",P,"submit_permission")}},async branchSession(A){const j=rr(y,t.current,"Branch session failed","branch_session");try{const I=await nt(j.client.branchSession(j.sessionId,{name:A},j.clientId),"Branch session timed out");return Ng(I.clientId,I.sessionId),O(I.sessionId,"load").catch(P=>{Ff(P)||On(y,"Branch session failed",P,"branch_session")}),{sessionId:I.sessionId,displayName:I.displayName}}catch(I){throw On(y,"Branch session failed",I,"branch_session")}},async forkSession(A){const j=rr(y,t.current,"Fork session failed","fork_session");try{return await nt(j.fork(A),"Fork session timed out")}catch(I){throw On(y,"Fork session failed",I,"fork_session")}}}}function zH(e,t,n,r,s){return new Promise((i,o)=>{const a=Fw(n,s),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)!==r){o(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==s){o(new Error(`Prompt accepted with unexpected id ${s}`));return}if(r.signal.aborted){e.delete(n),o(r.signal.reason??new DOMException("Aborted","AbortError"));return}const u=()=>{r.signal.removeEventListener("abort",d)},d=()=>{const f=e.get(n);(f==null?void 0:f.controller)===r&&e.delete(n),u(),o(r.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:s,resolve:f=>{u(),i(f)},reject:f=>{u(),o(f)}}),r.signal.addEventListener("abort",d,{once:!0})})}function Fw(e,t){return JSON.stringify([e,t])}function FH(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 UH(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 rr(e,t,n,r){if(!t)throw On(e,n,"Daemon session is not connected",r);return t}function On(e,t,n,r){if(Ff(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",o=new Error(i);return o.name="AbortError",o}const s=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:r,code:`daemon.${r}.failed`,message:`${t}: ${s}`,debugMessage:s,recoverable:!0}),qH(n instanceof Error?n:new Error(s))}function Ff(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function qH(e){return Object.assign(e,{_alreadyDispatched:!0})}function HH(e){return e.charAt(0).toUpperCase()+e.slice(1)}function VH(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const WH=33e4;function GH({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(s){const i=Ht(e,"List sessions failed"),o=t();return o?nt(i.listWorkspaceSessions(o,s),"List sessions timed out"):[]},async deleteSession(s){const i=Ht(e,"Delete session failed"),o=await nt(i.deleteSessionsData([s]),"Delete session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.removed.length>0||o.notFound.length>0},async deleteSessions(s){const i=Ht(e,"Delete sessions failed");return nt(i.deleteSessionsData(s),"Delete sessions timed out")},async loadMcpStatus(){const s=Ht(e,"Load MCP status failed");return nt(s.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(s){const i=Ht(e,"Load MCP tools failed");try{return await nt(i.workspaceMcpTools(s),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(s){const i=Ht(e,"Load MCP resources failed");try{return await nt(i.workspaceMcpResources(s),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(s){const i=Ht(e,"Restart MCP server failed");return nt(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const o=Ht(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return nt(o.manageMcpServer(s,i),"Manage MCP server timed out",a)},async loadSkillsStatus(){const s=Ht(e,"Load skills failed");return nt(s.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const s=Ht(e,"Load extensions failed");return nt(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=Ht(e,"Load tools failed");return nt(s.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(s,i){const o=Ht(e,"Set tool enabled failed");return nt(o.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=Ht(e,"Load settings failed");return nt(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,o){const a=Ht(e,"Set setting failed");return nt(a.setWorkspaceSetting(s,i,o),"Set setting timed out")},async loadMemoryStatus(){const s=Ht(e,"Load memory failed");return nt(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=Ht(e,"Read workspace file failed");return nt(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=Ht(e,"Write memory failed");return nt(i.writeWorkspaceMemory(s),"Write memory timed out")},async listAgents(){const s=Ht(e,"List agents failed");return nt(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s){const i=Ht(e,"Get agent failed");return nt(i.getWorkspaceAgent(s),"Get agent timed out")},async createAgent(s){const i=Ht(e,"Create agent failed");return nt(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=Ht(e,"Generate agent failed");return nt(i.generateWorkspaceAgent(s),"Generate agent timed out",WH)},async deleteAgent(s,i){const o=Ht(e,"Delete agent failed");return nt(o.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){Ht(e,"Glob workspace failed");const o=W2(n,"/glob");o.searchParams.set("pattern",s),(i==null?void 0:i.maxResults)!==void 0&&o.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&o.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&o.searchParams.set("cwd",i.cwd);const a=await nt(fetch(G2(o,n),{headers:V2(r)}),"Glob workspace timed out");if(!a.ok)throw new Error(await K2(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const s=Ht(e,"Load providers failed");return nt(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const o=Ht(e,"Read file bytes failed");return nt(o.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=Ht(e,"Write file failed");return nt(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=Ht(e,"Edit file failed");return nt(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){Ht(e,"Stat file failed");const i=W2(n,"/stat");i.searchParams.set("path",s);const o=await nt(fetch(G2(i,n),{headers:V2(r)}),"Stat file timed out");if(!o.ok)throw new Error(await K2(o,"GET /stat"));return await o.json()},async listDirectory(s){Ht(e,"List directory failed");const i=W2(n,"/list");i.searchParams.set("path",s);const o=await nt(fetch(G2(i,n),{headers:V2(r)}),"List directory timed out");if(!o.ok)throw new Error(await K2(o,"GET /list"));return await o.json()},async loadEnv(){const s=Ht(e,"Load env failed");return nt(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=Ht(e,"Load preflight failed");return nt(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=Ht(e,"Init workspace failed");return nt(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,o){const a=Ht(e,"Update agent failed");return nt(a.updateWorkspaceAgent(s,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(s,i){const o=Ht(e,"Install extension failed");return nt(o.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=Ht(e,"Load extension operation failed");return nt(i.extensionOperationStatus(s),"Load extension operation timed out")},async checkExtensionUpdates(s){const i=Ht(e,"Check extension updates failed");return nt(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=Ht(e,"Refresh extensions failed");return nt(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,o){const a=Ht(e,"Enable extension failed");return nt(a.enableExtension(s,i,o),"Enable extension timed out")},async disableExtension(s,i,o){const a=Ht(e,"Disable extension failed");return nt(a.disableExtension(s,i,o),"Disable extension timed out")},async updateExtension(s,i){const o=Ht(e,"Update extension failed");return nt(o.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const o=Ht(e,"Uninstall extension failed");return nt(o.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=Ht(e,"Start device flow failed");return nt(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const o=Ht(e,"Get device flow failed");return nt(o.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=Ht(e,"Cancel device flow failed");return nt(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=Ht(e,"Get auth status failed");return nt(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=Ht(e,"Get auth providers failed");return nt(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=Ht(e,"Install auth provider failed");return nt(i.installAuthProvider(s),"Install auth provider timed out")}}}function Ht(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function V2(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function W2(e,t){const n=AN(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function G2(e,t){return AN(t)?e.toString():`${e.pathname}${e.search}`}function AN(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 K2(e,t){try{const n=await e.json(),r=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return r?`${t}: ${r}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const o5=g.createContext(void 0);let wf;function KH({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const o=g.useMemo(()=>r?new jw({baseUrl:e,token:t,transport:s}):void 0,[r,e,t,s]),a=g.useRef(o);a.current=o;const l=g.useRef(void 0),c=g.useRef(void 0),u=g.useRef(n),[d,f]=g.useState(void 0),[m,p]=g.useState(r?"connecting":"idle"),[y,w]=g.useState(void 0),b=g.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 S=o.capabilities().catch(C=>{throw c.current===S&&(c.current=void 0),C});c.current=S}return c.current},[o]);g.useEffect(()=>{if(!o)return;p("connecting"),w(void 0),f(void 0),wf===o&&(wf=void 0);let S=!1;return b().then(C=>{S||(f(C),p("connected"))}).catch(C=>{S||(w(C instanceof Error?C:new Error(String(C))),p("error"))}),()=>{S=!0,wf=o,queueMicrotask(()=>{wf===o&&(wf=void 0,o.dispose())})}},[o,b]),u.current=(d==null?void 0:d.workspaceCwd)??n;const v=g.useMemo(()=>GH({getClient:()=>a.current,getWorkspaceCwd:()=>u.current,baseUrl:e,token:t}),[e,t]),x=g.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(d==null?void 0:d.workspaceCwd)??n,status:m,error:y,capabilities:d,getCapabilities:b,actions:v}},[o,t,e,n,m,y,d,b,v]);return h.jsx(o5.Provider,{value:x,children:i})}function a5(){const e=g.useContext(o5);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function Rc(){return a5().actions}function EN(){return g.useContext(o5)}function YH(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&OS(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&OS(t)||(t==null?void 0:t.kind)==="tool"&&BS(t))return"responding";for(let n=e.length-1;n>=0;n--){const r=e[n];if(r.kind==="user")break;if(r.kind==="tool"&&BS(r))return"responding"}return"idle"}function XH(e,t){const n=YH(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function OS(e){return e.streaming===!0}function BS(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Uw=new Set;let M1;function PS(){return M1}function QH(e){return Uw.add(e),()=>{Uw.delete(e)}}function JH(e){M1={...e},MN()}function kp(){M1!==void 0&&(M1=void 0,MN())}function MN(){for(const e of Uw)e()}function ZH(e){if(!e||typeof e!="object")return;const t=e;if(t.type!=="followup_suggestion")return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.suggestion,o=r.promptId;if(!(typeof s!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:s,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qw=new Set,IN=Object.freeze([]),Y2=64;let Ql=IN;function $S(){return Ql}function eV(e){return qw.add(e),()=>{qw.delete(e)}}function tV(e){const t=[...Ql,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>Y2){const n=t.length-Y2;console.debug(`[mid-turn] sidechannel buffer over ${Y2}; evicting ${n} oldest batch(es)`),Ql=t.slice(n)}else Ql=t;NN()}function nV(e){if(e.length===0||Ql.length===0)return;const t=new Set(e),n=Ql.filter(r=>!t.has(r));n.length!==Ql.length&&(Ql=n.length===0?IN:n,NN())}function NN(){for(const e of qw)e()}function rV(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==fN)return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.messages;if(typeof s!="string"||!Array.isArray(i))return;const o=i.filter(l=>typeof l=="string"&&l.length>0);if(o.length===0)return;const a=t.originatorClientId;return{sessionId:s,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Hw=new Set,Vw=new Set;let RN=0,Xd=[];function sV(){return RN}function zS(){return Xd}function iV(e){return Hw.add(e),()=>{Hw.delete(e)}}function oV(e){return Vw.add(e),()=>{Vw.delete(e)}}function aV(){RN++;for(const e of Hw)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function LN(){for(const e of Vw)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function lV(e){if(e.length===0)return;const t=new Set(e),n=Xd.filter(r=>!t.has(r));n.length!==Xd.length&&(Xd=n,LN())}function cV(e){const t=jN(e);return t?(Xd=[...Xd,t].slice(-200),LN(),(t.type===K_||t.type===Y_||t.type===X_)&&aV(),!0):!1}function uV(e){return jN(e)!==void 0}function jN(e){if(!e||typeof e!="object")return;const t=e,n=t.type,r=t.data;if(!r||typeof r!="object")return;const s=r;if(typeof s.sessionId=="string"&&((n===K_||n===Y_||n===X_)&&typeof s.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof s.promptId=="string"))return e}function jl(e,t){const n=gN(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const DN=g.createContext(void 0),ON=g.createContext(void 0),l5=g.createContext(void 0),BN=g.createContext(void 0),PN=g.createContext(void 0),$N=g.createContext(void 0),dV=new Set([401,403,404,410]),hV=2e5,fV={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},mV=new Set([401,403]),pV=Symbol("unhandled session");function gV(e){const{baseUrl:t,token:n,workspaceCwd:r,sessionId:s,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:l=hV,suppressOwnUserEcho:c=!0,includeRawEvent:u=!1,autoConnect:d=!0,autoReconnect:f=!0,reconnectDelayMs:m=1e3,maxReconnectDelayMs:p=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:w=3,loadWarnings:b,children:v}=e,x=EN(),S=t??(x==null?void 0:x.baseUrl),C=n??(x==null?void 0:x.token),E=r??(x==null?void 0:x.workspaceCwd),M=g.useRef(x==null?void 0:x.client);M.current=x==null?void 0:x.client;const D=g.useRef(x==null?void 0:x.capabilities);D.current=x==null?void 0:x.capabilities;const O=g.useRef(x==null?void 0:x.getCapabilities);O.current=x==null?void 0:x.getCapabilities;const j=g.useRef(s).current,I=j===void 0,P=g.useRef(E);P.current=E;const F=g.useRef(E);E&&(F.current=E);const q=g.useMemo(()=>_H({maxBlocks:l}),[l]),R=g.useRef(void 0),V=g.useRef(void 0),J=g.useRef(new Map),ee=g.useRef(new Map),N=g.useRef(void 0),G=g.useRef(0),B=g.useRef(void 0),k=g.useRef(!1),Q=g.useRef(!1),ce=g.useRef(void 0),pe=g.useRef(new WeakSet),be=g.useRef({suppressOwnUserEcho:c,includeRawEvent:u}),ye=g.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),ie=g.useRef(b),re=g.useRef(void 0);(!re.current||i)&&(re.current=q2(i)),be.current={suppressOwnUserEcho:c,includeRawEvent:u},ye.current={reconnectDelayMs:m,maxReconnectDelayMs:p},ie.current=b;const oe=o==null?void 0:o.modelServiceId,ve=o==null?void 0:o.sessionScope,qe=g.useRef(o);qe.current=o;const[We,te]=g.useState("idle"),[we,Se]=g.useState(j),[Ne,Pt]=g.useState("load"),[at,vt]=g.useState(0),[Tt,rt]=g.useState(0),[tt,Qe]=g.useState(0),[ne,se]=g.useState({status:d?"connecting":"idle",...j?{sessionId:j}:{}}),De=g.useRef(ne);De.current=ne;const lt=g.useRef(0),[ae,ze]=g.useState([]),Je=g.useCallback(Ze=>{const Kt={...Ze,id:Ze.id??`daemon-notice-${Date.now()}-${++lt.current}`,createdAt:Ze.createdAt??Date.now()};return ze(Wn=>[...Wn.slice(-49),Kt]),Kt},[]),Nt=g.useCallback(Ze=>{ze(Kt=>Kt.filter(Wn=>Wn.id!==Ze))},[]),Ut=g.useCallback(()=>{ze([])},[]),he=g.useMemo(()=>({notices:ae,dismissNotice:Nt,clearNotices:Ut}),[Ut,Nt,ae]),[Y,me]=g.useState(fV),le=g.useRef(()=>!1),Ke=g.useRef(!1);g.useEffect(()=>(Ke.current=!0,()=>{Ke.current=!1}),[]),g.useEffect(()=>{if(!d)return;if(!M.current&&!S){se({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Ze=new AbortController;let Kt=!1;return(async()=>{var yn,Sn,Ie,bt,Qt,Wr,ni,Gi,Po,Gn,kr;const Gr=M.current??new jw({baseUrl:S,token:C});let An,$o,Cs=we,So=!we&&tt>0,xe=0,Be=()=>!1,Dt=!1;for(;!Kt&&!Ze.signal.aborted;){try{let on=!1,nr=!1,Kr=!1,Yr=!1,fn,sn;if(!An){const fe=R.current;fe&&!we&&!Cs&&!So&&(An=fe,Cs=fe.sessionId,V.current=fe.sessionId,Yr=!0)}if(!An){se(ar=>({...ar,status:"connecting",error:void 0}));const fe=O.current,et=D.current??(fe?await fe():await Gr.capabilities());if(Kt||Ze.signal.aborted)return;$o=et,k.current=Array.isArray(et.features)&&et.features.includes("client_heartbeat");const pt=P.current??et.workspaceCwd;if(F.current=pt,(I||Q.current)&&!we&&!Cs&&!So){const[ar,xn]=await Promise.allSettled([Gr.workspaceProviders(),Gr.workspaceSkills()]);ar.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",ar.reason),xn.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",xn.reason);const Yn=ar.status==="fulfilled"?ar.value:void 0,Xi=RS(Yn),{commands:Qi,skills:$c}=CH(xn.status==="fulfilled"?xn.value:void 0);se(zc=>({...zc,status:"connected",workspaceCwd:pt,models:Xi.models,currentModel:Xi.currentModel,currentMode:Xi.currentMode,contextWindow:Xi.contextWindow,providers:Yn,capabilities:et,...Qi.length>0?{commands:Qi}:{},...$c.length>0?{skills:$c}:{}}));return}const Rt=we&&Ne==="resume"?bf.resume:bf.load,Mt=we??Cs,cn=i?re.current:q2(void 0,Mt);Mt&&se(ar=>({...ar,sessionId:Mt,error:void 0,loadingTranscript:!0}));const tn=we?await Rt(Gr,we,{workspaceCwd:pt},cn):Cs?await bf.load(Gr,Cs,{workspaceCwd:pt},cn):await bf.createOrAttach(Gr,{...oe!==void 0?{modelServiceId:oe}:{},...So?{sessionScope:"thread"}:ve!==void 0?{sessionScope:ve}:{},workspaceCwd:pt},cn);if(!i&&tn.clientId&&(re.current=tn.clientId,Ng(tn.clientId,tn.sessionId)),Kt||Ze.signal.aborted){DS({baseUrl:S,token:C,sessionId:tn.sessionId,clientId:tn.clientId}).catch(ar=>console.warn("[DaemonSessionProvider] detach failed:",ar));return}const vr=V.current;vr!==tn.sessionId&&Ut(),vr!==void 0&&tn.sessionId!==vr?(te("idle"),Or(B),Kr=!0):vr!==void 0&&(tn.replaySnapshot.compactedReplay.length+tn.replaySnapshot.liveJournal.length>0?(te("idle"),Or(B),Kr=!0):(q.dispatch({type:"assistant.done",reason:"reconnected"}),q.getSnapshot().awaitingResync&&q.clearAwaitingResync())),on=vr!==void 0&&vr===tn.sessionId,nr=tn.replaySnapshot.compactedReplay.length>0||tn.replaySnapshot.liveJournal.length>0;const $s=[...tn.replaySnapshot.compactedReplay,...tn.replaySnapshot.liveJournal];fn=MH($s),sn=i5(fn),An=tn,Cs=An.sessionId,So=!1,V.current=An.sessionId,R.current=An}const mt=An,Aa=pe.current.has(mt);let br=mt.hasActivePrompt===!0&&!Aa;const or=()=>{pe.current.add(mt),br=!1},os=()=>br||J.current.has(mt.sessionId);Be=os,le.current=os,te(os()?"streaming":"idle");const zo=N.current,xl=(zo==null?void 0:zo.sessionId)===mt.sessionId?zo:void 0,{compactedReplay:ef,liveJournal:td}=mt.replaySnapshot,Kn=[...ef,...td],ri=nr&&Kn.length>0;if(Kr&&!ri&&q.reset(),ri){const fe={...be.current,suppressOwnUserEcho:!1},et=[];for(const pt of Kn)try{const Rt=US(pt,mt.clientId,fe,se,{updateConnection:!1});if(et.push(...qS(pt,Rt,Je)),pt.type==="turn_complete"){const Mt=((yn=pt.data)==null?void 0:yn.stopReason)??"end_turn";et.push(jl(pt,Mt))}else pt.type==="turn_error"&&et.push(jl(pt,"error"))}catch(Rt){const Mt=Rt instanceof Error?Rt.message:String(Rt);Je({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Mt,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",Rt)}Kr&&q.reset(),et.length>0&&(q.dispatch(et),VS(et,me));for(const pt of Kn)FS(J.current,ee.current,mt.sessionId,pt,q,te,B,{requireBoundPromptId:!0});se(pt=>({...pt,catchingUp:void 0}))}se(fe=>({...fe,status:"connected",sessionId:mt.sessionId,...mt.clientId?{clientId:mt.clientId}:{},workspaceCwd:mt.workspaceCwd,displayName:LS(mt.state)??(fe.sessionId===mt.sessionId?fe.displayName:void 0),tokenUsage:fn!==void 0?fn:fe.sessionId===mt.sessionId?fe.tokenUsage:void 0,tokenCount:sn!==void 0?sn:fe.sessionId===mt.sessionId?fe.tokenCount??0:0,loadingTranscript:void 0,catchingUp:ri?fe.catchingUp:on||mt.lastEventId!=null||void 0})),xl&&(N.current=void 0,clearTimeout(xl.timeout),ce.current===mt.sessionId&&(ce.current=void 0),xl.resolve());const Pc=Yr&&De.current.commands!==void 0&&De.current.skills!==void 0&&De.current.supportedCommands!==void 0&&De.current.context!==void 0,[X,de,Re]=Pc?[void 0,void 0,void 0]:await Promise.allSettled([Gr.workspaceProviders(),mt.supportedCommands(),mt.context()]),st=(X==null?void 0:X.status)==="fulfilled"?X.value:void 0,en=(de==null?void 0:de.status)==="fulfilled"?de.value:void 0,jt=(Re==null?void 0:Re.status)==="fulfilled"?Re.value:void 0,mn=[(X==null?void 0:X.status)==="rejected"?(Sn=ie.current)==null?void 0:Sn.models:void 0,(de==null?void 0:de.status)==="rejected"?(Ie=ie.current)==null?void 0:Ie.commands:void 0,(Re==null?void 0:Re.status)==="rejected"?(bt=ie.current)==null?void 0:bt.context:void 0].filter(fe=>!!fe),En=RS(st),Pn=TH(jt),Tn=Pn&&Pn.models.length>0?Pn.models:En.models,As=(Pn==null?void 0:Pn.currentModel)??En.currentModel,Fo=As===En.currentModel?En.contextWindow:(Qt=En.models.find(fe=>fe.id===As))==null?void 0:Qt.contextWindow,as=(Pn==null?void 0:Pn.contextWindow)??((Wr=Tn.find(fe=>fe.id===As))==null?void 0:Wr.contextWindow)??Fo,{commands:si,skills:Ki}=_N(en),tf=EH(jt)??En.currentMode;se(fe=>fe.sessionId!==mt.sessionId?fe:{...fe,status:"connected",sessionId:mt.sessionId,...mt.clientId?{clientId:mt.clientId}:{},workspaceCwd:mt.workspaceCwd,commands:si.length>0?si:fe.commands,skills:Ki.length>0?Ki:fe.skills,models:Tn.length>0?Tn:fe.models,currentModel:As??fe.currentModel,currentMode:tf??fe.currentMode,displayName:LS(mt.state)??fe.displayName,contextWindow:as??fe.contextWindow,providers:st??fe.providers,supportedCommands:en??fe.supportedCommands,context:jt??fe.context,capabilities:$o??fe.capabilities,loadingTranscript:void 0,catchingUp:ri?fe.catchingUp:on||mt.lastEventId!=null||void 0}),mn.length>0&&q.dispatch(mn.map(fe=>({type:"status",text:fe})));let Uo=!1,Yi=!1;const Te=()=>{const fe=J.current.get(mt.sessionId);fe==null||fe.controller.abort(),J.current.delete(mt.sessionId),br&&or(),Or(B),te("idle"),q.reset(),mt.setLastEventId(0),Cs=mt.sessionId,Yi=!0,An=void 0,R.current=void 0,le.current=()=>!1,se(et=>({...et,status:"connecting",error:void 0}))};for await(const fe of mt.events({signal:Ze.signal,maxQueued:a})){if(((ni=R.current)==null?void 0:ni.sessionId)!==mt.sessionId)break;Uo||(Uo=!0,xe=0);try{const et=ZH(fe);if(et){JH(et);continue}const pt=rV(fe);pt&&tV(pt),uV(fe)&&(cV(fe),fe.type==="pending_prompt_started"&&(Or(B),te("waiting")));const Rt=US(fe,mt.clientId,be.current,se),Mt=qS(fe,Rt,Je);if(fe.type==="state_resync_required"&&(typeof fe.data=="object"&&fe.data!==null?fe.data.reason:void 0)==="epoch_reset"){Te();break}if(VS(Mt,me),Mt.length>0){const xn=X2(Mt);te(Yn=>Yn==="waiting"||Yn==="idle"&&xn?"streaming":Yn)}const cn=FS(J.current,ee.current,mt.sessionId,fe,q,te,B);let tn=!1;if(!cn&&br&&(fe.type==="turn_complete"||fe.type==="turn_error")){or(),tn=!0,Or(B);const xn=fe.type==="turn_complete"?((Gi=fe.data)==null?void 0:Gi.stopReason)??"end_turn":"error";q.dispatch(jl(fe,xn)),os()||te("idle")}const $s=!os()&&q.getSnapshot().activeAssistantBlockId!=null?Mt.filter(xn=>xn.type!=="debug"):Mt;q.dispatch($s);for(const xn of Mt)if(xn.type==="prompt.cancelled"&&(br||xn.originatorClientId!==mt.clientId)){q.dispatch(jl(fe,"cancelled"));const Yn=br;or(),tn=!0,Or(B),Yn||J.current.delete(mt.sessionId),os()||te("idle")}else xn.type==="session.replay_complete"&&(se(Yn=>({...Yn,catchingUp:void 0})),q.getSnapshot().awaitingResync&&q.clearAwaitingResync(),os()||(Or(B),q.dispatch({type:"assistant.done",reason:"replay_complete"}),te("idle")));const ar=!cn&&!tn&&!os();if(ar&&(Mt.some(Yn=>Yn.type==="user.text.delta")?te("waiting"):X2(Mt)&&te(Yn=>Yn==="idle"?"streaming":Yn)),ar&&fe.type==="turn_complete"){Or(B);const xn=((Po=fe.data)==null?void 0:Po.stopReason)??"end_turn";q.dispatch(jl(fe,xn)),te("idle")}else ar&&fe.type==="turn_error"?(Or(B),q.dispatch(jl(fe,"error")),te("idle")):ar&&X2(Mt)&&DH(q,B,"passive_observer",3e3,()=>te("idle"));if(fe.type==="state_resync_required"&&(typeof fe.data=="object"&&fe.data!==null?fe.data.reason:void 0)!=="epoch_reset"){os()||(te("idle"),Or(B)),q.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",mt.sessionId),Yi=!0,An=void 0,R.current=void 0,le.current=()=>!1,se(Yn=>({...Yn,status:"connecting",error:void 0}));break}if(fe.type==="session_closed"&&((Gn=fe.data)==null?void 0:Gn.reason)==="client_close"){Dt=!0;const xn=mt.sessionId,Yn=J.current.get(xn);Yn==null||Yn.controller.abort(),J.current.delete(xn),An=void 0,R.current=void 0;break}}catch(et){const pt=et instanceof Error?et.message:String(et);Je({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:pt,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",et)}}if(Dt){q.dispatch({type:"assistant.done",reason:"cancelled"}),te("idle"),Or(B),se(fe=>({...fe,status:"disconnected",sessionId:void 0,error:void 0}));return}if(Q.current){An=void 0,R.current=void 0,le.current=()=>!1;return}!Kt&&!Ze.signal.aborted&&!Yi&&(((kr=R.current)==null?void 0:kr.sessionId)===mt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),os()||(Or(B),te("idle"),q.dispatch({type:"assistant.done",reason:"stream_ended"}))),se(fe=>({...fe,status:"disconnected",error:void 0})))}catch(on){if(Kt||Ze.signal.aborted)return;const nr=on instanceof Error?on.message:String(on),Kr=An==null?void 0:An.sessionId,Yr=CV(on),fn=TV(on);if(Kr&&(Yr||fn)){const mt=J.current.get(Kr);mt==null||mt.controller.abort(),J.current.delete(Kr)}(Yr||fn||!Be())&&(Or(B),te("idle"));const sn=N.current;if(sn&&(sn.sessionId===we||sn.sessionId===Cs)&&(ce.current===sn.sessionId&&(ce.current=void 0),N.current=void 0,clearTimeout(sn.timeout),sn.reject(on)),Yr||fn){if(An=void 0,R.current=void 0,Yr){se({status:"error",error:nr});return}se(mt=>({...mt,status:"disconnected",sessionId:void 0,error:nr,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",An==null?void 0:An.sessionId);if(!f){An=void 0,R.current=void 0,se({status:"error",error:nr});return}se(mt=>({...mt,status:"disconnected",error:nr,loadingTranscript:void 0}))}if(!f){R.current=void 0,se(on=>({...on,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}xe+=1;const rn=ye.current,qt=LH(xe,rn.reconnectDelayMs,rn.maxReconnectDelayMs);se(on=>({...on,status:"disconnected",error:`Reconnecting in ${qt}ms`})),await jH(qt,Ze.signal)}})(),()=>{const yn=R.current;Kt=!0,Ze.abort(),le.current=()=>!1,te("idle"),Or(B);const Sn=(yn==null?void 0:yn.sessionId)===ce.current,Ie=!Ke.current;N.current&&(!Sn||Ie)&&(clearTimeout(N.current.timeout),N.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),N.current=void 0),(!Sn||Ie)&&(yn!=null&&yn.clientId)&&DS({baseUrl:S,token:C,sessionId:yn.sessionId,clientId:yn.clientId}).catch(bt=>console.warn("[DaemonSessionProvider] detach failed:",bt)),(!Sn||Ie)&&(R.current=void 0)}},[d,f,S,C,r,oe,ve,a,q,we,Ne,at,Tt,tt,i,I,Ut,Je]),g.useEffect(()=>{if(!k.current||ne.status!=="connected"||y<=0||w<=0||!ne.sessionId)return;let Ze=!1,Kt=0;const Wn=setInterval(()=>{const yn=R.current;yn&&yn.heartbeat().then(()=>{Ze||(Kt>=w&&se(Sn=>Sn.sessionId===yn.sessionId?{...Sn,status:"connected",error:void 0}:Sn),Kt=0)}).catch(Sn=>{if(Ze||(Kt+=1,Kt<w))return;const Ie=Sn instanceof Error?Sn.message:"Session heartbeat failed";se(bt=>bt.sessionId===yn.sessionId?{...bt,status:"disconnected",error:Ie}:bt)})},y);return()=>{Ze=!0,clearInterval(Wn)}},[ne.sessionId,ne.status,w,y]);const _t=g.useMemo(()=>$H({store:q,sessionRef:R,activePromptsRef:J,settledPromptsRef:ee,pendingSessionLoadRef:N,pendingSessionLoadIdRef:G,heartbeatSupportedRef:k,manualSessionClearRef:Q,skipNextCleanupDetachSessionIdRef:ce,passiveAssistantDoneTimerRef:B,hasSessionActivePrompt:()=>le.current(),resetCurrentSessionActivePrompt:()=>{le.current=()=>!1},getCreateSessionRequest:()=>{var Ze;return{...qe.current,sessionScope:"thread",workspaceCwd:F.current??((Ze=R.current)==null?void 0:Ze.workspaceCwd)}},createDetachedSession:()=>{var Ze;const Kt=M.current??new jw({baseUrl:S,token:C}),Wn={...qe.current,sessionScope:"thread",workspaceCwd:F.current??((Ze=R.current)==null?void 0:Ze.workspaceCwd)},yn=i?re.current:q2(void 0);return bf.createOrAttach(Kt,Wn,yn)},getConnection:()=>De.current,addNotice:Je,setConnection:se,setPromptStatus:te,setRestoreSessionId:Se,setRestoreMode:Pt,setRestoreSessionNonce:vt,setAttachSessionNonce:rt,setNewSessionNonce:Qe}),[Je,i,S,C,q]),Et=g.useRef(pV);return g.useEffect(()=>{if(Et.current===s)return;Et.current=s;const Ze=De.current.sessionId;if(s===Ze)return;const Kt=s?_t.loadSession(s):Ze?_t.clearSession():void 0;Kt&&Kt.catch(Wn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",Wn)})},[_t,s]),h.jsx(DN.Provider,{value:q,children:h.jsx(ON.Provider,{value:ne,children:h.jsx(BN.Provider,{value:We,children:h.jsx(PN.Provider,{value:he,children:h.jsx($N.Provider,{value:Y,children:h.jsx(l5.Provider,{value:_t,children:v})})})})})})}function FS(e,t,n,r,s,i,o,a={}){var l;if(r.type!=="turn_complete"&&r.type!=="turn_error")return!1;const c=(l=r.data)==null?void 0:l.promptId;if(!c)return!1;const u=e.get(n);if(!u||a.requireBoundPromptId&&u.promptId===void 0||u.promptId!==void 0&&u.promptId!==c)return!1;Or(o);try{const d=G_(r,c);if(!d)return!1;s.dispatch(jl(r,d.stopReason)),i("idle"),u.resolve?(e.delete(n),u.resolve(d)):(e.delete(n),t.set(Fw(n,c),{status:"resolved",result:d}))}catch(d){s.dispatch(jl(r,"error")),i("idle"),u.reject?(e.delete(n),u.reject(d)):(e.delete(n),t.set(Fw(n,c),{status:"rejected",error:d}))}return!0}function yV(e){return e.type==="turn_complete"}function US(e,t,n,r,s={}){s.updateConnection!==!1&&AH(e,r);const i=XU(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=_V(e);return yV(e)?o?[o]:[]:o?[...i,o]:i}function qS(e,t,n){const r=[];for(const s of t){if(s.type!=="error"){r.push(s);continue}if(e.type==="turn_error"){r.push(s);continue}const i=n(bV(e,s));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return r}function bV(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 c5(){const e=g.useContext(DN);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function Gy(){const e=c5(),t=g.useCallback(()=>e.getSnapshot().blocks,[e]);return g.useSyncExternalStore(e.subscribe,t,t)}function u5(){const e=Gy(),t=wV();return g.useMemo(()=>XH(e,t),[e,t])}function Ky(){const e=g.useContext(l5);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function vV(){return g.useContext(l5)}function Yu(){return g.useContext($N)}function wV(){const e=g.useContext(BN);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function ml(){const e=g.useContext(ON);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function xV(){const e=g.useContext(PN);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function X2(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function _V(e){if(e.type!=="session_update")return null;const t=Fa(e.data)?e.data:void 0,n=Fa(t==null?void 0:t.update)?t.update:Fa(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!Fa(r))return null;const s=kV(r.goalStatus);if(s)return HS(e,s);const i=SV(r.goalTerminal);if(i)return HS(e,i);const o=r.stopHookLoop;if(!Fa(o))return null;const a=o.goal;return!Fa(a)||!Su(a,"condition"),null}function HS(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function kV(e){if(!Fa(e))return null;const t=Su(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Su(e,"condition");if(!n)return null;const r=f0(e,"iterations"),s=f0(e,"durationMs"),i=f0(e,"setAt"),o=Su(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function SV(e){if(!Fa(e))return null;const t=Su(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Su(e,"condition");if(!n)return null;const r=f0(e,"iterations"),s=f0(e,"durationMs"),i=Su(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function Su(e,t){const n=e[t];return typeof n=="string"?n:void 0}function f0(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function VS(e,t){let n=0,r=0,s=0,i=0,o=0,a=0,l,c=0,u=0;for(const d of e)switch(d.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":r+=1;break;case"workspace.tool.toggled":s+=1;break;case"workspace.settings.changed":i+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":o+=1;break;case"workspace.extensions.changed":a+=1,l={...d.status?{status:d.status}:{},...d.source?{source:d.source}:{},...d.name?{name:d.name}:{},...d.version?{version:d.version}:{},...d.error?{error:d.error}:{},refreshed:d.refreshed,failed:d.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":u+=1;break}n+r+s+i+o+a+c+u!==0&&t(d=>({memoryVersion:d.memoryVersion+n,agentsVersion:d.agentsVersion+r,toolsVersion:d.toolsVersion+s,settingsVersion:d.settingsVersion+i,mcpVersion:d.mcpVersion+o,extensionsVersion:d.extensionsVersion+a,...l?{lastExtensionChange:l}:{},initVersion:d.initVersion+c,authVersion:d.authVersion+u}))}function TV(e){const t=zN(e);return t!==void 0&&dV.has(t)}function CV(e){const t=zN(e);return t!==void 0&&mV.has(t)}function zN(e){if(e instanceof ju||Fa(e)&&typeof e.status=="number")return e.status}function Fa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zh(e,t){const{autoLoad:n=!1,enabled:r=!0}=t,[s,i]=g.useState({data:void 0,loading:!1,error:void 0}),o=g.useRef(0),a=g.useCallback(async()=>{if(!r)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 u=c instanceof Error?c:new Error(String(c));i(d=>({...d,loading:!1,error:u}));return}},[r,e]);return g.useEffect(()=>{!n||!r||a()},[n,r,a]),{...s,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Mm(e,t,n){const r=g.useRef(!1);g.useEffect(()=>{if(!(e===void 0||!n)){if(!r.current){r.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function AV(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.listAgents(),[n]),s=zh(r,e),i=Yu();return Mm(i==null?void 0:i.agentsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,agents:((t=s.data)==null?void 0:t.agents)??[],getAgent:n.getAgent,createAgent:n.createAgent,generateAgent:n.generateAgent,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function FN(e={}){const t=Rc(),n=g.useCallback(()=>t.loadMcpStatus(),[t]),r=zh(n,e),s=Yu();return Mm(s==null?void 0:s.mcpVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.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 EV(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.loadMemoryStatus(),[n]),s=zh(r,e),i=Yu();return Mm(i==null?void 0:i.memoryVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,files:((t=s.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Yy(e={}){const{pageSize:t,...n}=e,r=a5(),s=vV(),i=g.useCallback(()=>r.actions.listSessions({pageSize:t}),[t,r.actions]),o=!!r.workspaceCwd,a=zh(i,{...n,enabled:(n.enabled??!0)&&o}),{reload:l}=a,c=g.useCallback(async d=>{const f=await r.actions.deleteSession(d);return f&&l(),f},[r.actions,l]),u=g.useCallback(async d=>{const f=await r.actions.deleteSessions(d);return(f.removed.length>0||f.notFound.length>0)&&l(),f},[r.actions,l]);return{...a,sessions:a.data??[],loadSession:s==null?void 0:s.loadSession,resumeSession:s==null?void 0:s.resumeSession,newSession:s==null?void 0:s.newSession,releaseSession:s==null?void 0:s.releaseSession,deleteSession:c,deleteSessions:u}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function UN(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.loadToolsStatus(),[n]),s=zh(r,e),i=Yu();return Mm(i==null?void 0:i.toolsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,tools:((t=s.data)==null?void 0:t.tools)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function MV(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.loadSettingsStatus(),[n]),s=zh(r,e),i=Yu();return Mm(i==null?void 0:i.settingsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,settings:((t=s.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const IV=300,NV=100,wd=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function Q2(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function RV(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=wd,o=null,a=!1,l=null;function c(w){i=w,n(w)}function u(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:w=>{if(o&&(clearTimeout(o),o=null),!w){c(wd);return}t&&(o=setTimeout(()=>{c({suggestion:w,isVisible:!0,shownAt:Date.now()})},IV))},accept:(w,b)=>{var v;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const x=i.suggestion,{shownAt:S}=i;if(!x){a=!1;return}try{(v=s())==null||v({outcome:"accepted",accept_method:w,time_ms:S>0?Date.now()-S:0,suggestion_length:x.length})}catch(C){console.error("[followup] onOutcome callback threw:",C)}c(wd),queueMicrotask(()=>{var C;try{b!=null&&b.skipOnAccept||(C=r())==null||C(x)}catch(E){console.error("[followup] onAccept callback threw:",E)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},NV)}})},dismiss:()=>{var w;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(w=s())==null||w({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(b){console.error("[followup] onOutcome callback threw:",b)}c(wd)}},clear:()=>{u(),a=!1,c(wd)},cleanup:()=>{u(),a=!1}}}function LV(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=c5(),i=ml().sessionId,[o,a]=g.useState(wd),l=g.useRef(n);l.current=n;const c=g.useRef(r);c.current=r;const u=g.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),d=g.useSyncExternalStore(QH,PS,PS),f=(d==null?void 0:d.sessionId)===i?d:u,m=g.useMemo(()=>RV({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>c.current}),[t]),{setSuggestion:p}=m;g.useEffect(()=>(t||m.clear(),()=>m.cleanup()),[m,t]);const y=g.useRef(void 0),w=g.useRef(i);g.useEffect(()=>{const S=w.current;w.current=i,S!==void 0&&i!==void 0&&S!==i&&(m.clear(),kp(),y.current=void 0)},[m,i]),g.useEffect(()=>{const S=f==null?void 0:f.promptId;S!==y.current&&(y.current=S,p((f==null?void 0:f.suggestion)??null))},[f,p]);const b=g.useCallback(()=>{m.clear(),Q2(s),kp(),y.current=void 0},[m,s]),v=g.useCallback((S,C)=>{m.accept(S,C),Q2(s),kp(),y.current=void 0},[m,s]),x=g.useCallback(()=>{m.dismiss(),Q2(s),kp(),y.current=void 0},[m,s]);return g.useMemo(()=>({followupState:o,onAcceptFollowup:v,onDismissFollowup:x,clear:b}),[o,v,x,b])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function jV(){const e=g.useSyncExternalStore(eV,$S,$S),t=g.useCallback(n=>nV(n),[]);return{batches:e,consume:t}}function DV(e){for(const t of e){if(!OV(t))continue;const n=t;if(n.resolved)continue;const r=Od(n.toolCall),s=typeof(r==null?void 0:r.toolCallId)=="string"?r.toolCallId:typeof(r==null?void 0:r.id)=="string"?r.id:void 0,i=typeof(r==null?void 0:r.kind)=="string"?r.kind:void 0,o=Od(r==null?void 0:r._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:s,title:n.title,toolKind:i,toolName:a,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(l=>({id:l.optionId,label:l.label,kind:PV(l.raw)})),rawInput:BV(n.toolCall)}}return null}function OV(e){return e.kind==="permission"}function BV(e){const t=Od(e);return t?Od(t.rawInput)??Od(t.input)??Od(t.args)??t:void 0}function Od(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function PV(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 $V(e,t,n){const r=new Array(e);return new Proxy(r,{get(s,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=s[l];if(!c){const u=t[l*2];c=s[l]={index:l,key:n(l),start:u,size:t[l*2+1],end:u+t[l*2+1],lane:0}}return c}}if(i==="length")return e}return Reflect.get(s,i,o)}})}function dd(e,t,n){let r=n.initialDeps??[],s,i=!0;function o(){const a=e();return(a.length!==r.length||a.some((c,u)=>r[u]!==c))&&(r=a,s=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(s),i=!1),s}return o.updateDeps=a=>{r=a},o}function WS(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const zV=(e,t)=>Math.abs(e-t)<1.01,FV=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let xf;const J2=()=>{if(xf!==void 0)return xf;if(typeof navigator>"u")return xf=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return xf=!0;const e=navigator.maxTouchPoints;return xf=navigator.platform==="MacIntel"&&e!==void 0&&e>0},GS=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},UV=e=>e,qV=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,s=new Array(r);for(let i=0;i<r;i++)s[i]=t+i;return s},HV=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(s(GS(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(GS(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},I1={passive:!0},VV=typeof window>"u"?!0:"onscrollend"in window,WV=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&VV;let o=0;const a=i?null:FV(s,()=>t(o,!1),e.options.isScrollingResetDelay),l=d=>()=>{o=n(r),a==null||a(),t(o,d)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,I1),i&&r.addEventListener("scrollend",u,I1),()=>{r.removeEventListener("scroll",c),i&&r.removeEventListener("scrollend",u)}},GV=(e,t)=>WV(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),KV=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),s=n.options.getItemKey(r);return n.itemSizeCache.get(s)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),s=n.options.getItemKey(r),i=n.itemSizeCache.get(s);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},YV=(e,{adjustments:t=0,behavior:n},r)=>{var s,i;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},XV=YV;class QV{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const o=()=>{const a=i.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,u]of this.elementsCache)if(u===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 s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{var r,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:UV,rangeExtractor:qV,onChange:()=>{},measureElement:KV,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,p=this.getMeasurements(),y=f>0?((r=p[0])==null?void 0:r.key)??o.getItemKey(0):null,w=f>0?((s=p[f-1])==null?void 0:s.key)??o.getItemKey(f-1):null;if(m!==f||f>0&&m>0&&(i.getItemKey(0)!==y||i.getItemKey(m-1)!==w)){c=!0;const x=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.start]);const S=i.followOnAppend===!0?"auto":i.followOnAppend||null;S&&m>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||i.getItemKey(m-1)!==w)&&(l=S)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(a&&this.scrollOffset!==null){const[f,m]=a,p=this.getMeasurements(),{count:y,getItemKey:w}=this.options;let b=0;for(;b<y&&w(b)!==f;)b++;if(b<y){const v=p[b];if(v){const x=v.start+m;x!==this.scrollOffset&&(d=x-this.scrollOffset,this.scrollOffset=x,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?a[0]:null,u?a[1]:0,l,d])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=dd(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!J2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,I1),i.addEventListener("touchend",a,I1),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 s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,o,a,l]=s;i!==null&&!a&&(J2()&&(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(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let o=r-1;o>=0;o--){const a=n[o];if(s.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&&s.set(a.lane,!0),s.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=dd(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,s,i,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=dd(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const u=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const p of this.laneAssignments.keys())p>=n&&this.laneAssignments.delete(p);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(p=>{this.itemSizeCache.set(p.key,p.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const p=this.options.gap,y=n*2;let w=this._flatMeasurements;if(!w||w.length<y){const x=new Float64Array(y);w&&d>0&&x.set(w.subarray(0,d*2)),w=x,this._flatMeasurements=w}let b;if(d===0)b=r+s;else{const x=d-1;b=w[x*2]+w[x*2+1]+p}for(let x=d;x<n;x++){const S=i(x),C=u.get(S),E=typeof C=="number"?C:this.options.estimateSize(x);w[x*2]=b,w[x*2+1]=E,b+=E+p}const v=$V(n,w,i);return this.measurementsCache=v,v}const f=this.measurementsCache.slice(0,d),m=new Array(a).fill(void 0);for(let p=0;p<d;p++){const y=f[p];y&&(m[y.lane]=p)}for(let p=d;p<n;p++){const y=i(p),w=this.laneAssignments.get(p);let b,v;const x=l==="estimate"||u.has(y);if(w!==void 0&&this.options.lanes>1){b=w;const M=m[b],D=M!==void 0?f[M]:void 0;v=D?D.end+this.options.gap:r+s}else{const M=this.options.lanes===1?f[p-1]:this.getFurthestMeasurement(f,p);v=M?M.end+this.options.gap:r+s,b=M?M.lane:p%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(p,b)}const S=u.get(y),C=typeof S=="number"?S:this.options.estimateSize(p),E=v+C;f[p]={index:p,start:v,size:C,end:E,key:y,lane:b},m[b]=p}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=dd(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?JV({measurements:n,outerSize:r,scrollOffset:s,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=dd(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,s-i),a=Math.min(this.options.count-1,s+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 r=this.indexFromElement(n),s=this.options.getItemKey(r),i=this.elementsCache.get(s);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s,i;if(n<0||n>=this.options.count)return;let o,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 u=this.itemSizeCache.get(l)??o,d=r-u;if(d!==0){const f=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=f?this.getTotalSize():0,p=((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},d,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-m):p&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=dd(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],l=r[a];s.push(l)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,i=this.options.lanes===1&&s!=null,o=qN(0,r.length-1,i?a=>s[a*2]:a=>WS(r[a]).start,n);return WS(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[o,a]=i,l=this.now();this.scrollState={index:n,align:a,behavior:s,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=this._flatMeasurements;o!=null?s=o[i*2]+o[i*2+1]:s=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(a=>a===null);){const a=r[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}s=Math.max(...i.filter(a=>a!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&n.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(J2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,i=1,o=s!==this.scrollState.lastTargetOffset;if(!o&&zV(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=s,c||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const qN=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,i=n(s);if(i<r)e=s+1;else if(i>r)t=s-1;else return s}return e>0?e-1:0};function JV({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const i=e.length-1,o=s?u=>s[u*2]:u=>e[u].start,a=s?u=>s[u*2]+s[u*2+1]:u=>e[u].end;if(e.length<=r)return{startIndex:0,endIndex:i};let l=qN(0,i,o,n),c=l;if(r===1)for(;c<i&&a(c)<n+t;)c++;else if(r>1){const u=Array(r).fill(0);for(;c<i&&u.some(f=>f<n+t);){const f=e[c];u[f.lane]=f.end,c++}const d=Array(r).fill(n+t);for(;l>=0&&d.some(f=>f>=n);){const f=e[l];d[f.lane]=f.start,l--}l=Math.max(0,l-l%r),c=Math.min(i,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}const Z2=typeof document<"u"?g.useLayoutEffect:g.useEffect;function ZV({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=g.useReducer(c=>c+1,0)[1],i=g.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 u=i.current;if(!u.enabled)return;const d=c.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const b=c.options.horizontal?"width":"height";u.container.style[b]=`${d}px`}const f=!!c.options.horizontal,m=u.mode==="transform",p=f?"left":"top",y=c.options.scrollMargin,w=c.getVirtualItems();for(const b of w){const v=b.start-y,x=c.elementsCache.get(b.key);x&&u.lastPositions.get(x)!==v&&(u.lastPositions.set(x,v),m?x.style.transform=f?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:x.style[p]=`${v}px`)}},a={...r,onChange:(c,u)=>{var d;const f=i.current;let m=!0;if(f.enabled){o(c);const p=c.range,y=f.prevRange;m=!y||y.isScrolling!==c.isScrolling||y.startIndex!==(p==null?void 0:p.startIndex)||y.endIndex!==(p==null?void 0:p.endIndex),m&&(f.prevRange=p?{startIndex:p.startIndex,endIndex:p.endIndex,isScrolling:c.isScrolling}:null)}m&&(e&&u?Ay.flushSync(s):s()),(d=r.onChange)==null||d.call(r,c,u)}},[l]=g.useState(()=>{const c=new QV(a);return Object.assign(c,{containerRef:u=>{const d=i.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const f=c.getTotalSize();d.lastSize=f;const m=c.options.horizontal?"width":"height";u.style[m]=`${f}px`}}})});return l.setOptions(a),Z2(()=>l._didMount(),[]),Z2(()=>l._willUpdate()),Z2(()=>{o(l)}),l}function eW(e){return ZV({observeElementRect:HV,observeElementOffset:GV,scrollToFn:XV,...e})}function HN(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function tW(e){var t;return((t=HN(e))==null?void 0:t.type)==="task_execution"}function Xy(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||tW(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function VN(e){var n;if(!Xy(e))return!1;const t=HN(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const WN=g.createContext({}),nW=WN.Provider;function Lc(){return g.useContext(WN)}const rW=["en","zh-CN"],d5={"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.toggleStream":"Toggle agent stream details","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","common.back":"back","common.cancel":"cancel","common.close":"close","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.navigate":"↑↓ to navigate","common.next":"next","common.previous":"previous","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!","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.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.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","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","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.project":"Project","sidebar.projectFallback":"Project","sidebar.settings":"Settings","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.delete":"Delete","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","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","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.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.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.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.output":"Output","stats.outputTokens":"Output Tokens","stats.overview":"Session Overview","stats.performance":"Performance","stats.prompt":"Prompt","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","tool.showAll":e=>`▼ Show all (${(e==null?void 0:e.count)??0} lines)`,"tool.showLess":"▲ Show less","tool.showFullLines":"▼ Show full lines","tool.linesTotal":e=>`▼ ${(e==null?void 0:e.count)??0} lines total`,"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.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`:""}`,"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","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:"},sW={...d5,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep_search":"Grep","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":"Grep","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.toggleStream":"展开/收起子智能体详情","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":"复制","common.back":"返回","common.cancel":"取消","common.close":"关闭","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.navigate":"↑↓ 导航","common.next":"下一步","common.previous":"上一步","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":"已复制！","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.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"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":"已用","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":"设置目标","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.project":"项目","sidebar.projectFallback":"项目","sidebar.settings":"设置","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.delete":"删除","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":"刚完成","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":"未知错误","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.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.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.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 Servers","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.output":"输出","stats.outputTokens":"输出 Token","stats.overview":"会话概览","stats.performance":"性能","stats.prompt":"提示","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":"执行失败","tool.showAll":e=>`▼ 显示全部（${(e==null?void 0:e.count)??0} 行）`,"tool.showLess":"▲ 显示更少","tool.showFullLines":"▼ 显示完整行","tool.linesTotal":e=>`▼ 共 ${(e==null?void 0:e.count)??0} 行`,"toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":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} 个工具`:""}`,"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":"未知模型","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":"提示："},iW={en:d5,"zh-CN":sW},oW={en:"English [en]","zh-CN":"中文 [zh-CN]"},GN=g.createContext({language:"en",t:e=>e});function dc(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function h5(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return dc(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 f5(e){return oW[e]}function KN(e){const t=iW[e];return(n,r)=>{const s=t[n]??d5[n]??n;return typeof s=="function"?s(r):s}}function aW({language:e,children:t}){const n=g.useMemo(()=>({language:e,t:KN(e)}),[e]);return h.jsx(GN.Provider,{value:n,children:t})}function ht(){return g.useContext(GN)}const KS=[];function lW(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,r)=>!Object.is(n,t[r]))}class YN extends g.Component{constructor(){super(...arguments);ue(this,"state",{error:null,resetKeys:this.props.resetKeys??KS});ue(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){const s=n.resetKeys??KS;return lW(r.resetKeys,s)?{error:null,resetKeys:s}:null}componentDidCatch(n,r){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,r.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:r}=this.props;return typeof r=="function"?r(n,this.reset):r}}const cW="_row_19m4s_1",uW="_tip_19m4s_13",dW="_chatRow_19m4s_35",hW="_chatTip_19m4s_43",fW="_chatActions_19m4s_56",mW="_copyButton_19m4s_71",Tl={row:cW,tip:uW,chatRow:dW,chatTip:hW,chatActions:fW,copyButton:mW};function Ww({timestamp:e,children:t,chatMode:n=!1,copyText:r,copyTitle:s="Copy"}){const[i,o]=g.useState(!1),a=g.useCallback(()=>{var c;r&&((c=navigator.clipboard)==null||c.writeText(r).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[r]);if(e===void 0&&!r)return h.jsx(h.Fragment,{children:t});const l=r?h.jsx("button",{type:"button",className:Tl.copyButton,title:s,"aria-label":s,onClick:a,children:i?h.jsx(gW,{}):h.jsx(pW,{})}):null;return e===void 0?h.jsxs("div",{className:n?Tl.chatRow:Tl.row,children:[t,l]}):h.jsxs("div",{className:n?Tl.chatRow:Tl.row,children:[t,n?h.jsxs("span",{className:Tl.chatActions,children:[h.jsx("span",{className:Tl.chatTip,"aria-hidden":"true",children:gh(e)}),l]}):h.jsx("span",{className:Tl.tip,"aria-hidden":"true",children:gh(e)})]})}function pW(){return h.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[h.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"}),h.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function gW(){return h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function gh(e,t=new Date){const n=new Date(e),r=o=>String(o).padStart(2,"0"),s=`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?s:`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())} ${s}`}const yW="modulepreload",bW=function(e){return"/"+e},YS={},U=function(t,n,r){let s=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"));s=Promise.allSettled(n.map(l=>{if(l=bW(l),l in YS)return;YS[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":yW,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((f,m)=>{d.addEventListener("load",f),d.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 s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},Rs={Dark:"dark",Light:"light"},XN=[Rs.Dark,Rs.Light],QN=g.createContext(Rs.Dark),vW=QN.Provider;function m5(){return g.useContext(QN)}const ou="ui.theme",m0="general.language";function p5(e,t){return e===Rs.Light||e==="Qwen Light"?Rs.Light:e===Rs.Dark||e==="Qwen Dark"?Rs.Dark:t}function wW(e){return e===Rs.Light?"Qwen Light":"Qwen Dark"}function XS(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(s,r).trim();(o||!i)&&t.push(o),s=r+1,r=n.indexOf(",",s)}return t}function JN(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const xW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_W=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kW={};function QS(e,t){return(kW.jsx?_W:xW).test(e)}const SW=/[ \t\n\f\r]/g;function Qy(e){return typeof e=="object"?e.type==="text"?JS(e.value):!1:JS(e)}function JS(e){return e.replace(SW,"")===""}class Im{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Im.prototype.normal={};Im.prototype.property={};Im.prototype.space=void 0;function ZN(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Im(n,r,t)}function q0(e){return e.toLowerCase()}class ki{constructor(t,n){this.attribute=n,this.property=t}}ki.prototype.attribute="";ki.prototype.booleanish=!1;ki.prototype.boolean=!1;ki.prototype.commaOrSpaceSeparated=!1;ki.prototype.commaSeparated=!1;ki.prototype.defined=!1;ki.prototype.mustUseProperty=!1;ki.prototype.number=!1;ki.prototype.overloadedBoolean=!1;ki.prototype.property="";ki.prototype.spaceSeparated=!1;ki.prototype.space=void 0;let TW=0;const Wt=Xu(),Br=Xu(),Gw=Xu(),Fe=Xu(),Qn=Xu(),Tu=Xu(),Ai=Xu();function Xu(){return 2**++TW}const Kw=Object.freeze(Object.defineProperty({__proto__:null,boolean:Wt,booleanish:Br,commaOrSpaceSeparated:Ai,commaSeparated:Tu,number:Fe,overloadedBoolean:Gw,spaceSeparated:Qn},Symbol.toStringTag,{value:"Module"})),e4=Object.keys(Kw);class g5 extends ki{constructor(t,n,r,s){let i=-1;if(super(t,n),ZS(this,"space",s),typeof r=="number")for(;++i<e4.length;){const o=e4[i];ZS(this,e4[i],(r&Kw[o])===Kw[o])}}}g5.prototype.defined=!0;function ZS(e,t,n){n&&(e[t]=n)}function Fh(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new g5(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[q0(r)]=r,n[q0(i.attribute)]=r}return new Im(t,n,e.space)}const eR=Fh({properties:{ariaActiveDescendant:null,ariaAtomic:Br,ariaAutoComplete:null,ariaBusy:Br,ariaChecked:Br,ariaColCount:Fe,ariaColIndex:Fe,ariaColSpan:Fe,ariaControls:Qn,ariaCurrent:null,ariaDescribedBy:Qn,ariaDetails:null,ariaDisabled:Br,ariaDropEffect:Qn,ariaErrorMessage:null,ariaExpanded:Br,ariaFlowTo:Qn,ariaGrabbed:Br,ariaHasPopup:null,ariaHidden:Br,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qn,ariaLevel:Fe,ariaLive:null,ariaModal:Br,ariaMultiLine:Br,ariaMultiSelectable:Br,ariaOrientation:null,ariaOwns:Qn,ariaPlaceholder:null,ariaPosInSet:Fe,ariaPressed:Br,ariaReadOnly:Br,ariaRelevant:null,ariaRequired:Br,ariaRoleDescription:Qn,ariaRowCount:Fe,ariaRowIndex:Fe,ariaRowSpan:Fe,ariaSelected:Br,ariaSetSize:Fe,ariaSort:null,ariaValueMax:Fe,ariaValueMin:Fe,ariaValueNow:Fe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function tR(e,t){return t in e?e[t]:t}function nR(e,t){return tR(e,t.toLowerCase())}const CW=Fh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Tu,acceptCharset:Qn,accessKey:Qn,action:null,allow:null,allowFullScreen:Wt,allowPaymentRequest:Wt,allowUserMedia:Wt,alpha:Wt,alt:null,as:null,async:Wt,autoCapitalize:null,autoComplete:Qn,autoFocus:Wt,autoPlay:Wt,blocking:Qn,capture:null,charSet:null,checked:Wt,cite:null,className:Qn,closedBy:null,colorSpace:null,cols:Fe,colSpan:Fe,command:null,commandFor:null,content:null,contentEditable:Br,controls:Wt,controlsList:Qn,coords:Fe|Tu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Wt,defer:Wt,dir:null,dirName:null,disabled:Wt,download:Gw,draggable:Br,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Wt,formTarget:null,headers:Qn,height:Fe,hidden:Gw,high:Fe,href:null,hrefLang:null,htmlFor:Qn,httpEquiv:Qn,id:null,imageSizes:null,imageSrcSet:null,inert:Wt,inputMode:null,integrity:null,is:null,isMap:Wt,itemId:null,itemProp:Qn,itemRef:Qn,itemScope:Wt,itemType:Qn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Wt,low:Fe,manifest:null,max:null,maxLength:Fe,media:null,method:null,min:null,minLength:Fe,multiple:Wt,muted:Wt,name:null,nonce:null,noModule:Wt,noValidate:Wt,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:Wt,optimum:Fe,pattern:null,ping:Qn,placeholder:null,playsInline:Wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Wt,referrerPolicy:null,rel:Qn,required:Wt,reversed:Wt,rows:Fe,rowSpan:Fe,sandbox:Qn,scope:null,scoped:Wt,seamless:Wt,selected:Wt,shadowRootClonable:Wt,shadowRootCustomElementRegistry:Wt,shadowRootDelegatesFocus:Wt,shadowRootMode:null,shadowRootSerializable:Wt,shape:null,size:Fe,sizes:null,slot:null,span:Fe,spellCheck:Br,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Fe,step:null,style:null,tabIndex:Fe,target:null,title:null,translate:null,type:null,typeMustMatch:Wt,useMap:null,value:Br,width:Fe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qn,axis:null,background:null,bgColor:null,border:Fe,borderColor:null,bottomMargin:Fe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Wt,declare:Wt,event:null,face:null,frame:null,frameBorder:null,hSpace:Fe,leftMargin:Fe,link:null,longDesc:null,lowSrc:null,marginHeight:Fe,marginWidth:Fe,noResize:Wt,noHref:Wt,noShade:Wt,noWrap:Wt,object:null,profile:null,prompt:null,rev:null,rightMargin:Fe,rules:null,scheme:null,scrolling:Br,standby:null,summary:null,text:null,topMargin:Fe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Fe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Wt,disablePictureInPicture:Wt,disableRemotePlayback:Wt,exportParts:Tu,part:Qn,prefix:null,property:null,results:Fe,security:null,unselectable:null},space:"html",transform:nR}),AW=Fh({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:Ai,accentHeight:Fe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Fe,amplitude:Fe,arabicForm:null,ascent:Fe,attributeName:null,attributeType:null,azimuth:Fe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Fe,by:null,calcMode:null,capHeight:Fe,className:Qn,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:Fe,diffuseConstant:Fe,direction:null,display:null,dur:null,divisor:Fe,dominantBaseline:null,download:Wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Fe,enableBackground:null,end:null,event:null,exponent:Fe,externalResourcesRequired:null,fill:null,fillOpacity:Fe,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:Tu,g2:Tu,glyphName:Tu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Fe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Fe,horizOriginX:Fe,horizOriginY:Fe,id:null,ideographic:Fe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Fe,k:Fe,k1:Fe,k2:Fe,k3:Fe,k4:Fe,kernelMatrix:Ai,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Fe,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:Fe,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:Fe,overlineThickness:Fe,paintOrder:null,panose1:null,path:null,pathLength:Fe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Fe,pointsAtY:Fe,pointsAtZ:Fe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ai,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ai,rev:Ai,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ai,requiredFeatures:Ai,requiredFonts:Ai,requiredFormats:Ai,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:Fe,specularExponent:Fe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Fe,strikethroughThickness:Fe,string:null,stroke:null,strokeDashArray:Ai,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Fe,strokeOpacity:Fe,strokeWidth:null,style:null,surfaceScale:Fe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ai,tabIndex:Fe,tableValues:null,target:null,targetX:Fe,targetY:Fe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ai,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Fe,underlineThickness:Fe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Fe,values:null,vAlphabetic:Fe,vMathematical:Fe,vectorEffect:null,vHanging:Fe,vIdeographic:Fe,version:null,vertAdvY:Fe,vertOriginX:Fe,vertOriginY:Fe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Fe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tR}),rR=Fh({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()}}),sR=Fh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nR}),iR=Fh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),EW={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"},MW=/[A-Z]/g,e7=/-[a-z]/g,IW=/^data[-\w.:]+$/i;function y5(e,t){const n=q0(t);let r=t,s=ki;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&IW.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(e7,RW);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!e7.test(i)){let o=i.replace(MW,NW);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=g5}return new s(r,t)}function NW(e){return"-"+e.toLowerCase()}function RW(e){return e.charAt(1).toUpperCase()}const b5=ZN([eR,CW,rR,sR,iR],"html"),Uh=ZN([eR,AW,rR,sR,iR],"svg");function t7(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function oR(e){return e.join(" ").trim()}var v5={},n7=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,LW=/\n/g,jW=/^\s*/,DW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,OW=/^:\s*/,BW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,PW=/^[;\s]*/,$W=/^\s+|\s+$/g,zW=`
`,r7="/",s7="*",au="",FW="comment",UW="declaration";function qW(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(p){var y=p.match(LW);y&&(n+=y.length);var w=p.lastIndexOf(zW);r=~w?p.length-w:r+p.length}function i(){var p={line:n,column:r};return function(y){return y.position=new o(p),c(),y}}function o(p){this.start=p,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(p){var y=new Error(t.source+":"+n+":"+r+": "+p);if(y.reason=p,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(p){var y=p.exec(e);if(y){var w=y[0];return s(w),e=e.slice(w.length),y}}function c(){l(jW)}function u(p){var y;for(p=p||[];y=d();)y!==!1&&p.push(y);return p}function d(){var p=i();if(!(r7!=e.charAt(0)||s7!=e.charAt(1))){for(var y=2;au!=e.charAt(y)&&(s7!=e.charAt(y)||r7!=e.charAt(y+1));)++y;if(y+=2,au===e.charAt(y-1))return a("End of comment missing");var w=e.slice(2,y-2);return r+=2,s(w),e=e.slice(y),r+=2,p({type:FW,comment:w})}}function f(){var p=i(),y=l(DW);if(y){if(d(),!l(OW))return a("property missing ':'");var w=l(BW),b=p({type:UW,property:i7(y[0].replace(n7,au)),value:w?i7(w[0].replace(n7,au)):au});return l(PW),b}}function m(){var p=[];u(p);for(var y;y=f();)y!==!1&&(p.push(y),u(p));return p}return c(),m()}function i7(e){return e?e.replace($W,au):au}var HW=qW,VW=Xg&&Xg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(v5,"__esModule",{value:!0});v5.default=GW;const WW=VW(HW);function GW(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,WW.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;s?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var Jy={};Object.defineProperty(Jy,"__esModule",{value:!0});Jy.camelCase=void 0;var KW=/^--[a-zA-Z0-9_-]+$/,YW=/-([a-z])/g,XW=/^[^-]+$/,QW=/^-(webkit|moz|ms|o|khtml)-/,JW=/^-(ms)-/,ZW=function(e){return!e||XW.test(e)||KW.test(e)},eG=function(e,t){return t.toUpperCase()},o7=function(e,t){return"".concat(t,"-")},tG=function(e,t){return t===void 0&&(t={}),ZW(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(JW,o7):e=e.replace(QW,o7),e.replace(YW,eG))};Jy.camelCase=tG;var nG=Xg&&Xg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},rG=nG(v5),sG=Jy;function Yw(e,t){var n={};return!e||typeof e!="string"||(0,rG.default)(e,function(r,s){r&&s&&(n[(0,sG.camelCase)(r,t)]=s)}),n}Yw.default=Yw;var iG=Yw;const oG=ky(iG),aR=lR("end"),w5=lR("start");function lR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function aG(e){const t=w5(e),n=aR(e);if(t&&n)return{start:t,end:n}}function p0(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?a7(e.position):"start"in e||"end"in e?a7(e):"line"in e||"column"in e?Xw(e):""}function Xw(e){return l7(e&&e.line)+":"+l7(e&&e.column)}function a7(e){return Xw(e&&e.start)+"-"+Xw(e&&e.end)}function l7(e){return e&&typeof e=="number"?e:1}class Bs extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.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=s,this.line=a?a.line:void 0,this.name=p0(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}}Bs.prototype.file="";Bs.prototype.name="";Bs.prototype.reason="";Bs.prototype.message="";Bs.prototype.stack="";Bs.prototype.column=void 0;Bs.prototype.line=void 0;Bs.prototype.ancestors=void 0;Bs.prototype.cause=void 0;Bs.prototype.fatal=void 0;Bs.prototype.place=void 0;Bs.prototype.ruleId=void 0;Bs.prototype.source=void 0;const x5={}.hasOwnProperty,lG=new Map,cG=/[A-Z]/g,uG=new Set(["table","tbody","thead","tfoot","tr"]),dG=new Set(["td","th"]),cR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hG(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wG(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=vG(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Uh:b5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=uR(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function uR(e,t,n){if(t.type==="element")return fG(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mG(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gG(e,t,n);if(t.type==="mdxjsEsm")return pG(e,t);if(t.type==="root")return yG(e,t,n);if(t.type==="text")return bG(e,t)}function fG(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Uh,e.schema=s),e.ancestors.push(t);const i=hR(e,t.tagName,!1),o=xG(e,t);let a=k5(e,t);return uG.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Qy(l):!0})),dR(e,o,i,t),_5(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function mG(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}H0(e,t.position)}function pG(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);H0(e,t.position)}function gG(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Uh,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:hR(e,t.name,!0),o=_G(e,t),a=k5(e,t);return dR(e,o,i,t),_5(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function yG(e,t,n){const r={};return _5(r,k5(e,t)),e.create(t,e.Fragment,r,n)}function bG(e,t){return t.value}function dR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function _5(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vG(e,t,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function wG(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=w5(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function xG(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&x5.call(t.properties,s)){const i=kG(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&dG.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function _G(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else H0(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else H0(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function k5(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:lG;for(;++r<t.children.length;){const i=t.children[r];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=s.get(l)||0;o=l+"-"+c,s.set(l,c+1)}}const a=uR(e,i,o);a!==void 0&&n.push(a)}return n}function kG(e,t,n){const r=y5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?JN(n):oR(n)),r.property==="style"){let s=typeof n=="object"?n:SG(e,String(n));return e.stylePropertyNameCase==="css"&&(s=TG(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?EW[r.property]||r.property:r.attribute,n]}}function SG(e,t){try{return oG(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Bs("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=cR+"#cannot-parse-style-attribute",s}}function hR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=QS(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=QS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return x5.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);H0(e)}function H0(e,t){const n=new Bs("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=cR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function TG(e){const t={};let n;for(n in e)x5.call(e,n)&&(t[CG(n)]=e[n]);return t}function CG(e){let t=e.replace(cG,AG);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function AG(e){return"-"+e.toLowerCase()}const t4={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"]},EG={};function S5(e,t){const n=EG,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return fR(e,r,s)}function fR(e,t,n){if(MG(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 c7(e.children,t,n)}return Array.isArray(e)?c7(e,t,n):""}function c7(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=fR(e[s],t,n);return r.join("")}function MG(e){return!!(e&&typeof e=="object")}const u7=document.createElement("i");function T5(e){const t="&"+e+";";u7.innerHTML=t;const n=u7.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function zi(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function io(e,t){return e.length>0?(zi(e,e.length,0,t),e):t}const d7={}.hasOwnProperty;function mR(e){const t={};let n=-1;for(;++n<e.length;)IG(t,e[n]);return t}function IG(e,t){let n;for(n in t){const s=(d7.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){d7.call(s,o)||(s[o]=[]);const a=i[o];NG(s[o],Array.isArray(a)?a:a?[a]:[])}}}function NG(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);zi(e,0,0,r)}function pR(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 Ro(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ys=jc(/[A-Za-z]/),Ls=jc(/[\dA-Za-z]/),RG=jc(/[#-'*+\--9=?A-Z^-~]/);function N1(e){return e!==null&&(e<32||e===127)}const Qw=jc(/\d/),LG=jc(/[\dA-Fa-f]/),jG=jc(/[!-/:-@[-`{-~]/);function Ct(e){return e!==null&&e<-2}function er(e){return e!==null&&(e<0||e===32)}function hn(e){return e===-2||e===-1||e===32}const Zy=jc(new RegExp("\\p{P}|\\p{S}","u")),Du=jc(/\s/);function jc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function qh(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Ls(e.charCodeAt(n+1))&&Ls(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function ln(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return hn(l)?(e.enter(n),a(l)):t(l)}function a(l){return hn(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const DG={tokenize:OG};function OG(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ln(e,t,"linePrefix")}function s(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 Ct(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const BG={tokenize:PG},h7={tokenize:$G};function PG(e){const t=this,n=[];let r=0,s,i,o;return a;function a(x){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(x)}return c(x)}function l(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const S=t.events.length;let C=S,E;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){E=t.events[C][1].end;break}b(r);let M=S;for(;M<t.events.length;)t.events[M][1].end={...E},M++;return zi(t.events,C+1,0,t.events.slice(S)),t.events.length=M,c(x)}return a(x)}function c(x){if(r===n.length){if(!s)return f(x);if(s.currentConstruct&&s.currentConstruct.concrete)return p(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(h7,u,d)(x)}function u(x){return s&&v(),b(r),f(x)}function d(x){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,p(x)}function f(x){return t.containerState={},e.attempt(h7,m,p)(x)}function m(x){return r++,n.push([t.currentConstruct,t.containerState]),f(x)}function p(x){if(x===null){s&&v(),b(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(x)}function y(x){if(x===null){w(e.exit("chunkFlow"),!0),b(0),e.consume(x);return}return Ct(x)?(e.consume(x),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(x),y)}function w(x,S){const C=t.sliceStream(x);if(S&&C.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(C),t.parser.lazy[x.start.line]){let E=s.events.length;for(;E--;)if(s.events[E][1].start.offset<o&&(!s.events[E][1].end||s.events[E][1].end.offset>o))return;const M=t.events.length;let D=M,O,A;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(O){A=t.events[D][1].end;break}O=!0}for(b(r),E=M;E<t.events.length;)t.events[E][1].end={...A},E++;zi(t.events,D+1,0,t.events.slice(M)),t.events.length=E}}function b(x){let S=n.length;for(;S-- >x;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=x}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function $G(e,t,n){return ln(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function yh(e){if(e===null||er(e)||Du(e))return 1;if(Zy(e))return 2}function eb(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Jw={name:"attention",resolveAll:zG,tokenize:FG};function zG(e,t){let n=-1,r,s,i,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};f7(d,-l),f7(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=io(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=io(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=io(c,eb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=io(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=io(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,zi(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function FG(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=yh(r);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"),u=yh(l),d=!u||u===2&&s||n.includes(l),f=!s||s===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(s||!f)),c._close=!!(i===42?f:f&&(u||!d)),t(l)}}function f7(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const UG={name:"autolink",tokenize:qG};function qG(e,t,n){let r=0;return s;function s(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Ys(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||Ls(m)?(r=1,a(m)):c(m)}function a(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||Ls(m))&&r++<32?(e.consume(m),a):(r=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||N1(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),u):RG(m)?(e.consume(m),c):n(m)}function u(m){return Ls(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,u):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||Ls(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const Nm={partial:!0,tokenize:HG};function HG(e,t,n){return r;function r(i){return hn(i)?ln(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Ct(i)?t(i):n(i)}}const gR={continuation:{tokenize:WG},exit:GG,name:"blockQuote",tokenize:VG};function VG(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.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 hn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function WG(e,t,n){const r=this;return s;function s(o){return hn(o)?ln(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(gR,t,n)(o)}}function GG(e){e.exit("blockQuote")}const yR={name:"characterEscape",tokenize:KG};function KG(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return jG(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const bR={name:"characterReference",tokenize:YG};function YG(e,t,n){const r=this;let s=0,i,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=Ls,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=LG,u):(e.enter("characterReferenceValue"),i=7,o=Qw,u(d))}function u(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return o===Ls&&!T5(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),u):n(d)}}const m7={partial:!0,tokenize:QG},p7={concrete:!0,name:"codeFenced",tokenize:XG};function XG(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,o=0,a;return l;function l(E){return c(E)}function c(E){const M=r.events[r.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(o++,e.consume(E),u):o<3?n(E):(e.exit("codeFencedFenceSequence"),hn(E)?ln(e,d,"whitespace")(E):d(E))}function d(E){return E===null||Ct(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(m7,y,S)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(E))}function f(E){return E===null||Ct(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(E)):hn(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ln(e,m,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),f)}function m(E){return E===null||Ct(E)?d(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===null||Ct(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(E)):E===96&&E===a?n(E):(e.consume(E),p)}function y(E){return e.attempt(s,S,w)(E)}function w(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),b}function b(E){return i>0&&hn(E)?ln(e,v,"linePrefix",i+1)(E):v(E)}function v(E){return E===null||Ct(E)?e.check(m7,y,S)(E):(e.enter("codeFlowValue"),x(E))}function x(E){return E===null||Ct(E)?(e.exit("codeFlowValue"),v(E)):(e.consume(E),x)}function S(E){return e.exit("codeFenced"),t(E)}function C(E,M,D){let O=0;return A;function A(q){return E.enter("lineEnding"),E.consume(q),E.exit("lineEnding"),j}function j(q){return E.enter("codeFencedFence"),hn(q)?ln(E,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):I(q)}function I(q){return q===a?(E.enter("codeFencedFenceSequence"),P(q)):D(q)}function P(q){return q===a?(O++,E.consume(q),P):O>=o?(E.exit("codeFencedFenceSequence"),hn(q)?ln(E,F,"whitespace")(q):F(q)):D(q)}function F(q){return q===null||Ct(q)?(E.exit("codeFencedFence"),M(q)):D(q)}}}function QG(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const n4={name:"codeIndented",tokenize:ZG},JG={partial:!0,tokenize:eK};function ZG(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),ln(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Ct(c)?e.attempt(JG,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ct(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function eK(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Ct(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):ln(e,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):Ct(o)?s(o):n(o)}}const tK={name:"codeText",previous:rK,resolve:nK,tokenize:sK};function nK(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function rK(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sK(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),s=0,u(d)):Ct(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Ct(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),s++,u):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",c(d))}}class iK{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&_f(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),_f(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_f(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);_f(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_f(this.left,n.reverse())}}}function _f(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 vR(e){const t={};let n=-1,r,s,i,o,a,l,c;const u=new iK(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,oK(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return zi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function oK(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,m=n,p=0,y=0;const w=[y];for(;m;){for(;e.get(++s)[1]!==m;);i.push(s),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),d&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=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,w.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):w.pop(),f=w.length;f--;){const b=a.slice(w[f],w[f+1]),v=i.pop();l.push([v,v+b.length-1]),e.splice(v,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const aK={resolve:cK,tokenize:uK},lK={partial:!0,tokenize:dK};function cK(e){return vR(e),e}function uK(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):Ct(a)?e.check(lK,o,i)(a):(e.consume(a),s)}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,s}}function dK(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ln(e,i,"linePrefix")}function i(o){if(o===null||Ct(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function wR(e,t,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||N1(b)?n(b):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(b))}function f(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(e.exit("chunkString"),e.exit(a),f(b)):b===null||b===60||Ct(b)?n(b):(e.consume(b),b===92?p:m)}function p(b){return b===60||b===62||b===92?(e.consume(b),m):m(b)}function y(b){return!u&&(b===null||b===41||er(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,y):b===41?(e.consume(b),u--,y):b===null||b===32||b===40||N1(b)?n(b):(e.consume(b),b===92?w:y)}function w(b){return b===40||b===41||b===92?(e.consume(b),y):y(b)}}function xR(e,t,n,r,s,i){const o=this;let a=0,l;return c;function c(m){return e.enter(r),e.enter(s),e.consume(m),e.exit(s),e.enter(i),u}function u(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(s),e.consume(m),e.exit(s),e.exit(r),t):Ct(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||Ct(m)||a++>999?(e.exit("chunkString"),u(m)):(e.consume(m),l||(l=!hn(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}}function _R(e,t,n,r,s,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):Ct(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ln(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Ct(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function g0(e,t){let n;return r;function r(s){return Ct(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):hn(s)?ln(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const hK={name:"definition",tokenize:mK},fK={partial:!0,tokenize:pK};function mK(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return xR.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return s=Ro(r.sliceSerialize(r.events[r.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 er(m)?g0(e,c)(m):c(m)}function c(m){return wR(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return e.attempt(fK,d,d)(m)}function d(m){return hn(m)?ln(e,f,"whitespace")(m):f(m)}function f(m){return m===null||Ct(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function pK(e,t,n){return r;function r(a){return er(a)?g0(e,s)(a):n(a)}function s(a){return _R(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return hn(a)?ln(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Ct(a)?t(a):n(a)}}const gK={name:"hardBreakEscape",tokenize:yK};function yK(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Ct(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const bK={name:"headingAtx",resolve:vK,tokenize:wK};function vK(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},zi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function wK(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||er(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Ct(u)?(e.exit("atxHeading"),t(u)):hn(u)?ln(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||er(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const xK=["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"],g7=["pre","script","style","textarea"],_K={concrete:!0,name:"htmlFlow",resolveTo:TK,tokenize:CK},kK={partial:!0,tokenize:EK},SK={partial:!0,tokenize:AK};function TK(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 CK(e,t,n){const r=this;let s,i,o,a,l;return c;function c(k){return u(k)}function u(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),d}function d(k){return k===33?(e.consume(k),f):k===47?(e.consume(k),i=!0,y):k===63?(e.consume(k),s=3,r.interrupt?t:N):Ys(k)?(e.consume(k),o=String.fromCharCode(k),w):n(k)}function f(k){return k===45?(e.consume(k),s=2,m):k===91?(e.consume(k),s=5,a=0,p):Ys(k)?(e.consume(k),s=4,r.interrupt?t:N):n(k)}function m(k){return k===45?(e.consume(k),r.interrupt?t:N):n(k)}function p(k){const Q="CDATA[";return k===Q.charCodeAt(a++)?(e.consume(k),a===Q.length?r.interrupt?t:I:p):n(k)}function y(k){return Ys(k)?(e.consume(k),o=String.fromCharCode(k),w):n(k)}function w(k){if(k===null||k===47||k===62||er(k)){const Q=k===47,ce=o.toLowerCase();return!Q&&!i&&g7.includes(ce)?(s=1,r.interrupt?t(k):I(k)):xK.includes(o.toLowerCase())?(s=6,Q?(e.consume(k),b):r.interrupt?t(k):I(k)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):i?v(k):x(k))}return k===45||Ls(k)?(e.consume(k),o+=String.fromCharCode(k),w):n(k)}function b(k){return k===62?(e.consume(k),r.interrupt?t:I):n(k)}function v(k){return hn(k)?(e.consume(k),v):A(k)}function x(k){return k===47?(e.consume(k),A):k===58||k===95||Ys(k)?(e.consume(k),S):hn(k)?(e.consume(k),x):A(k)}function S(k){return k===45||k===46||k===58||k===95||Ls(k)?(e.consume(k),S):C(k)}function C(k){return k===61?(e.consume(k),E):hn(k)?(e.consume(k),C):x(k)}function E(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,M):hn(k)?(e.consume(k),E):D(k)}function M(k){return k===l?(e.consume(k),l=null,O):k===null||Ct(k)?n(k):(e.consume(k),M)}function D(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||er(k)?C(k):(e.consume(k),D)}function O(k){return k===47||k===62||hn(k)?x(k):n(k)}function A(k){return k===62?(e.consume(k),j):n(k)}function j(k){return k===null||Ct(k)?I(k):hn(k)?(e.consume(k),j):n(k)}function I(k){return k===45&&s===2?(e.consume(k),R):k===60&&s===1?(e.consume(k),V):k===62&&s===4?(e.consume(k),G):k===63&&s===3?(e.consume(k),N):k===93&&s===5?(e.consume(k),ee):Ct(k)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(kK,B,P)(k)):k===null||Ct(k)?(e.exit("htmlFlowData"),P(k)):(e.consume(k),I)}function P(k){return e.check(SK,F,B)(k)}function F(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),q}function q(k){return k===null||Ct(k)?P(k):(e.enter("htmlFlowData"),I(k))}function R(k){return k===45?(e.consume(k),N):I(k)}function V(k){return k===47?(e.consume(k),o="",J):I(k)}function J(k){if(k===62){const Q=o.toLowerCase();return g7.includes(Q)?(e.consume(k),G):I(k)}return Ys(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),J):I(k)}function ee(k){return k===93?(e.consume(k),N):I(k)}function N(k){return k===62?(e.consume(k),G):k===45&&s===2?(e.consume(k),N):I(k)}function G(k){return k===null||Ct(k)?(e.exit("htmlFlowData"),B(k)):(e.consume(k),G)}function B(k){return e.exit("htmlFlow"),t(k)}}function AK(e,t,n){const r=this;return s;function s(o){return Ct(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function EK(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Nm,t,n)}}const MK={name:"htmlText",tokenize:IK};function IK(e,t,n){const r=this;let s,i,o;return a;function a(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),c):N===47?(e.consume(N),C):N===63?(e.consume(N),x):Ys(N)?(e.consume(N),D):n(N)}function c(N){return N===45?(e.consume(N),u):N===91?(e.consume(N),i=0,p):Ys(N)?(e.consume(N),v):n(N)}function u(N){return N===45?(e.consume(N),m):n(N)}function d(N){return N===null?n(N):N===45?(e.consume(N),f):Ct(N)?(o=d,V(N)):(e.consume(N),d)}function f(N){return N===45?(e.consume(N),m):d(N)}function m(N){return N===62?R(N):N===45?f(N):d(N)}function p(N){const G="CDATA[";return N===G.charCodeAt(i++)?(e.consume(N),i===G.length?y:p):n(N)}function y(N){return N===null?n(N):N===93?(e.consume(N),w):Ct(N)?(o=y,V(N)):(e.consume(N),y)}function w(N){return N===93?(e.consume(N),b):y(N)}function b(N){return N===62?R(N):N===93?(e.consume(N),b):y(N)}function v(N){return N===null||N===62?R(N):Ct(N)?(o=v,V(N)):(e.consume(N),v)}function x(N){return N===null?n(N):N===63?(e.consume(N),S):Ct(N)?(o=x,V(N)):(e.consume(N),x)}function S(N){return N===62?R(N):x(N)}function C(N){return Ys(N)?(e.consume(N),E):n(N)}function E(N){return N===45||Ls(N)?(e.consume(N),E):M(N)}function M(N){return Ct(N)?(o=M,V(N)):hn(N)?(e.consume(N),M):R(N)}function D(N){return N===45||Ls(N)?(e.consume(N),D):N===47||N===62||er(N)?O(N):n(N)}function O(N){return N===47?(e.consume(N),R):N===58||N===95||Ys(N)?(e.consume(N),A):Ct(N)?(o=O,V(N)):hn(N)?(e.consume(N),O):R(N)}function A(N){return N===45||N===46||N===58||N===95||Ls(N)?(e.consume(N),A):j(N)}function j(N){return N===61?(e.consume(N),I):Ct(N)?(o=j,V(N)):hn(N)?(e.consume(N),j):O(N)}function I(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),s=N,P):Ct(N)?(o=I,V(N)):hn(N)?(e.consume(N),I):(e.consume(N),F)}function P(N){return N===s?(e.consume(N),s=void 0,q):N===null?n(N):Ct(N)?(o=P,V(N)):(e.consume(N),P)}function F(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||er(N)?O(N):(e.consume(N),F)}function q(N){return N===47||N===62||er(N)?O(N):n(N)}function R(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function V(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),J}function J(N){return hn(N)?ln(e,ee,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ee(N)}function ee(N){return e.enter("htmlTextData"),o(N)}}const C5={name:"labelEnd",resolveAll:jK,resolveTo:DK,tokenize:OK},NK={tokenize:BK},RK={tokenize:PK},LK={tokenize:$K};function jK(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&zi(e,0,e.length,n),e}function DK(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const 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}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=io(a,e.slice(i+1,i+r+3)),a=io(a,[["enter",u,t]]),a=io(a,eb(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=io(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=io(a,e.slice(o+1)),a=io(a,[["exit",l,t]]),zi(e,i,e.length,a),e}function OK(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(Ro(r.sliceSerialize({start:i.end,end:r.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(NK,u,o?u:d)(f):f===91?e.attempt(RK,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(LK,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function BK(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return er(d)?g0(e,i)(d):i(d)}function i(d){return d===41?u(d):wR(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return er(d)?g0(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?_R(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return er(d)?g0(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function PK(e,t,n){const r=this;return s;function s(a){return xR.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Ro(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function $K(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const zK={name:"labelStartImage",resolveAll:C5.resolveAll,tokenize:FK};function FK(e,t,n){const r=this;return s;function s(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 r.parser.constructs?n(a):t(a)}}const UK={name:"labelStartLink",resolveAll:C5.resolveAll,tokenize:qK};function qK(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const r4={name:"lineEnding",tokenize:HK};function HK(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ln(e,t,"linePrefix")}}const Rg={name:"thematicBreak",tokenize:VK};function VK(e,t,n){let r=0,s;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Ct(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===s?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),hn(c)?ln(e,a,"whitespace")(c):a(c))}}const li={continuation:{tokenize:YK},exit:QK,name:"list",tokenize:KK},WK={partial:!0,tokenize:JK},GK={partial:!0,tokenize:XK};function KK(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Qw(m)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Rg,n,c)(m):c(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Qw(m)&&++o<10?(e.consume(m),l):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.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"),r.containerState.marker=r.containerState.marker||m,e.check(Nm,r.interrupt?n:u,e.attempt(WK,f,d))}function u(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return hn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function YK(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Nm,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ln(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!hn(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(GK,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ln(e,e.attempt(li,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function XK(e,t,n){const r=this;return ln(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function QK(e){e.exit(this.containerState.type)}function JK(e,t,n){const r=this;return ln(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!hn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const y7={name:"setextUnderline",resolveTo:ZK,tokenize:eY};function ZK(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function eY(e,t,n){const r=this;let s;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),hn(c)?ln(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ct(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const tY={tokenize:nY};function nY(e){const t=this,n=e.attempt(Nm,r,e.attempt(this.parser.constructs.flowInitial,s,ln(e,e.attempt(this.parser.constructs.flow,s,e.attempt(aK,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const rY={resolveAll:SR()},sY=kR("string"),iY=kR("text");function kR(e){return{resolveAll:SR(e==="text"?oY:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=s[u];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function SR(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function oY(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const c=s[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:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const aY={42:li,43:li,45:li,48:li,49:li,50:li,51:li,52:li,53:li,54:li,55:li,56:li,57:li,62:gR},lY={91:hK},cY={[-2]:n4,[-1]:n4,32:n4},uY={35:bK,42:Rg,45:[y7,Rg],60:_K,61:y7,95:Rg,96:p7,126:p7},dY={38:bR,92:yR},hY={[-5]:r4,[-4]:r4,[-3]:r4,33:zK,38:bR,42:Jw,60:[UG,MK],91:UK,92:[gK,yR],93:C5,95:Jw,96:tK},fY={null:[Jw,rY]},mY={null:[42,95]},pY={null:[]},gY=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mY,contentInitial:lY,disable:pY,document:aY,flow:uY,flowInitial:cY,insideSpan:fY,string:dY,text:hY},Symbol.toStringTag,{value:"Module"}));function yY(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],a=[];const l={attempt:M(C),check:M(E),consume:v,enter:x,exit:S,interrupt:M(E,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function d(j){return o=io(o,j),w(),o[o.length-1]!==null?[]:(D(t,0),c.events=eb(i,c.events,c),c.events)}function f(j,I){return vY(m(j),I)}function m(j){return bY(o,j)}function p(){const{_bufferIndex:j,_index:I,line:P,column:F,offset:q}=r;return{_bufferIndex:j,_index:I,line:P,column:F,offset:q}}function y(j){s[j.line]=j.column,A()}function w(){let j;for(;r._index<o.length;){const I=o[r._index];if(typeof I=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<I.length;)b(I.charCodeAt(r._bufferIndex));else b(I)}}function b(j){u=u(j)}function v(j){Ct(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,A()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=j}function x(j,I){const P=I||{};return P.type=j,P.start=p(),c.events.push(["enter",P,c]),a.push(P),P}function S(j){const I=a.pop();return I.end=p(),c.events.push(["exit",I,c]),I}function C(j,I){D(j,I.from)}function E(j,I){I.restore()}function M(j,I){return P;function P(F,q,R){let V,J,ee,N;return Array.isArray(F)?B(F):"tokenize"in F?B([F]):G(F);function G(pe){return be;function be(ye){const ie=ye!==null&&pe[ye],re=ye!==null&&pe.null,oe=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(re)?re:re?[re]:[]];return B(oe)(ye)}}function B(pe){return V=pe,J=0,pe.length===0?R:k(pe[J])}function k(pe){return be;function be(ye){return N=O(),ee=pe,pe.partial||(c.currentConstruct=pe),pe.name&&c.parser.constructs.disable.null.includes(pe.name)?ce():pe.tokenize.call(I?Object.assign(Object.create(c),I):c,l,Q,ce)(ye)}}function Q(pe){return j(ee,N),q}function ce(pe){return N.restore(),++J<V.length?k(V[J]):R}}}function D(j,I){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&zi(c.events,I,c.events.length-I,j.resolve(c.events.slice(I),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function O(){const j=p(),I=c.previous,P=c.currentConstruct,F=c.events.length,q=Array.from(a);return{from:F,restore:R};function R(){r=j,c.previous=I,c.currentConstruct=P,c.events.length=F,a=q,A()}}function A(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function bY(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function vY(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function wY(e){const r={constructs:mR([gY,...(e||{}).extensions||[]]),content:s(DG),defined:[],document:s(BG),flow:s(tY),lazy:{},string:s(sY),text:s(iY)};return r;function s(i){return o;function o(a){return yY(r,i,a)}}}function xY(e){for(;!vR(e););return e}const b7=/[\0\t\n\r]/g;function _Y(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let c,u,d,f,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(b7.lastIndex=d,c=b7.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){t=i.slice(d);break}if(m===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),e+=f-d),m){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const kY=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function SY(e){return e.replace(kY,TY)}function TY(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return pR(n.slice(i?2:1),i?16:10)}return T5(n)||e}const TR={}.hasOwnProperty;function CY(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),AY(n)(xY(wY(n).document().write(_Y()(e,t,!0))))}function AY(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Pt),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(te),blockQuote:i(re),characterEscape:O,characterReference:O,codeFenced:i(oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(oe,o),codeText:i(ve,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(qe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(We),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(Se,o),htmlFlowData:O,htmlText:i(Se,o),htmlTextData:O,image:i(Ne),label:o,link:i(Pt),listItem:i(vt),listItemValue:f,listOrdered:i(at,d),listUnordered:i(at),paragraph:i(Tt),reference:k,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(te),strong:i(rt),thematicBreak:i(Qe)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:ie,autolinkProtocol:ye,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:pe,characterReference:be,codeFenced:l(w),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:A,codeIndented:l(b),codeText:l(q),codeTextData:A,data:A,definition:l(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(P),htmlFlowData:A,htmlText:l(F),htmlTextData:A,image:l(V),label:ee,labelText:J,lineEnding:j,link:l(R),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Q,resourceDestinationString:N,resourceTitleString:G,resource:B,setextHeading:l(D),setextHeadingLineSequence:M,setextHeadingText:E,strong:l(),thematicBreak:l()}};CR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ne){let se={type:"root",children:[]};const De={stack:[se],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},lt=[];let ae=-1;for(;++ae<ne.length;)if(ne[ae][1].type==="listOrdered"||ne[ae][1].type==="listUnordered")if(ne[ae][0]==="enter")lt.push(ae);else{const ze=lt.pop();ae=s(ne,ze,ae)}for(ae=-1;++ae<ne.length;){const ze=t[ne[ae][0]];TR.call(ze,ne[ae][1].type)&&ze[ne[ae][1].type].call(Object.assign({sliceSerialize:ne[ae][2].sliceSerialize},De),ne[ae][1])}if(De.tokenStack.length>0){const ze=De.tokenStack[De.tokenStack.length-1];(ze[1]||v7).call(De,void 0,ze[0])}for(se.position={start:Cl(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Cl(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},ae=-1;++ae<t.transforms.length;)se=t.transforms[ae](se)||se;return se}function s(ne,se,De){let lt=se-1,ae=-1,ze=!1,Je,Nt,Ut,he;for(;++lt<=De;){const Y=ne[lt];switch(Y[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Y[0]==="enter"?ae++:ae--,he=void 0;break}case"lineEndingBlank":{Y[0]==="enter"&&(Je&&!he&&!ae&&!Ut&&(Ut=lt),he=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:he=void 0}if(!ae&&Y[0]==="enter"&&Y[1].type==="listItemPrefix"||ae===-1&&Y[0]==="exit"&&(Y[1].type==="listUnordered"||Y[1].type==="listOrdered")){if(Je){let me=lt;for(Nt=void 0;me--;){const le=ne[me];if(le[1].type==="lineEnding"||le[1].type==="lineEndingBlank"){if(le[0]==="exit")continue;Nt&&(ne[Nt][1].type="lineEndingBlank",ze=!0),le[1].type="lineEnding",Nt=me}else if(!(le[1].type==="linePrefix"||le[1].type==="blockQuotePrefix"||le[1].type==="blockQuotePrefixWhitespace"||le[1].type==="blockQuoteMarker"||le[1].type==="listItemIndent"))break}Ut&&(!Nt||Ut<Nt)&&(Je._spread=!0),Je.end=Object.assign({},Nt?ne[Nt][1].start:Y[1].end),ne.splice(Nt||lt,0,["exit",Je,Y[2]]),lt++,De++}if(Y[1].type==="listItemPrefix"){const me={type:"listItem",_spread:!1,start:Object.assign({},Y[1].start),end:void 0};Je=me,ne.splice(lt,0,["enter",me,Y[2]]),lt++,De++,Ut=void 0,he=!0}}}return ne[se][1]._spread=ze,De}function i(ne,se){return De;function De(lt){a.call(this,ne(lt),lt),se&&se.call(this,lt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ne,se,De){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([se,De||void 0]),ne.position={start:Cl(se.start),end:void 0}}function l(ne){return se;function se(De){ne&&ne.call(this,De),c.call(this,De)}}function c(ne,se){const De=this.stack.pop(),lt=this.tokenStack.pop();if(lt)lt[0].type!==ne.type&&(se?se.call(this,ne,lt[0]):(lt[1]||v7).call(this,ne,lt[0]));else throw new Error("Cannot close `"+ne.type+"` ("+p0({start:ne.start,end:ne.end})+"): it’s not open");De.position.end=Cl(ne.end)}function u(){return S5(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(ne){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.lang=ne}function p(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.meta=ne}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.value=ne.replace(/(\r?\n|\r)$/g,"")}function v(ne){const se=this.resume(),De=this.stack[this.stack.length-1];De.label=se,De.identifier=Ro(this.sliceSerialize(ne)).toLowerCase()}function x(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.title=ne}function S(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.url=ne}function C(ne){const se=this.stack[this.stack.length-1];if(!se.depth){const De=this.sliceSerialize(ne).length;se.depth=De}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function M(ne){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function O(ne){const De=this.stack[this.stack.length-1].children;let lt=De[De.length-1];(!lt||lt.type!=="text")&&(lt=tt(),lt.position={start:Cl(ne.start),end:void 0},De.push(lt)),this.stack.push(lt)}function A(ne){const se=this.stack.pop();se.value+=this.sliceSerialize(ne),se.position.end=Cl(ne.end)}function j(ne){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=se.children[se.children.length-1];De.position.end=Cl(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(O.call(this,ne),A.call(this,ne))}function I(){this.data.atHardBreak=!0}function P(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.value=ne}function F(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.value=ne}function q(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.value=ne}function R(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=se,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function V(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=se,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function J(ne){const se=this.sliceSerialize(ne),De=this.stack[this.stack.length-2];De.label=SY(se),De.identifier=Ro(se).toLowerCase()}function ee(){const ne=this.stack[this.stack.length-1],se=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const lt=ne.children;De.children=lt}else De.alt=se}function N(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.url=ne}function G(){const ne=this.resume(),se=this.stack[this.stack.length-1];se.title=ne}function B(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function Q(ne){const se=this.resume(),De=this.stack[this.stack.length-1];De.label=se,De.identifier=Ro(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function ce(ne){this.data.characterReferenceType=ne.type}function pe(ne){const se=this.sliceSerialize(ne),De=this.data.characterReferenceType;let lt;De?(lt=pR(se,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):lt=T5(se);const ae=this.stack[this.stack.length-1];ae.value+=lt}function be(ne){const se=this.stack.pop();se.position.end=Cl(ne.end)}function ye(ne){A.call(this,ne);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(ne)}function ie(ne){A.call(this,ne);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(ne)}function re(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function We(){return{type:"emphasis",children:[]}}function te(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Ne(){return{type:"image",title:null,url:"",alt:null}}function Pt(){return{type:"link",title:null,url:"",children:[]}}function at(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function vt(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Tt(){return{type:"paragraph",children:[]}}function rt(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function Qe(){return{type:"thematicBreak"}}}function Cl(e){return{line:e.line,column:e.column,offset:e.offset}}function CR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?CR(e,r):EY(e,r)}}function EY(e,t){let n;for(n in t)if(TR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function v7(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+p0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+p0({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+p0({start:t.start,end:t.end})+") is still open")}function MY(e){const t=this;t.parser=n;function n(r){return CY(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function IY(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 NY(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function RY(e,t){const n=t.value?t.value+`
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function LY(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jY(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DY(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=qh(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(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 OY(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 BY(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function AR(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function PY(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return AR(e,t);const s={src:qh(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function $Y(e,t){const n={src:qh(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function zY(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function FY(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return AR(e,t);const s={href:qh(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function UY(e,t){const n={href:qh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qY(e,t,n){const r=e.all(t),s=n?HY(n):ER(t),i={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.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<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(s||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 HY(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=ER(n[r])}return t}function ER(e){const t=e.spread;return t??e.children.length>1}function VY(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function WY(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function GY(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function KY(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YY(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=w5(t.children[1]),l=aR(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function XY(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],f={},m=o?o[l]:void 0;m&&(f.align=m);let p={type:"element",tagName:i,properties:f,children:[]};d&&(p.children=e.all(d),e.patch(d,p),p=e.applyData(d,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function QY(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const w7=9,x7=32;function JY(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(_7(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(_7(t.slice(s),s>0,!1)),i.join("")}function _7(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===w7||i===x7;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===w7||i===x7;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function ZY(e,t){const n={type:"text",value:JY(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function eX(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const tX={blockquote:IY,break:NY,code:RY,delete:LY,emphasis:jY,footnoteReference:DY,heading:OY,html:BY,imageReference:PY,image:$Y,inlineCode:zY,linkReference:FY,link:UY,listItem:qY,list:VY,paragraph:WY,root:GY,strong:KY,table:YY,tableCell:QY,tableRow:XY,text:ZY,thematicBreak:eX,toml:Sp,yaml:Sp,definition:Sp,footnoteDefinition:Sp};function Sp(){}const MR=-1,tb=0,y0=1,R1=2,A5=3,E5=4,M5=5,I5=6,IR=7,NR=8,k7=typeof self=="object"?self:globalThis,nX=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case tb:case MR:return n(o,s);case y0:{const a=n([],s);for(const l of o)a.push(r(l));return a}case R1:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case A5:return n(new Date(o),s);case E5:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case M5:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case I5:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case IR:{const{name:a,message:l}=o;return n(new k7[a](l),s)}case NR:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new k7[i](o),s)};return r},S7=e=>nX(new Map,e)(0),hd="",{toString:rX}={},{keys:sX}=Object,kf=e=>{const t=typeof e;if(t!=="object"||!e)return[tb,t];const n=rX.call(e).slice(8,-1);switch(n){case"Array":return[y0,hd];case"Object":return[R1,hd];case"Date":return[A5,hd];case"RegExp":return[E5,hd];case"Map":return[M5,hd];case"Set":return[I5,hd];case"DataView":return[y0,n]}return n.includes("Array")?[y0,n]:n.includes("Error")?[IR,n]:[R1,n]},Tp=([e,t])=>e===tb&&(t==="function"||t==="symbol"),iX=(e,t,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=kf(o);switch(a){case tb:{let u=o;switch(l){case"bigint":a=NR,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([MR],o)}return s([a,u],o)}case y0:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),s([l,[...f]],o)}const u=[],d=s([a,u],o);for(const f of o)u.push(i(f));return d}case R1:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],d=s([a,u],o);for(const f of sX(o))(e||!Tp(kf(o[f])))&&u.push([i(f),i(o[f])]);return d}case A5:return s([a,o.toISOString()],o);case E5:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case M5:{const u=[],d=s([a,u],o);for(const[f,m]of o)(e||!(Tp(kf(f))||Tp(kf(m))))&&u.push([i(f),i(m)]);return d}case I5:{const u=[],d=s([a,u],o);for(const f of o)(e||!Tp(kf(f)))&&u.push(i(f));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},T7=(e,{json:t,lossy:n}={})=>{const r=[];return iX(!(t||n),!!t,new Map,r)(e),r},L1=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?S7(T7(e,t)):structuredClone(e):(e,t)=>S7(T7(e,t));function oX(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 aX(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function lX(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||oX,r=e.options.footnoteBackLabel||aX,s=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 u=e.all(c),d=String(c.identifier).toUpperCase(),f=qh(d.toLowerCase());let m=0;const p=[],y=e.footnoteCounts.get(d);for(;y!==void 0&&++m<=y;){p.length>0&&p.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,m);typeof v=="string"&&(v={type:"text",value:v}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=u[u.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...p)}else u.push(...p);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...L1(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const Rm=function(e){if(e==null)return hX;if(typeof e=="function")return nb(e);if(typeof e=="object")return Array.isArray(e)?cX(e):uX(e);if(typeof e=="string")return dX(e);throw new Error("Expected function, string, or object as test")};function cX(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rm(e[n]);return nb(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function uX(e){const t=e;return nb(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function dX(e){return nb(t);function t(n){return n&&n.type===e}}function nb(e){return t;function t(n,r,s){return!!(fX(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function hX(){return!0}function fX(e){return e!==null&&typeof e=="object"&&"type"in e}const RR=[],mX=!0,Zw=!1,LR="skip";function N5(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Rm(s),o=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=RR,p,y,w;if((!t||i(l,c,u[u.length-1]||void 0))&&(m=pX(n(l,u)),m[0]===Zw))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==LR)for(y=(r?b.children.length:-1)+o,w=u.concat(b);y>-1&&y<b.children.length;){const v=b.children[y];if(p=a(v,y,w)(),p[0]===Zw)return p;y=typeof p[1]=="number"?p[1]:y+o}}return m}}}function pX(e){return Array.isArray(e)?e:typeof e=="number"?[mX,e]:e==null?RR:[e]}function R5(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),N5(e,i,a,s);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const ex={}.hasOwnProperty,gX={};function yX(e,t){const n=t||gX,r=new Map,s=new Map,i=new Map,o={...tX,...n.handlers},a={all:c,applyData:vX,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:bX,wrap:xX};return R5(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:s,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,m=a.handlers[f];if(ex.call(a.handlers,f)&&m)return m(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:y,...w}=u,b=L1(w);return b.children=a.all(u),b}return L1(u)}return(a.options.unknownHandler||wX)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let m=-1;for(;++m<f.length;){const p=a.one(f[m],u);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=C7(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=C7(y.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function bX(e,t){e.position&&(t.position=aG(e))}function vX(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,L1(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function wX(e,t){const n=t.data||{},r="value"in t&&!(ex.call(n,"hProperties")||ex.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function xX(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function C7(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function A7(e,t){const n=yX(e,t),r=n.one(e,void 0),s=lX(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function _X(e,t){return e&&"run"in e?async function(n,r){const s=A7(n,{file:r,...t});await e.run(s,r)}:function(n,r){return A7(n,{file:r,...e||t})}}function E7(e){if(e)throw e}var Lg=Object.prototype.hasOwnProperty,jR=Object.prototype.toString,M7=Object.defineProperty,I7=Object.getOwnPropertyDescriptor,N7=function(t){return typeof Array.isArray=="function"?Array.isArray(t):jR.call(t)==="[object Array]"},R7=function(t){if(!t||jR.call(t)!=="[object Object]")return!1;var n=Lg.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Lg.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Lg.call(t,s)},L7=function(t,n){M7&&n.name==="__proto__"?M7(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},j7=function(t,n){if(n==="__proto__")if(Lg.call(t,n)){if(I7)return I7(t,n).value}else return;return t[n]},kX=function e(){var t,n,r,s,i,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=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)r=j7(a,n),s=j7(t,n),a!==s&&(u&&s&&(R7(s)||(i=N7(s)))?(i?(i=!1,o=r&&N7(r)?r:[]):o=r&&R7(r)?r:{},L7(a,{name:n,newValue:e(u,o,s)})):typeof s<"u"&&L7(a,{name:n,newValue:s}));return a};const s4=ky(kX);function tx(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 SX(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=e[++i];let d=-1;if(l){o(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?TX(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function TX(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(s);try{l=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,t(o,...a))}function i(o){s(null,o)}}const ra={basename:CX,dirname:AX,extname:EX,join:MX,sep:"/"};function CX(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lm(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function AX(e){if(Lm(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function EX(e){Lm(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function MX(...e){let t=-1,n;for(;++t<e.length;)Lm(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":IX(n)}function IX(e){Lm(e);const t=e.codePointAt(0)===47;let n=NX(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function NX(e,t){let n="",r=0,s=-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(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function Lm(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const RX={cwd:LX};function LX(){return"/"}function nx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jX(e){if(typeof e=="string")e=new URL(e);else if(!nx(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 DX(e)}function DX(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const i4=["history","path","basename","stem","extname","dirname"];class DR{constructor(t){let n;t?nx(t)?n={path:t}:typeof t=="string"||OX(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":RX.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<i4.length;){const i=i4[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)i4.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ra.basename(this.path):void 0}set basename(t){a4(t,"basename"),o4(t,"basename"),this.path=ra.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ra.dirname(this.path):void 0}set dirname(t){D7(this.basename,"dirname"),this.path=ra.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ra.extname(this.path):void 0}set extname(t){if(o4(t,"extname"),D7(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=ra.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){nx(t)&&(t=jX(t)),a4(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ra.basename(this.path,this.extname):void 0}set stem(t){a4(t,"stem"),o4(t,"stem"),this.path=ra.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Bs(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function o4(e,t){if(e&&e.includes(ra.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ra.sep+"`")}function a4(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function D7(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function OX(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const BX=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},PX={}.hasOwnProperty;class L5 extends BX{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=SX()}copy(){const t=new L5;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(s4(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(u4("data",this.frozen),this.namespace[t]=n,this):PX.call(this.namespace,t)&&this.namespace[t]||void 0:t?(u4("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Cp(t),r=this.parser||this.Parser;return l4("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),l4("process",this.parser||this.Parser),c4("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=Cp(t),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const m=d,p=r.stringify(m,f);FX(p)?f.value=p:f.result=p,c(u,f)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),l4("processSync",this.parser||this.Parser),c4("processSync",this.compiler||this.Compiler),this.process(t,s),B7("processSync","process",n),r;function s(i,o){n=!0,E7(i),r=o}}run(t,n,r){O7(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=Cp(n);s.run(t,l,c);function c(u,d,f){const m=d||t;u?a(u):o?o(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),B7("runSync","run",r),s;function i(o,a){E7(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=Cp(n),s=this.compiler||this.Compiler;return c4("stringify",s),O7(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(u4("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[u,...d]=c;l(u,d)}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&&(s.settings=s4(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[m,...p]=u;const y=r[f][1];tx(y)&&tx(m)&&(m=s4(!0,y,m)),r[f]=[c,m,...p]}}}}const $X=new L5().freeze();function l4(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function c4(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function u4(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 O7(e){if(!tx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function B7(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cp(e){return zX(e)?e:new DR(e)}function zX(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function FX(e){return typeof e=="string"||UX(e)}function UX(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qX="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",P7=[],$7={allowDangerousHtml:!0},HX=/^(https?|ircs?|mailto|xmpp)$/i,VX=[{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 WX(e){const t=GX(e),n=KX(e);return YX(t.runSync(t.parse(n),n),e)}function GX(e){const t=e.rehypePlugins||P7,n=e.remarkPlugins||P7,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$7}:$7;return $X().use(MY).use(n).use(_X,r).use(t)}function KX(e){const t=e.children||"",n=new DR;return typeof t=="string"&&(n.value=t),n}function YX(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||XX;for(const u of VX)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+qX+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),R5(e,c),hG(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let m;for(m in t4)if(Object.hasOwn(t4,m)&&Object.hasOwn(u.properties,m)){const p=u.properties[m],y=t4[m];(y===null||y.includes(u.tagName))&&(u.properties[m]=l(String(p||""),m,u))}}if(u.type==="element"){let m=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!m&&r&&typeof d=="number"&&(m=!r(u,d,f)),m&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function XX(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||HX.test(e.slice(0,t))?e:""}function j1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function QX(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function JX(e,t,n){const s=Rm((n||{}).ignore||[]),i=ZX(t);let o=-1;for(;++o<i.length;)N5(e,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const m=u[d],p=f?f.children:void 0;if(s(m,p?p.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[o][0],m=i[o][1];let p=0;const w=d.children.indexOf(c);let b=!1,v=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const S=x.index,C={index:x.index,input:x.input,stack:[...u,c]};let E=m(...x,C);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?f.lastIndex=S+1:(p!==S&&v.push({type:"text",value:c.value.slice(p,S)}),Array.isArray(E)?v.push(...E):E&&v.push(E),p=S+x[0].length,b=!0),!f.global)break;x=f.exec(c.value)}return b?(p<c.value.length&&v.push({type:"text",value:c.value.slice(p)}),d.children.splice(w,1,...v)):v=[c],w+v.length}}function ZX(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([eQ(s[0]),tQ(s[1])])}return t}function eQ(e){return typeof e=="string"?new RegExp(QX(e),"g"):e}function tQ(e){return typeof e=="function"?e:function(){return e}}const d4="phrasing",h4=["autolink","link","image","label"];function nQ(){return{transforms:[cQ],enter:{literalAutolink:sQ,literalAutolinkEmail:f4,literalAutolinkHttp:f4,literalAutolinkWww:f4},exit:{literalAutolink:lQ,literalAutolinkEmail:aQ,literalAutolinkHttp:iQ,literalAutolinkWww:oQ}}}function rQ(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:d4,notInConstruct:h4},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:d4,notInConstruct:h4},{character:":",before:"[ps]",after:"\\/",inConstruct:d4,notInConstruct:h4}]}}function sQ(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function f4(e){this.config.enter.autolinkProtocol.call(this,e)}function iQ(e){this.config.exit.autolinkProtocol.call(this,e)}function oQ(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 aQ(e){this.config.exit.autolinkEmail.call(this,e)}function lQ(e){this.exit(e)}function cQ(e){JX(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,uQ],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),dQ]],{ignore:["link","linkReference"]})}function uQ(e,t,n,r,s){let i="";if(!OR(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!hQ(n)))return!1;const o=fQ(n+r);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 dQ(e,t,n,r){return!OR(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function hQ(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 fQ(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=j1(e,"(");let i=j1(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function OR(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Du(n)||Zy(n))&&(!t||n!==47)}BR.peek=_Q;function mQ(){this.buffer()}function pQ(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function gQ(){this.buffer()}function yQ(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bQ(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ro(this.sliceSerialize(e)).toLowerCase(),n.label=t}function vQ(e){this.exit(e)}function wQ(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ro(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xQ(e){this.exit(e)}function _Q(){return"["}function BR(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function kQ(){return{enter:{gfmFootnoteCallString:mQ,gfmFootnoteCall:pQ,gfmFootnoteDefinitionLabelString:gQ,gfmFootnoteDefinition:yQ},exit:{gfmFootnoteCallString:bQ,gfmFootnoteCall:vQ,gfmFootnoteDefinitionLabelString:wQ,gfmFootnoteDefinition:xQ}}}function SQ(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:BR},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(r,a.current()),t?PR:TQ))),c(),l}}function TQ(e,t,n){return t===0?e:PR(e,t,n)}function PR(e,t,n){return(n?"":"    ")+e}const CQ=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$R.peek=NQ;function AQ(){return{canContainEols:["delete"],enter:{strikethrough:MQ},exit:{strikethrough:IQ}}}function EQ(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:CQ}],handlers:{delete:$R}}}function MQ(e){this.enter({type:"delete",children:[]},e)}function IQ(e){this.exit(e)}function $R(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function NQ(){return"~"}function RQ(e){return e.length}function LQ(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||RQ,i=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const y=[],w=[];let b=-1;for(e[u].length>c&&(c=e[u].length);++b<e[u].length;){const v=jQ(e[u][b]);if(n.alignDelimiters!==!1){const x=s(v);w[b]=x,(l[b]===void 0||x>l[b])&&(l[b]=x)}y.push(v)}o[u]=y,a[u]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=z7(r[d]);else{const y=z7(r);for(;++d<c;)i[d]=y}d=-1;const f=[],m=[];for(;++d<c;){const y=i[d];let w="",b="";y===99?(w=":",b=":"):y===108?w=":":y===114&&(b=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[d]-w.length-b.length);const x=w+"-".repeat(v)+b;n.alignDelimiters!==!1&&(v=w.length+v+b.length,v>l[d]&&(l[d]=v),m[d]=v),f[d]=x}o.splice(1,0,f),a.splice(1,0,m),u=-1;const p=[];for(;++u<o.length;){const y=o[u],w=a[u];d=-1;const b=[];for(;++d<c;){const v=y[d]||"";let x="",S="";if(n.alignDelimiters!==!1){const C=l[d]-(w[d]||0),E=i[d];E===114?x=" ".repeat(C):E===99?C%2?(x=" ".repeat(C/2+.5),S=" ".repeat(C/2-.5)):(x=" ".repeat(C/2),S=x):S=" ".repeat(C)}n.delimiterStart!==!1&&!d&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||d)&&b.push(" "),n.alignDelimiters!==!1&&b.push(x),b.push(v),n.alignDelimiters!==!1&&b.push(S),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
`)}function jQ(e){return e==null?"":String(e)}function z7(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 F7={}.hasOwnProperty;function DQ(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&F7.call(s,e)){const l=String(s[e]);o=F7.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function OQ(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),BQ);return s(),o}function BQ(e,t,n){return">"+(n?"":" ")+e}function PQ(e,t){return U7(e,t.inConstruct,!0)&&!U7(e,t.notInConstruct,!1)}function U7(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function q7(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&PQ(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function zR(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function $Q(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 zQ(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 FQ(e,t,n,r){const s=zQ(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if($Q(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,UQ);return d(),f}const a=n.createTracker(r),l=s.repeat(Math.max(zR(i,s)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:`
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
`),i&&(u+=a.move(i+`
`)),u+=a.move(l),c(),u}function UQ(e,t,n){return(n?"":"    ")+e}function j5(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 qQ(e,t,n,r){const s=j5(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);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(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),o(),c}function HQ(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 V0(e){return"&#x"+e.toString(16).toUpperCase()+";"}function D1(e,t,n){const r=yh(e),s=yh(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}FR.peek=VQ;function FR(e,t,n,r){const s=HQ(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=D1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=V0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=D1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+V0(d));const m=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function VQ(e,t,n){return n.options.emphasis||"*"}function WQ(e,t){let n=!1;return R5(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Zw}),!!((!e.depth||e.depth<3)&&S5(e)&&(t.options.setext||n))}function GQ(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(WQ(e,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return d(),u(),f+`
`+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
`))+1))}const o="#".repeat(s),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=V0(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}UR.peek=KQ;function UR(e){return e.value||""}function KQ(){return"<"}qR.peek=YQ;function qR(e,t,n,r){const s=j5(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);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(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),o(),c}function YQ(){return"!"}HR.peek=XQ;function HR(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function XQ(){return"!"}VR.peek=QQ;function VR(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return s+r+s}function QQ(){return"`"}function WR(e,t){const n=S5(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))}GR.peek=JQ;function GR(e,t,n,r){const s=j5(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(WR(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}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(" "+s),c+=o.move(n.safe(e.title,{before:c,after:s,...o.current()})),c+=o.move(s),l()),c+=o.move(")"),a(),c}function JQ(e,t,n){return WR(e,n)?"<":"["}KR.peek=ZQ;function KR(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function ZQ(){return"["}function D5(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 eJ(e){const t=D5(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 tJ(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 YR(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 nJ(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?tJ(n):D5(n);const a=e.ordered?o==="."?")":".":eJ(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.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),YR(n)===o&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];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,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),c}function rJ(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 sJ(e,t,n,r){const s=rJ(n);let i=n.bulletCurrent||D5(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,m){return f?(m?"":" ".repeat(o))+d:(m?i:i+" ".repeat(o-i.length))+d}}function iJ(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const oJ=Rm(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aJ(e,t,n,r){return(e.children.some(function(o){return oJ(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function lJ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}XR.peek=cJ;function XR(e,t,n,r){const s=lJ(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=D1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=V0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=D1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+V0(d));const m=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function cJ(e,t,n){return n.options.strong||"*"}function uJ(e,t,n,r){return n.safe(e.value,r)}function dJ(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 hJ(e,t,n){const r=(YR(n)+(n.options.ruleSpaces?" ":"")).repeat(dJ(n));return n.options.ruleSpaces?r.slice(0,-1):r}const QR={blockquote:OQ,break:q7,code:FQ,definition:qQ,emphasis:FR,hardBreak:q7,heading:GQ,html:UR,image:qR,imageReference:HR,inlineCode:VR,link:GR,linkReference:KR,list:nJ,listItem:sJ,paragraph:iJ,root:aJ,strong:XR,text:uJ,thematicBreak:hJ};function fJ(){return{enter:{table:mJ,tableData:H7,tableHeader:H7,tableRow:gJ},exit:{codeText:yJ,table:pJ,tableData:m4,tableHeader:m4,tableRow:m4}}}function mJ(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 pJ(e){this.exit(e),this.data.inTable=void 0}function gJ(e){this.enter({type:"tableRow",children:[]},e)}function m4(e){this.exit(e)}function H7(e){this.enter({type:"tableCell",children:[]},e)}function yJ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,bJ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function bJ(e,t){return t==="|"?t:e}function vJ(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(m,p,y,w){return c(u(m,y,w),m.align)}function a(m,p,y,w){const b=d(m,y,w),v=c([b]);return v.slice(0,v.indexOf(`
`))}function l(m,p,y,w){const b=y.enter("tableCell"),v=y.enter("phrasing"),x=y.containerPhrasing(m,{...w,before:i,after:i});return v(),b(),x}function c(m,p){return LQ(m,{align:p,alignDelimiters:r,padding:n,stringLength:s})}function u(m,p,y){const w=m.children;let b=-1;const v=[],x=p.enter("table");for(;++b<w.length;)v[b]=d(w[b],p,y);return x(),v}function d(m,p,y){const w=m.children;let b=-1;const v=[],x=p.enter("tableRow");for(;++b<w.length;)v[b]=l(w[b],m,p,y);return x(),v}function f(m,p,y){let w=QR.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function wJ(){return{exit:{taskListCheckValueChecked:V7,taskListCheckValueUnchecked:V7,paragraph:_J}}}function xJ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:kJ}}}function V7(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function _J(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function kJ(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=QR.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function SJ(){return[nQ(),kQ(),AQ(),fJ(),wJ()]}function TJ(e){return{extensions:[rQ(),SQ(e),EQ(),vJ(e),xJ()]}}const CJ={tokenize:RJ,partial:!0},JR={tokenize:LJ,partial:!0},ZR={tokenize:jJ,partial:!0},eL={tokenize:DJ,partial:!0},AJ={tokenize:OJ,partial:!0},tL={name:"wwwAutolink",tokenize:IJ,previous:rL},nL={name:"protocolAutolink",tokenize:NJ,previous:sL},pl={name:"emailAutolink",tokenize:MJ,previous:iL},xa={};function EJ(){return{text:xa}}let Wc=48;for(;Wc<123;)xa[Wc]=pl,Wc++,Wc===58?Wc=65:Wc===91&&(Wc=97);xa[43]=pl;xa[45]=pl;xa[46]=pl;xa[95]=pl;xa[72]=[pl,nL];xa[104]=[pl,nL];xa[87]=[pl,tL];xa[119]=[pl,tL];function MJ(e,t,n){const r=this;let s,i;return o;function o(d){return!rx(d)||!iL.call(r,r.previous)||O5(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return rx(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(AJ,u,c)(d):d===45||d===95||Ls(d)?(i=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),s=!0,l}function u(d){return i&&s&&Ys(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function IJ(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!rL.call(r,r.previous)||O5(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(CJ,e.attempt(JR,e.attempt(ZR,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function NJ(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&sL.call(r,r.previous)&&!O5(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Ys(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||N1(d)||er(d)||Du(d)||Zy(d)?n(d):e.attempt(JR,e.attempt(ZR,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function RJ(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function LJ(e,t,n){let r,s,i;return o;function o(c){return c===46||c===95?e.check(eL,l,a)(c):c===null||er(c)||Du(c)||c!==45&&Zy(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),e.consume(c),o}function l(c){return s||r||!i?n(c):t(c)}}function jJ(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(eL,t,i)(o):o===null||er(o)||Du(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function DJ(e,t,n){return r;function r(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),r):a===38?(e.consume(a),i):a===93?(e.consume(a),s):a===60||a===null||er(a)||Du(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||er(a)||Du(a)?t(a):r(a)}function i(a){return Ys(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ys(a)?(e.consume(a),o):n(a)}}function OJ(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Ls(i)?n(i):t(i)}}function rL(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||er(e)}function sL(e){return!Ys(e)}function iL(e){return!(e===47||rx(e))}function rx(e){return e===43||e===45||e===46||e===95||Ls(e)}function O5(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const BJ={tokenize:VJ,partial:!0};function PJ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:UJ,continuation:{tokenize:qJ},exit:HJ}},text:{91:{name:"gfmFootnoteCall",tokenize:FJ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$J,resolveTo:zJ}}}}function $J(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][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=Ro(r.sliceSerialize({start:o.end,end:r.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 zJ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function FJ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!o||d===null||d===91||er(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(Ro(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return er(d)||(o=!0),i++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),i++,c):c(d)}}function UJ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(p)}function u(p){if(o>999||p===93&&!a||p===null||p===91||er(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Ro(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return er(p)||(a=!0),o++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),o++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s.includes(i)||s.push(i),ln(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function qJ(e,t,n){return e.check(Nm,t,e.attempt(BJ,t,n))}function HJ(e){e.exit("gfmFootnoteDefinition")}function VJ(e,t,n){const r=this;return ln(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function WJ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,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 u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],m=a.parser.constructs.insideSpan.null;m&&zi(f,f.length,0,eb(m,o.slice(c+1,l),a)),zi(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),zi(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,u=this.events;let d=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const y=yh(c);if(p===126)return d>1?l(p):(o.consume(p),d++,m);if(d<2&&!n)return l(p);const w=o.exit("strikethroughSequenceTemporary"),b=yh(p);return w._open=!b||b===2&&!!y,w._close=!y||y===2&&!!b,a(p)}}}class GJ{constructor(){this.map=[]}add(t,n,r){KJ(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function KJ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function YJ(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function XJ(){return{flow:{null:{name:"table",tokenize:QJ,resolveAll:JJ}}}}function QJ(e,t,n){const r=this;let s=0,i=0,o;return a;function a(A){let j=r.events.length-1;for(;j>-1;){const F=r.events[j][1].type;if(F==="lineEnding"||F==="linePrefix")j--;else break}const I=j>-1?r.events[j][1].type:null,P=I==="tableHead"||I==="tableRow"?E:l;return P===E&&r.parser.lazy[r.now().line]?n(A):P(A)}function l(A){return e.enter("tableHead"),e.enter("tableRow"),c(A)}function c(A){return A===124||(o=!0,i+=1),u(A)}function u(A){return A===null?n(A):Ct(A)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),m):n(A):hn(A)?ln(e,u,"whitespace")(A):(i+=1,o&&(o=!1,s+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(A)))}function d(A){return A===null||A===124||er(A)?(e.exit("data"),u(A)):(e.consume(A),A===92?f:d)}function f(A){return A===92||A===124?(e.consume(A),d):d(A)}function m(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),o=!1,hn(A)?ln(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):p(A))}function p(A){return A===45||A===58?w(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),y):C(A)}function y(A){return hn(A)?ln(e,w,"whitespace")(A):w(A)}function w(A){return A===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),b):A===45?(i+=1,b(A)):A===null||Ct(A)?S(A):C(A)}function b(A){return A===45?(e.enter("tableDelimiterFiller"),v(A)):C(A)}function v(A){return A===45?(e.consume(A),v):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(A))}function x(A){return hn(A)?ln(e,S,"whitespace")(A):S(A)}function S(A){return A===124?p(A):A===null||Ct(A)?!o||s!==i?C(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):C(A)}function C(A){return n(A)}function E(A){return e.enter("tableRow"),M(A)}function M(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),M):A===null||Ct(A)?(e.exit("tableRow"),t(A)):hn(A)?ln(e,M,"whitespace")(A):(e.enter("data"),D(A))}function D(A){return A===null||A===124||er(A)?(e.exit("data"),M(A)):(e.consume(A),A===92?O:D)}function O(A){return A===92||A===124?(e.consume(A),D):D(A)}}function JJ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new GJ;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(W7(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",u,t]])),s=p.type==="tableDelimiterRow"?2:u?3:1):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=Ap(f,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=Ap(f,t,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],d=Ap(f,t,i,s,n,d)):o[1]!==0&&(d=Ap(f,t,o,s,n,d)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&W7(f,t,l,c,u),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=YJ(t.events,n))}return e}function Ap(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},xd(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=xd(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=xd(t.events,n[2]),u=xd(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==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 p=n[2]+1,y=n[3]-n[2]-1;e.add(p,y,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return s!==void 0&&(i.end=Object.assign({},xd(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function W7(e,t,n,r,s){const i=[],o=xd(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function xd(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const ZJ={name:"tasklistCheck",tokenize:tZ};function eZ(){return{text:{91:ZJ}}}function tZ(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return er(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 Ct(l)?t(l):hn(l)?e.check({tokenize:nZ},t,n)(l):n(l)}}function nZ(e,t,n){return ln(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function rZ(e){return mR([EJ(),PJ(),WJ(e),XJ(),eZ()])}const sZ={};function G7(e){const t=this,n=e||sZ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(rZ(n)),i.push(SJ()),o.push(TJ(n))}function iZ(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:s,mathFlowFence:r,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 r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c;const d=u.data.hChildren[0];d.type,d.tagName,d.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(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.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 oZ(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,o,a,l){const c=i.value||"",u=a.createTracker(l),d="$".repeat(Math.max(zR(c,"$")+1,2)),f=a.enter("mathFlow");let m=u.move(d);if(i.meta){const p=a.enter("mathFlowMeta");m+=u.move(a.safe(i.meta,{after:`
`,before:m,encode:["$"],...u.current()})),p()}return m+=u.move(`
`),c&&(m+=u.move(c+`
`)),m+=u.move(d),f(),m}function r(i,o,a){let l=i.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++d<a.unsafe.length;){const f=a.unsafe[d];if(!f.atBreak)continue;const m=a.compilePattern(f);let p;for(;p=m.exec(l);){let y=p.index;l.codePointAt(y)===10&&l.codePointAt(y-1)===13&&y--,l=l.slice(0,y)+" "+l.slice(p.index+1)}}return u+l+u}function s(){return"$"}}const aZ={tokenize:lZ,concrete:!0,name:"mathFlow"},K7={tokenize:cZ,partial:!0};function lZ(e,t,n){const r=this,s=r.events[r.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let o=0;return 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"),ln(e,c,"whitespace")(v))}function c(v){return v===null||Ct(v)?d(v):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(v))}function u(v){return v===null||Ct(v)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(v)):v===36?n(v):(e.consume(v),u)}function d(v){return e.exit("mathFlowFence"),r.interrupt?t(v):e.attempt(K7,f,w)(v)}function f(v){return e.attempt({tokenize:b,partial:!0},w,m)(v)}function m(v){return(i?ln(e,p,"linePrefix",i+1):p)(v)}function p(v){return v===null?w(v):Ct(v)?e.attempt(K7,f,w)(v):(e.enter("mathFlowValue"),y(v))}function y(v){return v===null||Ct(v)?(e.exit("mathFlowValue"),p(v)):(e.consume(v),y)}function w(v){return e.exit("mathFlow"),t(v)}function b(v,x,S){let C=0;return ln(v,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function E(O){return v.enter("mathFlowFence"),v.enter("mathFlowFenceSequence"),M(O)}function M(O){return O===36?(C++,v.consume(O),M):C<o?S(O):(v.exit("mathFlowFenceSequence"),ln(v,D,"whitespace")(O))}function D(O){return O===null||Ct(O)?(v.exit("mathFlowFence"),x(O)):S(O)}}}function cZ(e,t,n){const r=this;return s;function s(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function uZ(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:dZ,previous:hZ,name:"mathText"};function r(s,i,o){let a=0,l,c;return u;function u(y){return s.enter("mathText"),s.enter("mathTextSequence"),d(y)}function d(y){return y===36?(s.consume(y),a++,d):a<2&&!n?o(y):(s.exit("mathTextSequence"),f(y))}function f(y){return y===null?o(y):y===36?(c=s.enter("mathTextSequence"),l=0,p(y)):y===32?(s.enter("space"),s.consume(y),s.exit("space"),f):Ct(y)?(s.enter("lineEnding"),s.consume(y),s.exit("lineEnding"),f):(s.enter("mathTextData"),m(y))}function m(y){return y===null||y===32||y===36||Ct(y)?(s.exit("mathTextData"),f(y)):(s.consume(y),m)}function p(y){return y===36?(s.consume(y),l++,p):l===a?(s.exit("mathTextSequence"),s.exit("mathText"),i(y)):(c.type="mathTextData",m(y))}}}function dZ(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="mathTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function hZ(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function fZ(e){return{flow:{36:aZ},text:{36:uZ(e)}}}class $e extends Error{constructor(t,n){var r="KaTeX parse error: "+t,s,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;s=o.start,i=o.end,s===a.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var l=a.slice(s,i).replace(/[^]/g,"$&̲"),c;s>15?c="…"+a.slice(s-15,s):c=a.slice(0,s);var u;i+15<a.length?u=a.slice(i,i+15)+"…":u=a.slice(i),r+=c+l+u}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,$e.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var mZ=/([A-Z])/g,pZ=e=>e.replace(mZ,"-$1").toLowerCase(),gZ={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},yZ=/[&><"']/g,Os=e=>String(e).replace(yZ,t=>gZ[t]),jg=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?jg(e.body[0]):e:e.type==="font"?jg(e.body):e,bZ=new Set(["mathord","textord","atom"]),gl=e=>bZ.has(jg(e).type),vZ=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"},O1={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 wZ(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 xZ(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return wZ(t)}function _Z(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:xZ(r)}class B5{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(O1)){var r=O1[n];r&&_Z(this,n,t,r)}}reportNonstrict(t,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(t,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new $e("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,r){var s=this.strict;if(typeof s=="function")try{s=s(t,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=vZ(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class Al{constructor(t,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=r}sup(){return sa[kZ[this.id]]}sub(){return sa[SZ[this.id]]}fracNum(){return sa[TZ[this.id]]}fracDen(){return sa[CZ[this.id]]}cramp(){return sa[AZ[this.id]]}text(){return sa[EZ[this.id]]}isTight(){return this.size>=2}}var P5=0,B1=1,Qd=2,tl=3,W0=4,ho=5,bh=6,Qs=7,sa=[new Al(P5,0,!1),new Al(B1,0,!0),new Al(Qd,1,!1),new Al(tl,1,!0),new Al(W0,2,!1),new Al(ho,2,!0),new Al(bh,3,!1),new Al(Qs,3,!0)],kZ=[W0,ho,W0,ho,bh,Qs,bh,Qs],SZ=[ho,ho,ho,ho,Qs,Qs,Qs,Qs],TZ=[Qd,tl,W0,ho,bh,Qs,bh,Qs],CZ=[tl,tl,ho,ho,Qs,Qs,Qs,Qs],AZ=[B1,B1,tl,tl,ho,ho,Qs,Qs],EZ=[P5,B1,Qd,tl,Qd,tl,Qd,tl],Gt={DISPLAY:sa[P5],TEXT:sa[Qd],SCRIPT:sa[W0],SCRIPTSCRIPT:sa[bh]},sx=[{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 MZ(e){for(var t=0;t<sx.length;t++)for(var n=sx[t],r=0;r<n.blocks.length;r++){var s=n.blocks[r];if(e>=s[0]&&e<=s[1])return n.name}return null}var Dg=[];sx.forEach(e=>e.blocks.forEach(t=>Dg.push(...t)));function oL(e){for(var t=0;t<Dg.length;t+=2)if(e>=Dg[t]&&e<=Dg[t+1])return!0;return!1}var Qr=e=>e+" "+e,fd=80,IZ=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"},NZ=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"},RZ=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"},LZ=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"},jZ=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"},DZ=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},OZ=function(t,n,r){var s=r-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},BZ=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=IZ(n,fd);break;case"sqrtSize1":s=NZ(n,fd);break;case"sqrtSize2":s=RZ(n,fd);break;case"sqrtSize3":s=LZ(n,fd);break;case"sqrtSize4":s=jZ(n,fd);break;case"sqrtTall":s=OZ(n,fd,r)}return s},PZ=function(t,n){switch(t){case"⎜":return Qr("M291 0 H417 V"+n+" H291z");case"∣":return Qr("M145 0 H188 V"+n+" H145z");case"∥":return Qr("M145 0 H188 V"+n+" H145z")+Qr("M367 0 H410 V"+n+" H367z");case"⎟":return Qr("M457 0 H583 V"+n+" H457z");case"⎢":return Qr("M319 0 H403 V"+n+" H319z");case"⎥":return Qr("M263 0 H347 V"+n+" H263z");case"⎪":return Qr("M384 0 H504 V"+n+" H384z");case"⏐":return Qr("M312 0 H355 V"+n+" H312z");case"‖":return Qr("M257 0 H300 V"+n+" H257z")+Qr("M478 0 H521 V"+n+" H478z");default:return""}},Y7={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:Qr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Qr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Qr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Qr("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:Qr("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:Qr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Qr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Qr("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`},$Z=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 zZ(e){return"toText"in e}class Hh{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(zZ(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var ix={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},FZ={ex:!0,em:!0,mu:!0},aL=function(t){return typeof t!="string"&&(t=t.unit),t in ix||t in FZ||t==="ex"},_r=function(t,n){var r;if(t.unit in ix)r=ix[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,t.unit==="ex")r=s.fontMetrics().xHeight;else if(t.unit==="em")r=s.fontMetrics().quad;else throw new $e("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},Ve=function(t){return+t.toFixed(4)+"em"},vc=function(t){return t.filter(n=>n).join(" ")},$5=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=pZ(r)+":"+s+";")}return n},lL=function(t,n,r){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},cL=function(t){var n=document.createElement(t);n.className=vc(this.classes),Object.assign(n.style,this.style);for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n},UZ=/[\s"'>/=\x00-\x1f]/,uL=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Os(vc(this.classes))+'"');var r=$5(this.style);r&&(n+=' style="'+Os(r)+'"');for(var s of Object.keys(this.attributes)){if(UZ.test(s))throw new $e("Invalid attribute name '"+s+"'");n+=" "+s+'="'+Os(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class Vh{constructor(t,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,lL.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return cL.call(this,"span")}toMarkup(){return uL.call(this,"span")}}class rb{constructor(t,n,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,lL.call(this,n,s),this.children=r||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return cL.call(this,"a")}toMarkup(){return uL.call(this,"a")}}class qZ{constructor(t,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+Os(this.src)+'"'+(' alt="'+Os(this.alt)+'"'),n=$5(this.style);return n&&(t+=' style="'+Os(n)+'"'),t+="'/>",t}}var HZ={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Hi{constructor(t,n,r,s,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=r||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=MZ(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=HZ[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=Ve(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=vc(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+=Os(vc(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+Ve(this.italic)+";"),r+=$5(this.style),r&&(t=!0,n+=' style="'+Os(r)+'"');var s=Os(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class ul{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+Os(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class wc{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",Y7[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+Os(this.alternate)+'"/>':'<path d="'+Os(Y7[this.pathName])+'"/>'}}class ox{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+Os(this.attributes[n])+'"';return t+="/>",t}}function VZ(e){if(e instanceof Hi)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function WZ(e){if(e instanceof Vh)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var GZ=e=>e instanceof Vh||e instanceof rb||e instanceof Hh,da={"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]}},Ep={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]},X7={Å:"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 dL(e,t){da[e]=t}function z5(e,t,n){if(!da[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=da[t][r];if(!s&&e[0]in X7&&(r=X7[e[0]].charCodeAt(0),s=da[t][r]),!s&&n==="text"&&oL(r)&&(s=da[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var p4={};function KZ(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!p4[t]){var n=p4[t]={cssEmPerMu:Ep.quad[t]/18};for(var r in Ep)Ep.hasOwnProperty(r)&&(n[r]=Ep[r][t])}return p4[t]}var gr={math:{},text:{}};function _(e,t,n,r,s,i){gr[e][s]={font:t,group:n,replace:r},i&&r&&(gr[e][r]=gr[e][s])}var T="math",Ae="text",L="main",H="ams",yr="accent-token",gt="bin",ti="close",Wh="inner",Bt="mathord",Vr="op-token",Vi="open",jm="punct",W="rel",yl="spacing",Z="textord";_(T,L,W,"≡","\\equiv",!0);_(T,L,W,"≺","\\prec",!0);_(T,L,W,"≻","\\succ",!0);_(T,L,W,"∼","\\sim",!0);_(T,L,W,"⊥","\\perp");_(T,L,W,"⪯","\\preceq",!0);_(T,L,W,"⪰","\\succeq",!0);_(T,L,W,"≃","\\simeq",!0);_(T,L,W,"∣","\\mid",!0);_(T,L,W,"≪","\\ll",!0);_(T,L,W,"≫","\\gg",!0);_(T,L,W,"≍","\\asymp",!0);_(T,L,W,"∥","\\parallel");_(T,L,W,"⋈","\\bowtie",!0);_(T,L,W,"⌣","\\smile",!0);_(T,L,W,"⊑","\\sqsubseteq",!0);_(T,L,W,"⊒","\\sqsupseteq",!0);_(T,L,W,"≐","\\doteq",!0);_(T,L,W,"⌢","\\frown",!0);_(T,L,W,"∋","\\ni",!0);_(T,L,W,"∝","\\propto",!0);_(T,L,W,"⊢","\\vdash",!0);_(T,L,W,"⊣","\\dashv",!0);_(T,L,W,"∋","\\owns");_(T,L,jm,".","\\ldotp");_(T,L,jm,"⋅","\\cdotp");_(T,L,jm,"⋅","·");_(Ae,L,Z,"⋅","·");_(T,L,Z,"#","\\#");_(Ae,L,Z,"#","\\#");_(T,L,Z,"&","\\&");_(Ae,L,Z,"&","\\&");_(T,L,Z,"ℵ","\\aleph",!0);_(T,L,Z,"∀","\\forall",!0);_(T,L,Z,"ℏ","\\hbar",!0);_(T,L,Z,"∃","\\exists",!0);_(T,L,Z,"∇","\\nabla",!0);_(T,L,Z,"♭","\\flat",!0);_(T,L,Z,"ℓ","\\ell",!0);_(T,L,Z,"♮","\\natural",!0);_(T,L,Z,"♣","\\clubsuit",!0);_(T,L,Z,"℘","\\wp",!0);_(T,L,Z,"♯","\\sharp",!0);_(T,L,Z,"♢","\\diamondsuit",!0);_(T,L,Z,"ℜ","\\Re",!0);_(T,L,Z,"♡","\\heartsuit",!0);_(T,L,Z,"ℑ","\\Im",!0);_(T,L,Z,"♠","\\spadesuit",!0);_(T,L,Z,"§","\\S",!0);_(Ae,L,Z,"§","\\S");_(T,L,Z,"¶","\\P",!0);_(Ae,L,Z,"¶","\\P");_(T,L,Z,"†","\\dag");_(Ae,L,Z,"†","\\dag");_(Ae,L,Z,"†","\\textdagger");_(T,L,Z,"‡","\\ddag");_(Ae,L,Z,"‡","\\ddag");_(Ae,L,Z,"‡","\\textdaggerdbl");_(T,L,ti,"⎱","\\rmoustache",!0);_(T,L,Vi,"⎰","\\lmoustache",!0);_(T,L,ti,"⟯","\\rgroup",!0);_(T,L,Vi,"⟮","\\lgroup",!0);_(T,L,gt,"∓","\\mp",!0);_(T,L,gt,"⊖","\\ominus",!0);_(T,L,gt,"⊎","\\uplus",!0);_(T,L,gt,"⊓","\\sqcap",!0);_(T,L,gt,"∗","\\ast");_(T,L,gt,"⊔","\\sqcup",!0);_(T,L,gt,"◯","\\bigcirc",!0);_(T,L,gt,"∙","\\bullet",!0);_(T,L,gt,"‡","\\ddagger");_(T,L,gt,"≀","\\wr",!0);_(T,L,gt,"⨿","\\amalg");_(T,L,gt,"&","\\And");_(T,L,W,"⟵","\\longleftarrow",!0);_(T,L,W,"⇐","\\Leftarrow",!0);_(T,L,W,"⟸","\\Longleftarrow",!0);_(T,L,W,"⟶","\\longrightarrow",!0);_(T,L,W,"⇒","\\Rightarrow",!0);_(T,L,W,"⟹","\\Longrightarrow",!0);_(T,L,W,"↔","\\leftrightarrow",!0);_(T,L,W,"⟷","\\longleftrightarrow",!0);_(T,L,W,"⇔","\\Leftrightarrow",!0);_(T,L,W,"⟺","\\Longleftrightarrow",!0);_(T,L,W,"↦","\\mapsto",!0);_(T,L,W,"⟼","\\longmapsto",!0);_(T,L,W,"↗","\\nearrow",!0);_(T,L,W,"↩","\\hookleftarrow",!0);_(T,L,W,"↪","\\hookrightarrow",!0);_(T,L,W,"↘","\\searrow",!0);_(T,L,W,"↼","\\leftharpoonup",!0);_(T,L,W,"⇀","\\rightharpoonup",!0);_(T,L,W,"↙","\\swarrow",!0);_(T,L,W,"↽","\\leftharpoondown",!0);_(T,L,W,"⇁","\\rightharpoondown",!0);_(T,L,W,"↖","\\nwarrow",!0);_(T,L,W,"⇌","\\rightleftharpoons",!0);_(T,H,W,"≮","\\nless",!0);_(T,H,W,"","\\@nleqslant");_(T,H,W,"","\\@nleqq");_(T,H,W,"⪇","\\lneq",!0);_(T,H,W,"≨","\\lneqq",!0);_(T,H,W,"","\\@lvertneqq");_(T,H,W,"⋦","\\lnsim",!0);_(T,H,W,"⪉","\\lnapprox",!0);_(T,H,W,"⊀","\\nprec",!0);_(T,H,W,"⋠","\\npreceq",!0);_(T,H,W,"⋨","\\precnsim",!0);_(T,H,W,"⪹","\\precnapprox",!0);_(T,H,W,"≁","\\nsim",!0);_(T,H,W,"","\\@nshortmid");_(T,H,W,"∤","\\nmid",!0);_(T,H,W,"⊬","\\nvdash",!0);_(T,H,W,"⊭","\\nvDash",!0);_(T,H,W,"⋪","\\ntriangleleft");_(T,H,W,"⋬","\\ntrianglelefteq",!0);_(T,H,W,"⊊","\\subsetneq",!0);_(T,H,W,"","\\@varsubsetneq");_(T,H,W,"⫋","\\subsetneqq",!0);_(T,H,W,"","\\@varsubsetneqq");_(T,H,W,"≯","\\ngtr",!0);_(T,H,W,"","\\@ngeqslant");_(T,H,W,"","\\@ngeqq");_(T,H,W,"⪈","\\gneq",!0);_(T,H,W,"≩","\\gneqq",!0);_(T,H,W,"","\\@gvertneqq");_(T,H,W,"⋧","\\gnsim",!0);_(T,H,W,"⪊","\\gnapprox",!0);_(T,H,W,"⊁","\\nsucc",!0);_(T,H,W,"⋡","\\nsucceq",!0);_(T,H,W,"⋩","\\succnsim",!0);_(T,H,W,"⪺","\\succnapprox",!0);_(T,H,W,"≆","\\ncong",!0);_(T,H,W,"","\\@nshortparallel");_(T,H,W,"∦","\\nparallel",!0);_(T,H,W,"⊯","\\nVDash",!0);_(T,H,W,"⋫","\\ntriangleright");_(T,H,W,"⋭","\\ntrianglerighteq",!0);_(T,H,W,"","\\@nsupseteqq");_(T,H,W,"⊋","\\supsetneq",!0);_(T,H,W,"","\\@varsupsetneq");_(T,H,W,"⫌","\\supsetneqq",!0);_(T,H,W,"","\\@varsupsetneqq");_(T,H,W,"⊮","\\nVdash",!0);_(T,H,W,"⪵","\\precneqq",!0);_(T,H,W,"⪶","\\succneqq",!0);_(T,H,W,"","\\@nsubseteqq");_(T,H,gt,"⊴","\\unlhd");_(T,H,gt,"⊵","\\unrhd");_(T,H,W,"↚","\\nleftarrow",!0);_(T,H,W,"↛","\\nrightarrow",!0);_(T,H,W,"⇍","\\nLeftarrow",!0);_(T,H,W,"⇏","\\nRightarrow",!0);_(T,H,W,"↮","\\nleftrightarrow",!0);_(T,H,W,"⇎","\\nLeftrightarrow",!0);_(T,H,W,"△","\\vartriangle");_(T,H,Z,"ℏ","\\hslash");_(T,H,Z,"▽","\\triangledown");_(T,H,Z,"◊","\\lozenge");_(T,H,Z,"Ⓢ","\\circledS");_(T,H,Z,"®","\\circledR");_(Ae,H,Z,"®","\\circledR");_(T,H,Z,"∡","\\measuredangle",!0);_(T,H,Z,"∄","\\nexists");_(T,H,Z,"℧","\\mho");_(T,H,Z,"Ⅎ","\\Finv",!0);_(T,H,Z,"⅁","\\Game",!0);_(T,H,Z,"‵","\\backprime");_(T,H,Z,"▲","\\blacktriangle");_(T,H,Z,"▼","\\blacktriangledown");_(T,H,Z,"■","\\blacksquare");_(T,H,Z,"⧫","\\blacklozenge");_(T,H,Z,"★","\\bigstar");_(T,H,Z,"∢","\\sphericalangle",!0);_(T,H,Z,"∁","\\complement",!0);_(T,H,Z,"ð","\\eth",!0);_(Ae,L,Z,"ð","ð");_(T,H,Z,"╱","\\diagup");_(T,H,Z,"╲","\\diagdown");_(T,H,Z,"□","\\square");_(T,H,Z,"□","\\Box");_(T,H,Z,"◊","\\Diamond");_(T,H,Z,"¥","\\yen",!0);_(Ae,H,Z,"¥","\\yen",!0);_(T,H,Z,"✓","\\checkmark",!0);_(Ae,H,Z,"✓","\\checkmark");_(T,H,Z,"ℶ","\\beth",!0);_(T,H,Z,"ℸ","\\daleth",!0);_(T,H,Z,"ℷ","\\gimel",!0);_(T,H,Z,"ϝ","\\digamma",!0);_(T,H,Z,"ϰ","\\varkappa");_(T,H,Vi,"┌","\\@ulcorner",!0);_(T,H,ti,"┐","\\@urcorner",!0);_(T,H,Vi,"└","\\@llcorner",!0);_(T,H,ti,"┘","\\@lrcorner",!0);_(T,H,W,"≦","\\leqq",!0);_(T,H,W,"⩽","\\leqslant",!0);_(T,H,W,"⪕","\\eqslantless",!0);_(T,H,W,"≲","\\lesssim",!0);_(T,H,W,"⪅","\\lessapprox",!0);_(T,H,W,"≊","\\approxeq",!0);_(T,H,gt,"⋖","\\lessdot");_(T,H,W,"⋘","\\lll",!0);_(T,H,W,"≶","\\lessgtr",!0);_(T,H,W,"⋚","\\lesseqgtr",!0);_(T,H,W,"⪋","\\lesseqqgtr",!0);_(T,H,W,"≑","\\doteqdot");_(T,H,W,"≓","\\risingdotseq",!0);_(T,H,W,"≒","\\fallingdotseq",!0);_(T,H,W,"∽","\\backsim",!0);_(T,H,W,"⋍","\\backsimeq",!0);_(T,H,W,"⫅","\\subseteqq",!0);_(T,H,W,"⋐","\\Subset",!0);_(T,H,W,"⊏","\\sqsubset",!0);_(T,H,W,"≼","\\preccurlyeq",!0);_(T,H,W,"⋞","\\curlyeqprec",!0);_(T,H,W,"≾","\\precsim",!0);_(T,H,W,"⪷","\\precapprox",!0);_(T,H,W,"⊲","\\vartriangleleft");_(T,H,W,"⊴","\\trianglelefteq");_(T,H,W,"⊨","\\vDash",!0);_(T,H,W,"⊪","\\Vvdash",!0);_(T,H,W,"⌣","\\smallsmile");_(T,H,W,"⌢","\\smallfrown");_(T,H,W,"≏","\\bumpeq",!0);_(T,H,W,"≎","\\Bumpeq",!0);_(T,H,W,"≧","\\geqq",!0);_(T,H,W,"⩾","\\geqslant",!0);_(T,H,W,"⪖","\\eqslantgtr",!0);_(T,H,W,"≳","\\gtrsim",!0);_(T,H,W,"⪆","\\gtrapprox",!0);_(T,H,gt,"⋗","\\gtrdot");_(T,H,W,"⋙","\\ggg",!0);_(T,H,W,"≷","\\gtrless",!0);_(T,H,W,"⋛","\\gtreqless",!0);_(T,H,W,"⪌","\\gtreqqless",!0);_(T,H,W,"≖","\\eqcirc",!0);_(T,H,W,"≗","\\circeq",!0);_(T,H,W,"≜","\\triangleq",!0);_(T,H,W,"∼","\\thicksim");_(T,H,W,"≈","\\thickapprox");_(T,H,W,"⫆","\\supseteqq",!0);_(T,H,W,"⋑","\\Supset",!0);_(T,H,W,"⊐","\\sqsupset",!0);_(T,H,W,"≽","\\succcurlyeq",!0);_(T,H,W,"⋟","\\curlyeqsucc",!0);_(T,H,W,"≿","\\succsim",!0);_(T,H,W,"⪸","\\succapprox",!0);_(T,H,W,"⊳","\\vartriangleright");_(T,H,W,"⊵","\\trianglerighteq");_(T,H,W,"⊩","\\Vdash",!0);_(T,H,W,"∣","\\shortmid");_(T,H,W,"∥","\\shortparallel");_(T,H,W,"≬","\\between",!0);_(T,H,W,"⋔","\\pitchfork",!0);_(T,H,W,"∝","\\varpropto");_(T,H,W,"◀","\\blacktriangleleft");_(T,H,W,"∴","\\therefore",!0);_(T,H,W,"∍","\\backepsilon");_(T,H,W,"▶","\\blacktriangleright");_(T,H,W,"∵","\\because",!0);_(T,H,W,"⋘","\\llless");_(T,H,W,"⋙","\\gggtr");_(T,H,gt,"⊲","\\lhd");_(T,H,gt,"⊳","\\rhd");_(T,H,W,"≂","\\eqsim",!0);_(T,L,W,"⋈","\\Join");_(T,H,W,"≑","\\Doteq",!0);_(T,H,gt,"∔","\\dotplus",!0);_(T,H,gt,"∖","\\smallsetminus");_(T,H,gt,"⋒","\\Cap",!0);_(T,H,gt,"⋓","\\Cup",!0);_(T,H,gt,"⩞","\\doublebarwedge",!0);_(T,H,gt,"⊟","\\boxminus",!0);_(T,H,gt,"⊞","\\boxplus",!0);_(T,H,gt,"⋇","\\divideontimes",!0);_(T,H,gt,"⋉","\\ltimes",!0);_(T,H,gt,"⋊","\\rtimes",!0);_(T,H,gt,"⋋","\\leftthreetimes",!0);_(T,H,gt,"⋌","\\rightthreetimes",!0);_(T,H,gt,"⋏","\\curlywedge",!0);_(T,H,gt,"⋎","\\curlyvee",!0);_(T,H,gt,"⊝","\\circleddash",!0);_(T,H,gt,"⊛","\\circledast",!0);_(T,H,gt,"⋅","\\centerdot");_(T,H,gt,"⊺","\\intercal",!0);_(T,H,gt,"⋒","\\doublecap");_(T,H,gt,"⋓","\\doublecup");_(T,H,gt,"⊠","\\boxtimes",!0);_(T,H,W,"⇢","\\dashrightarrow",!0);_(T,H,W,"⇠","\\dashleftarrow",!0);_(T,H,W,"⇇","\\leftleftarrows",!0);_(T,H,W,"⇆","\\leftrightarrows",!0);_(T,H,W,"⇚","\\Lleftarrow",!0);_(T,H,W,"↞","\\twoheadleftarrow",!0);_(T,H,W,"↢","\\leftarrowtail",!0);_(T,H,W,"↫","\\looparrowleft",!0);_(T,H,W,"⇋","\\leftrightharpoons",!0);_(T,H,W,"↶","\\curvearrowleft",!0);_(T,H,W,"↺","\\circlearrowleft",!0);_(T,H,W,"↰","\\Lsh",!0);_(T,H,W,"⇈","\\upuparrows",!0);_(T,H,W,"↿","\\upharpoonleft",!0);_(T,H,W,"⇃","\\downharpoonleft",!0);_(T,L,W,"⊶","\\origof",!0);_(T,L,W,"⊷","\\imageof",!0);_(T,H,W,"⊸","\\multimap",!0);_(T,H,W,"↭","\\leftrightsquigarrow",!0);_(T,H,W,"⇉","\\rightrightarrows",!0);_(T,H,W,"⇄","\\rightleftarrows",!0);_(T,H,W,"↠","\\twoheadrightarrow",!0);_(T,H,W,"↣","\\rightarrowtail",!0);_(T,H,W,"↬","\\looparrowright",!0);_(T,H,W,"↷","\\curvearrowright",!0);_(T,H,W,"↻","\\circlearrowright",!0);_(T,H,W,"↱","\\Rsh",!0);_(T,H,W,"⇊","\\downdownarrows",!0);_(T,H,W,"↾","\\upharpoonright",!0);_(T,H,W,"⇂","\\downharpoonright",!0);_(T,H,W,"⇝","\\rightsquigarrow",!0);_(T,H,W,"⇝","\\leadsto");_(T,H,W,"⇛","\\Rrightarrow",!0);_(T,H,W,"↾","\\restriction");_(T,L,Z,"‘","`");_(T,L,Z,"$","\\$");_(Ae,L,Z,"$","\\$");_(Ae,L,Z,"$","\\textdollar");_(T,L,Z,"%","\\%");_(Ae,L,Z,"%","\\%");_(T,L,Z,"_","\\_");_(Ae,L,Z,"_","\\_");_(Ae,L,Z,"_","\\textunderscore");_(T,L,Z,"∠","\\angle",!0);_(T,L,Z,"∞","\\infty",!0);_(T,L,Z,"′","\\prime");_(T,L,Z,"△","\\triangle");_(T,L,Z,"Γ","\\Gamma",!0);_(T,L,Z,"Δ","\\Delta",!0);_(T,L,Z,"Θ","\\Theta",!0);_(T,L,Z,"Λ","\\Lambda",!0);_(T,L,Z,"Ξ","\\Xi",!0);_(T,L,Z,"Π","\\Pi",!0);_(T,L,Z,"Σ","\\Sigma",!0);_(T,L,Z,"Υ","\\Upsilon",!0);_(T,L,Z,"Φ","\\Phi",!0);_(T,L,Z,"Ψ","\\Psi",!0);_(T,L,Z,"Ω","\\Omega",!0);_(T,L,Z,"A","Α");_(T,L,Z,"B","Β");_(T,L,Z,"E","Ε");_(T,L,Z,"Z","Ζ");_(T,L,Z,"H","Η");_(T,L,Z,"I","Ι");_(T,L,Z,"K","Κ");_(T,L,Z,"M","Μ");_(T,L,Z,"N","Ν");_(T,L,Z,"O","Ο");_(T,L,Z,"P","Ρ");_(T,L,Z,"T","Τ");_(T,L,Z,"X","Χ");_(T,L,Z,"¬","\\neg",!0);_(T,L,Z,"¬","\\lnot");_(T,L,Z,"⊤","\\top");_(T,L,Z,"⊥","\\bot");_(T,L,Z,"∅","\\emptyset");_(T,H,Z,"∅","\\varnothing");_(T,L,Bt,"α","\\alpha",!0);_(T,L,Bt,"β","\\beta",!0);_(T,L,Bt,"γ","\\gamma",!0);_(T,L,Bt,"δ","\\delta",!0);_(T,L,Bt,"ϵ","\\epsilon",!0);_(T,L,Bt,"ζ","\\zeta",!0);_(T,L,Bt,"η","\\eta",!0);_(T,L,Bt,"θ","\\theta",!0);_(T,L,Bt,"ι","\\iota",!0);_(T,L,Bt,"κ","\\kappa",!0);_(T,L,Bt,"λ","\\lambda",!0);_(T,L,Bt,"μ","\\mu",!0);_(T,L,Bt,"ν","\\nu",!0);_(T,L,Bt,"ξ","\\xi",!0);_(T,L,Bt,"ο","\\omicron",!0);_(T,L,Bt,"π","\\pi",!0);_(T,L,Bt,"ρ","\\rho",!0);_(T,L,Bt,"σ","\\sigma",!0);_(T,L,Bt,"τ","\\tau",!0);_(T,L,Bt,"υ","\\upsilon",!0);_(T,L,Bt,"ϕ","\\phi",!0);_(T,L,Bt,"χ","\\chi",!0);_(T,L,Bt,"ψ","\\psi",!0);_(T,L,Bt,"ω","\\omega",!0);_(T,L,Bt,"ε","\\varepsilon",!0);_(T,L,Bt,"ϑ","\\vartheta",!0);_(T,L,Bt,"ϖ","\\varpi",!0);_(T,L,Bt,"ϱ","\\varrho",!0);_(T,L,Bt,"ς","\\varsigma",!0);_(T,L,Bt,"φ","\\varphi",!0);_(T,L,gt,"∗","*",!0);_(T,L,gt,"+","+");_(T,L,gt,"−","-",!0);_(T,L,gt,"⋅","\\cdot",!0);_(T,L,gt,"∘","\\circ",!0);_(T,L,gt,"÷","\\div",!0);_(T,L,gt,"±","\\pm",!0);_(T,L,gt,"×","\\times",!0);_(T,L,gt,"∩","\\cap",!0);_(T,L,gt,"∪","\\cup",!0);_(T,L,gt,"∖","\\setminus",!0);_(T,L,gt,"∧","\\land");_(T,L,gt,"∨","\\lor");_(T,L,gt,"∧","\\wedge",!0);_(T,L,gt,"∨","\\vee",!0);_(T,L,Z,"√","\\surd");_(T,L,Vi,"⟨","\\langle",!0);_(T,L,Vi,"∣","\\lvert");_(T,L,Vi,"∥","\\lVert");_(T,L,ti,"?","?");_(T,L,ti,"!","!");_(T,L,ti,"⟩","\\rangle",!0);_(T,L,ti,"∣","\\rvert");_(T,L,ti,"∥","\\rVert");_(T,L,W,"=","=");_(T,L,W,":",":");_(T,L,W,"≈","\\approx",!0);_(T,L,W,"≅","\\cong",!0);_(T,L,W,"≥","\\ge");_(T,L,W,"≥","\\geq",!0);_(T,L,W,"←","\\gets");_(T,L,W,">","\\gt",!0);_(T,L,W,"∈","\\in",!0);_(T,L,W,"","\\@not");_(T,L,W,"⊂","\\subset",!0);_(T,L,W,"⊃","\\supset",!0);_(T,L,W,"⊆","\\subseteq",!0);_(T,L,W,"⊇","\\supseteq",!0);_(T,H,W,"⊈","\\nsubseteq",!0);_(T,H,W,"⊉","\\nsupseteq",!0);_(T,L,W,"⊨","\\models");_(T,L,W,"←","\\leftarrow",!0);_(T,L,W,"≤","\\le");_(T,L,W,"≤","\\leq",!0);_(T,L,W,"<","\\lt",!0);_(T,L,W,"→","\\rightarrow",!0);_(T,L,W,"→","\\to");_(T,H,W,"≱","\\ngeq",!0);_(T,H,W,"≰","\\nleq",!0);_(T,L,yl," ","\\ ");_(T,L,yl," ","\\space");_(T,L,yl," ","\\nobreakspace");_(Ae,L,yl," ","\\ ");_(Ae,L,yl," "," ");_(Ae,L,yl," ","\\space");_(Ae,L,yl," ","\\nobreakspace");_(T,L,yl,"","\\nobreak");_(T,L,yl,"","\\allowbreak");_(T,L,jm,",",",");_(T,L,jm,";",";");_(T,H,gt,"⊼","\\barwedge",!0);_(T,H,gt,"⊻","\\veebar",!0);_(T,L,gt,"⊙","\\odot",!0);_(T,L,gt,"⊕","\\oplus",!0);_(T,L,gt,"⊗","\\otimes",!0);_(T,L,Z,"∂","\\partial",!0);_(T,L,gt,"⊘","\\oslash",!0);_(T,H,gt,"⊚","\\circledcirc",!0);_(T,H,gt,"⊡","\\boxdot",!0);_(T,L,gt,"△","\\bigtriangleup");_(T,L,gt,"▽","\\bigtriangledown");_(T,L,gt,"†","\\dagger");_(T,L,gt,"⋄","\\diamond");_(T,L,gt,"⋆","\\star");_(T,L,gt,"◃","\\triangleleft");_(T,L,gt,"▹","\\triangleright");_(T,L,Vi,"{","\\{");_(Ae,L,Z,"{","\\{");_(Ae,L,Z,"{","\\textbraceleft");_(T,L,ti,"}","\\}");_(Ae,L,Z,"}","\\}");_(Ae,L,Z,"}","\\textbraceright");_(T,L,Vi,"{","\\lbrace");_(T,L,ti,"}","\\rbrace");_(T,L,Vi,"[","\\lbrack",!0);_(Ae,L,Z,"[","\\lbrack",!0);_(T,L,ti,"]","\\rbrack",!0);_(Ae,L,Z,"]","\\rbrack",!0);_(T,L,Vi,"(","\\lparen",!0);_(T,L,ti,")","\\rparen",!0);_(Ae,L,Z,"<","\\textless",!0);_(Ae,L,Z,">","\\textgreater",!0);_(T,L,Vi,"⌊","\\lfloor",!0);_(T,L,ti,"⌋","\\rfloor",!0);_(T,L,Vi,"⌈","\\lceil",!0);_(T,L,ti,"⌉","\\rceil",!0);_(T,L,Z,"\\","\\backslash");_(T,L,Z,"∣","|");_(T,L,Z,"∣","\\vert");_(Ae,L,Z,"|","\\textbar",!0);_(T,L,Z,"∥","\\|");_(T,L,Z,"∥","\\Vert");_(Ae,L,Z,"∥","\\textbardbl");_(Ae,L,Z,"~","\\textasciitilde");_(Ae,L,Z,"\\","\\textbackslash");_(Ae,L,Z,"^","\\textasciicircum");_(T,L,W,"↑","\\uparrow",!0);_(T,L,W,"⇑","\\Uparrow",!0);_(T,L,W,"↓","\\downarrow",!0);_(T,L,W,"⇓","\\Downarrow",!0);_(T,L,W,"↕","\\updownarrow",!0);_(T,L,W,"⇕","\\Updownarrow",!0);_(T,L,Vr,"∐","\\coprod");_(T,L,Vr,"⋁","\\bigvee");_(T,L,Vr,"⋀","\\bigwedge");_(T,L,Vr,"⨄","\\biguplus");_(T,L,Vr,"⋂","\\bigcap");_(T,L,Vr,"⋃","\\bigcup");_(T,L,Vr,"∫","\\int");_(T,L,Vr,"∫","\\intop");_(T,L,Vr,"∬","\\iint");_(T,L,Vr,"∭","\\iiint");_(T,L,Vr,"∏","\\prod");_(T,L,Vr,"∑","\\sum");_(T,L,Vr,"⨂","\\bigotimes");_(T,L,Vr,"⨁","\\bigoplus");_(T,L,Vr,"⨀","\\bigodot");_(T,L,Vr,"∮","\\oint");_(T,L,Vr,"∯","\\oiint");_(T,L,Vr,"∰","\\oiiint");_(T,L,Vr,"⨆","\\bigsqcup");_(T,L,Vr,"∫","\\smallint");_(Ae,L,Wh,"…","\\textellipsis");_(T,L,Wh,"…","\\mathellipsis");_(Ae,L,Wh,"…","\\ldots",!0);_(T,L,Wh,"…","\\ldots",!0);_(T,L,Wh,"⋯","\\@cdots",!0);_(T,L,Wh,"⋱","\\ddots",!0);_(T,L,Z,"⋮","\\varvdots");_(Ae,L,Z,"⋮","\\varvdots");_(T,L,yr,"ˊ","\\acute");_(T,L,yr,"ˋ","\\grave");_(T,L,yr,"¨","\\ddot");_(T,L,yr,"~","\\tilde");_(T,L,yr,"ˉ","\\bar");_(T,L,yr,"˘","\\breve");_(T,L,yr,"ˇ","\\check");_(T,L,yr,"^","\\hat");_(T,L,yr,"⃗","\\vec");_(T,L,yr,"˙","\\dot");_(T,L,yr,"˚","\\mathring");_(T,L,Bt,"","\\@imath");_(T,L,Bt,"","\\@jmath");_(T,L,Z,"ı","ı");_(T,L,Z,"ȷ","ȷ");_(Ae,L,Z,"ı","\\i",!0);_(Ae,L,Z,"ȷ","\\j",!0);_(Ae,L,Z,"ß","\\ss",!0);_(Ae,L,Z,"æ","\\ae",!0);_(Ae,L,Z,"œ","\\oe",!0);_(Ae,L,Z,"ø","\\o",!0);_(Ae,L,Z,"Æ","\\AE",!0);_(Ae,L,Z,"Œ","\\OE",!0);_(Ae,L,Z,"Ø","\\O",!0);_(Ae,L,yr,"ˊ","\\'");_(Ae,L,yr,"ˋ","\\`");_(Ae,L,yr,"ˆ","\\^");_(Ae,L,yr,"˜","\\~");_(Ae,L,yr,"ˉ","\\=");_(Ae,L,yr,"˘","\\u");_(Ae,L,yr,"˙","\\.");_(Ae,L,yr,"¸","\\c");_(Ae,L,yr,"˚","\\r");_(Ae,L,yr,"ˇ","\\v");_(Ae,L,yr,"¨",'\\"');_(Ae,L,yr,"˝","\\H");_(Ae,L,yr,"◯","\\textcircled");var hL={"--":!0,"---":!0,"``":!0,"''":!0};_(Ae,L,Z,"–","--",!0);_(Ae,L,Z,"–","\\textendash");_(Ae,L,Z,"—","---",!0);_(Ae,L,Z,"—","\\textemdash");_(Ae,L,Z,"‘","`",!0);_(Ae,L,Z,"‘","\\textquoteleft");_(Ae,L,Z,"’","'",!0);_(Ae,L,Z,"’","\\textquoteright");_(Ae,L,Z,"“","``",!0);_(Ae,L,Z,"“","\\textquotedblleft");_(Ae,L,Z,"”","''",!0);_(Ae,L,Z,"”","\\textquotedblright");_(T,L,Z,"°","\\degree",!0);_(Ae,L,Z,"°","\\degree");_(Ae,L,Z,"°","\\textdegree",!0);_(T,L,Z,"£","\\pounds");_(T,L,Z,"£","\\mathsterling",!0);_(Ae,L,Z,"£","\\pounds");_(Ae,L,Z,"£","\\textsterling",!0);_(T,H,Z,"✠","\\maltese");_(Ae,H,Z,"✠","\\maltese");var Q7='0123456789/@."';for(var g4=0;g4<Q7.length;g4++){var J7=Q7.charAt(g4);_(T,L,Z,J7,J7)}var Z7='0123456789!@*()-=+";:?/.,';for(var y4=0;y4<Z7.length;y4++){var e9=Z7.charAt(y4);_(Ae,L,Z,e9,e9)}var P1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var b4=0;b4<P1.length;b4++){var Mp=P1.charAt(b4);_(T,L,Bt,Mp,Mp),_(Ae,L,Z,Mp,Mp)}_(T,H,Z,"C","ℂ");_(Ae,H,Z,"C","ℂ");_(T,H,Z,"H","ℍ");_(Ae,H,Z,"H","ℍ");_(T,H,Z,"N","ℕ");_(Ae,H,Z,"N","ℕ");_(T,H,Z,"P","ℙ");_(Ae,H,Z,"P","ℙ");_(T,H,Z,"Q","ℚ");_(Ae,H,Z,"Q","ℚ");_(T,H,Z,"R","ℝ");_(Ae,H,Z,"R","ℝ");_(T,H,Z,"Z","ℤ");_(Ae,H,Z,"Z","ℤ");_(T,L,Bt,"h","ℎ");_(Ae,L,Bt,"h","ℎ");var zt;for(var Us=0;Us<P1.length;Us++){var Sr=P1.charAt(Us);zt=String.fromCharCode(55349,56320+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56372+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56424+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56580+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56684+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56736+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56788+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56840+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56944+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),Us<26&&(zt=String.fromCharCode(55349,56632+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt),zt=String.fromCharCode(55349,56476+Us),_(T,L,Bt,Sr,zt),_(Ae,L,Z,Sr,zt))}zt="𝕜";_(T,L,Bt,"k",zt);_(Ae,L,Z,"k",zt);for(var Gc=0;Gc<10;Gc++){var El=Gc.toString();zt=String.fromCharCode(55349,57294+Gc),_(T,L,Bt,El,zt),_(Ae,L,Z,El,zt),zt=String.fromCharCode(55349,57314+Gc),_(T,L,Bt,El,zt),_(Ae,L,Z,El,zt),zt=String.fromCharCode(55349,57324+Gc),_(T,L,Bt,El,zt),_(Ae,L,Z,El,zt),zt=String.fromCharCode(55349,57334+Gc),_(T,L,Bt,El,zt),_(Ae,L,Z,El,zt)}var ax="ÐÞþ";for(var v4=0;v4<ax.length;v4++){var Ip=ax.charAt(v4);_(T,L,Bt,Ip,Ip),_(Ae,L,Z,Ip,Ip)}var lx={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},t9={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},n9={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},YZ={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},lu={mathClass:"",textClass:"",font:""},r9={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},s9={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},i9={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},cx={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},ux={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},o9={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},dx={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},a9=[lx,lx,t9,t9,n9,n9,YZ,lu,lu,lu,r9,r9,s9,s9,i9,i9,cx,cx,ux,ux,o9,o9,lu,lu,dx,dx],XZ=[lx,lu,cx,ux,dx],QZ=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484){var s=Math.floor((r-119808)/26);return a9[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return XZ[i]}else{if(r===120485||r===120486)return a9[0];if(120486<r&&r<120782)return lu;throw new $e("Unsupported character: "+e)}},sb=function(t,n,r){if(gr[r][t]){var s=gr[r][t].replace;s&&(t=s)}return{value:t,metrics:z5(t,n,r)}},Vs=function(t,n,r,s,i){var o=sb(t,n,r),a=o.metrics;t=o.value;var l;if(a){var c=a.italic;(r==="text"||s&&s.font==="mathit")&&(c=0),l=new Hi(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 '"+r+"'")),l=new Hi(t,0,0,0,0,0,i);if(s){l.maxFontSize=s.sizeMultiplier,s.style.isTight()&&l.classes.push("mtight");var u=s.getColor();u&&(l.style.color=u)}return l},F5=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&sb(t,"Main-Bold",n).metrics?Vs(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||gr[n][t].font==="main"?Vs(t,"Main-Regular",n,r,s):Vs(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},JZ=function(t,n,r){return r!=="textord"&&sb(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},ib=function(t,n,r){var s=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:u}=n,d=s==="math"||s==="text"&&!!a,f=d?a:l,m="",p="";if(i.charCodeAt(0)===55349){var y=QZ(i);m=y.font,p=y[s+"Class"]}if(m)return Vs(i,m,s,n,o.concat(p));if(f){var w,b;if(f==="boldsymbol"){var v=JZ(i,s,r);w=v.fontName,b=[v.fontClass]}else d?(w=hx[a].fontName,b=[a]):(w=Np(l,c,u),b=[l,c,u]);if(sb(i,w,s).metrics)return Vs(i,w,s,n,o.concat(b));if(hL.hasOwnProperty(i)&&w.slice(0,10)==="Typewriter"){for(var x=[],S=0;S<i.length;S++)x.push(Vs(i[S],w,s,n,o.concat(b)));return bl(x)}}if(r==="mathord")return Vs(i,"Math-Italic",s,n,o.concat(["mathnormal"]));if(r==="textord"){var C=gr[s][i]&&gr[s][i].font;if(C==="ams"){var E=Np("amsrm",c,u);return Vs(i,E,s,n,o.concat("amsrm",c,u))}else if(C==="main"||!C){var M=Np("textrm",c,u);return Vs(i,M,s,n,o.concat(c,u))}else{var D=Np(C,c,u);return Vs(i,D,s,n,o.concat(D,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},ZZ=(e,t)=>{if(vc(e.classes)!==vc(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var s of Object.keys(t.style))if(e.style[s]!==t.style[s])return!1;return!0},fL=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof Hi&&r instanceof Hi&&ZZ(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},U5=function(t){for(var n=0,r=0,s=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}t.height=n,t.depth=r,t.maxFontSize=s},Le=function(t,n,r,s){var i=new Vh(t,n,r,s);return U5(i),i},xc=(e,t,n,r)=>new Vh(e,t,n,r),vh=function(t,n,r){var s=Le([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ve(s.height),s.maxFontSize=1,s},eee=function(t,n,r,s){var i=new rb(t,n,r,s);return U5(i),i},bl=function(t){var n=new Hh(t);return U5(n),n},wh=function(t,n){return t instanceof Hh?Le([],[t],n):t},tee=function(t){if(t.positionType==="individualShift"){for(var n=t.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,o=1;o<n.length;o++){var a=-n[o].shift-i-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,r.push({type:"kern",size:l}),r.push(n[o])}return{children:r,depth:s}}var c;if(t.positionType==="top"){for(var u=t.positionData,d=0;d<t.children.length;d++){var f=t.children[d];u-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=u}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}},Ln=function(t,n){for(var{children:r,depth:s}=tee(t),i=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=Le(["pstrut"],[]);c.style.height=Ve(i);for(var u=[],d=s,f=s,m=s,p=0;p<r.length;p++){var y=r[p];if(y.type==="kern")m+=y.size;else{var w=y.elem,b=y.wrapperClasses||[],v=y.wrapperStyle||{},x=Le(b,[c,w],void 0,v);x.style.top=Ve(-i-m-w.depth),y.marginLeft&&(x.style.marginLeft=y.marginLeft),y.marginRight&&(x.style.marginRight=y.marginRight),u.push(x),m+=w.height+w.depth}d=Math.min(d,m),f=Math.max(f,m)}var S=Le(["vlist"],u);S.style.height=Ve(f);var C;if(d<0){var E=Le([],[]),M=Le(["vlist"],[E]);M.style.height=Ve(-d);var D=Le(["vlist-s"],[new Hi("​")]);C=[Le(["vlist-r"],[S,D]),Le(["vlist-r"],[M])]}else C=[Le(["vlist-r"],[S])];var O=Le(["vlist-t"],C);return C.length===2&&O.classes.push("vlist-t2"),O.height=f,O.depth=-d,O},mL=(e,t)=>{var n=Le(["mspace"],[],t),r=_r(e,t);return n.style.marginRight=Ve(r),n},Np=(e,t,n)=>{var r,s;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":n==="textit"?s="Italic":s="Regular",r+"-"+s},hx={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"}},pL={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},gL=function(t,n){var[r,s,i]=pL[t],o=new wc(r),a=new ul([o],{width:Ve(s),height:Ve(i),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=xc(["overlay"],[a],n);return l.height=i,l.style.height=Ve(i),l.style.width=Ve(s),l},wr={number:3,unit:"mu"},Kc={number:4,unit:"mu"},Da={number:5,unit:"mu"},nee={mord:{mop:wr,mbin:Kc,mrel:Da,minner:wr},mop:{mord:wr,mop:wr,mrel:Da,minner:wr},mbin:{mord:Kc,mop:Kc,mopen:Kc,minner:Kc},mrel:{mord:Da,mop:Da,mopen:Da,minner:Da},mopen:{},mclose:{mop:wr,mbin:Kc,mrel:Da,minner:wr},mpunct:{mord:wr,mop:wr,mrel:Da,mopen:wr,mclose:wr,mpunct:wr,minner:wr},minner:{mord:wr,mop:wr,mbin:Kc,mrel:Da,mopen:wr,mpunct:wr,minner:wr}},ree={mord:{mop:wr},mop:{mord:wr,mop:wr},mbin:{},mrel:{},mopen:{},mclose:{mop:wr},mpunct:{},minner:{mop:wr}},yL={},$1={},z1={};function ot(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},l=0;l<n.length;++l)yL[n[l]]=a;t&&(i&&($1[t]=i),o&&(z1[t]=o))}function Qu(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;ot({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var F1=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},qr=function(t){return t.type==="ordgroup"?t.body:[t]},see=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),iee=new Set(["rightmost","mrel","mclose","mpunct"]),oee={display:Gt.DISPLAY,text:Gt.TEXT,script:Gt.SCRIPT,scriptscript:Gt.SCRIPTSCRIPT},aee={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ss=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=Dn(t[o],n);if(a instanceof Hh){var l=a.children;i.push(...l)}else i.push(a)}if(fL(i),!r)return i;var c=n;if(t.length===1){var u=t[0];u.type==="sizing"?c=n.havingSize(u.size):u.type==="styling"&&(c=n.havingStyle(oee[u.style]))}var d=Le([s[0]||"leftmost"],[],n),f=Le([s[1]||"rightmost"],[],n),m=r==="root";return fx(i,(p,y)=>{var w=y.classes[0],b=p.classes[0];w==="mbin"&&iee.has(b)?y.classes[0]="mord":b==="mbin"&&see.has(w)&&(p.classes[0]="mord")},{node:d},f,m),fx(i,(p,y)=>{var w,b,v=px(y),x=px(p),S=v&&x?p.hasClass("mtight")?(w=ree[v])==null?void 0:w[x]:(b=nee[v])==null?void 0:b[x]:null;if(S)return mL(S,c)},{node:d},f,m),i},fx=function(t,n,r,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var a=t[o],l=bL(a);if(l){fx(l.children,n,r,null,i);continue}var c=!a.hasClass("mspace");if(c){var u=n(a,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),o++))}c?r.node=a:i&&a.hasClass("newline")&&(r.node=Le(["leftmost"])),r.insertAfter=(d=>f=>{t.splice(d+1,0,f),o++})(o)}s&&t.pop()},bL=function(t){return t instanceof Hh||t instanceof rb||t instanceof Vh&&t.hasClass("enclosing")?t:null},mx=function(t,n){var r=bL(t);if(r){var s=r.children;if(s.length){if(n==="right")return mx(s[s.length-1],"right");if(n==="left")return mx(s[0],"left")}}return t},px=function(t,n){if(!t)return null;n&&(t=mx(t,n));var r=t.classes[0];return aee[r]||null},G0=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return Le(n.concat(r))},Dn=function(t,n,r){if(!t)return Le();if($1[t.type]){var s=$1[t.type](t,n);if(r&&n.size!==r.size){s=Le(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new $e("Got group of unknown type: '"+t.type+"'")};function Rp(e,t){var n=Le(["base"],e,t),r=Le(["strut"]);return r.style.height=Ve(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ve(-n.depth)),n.children.unshift(r),n}function gx(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=ss(e,t,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(i.push(Rp(o,t)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(Rp(o,t)),o=[]),i.push(r[a]));o.length>0&&i.push(Rp(o,t));var c;n?(c=Rp(ss(n,t,!0),t),c.classes=["tag"],i.push(c)):s&&i.push(s);var u=Le(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=Ve(u.height+u.depth),u.depth&&(d.style.verticalAlign=Ve(-u.depth))}return u}function vL(e){return new Hh(e)}class Ue{constructor(t,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=vc(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Hr&&this.children[r+1]instanceof Hr){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Hr;)s+=this.children[++r].toText();t.appendChild(new Hr(s).toNode())}else t.appendChild(this.children[r].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=Os(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+Os(vc(this.classes))+'"'),t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let Hr=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Os(this.toText())}toText(){return this.text}};class wL{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",Ve(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ve(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var lee=new Set(["\\imath","\\jmath"]),cee=new Set(["mrow","mtable"]),xo=function(t,n,r){return gr[n][t]&&gr[n][t].replace&&t.charCodeAt(0)!==55349&&!(hL.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=gr[n][t].replace),new Hr(t)},q5=function(t){return t.length===1?t[0]:new Ue("mrow",t)},uee={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"},H5=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var n=t.font;if(!n||n==="mathnormal")return null;var r=e.mode,s=uee[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(lee.has(i))return null;if(gr[r][i]){var o=gr[r][i].replace;o&&(i=o)}var a=hx[n].fontName;return z5(i,a,r)?hx[n].variant:null};function w4(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Hr&&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 Hr&&n.text===","}else return!1}var Wi=function(t,n,r){if(t.length===1){var s=tr(t[0],n);return r&&s instanceof Ue&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<t.length;a++){var l=tr(t[a],n);if(l instanceof Ue&&o instanceof Ue){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(w4(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&w4(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||w4(o))){var c=l.children[0];c instanceof Ue&&c.type==="mn"&&(c.children=[...o.children,...c.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Hr&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Hr&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),o=l}return i},_c=function(t,n,r){return q5(Wi(t,n,r))},tr=function(t,n){if(!t)return new Ue("mrow");if(z1[t.type])return z1[t.type](t,n);throw new $e("Got group of unknown type: '"+t.type+"'")};function l9(e,t,n,r,s){var i=Wi(e,n),o;i.length===1&&i[0]instanceof Ue&&cee.has(i[0].type)?o=i[0]:o=new Ue("mrow",i);var a=new Ue("annotation",[new Hr(t)]);a.setAttribute("encoding","application/x-tex");var l=new Ue("semantics",[o,a]),c=new Ue("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=s?"katex":"katex-mathml";return Le([u],[c])}var dee=[[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]],c9=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],u9=function(t,n){return n.size<2?t:dee[t-1][n.size-1]};class Ua{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||Ua.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=c9[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 Ua(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:u9(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:c9[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=u9(Ua.BASESIZE,t);return this.size===n&&this.textSize===Ua.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!==Ua.BASESIZE?["sizing","reset-size"+this.size,"size"+Ua.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=KZ(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ua.BASESIZE=6;var xL=function(t){return new Ua({style:t.displayMode?Gt.DISPLAY:Gt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},_L=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=Le(r,[t])}return t},hee=function(t,n,r){var s=xL(r),i;if(r.output==="mathml")return l9(t,n,s,r.displayMode,!0);if(r.output==="html"){var o=gx(t,s);i=Le(["katex"],[o])}else{var a=l9(t,n,s,r.displayMode,!1),l=gx(t,s);i=Le(["katex"],[a,l])}return _L(i,r)},fee=function(t,n,r){var s=xL(r),i=gx(t,s),o=Le(["katex"],[i]);return _L(o,r)},mee={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":"="},ob=function(t){var n=new Ue("mo",[new Hr(mee[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},pee={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]},gee=new Set(["widehat","widecheck","widetilde","utilde"]),ab=function(t,n){function r(){var a=4e5,l=t.label.slice(1);if(gee.has(l)&&"base"in t){var c=t.base.type==="ordgroup"?t.base.body.length:1,u,d,f;if(c>5)l==="widehat"||l==="widecheck"?(u=420,a=2364,f=.42,d=l+"4"):(u=312,a=2340,f=.34,d="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],u=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],d=l+m):(a=[0,600,1033,2339,2340][m],u=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],d="tilde"+m)}var p=new wc(d),y=new ul([p],{width:"100%",height:Ve(f),viewBox:"0 0 "+a+" "+u,preserveAspectRatio:"none"});return{span:xc([],[y],n),minWidth:0,height:f}}else{var w=[],b=pee[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[v,x,S]=b,C=S/1e3,E=v.length,M,D;if(E===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');M=["hide-tail"],D=[b[3]]}else if(E===2)M=["halfarrow-left","halfarrow-right"],D=["xMinYMin","xMaxYMin"];else if(E===3)M=["brace-left","brace-center","brace-right"],D=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+E+" children.");for(var O=0;O<E;O++){var A=new wc(v[O]),j=new ul([A],{width:"400em",height:Ve(C),viewBox:"0 0 "+a+" "+S,preserveAspectRatio:D[O]+" slice"}),I=xc([M[O]],[j],n);if(E===1)return{span:I,minWidth:x,height:C};I.style.height=Ve(C),w.push(I)}return{span:Le(["stretchy"],w,n),minWidth:x,height:C}}}var{span:s,minWidth:i,height:o}=r();return s.height=o,s.style.height=Ve(o),i>0&&(s.style.minWidth=Ve(i)),s},yee=function(t,n,r,s,i){var o,a=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(o=Le(["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 ox({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new ox({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new ul(c,{width:"100%",height:Ve(a)});o=xc([],[u],i)}return o.height=a,o.style.height=Ve(a),o},bee={bin:1,close:1,inner:1,open:1,punct:1,rel:1},vee={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function wee(e){return e in bee}function nn(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 lb(e){var t=cb(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 cb(e){return e&&(e.type==="atom"||vee.hasOwnProperty(e.type))?e:null}var kL=e=>{if(e instanceof Hi)return e;if(GZ(e)&&e.children.length===1)return kL(e.children[0])},V5=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=nn(e.base,"accent"),n=r.base,e.base=n,s=WZ(Dn(e,t)),e.base=r):(r=nn(e,"accent"),n=r.base);var i=Dn(n,t.havingCrampedStyle()),o=r.isShifty&&gl(n),a=0;if(o){var l,c;a=(l=(c=kL(i))==null?void 0:c.skew)!=null?l:0}var u=r.label==="\\c",d=u?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),f;if(r.isStretchy)f=ab(r,t),f=Ln({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Ve(2*a)+")",marginLeft:Ve(2*a)}:void 0}]});else{var m,p;r.label==="\\vec"?(m=gL("vec",t),p=pL.vec[1]):(m=ib({mode:r.mode,text:r.label},t,"textord"),m=VZ(m),m.italic=0,p=m.width,u&&(d+=m.depth)),f=Le(["accent-body"],[m]);var y=r.label==="\\textcircled";y&&(f.classes.push("accent-full"),d=i.height);var w=a;y||(w-=p/2),f.style.left=Ve(w),r.label==="\\textcircled"&&(f.style.top=".2em"),f=Ln({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:f}]})}var b=Le(["mord","accent"],[f],t);return s?(s.children[0]=b,s.height=Math.max(b.height,s.height),s.classes[0]="mord",s):b},SL=(e,t)=>{var n=e.isStretchy?ob(e.label):new Ue("mo",[xo(e.label,e.mode)]),r=new Ue("mover",[tr(e.base,t),n]);return r.setAttribute("accent","true"),r},xee=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));ot({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=F1(t[0]),r=!xee.test(e.funcName),s=!r||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:V5,mathmlBuilder:SL});ot({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:V5,mathmlBuilder:SL});ot({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(e,t)=>{var n=Dn(e.base,t),r=ab(e,t),s=e.label==="\\utilde"?.12:0,i=Ln({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return Le(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=ob(e.label),r=new Ue("munder",[tr(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var Lp=e=>{var t=new Ue("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ot({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:s}=e;return{type:"xArrow",mode:r.mode,label:s,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,r=t.havingStyle(n.sup()),s=wh(Dn(e.body,r,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;e.below&&(r=t.havingStyle(n.sub()),o=wh(Dn(e.below,r,t),t),o.classes.push(i+"-arrow-pad"));var a=ab(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,c=-t.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(c-=s.depth);var u;if(o){var d=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;u=Ln({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:d}]})}else u=Ln({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return Le(["mrel","x-arrow"],[u],t)},mathmlBuilder(e,t){var n=ob(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=Lp(tr(e.body,t));if(e.below){var i=Lp(tr(e.below,t));r=new Ue("munderover",[n,i,s])}else r=new Ue("mover",[n,s])}else if(e.below){var o=Lp(tr(e.below,t));r=new Ue("munder",[n,o])}else r=Lp(),r=new Ue("mover",[n,r]);return r}});function TL(e,t){var n=ss(e.body,t,!0);return Le([e.mclass],n,t)}function CL(e,t){var n,r=Wi(e.body,t);return e.mclass==="minner"?n=new Ue("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new Ue("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new Ue("mo",r),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}ot({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:qr(s),isCharacterBox:gl(s)}},htmlBuilder:TL,mathmlBuilder:CL});var ub=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"};ot({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:ub(t[0]),body:qr(t[1]),isCharacterBox:gl(t[1])}}});ot({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:r}=e,s=t[1],i=t[0],o;r!=="\\stackrel"?o=ub(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:qr(s)},l={type:"supsub",mode:i.mode,base:a,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:gl(l)}},htmlBuilder:TL,mathmlBuilder:CL});ot({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:ub(t[0]),body:qr(t[0])}},htmlBuilder(e,t){var n=ss(e.body,t,!0),r=Le([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=Wi(e.body,t),r=new Ue("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var _ee={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},d9=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),h9=e=>e.type==="textord"&&e.text==="@",kee=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function See(e,t,n){var r=_ee[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[s,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 Tee(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 $e("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var o=t[i],a=d9(),l=0;l<o.length;l++)if(!h9(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=lb(o[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var f=!0,m=l+1;m<o.length;m++){if(kee(o[m],c)){f=!1,l=m;break}if(h9(o[m]))throw new $e("Missing a "+c+" character to complete a CD arrow.",o[m]);u[d].body.push(o[m])}if(f)throw new $e("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new $e('Expected one of "<>AV=|." after @',o[l]);var p=See(c,u,e),y={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(y),a=d9()}i%2===0?r.push(a):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var w=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:w,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}ot({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=wh(Dn(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=Ve(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Ue("mrow",[tr(e.label,t)]);return n=new Ue("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ue("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});ot({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=wh(Dn(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Ue("mrow",[tr(e.fragment,t)])}});ot({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=nn(t[0],"ordgroup"),s=r.body,i="",o=0;o<s.length;o++){var a=nn(s[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new $e("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new $e("\\@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 AL=(e,t)=>{var n=ss(e.body,t.withColor(e.color),!1);return bl(n)},EL=(e,t)=>{var n=Wi(e.body,t.withColor(e.color)),r=new Ue("mstyle",n);return r.setAttribute("mathcolor",e.color),r};ot({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=nn(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:qr(s)}},htmlBuilder:AL,mathmlBuilder:EL});ot({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=nn(t[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:AL,mathmlBuilder:EL});ot({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&nn(s,"size").value}},htmlBuilder(e,t){var n=Le(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Ve(_r(e.size,t)))),n},mathmlBuilder(e,t){var n=new Ue("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Ve(_r(e.size,t)))),n}});var yx={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},ML=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new $e("Expected a control sequence",e);return t},Cee=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},IL=(e,t,n,r)=>{var s=e.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,s,r)};ot({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(yx[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=yx[r.text]),nn(t.parseFunction(),"internal");throw new $e("Invalid token after macro prefix",r)}});ot({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new $e("Expected a control sequence",r);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(r=t.gullet.popToken(),r.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new $e('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new $e('Argument number "'+r.text+'" out of order');i++,a.push([])}else{if(r.text==="EOF")throw new $e("Expected a macro definition");a[i].push(r.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(s,{tokens:l,numArgs:i,delimiters:a},n===yx[n]),{type:"internal",mode:t.mode}}});ot({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=ML(t.gullet.popToken());t.gullet.consumeSpaces();var s=Cee(t);return IL(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});ot({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=ML(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return IL(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var Uf=function(t,n,r){var s=gr.math[t]&&gr.math[t].replace,i=z5(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},W5=function(t,n,r,s){var i=r.havingBaseStyle(n),o=Le(s.concat(i.sizingClasses(r)),[t],r),a=i.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},NL=function(t,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Ve(i),t.height-=i,t.depth+=i},Aee=function(t,n,r,s,i,o){var a=Vs(t,"Main-Regular",i,s),l=W5(a,n,s,o);return NL(l,s,n),l},Eee=function(t,n,r,s){return Vs(t,"Size"+n+"-Regular",r,s)},RL=function(t,n,r,s,i,o){var a=Eee(t,n,i,s),l=W5(Le(["delimsizing","size"+n],[a],s),Gt.TEXT,s,o);return r&&NL(l,s,Gt.TEXT),l},x4=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=Le(["delimsizinginner",s],[Le([],[Vs(t,n,r)])]);return{type:"elem",elem:i}},_4=function(t,n,r){var s=da["Size4-Regular"][t.charCodeAt(0)]?da["Size4-Regular"][t.charCodeAt(0)][4]:da["Size1-Regular"][t.charCodeAt(0)][4],i=new wc("inner",PZ(t,Math.round(1e3*n))),o=new ul([i],{width:Ve(s),height:Ve(n),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=xc([],[o],r);return a.height=n,a.style.height=Ve(n),a.style.width=Ve(s),{type:"elem",elem:a}},bx=.008,jp={type:"kern",size:-1*bx},Mee=new Set(["|","\\lvert","\\rvert","\\vert"]),Iee=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),LL=function(t,n,r,s,i,o){var a,l,c,u,d="",f=0;a=c=u=t,l=null;var m="Size1-Regular";t==="\\uparrow"?c=u="⏐":t==="\\Uparrow"?c=u="‖":t==="\\downarrow"?a=c="⏐":t==="\\Downarrow"?a=c="‖":t==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):Mee.has(t)?(c="∣",d="vert",f=333):Iee.has(t)?(c="∥",d="doublevert",f=556):t==="["||t==="\\lbrack"?(a="⎡",c="⎢",u="⎣",m="Size4-Regular",d="lbrack",f=667):t==="]"||t==="\\rbrack"?(a="⎤",c="⎥",u="⎦",m="Size4-Regular",d="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=a="⎢",u="⎣",m="Size4-Regular",d="lfloor",f=667):t==="\\lceil"||t==="⌈"?(a="⎡",c=u="⎢",m="Size4-Regular",d="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=a="⎥",u="⎦",m="Size4-Regular",d="rfloor",f=667):t==="\\rceil"||t==="⌉"?(a="⎤",c=u="⎥",m="Size4-Regular",d="rceil",f=667):t==="("||t==="\\lparen"?(a="⎛",c="⎜",u="⎝",m="Size4-Regular",d="lparen",f=875):t===")"||t==="\\rparen"?(a="⎞",c="⎟",u="⎠",m="Size4-Regular",d="rparen",f=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",u="⎩",c="⎪",m="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",u="⎭",c="⎪",m="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",u="⎩",c="⎪",m="Size4-Regular");var p=Uf(a,m,i),y=p.height+p.depth,w=Uf(c,m,i),b=w.height+w.depth,v=Uf(u,m,i),x=v.height+v.depth,S=0,C=1;if(l!==null){var E=Uf(l,m,i);S=E.height+E.depth,C=2}var M=y+x+S,D=Math.max(0,Math.ceil((n-M)/(C*b))),O=M+D*C*b,A=s.fontMetrics().axisHeight;r&&(A*=s.sizeMultiplier);var j=O/2-A,I=[];if(d.length>0){var P=O-y-x,F=Math.round(O*1e3),q=$Z(d,Math.round(P*1e3)),R=new wc(d,q),V=Ve(f/1e3),J=Ve(F/1e3),ee=new ul([R],{width:V,height:J,viewBox:"0 0 "+f+" "+F}),N=xc([],[ee],s);N.height=F/1e3,N.style.width=V,N.style.height=J,I.push({type:"elem",elem:N})}else{if(I.push(x4(u,m,i)),I.push(jp),l===null){var G=O-y-x+2*bx;I.push(_4(c,G,s))}else{var B=(O-y-x-S)/2+2*bx;I.push(_4(c,B,s)),I.push(jp),I.push(x4(l,m,i)),I.push(jp),I.push(_4(c,B,s))}I.push(jp),I.push(x4(a,m,i))}var k=s.havingBaseStyle(Gt.TEXT),Q=Ln({positionType:"bottom",positionData:j,children:I});return W5(Le(["delimsizing","mult"],[Q],k),Gt.TEXT,s,o)},k4=80,S4=.08,T4=function(t,n,r,s,i){var o=BZ(t,s,r),a=new wc(t,o),l=new ul([a],{width:"400em",height:Ve(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return xc(["hide-tail"],[l],i)},Nee=function(t,n){var r=n.havingBaseSizing(),s=PL("\\surd",t*r.sizeMultiplier,BL,r),i=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,u,d;return s.type==="small"?(u=1e3+1e3*o+k4,t<1?i=1:t<1.4&&(i=.7),l=(1+o+S4)/i,c=(1+o)/i,a=T4("sqrtMain",l,u,o,n),a.style.minWidth="0.853em",d=.833/i):s.type==="large"?(u=(1e3+k4)*b0[s.size],c=(b0[s.size]+o)/i,l=(b0[s.size]+o+S4)/i,a=T4("sqrtSize"+s.size,l,u,o,n),a.style.minWidth="1.02em",d=1/i):(l=t+o+S4,c=t+o,u=Math.floor(1e3*t+o)+k4,a=T4("sqrtTall",l,u,o,n),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=Ve(l),{span:a,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},jL=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),Ree=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),DL=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),b0=[0,1.2,1.8,2.4,3],OL=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),jL.has(t)||DL.has(t))return RL(t,n,!1,r,s,i);if(Ree.has(t))return LL(t,b0[n],!1,r,s,i);throw new $e("Illegal delimiter: '"+t+"'")},Lee=[{type:"small",style:Gt.SCRIPTSCRIPT},{type:"small",style:Gt.SCRIPT},{type:"small",style:Gt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],jee=[{type:"small",style:Gt.SCRIPTSCRIPT},{type:"small",style:Gt.SCRIPT},{type:"small",style:Gt.TEXT},{type:"stack"}],BL=[{type:"small",style:Gt.SCRIPTSCRIPT},{type:"small",style:Gt.SCRIPT},{type:"small",style:Gt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Dee=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.")},PL=function(t,n,r,s){for(var i=Math.min(2,3-s.style.size),o=i;o<r.length;o++){var a=r[o];if(a.type==="stack")break;var l=Uf(t,Dee(a),"math"),c=l.height+l.depth;if(a.type==="small"){var u=s.havingBaseStyle(a.style);c*=u.sizeMultiplier}if(c>n)return a}return r[r.length-1]},vx=function(t,n,r,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;DL.has(t)?a=Lee:jL.has(t)?a=BL:a=jee;var l=PL(t,n,a,s);return l.type==="small"?Aee(t,l.style,r,s,i,o):l.type==="large"?RL(t,l.size,r,s,i,o):LL(t,n,r,s,i,o)},C4=function(t,n,r,s,i,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,c=5/s.fontMetrics().ptPerEm,u=Math.max(n-a,r+a),d=Math.max(u/500*l,2*u-c);return vx(t,d,!0,s,i,o)},f9={"\\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}},Oee=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 m9(e){return"isMiddle"in e}function db(e,t){var n=cb(e);if(n&&Oee.has(n.text))return n;throw n?new $e("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new $e("Invalid delimiter type '"+e.type+"'",e)}ot({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=db(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:f9[e.funcName].size,mclass:f9[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Le([e.mclass]):OL(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(xo(e.delim,e.mode));var n=new Ue("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ve(b0[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function p9(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ot({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 $e("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:db(t[0],e).text,color:n}}});ot({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=db(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=nn(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{p9(e);for(var n=ss(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,o=0;o<n.length;o++){var a=n[o];m9(a)?i=!0:(r=Math.max(n[o].height,r),s=Math.max(n[o].depth,s))}r*=t.sizeMultiplier,s*=t.sizeMultiplier;var l;if(e.left==="."?l=G0(t,["mopen"]):l=C4(e.left,r,s,t,e.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var u=n[c];if(m9(u)){var d=u.isMiddle;n[c]=C4(d.delim,r,s,d.options,e.mode,[])}}var f;if(e.right===".")f=G0(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=C4(e.right,r,s,m,e.mode,["mclose"])}return n.push(f),Le(["minner"],n,t)},mathmlBuilder:(e,t)=>{p9(e);var n=Wi(e.body,t);if(e.left!=="."){var r=new Ue("mo",[xo(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new Ue("mo",[xo(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return q5(n)}});ot({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=db(t[0],e);if(!e.parser.leftrightDepth)throw new $e("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=G0(t,[]):(n=OL(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?xo("|","text"):xo(e.delim,e.mode),r=new Ue("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var hb=(e,t)=>{var n=wh(Dn(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,o,a=gl(e.body);if(r==="sout")i=Le(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=_r({number:.6,unit:"pt"},t),c=_r({number:.35,unit:"ex"},t),u=t.havingBaseSizing();s=s/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=Ve(d/2+l);var f=Math.floor(1e3*d*s),m=DZ(f),p=new ul([new wc("phase",m)],{width:"400em",height:Ve(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=xc(["hide-tail"],[p],t),i.style.height=Ve(d),o=n.depth+l+c}else{/cancel/.test(r)?a||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,w,b=0;/box/.test(r)?(b=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(r==="colorbox"?0:b),w=y):r==="angl"?(b=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*b,w=Math.max(0,.25-n.depth)):(y=a?.2:0,w=y),i=yee(n,r,y,w,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ve(b)):r==="angl"&&b!==.049&&(i.style.borderTopWidth=Ve(b),i.style.borderRightWidth=Ve(b)),o=n.depth+w,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var v;if(e.backgroundColor)v=Ln({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(r)?["svg-align"]:[];v=Ln({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(r)&&(v.height=n.height,v.depth=n.depth),/cancel/.test(r)&&!a?Le(["mord","cancel-lap"],[v],t):Le(["mord"],[v],t)},fb=(e,t)=>{var n,r=new Ue(e.label.includes("colorbox")?"mpadded":"menclose",[tr(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var s=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+Ve(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};ot({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=nn(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:hb,mathmlBuilder:fb});ot({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=nn(t[0],"color-token").color,o=nn(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:hb,mathmlBuilder:fb});ot({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]}}});ot({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:hb,mathmlBuilder:fb});ot({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:hb,mathmlBuilder:fb});ot({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 $L={};function _a(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<n.length;++l)$L[n[l]]=a;i&&($1[t]=i),o&&(z1[t]=o)}var zL={};function z(e,t){zL[e]=t}class fi{constructor(t,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=r}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new fi(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Fi{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 Fi(n,fi.range(this,t))}}function g9(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 mb=e=>{var t=e.parser.settings;if(!t.displayMode)throw new $e("{"+e.envName+"} can be used only in display mode.")},Bee=new Set(["gather","gather*"]);function G5(e){if(!e.includes("ed"))return!e.includes("*")}function Dc(e,t,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,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 $e("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],y=[p],w=[],b=[],v=l!=null?[]:void 0;function x(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function S(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new Fi("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),b.push(g9(e));;){var C=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var E={type:"ordgroup",mode:e.mode,body:C};n&&(E={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[E]}),p.push(E);var M=e.fetch().text;if(M==="&"){if(d&&p.length===d){if(c||a)throw new $e("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(M==="\\end"){S(),p.length===1&&E.type==="styling"&&E.body.length===1&&E.body[0].type==="ordgroup"&&E.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),b.length<y.length+1&&b.push([]);break}else if(M==="\\\\"){e.consume();var D=void 0;e.gullet.future().text!==" "&&(D=e.parseSizeGroup(!0)),w.push(D?D.value:null),S(),b.push(g9(e)),p=[],y.push(p),x()}else throw new $e("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:s,arraystretch:o,body:y,cols:i,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:b,colSeparationType:a,tags:v,leqno:f}}function K5(e){return e.slice(0,1)==="d"?"display":"text"}var ka=function(t,n){var r,s,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),c=[],u=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),d=1/n.fontMetrics().ptPerEm,f=5*d;if(t.colSeparationType&&t.colSeparationType==="small"){var m=n.havingStyle(Gt.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var p=t.colSeparationType==="CD"?_r({number:3,unit:"ex"},n):12*d,y=3*d,w=t.arraystretch*p,b=.7*w,v=.3*w,x=0;function S(De){for(var lt=0;lt<De.length;++lt)lt>0&&(x+=.25),c.push({pos:x,isDashed:De[lt]})}for(S(o[0]),r=0;r<t.body.length;++r){var C=t.body[r],E=b,M=v;a<C.length&&(a=C.length);var D={cells:new Array(C.length),height:0,depth:0,pos:0};for(s=0;s<C.length;++s){var O=Dn(C[s],n);M<O.depth&&(M=O.depth),E<O.height&&(E=O.height),D.cells[s]=O}var A=t.rowGaps[r],j=0;A&&(j=_r(A,n),j>0&&(j+=v,M<j&&(M=j),j=0)),t.addJot&&r<t.body.length-1&&(M+=y),D.height=E,D.depth=M,x+=E,D.pos=x,x+=M+j,l[r]=D,S(o[r+1])}var I=x/2+n.fontMetrics().axisHeight,P=t.cols||[],F=[],q,R,V=[];if(t.tags&&t.tags.some(De=>De))for(r=0;r<i;++r){var J=l[r],ee=J.pos-I,N=t.tags[r],G=void 0;N===!0?G=Le(["eqn-num"],[],n):N===!1?G=Le([],[],n):G=Le([],ss(N,n,!0),n),G.depth=J.depth,G.height=J.height,V.push({type:"elem",elem:G,shift:ee})}for(s=0,R=0;s<a||R<P.length;++s,++R){for(var B,k=P[R],Q=!0;((ce=k)==null?void 0:ce.type)==="separator";){var ce;if(Q||(q=Le(["arraycolsep"],[]),q.style.width=Ve(n.fontMetrics().doubleRuleSep),F.push(q)),k.separator==="|"||k.separator===":"){var pe=k.separator==="|"?"solid":"dashed",be=Le(["vertical-separator"],[],n);be.style.height=Ve(x),be.style.borderRightWidth=Ve(u),be.style.borderRightStyle=pe,be.style.margin="0 "+Ve(-u/2);var ye=x-I;ye&&(be.style.verticalAlign=Ve(-ye)),F.push(be)}else throw new $e("Invalid separator type: "+k.separator);R++,k=P[R],Q=!1}if(!(s>=a)){var ie=void 0;if(s>0||t.hskipBeforeAndAfter){var re,oe;ie=(re=(oe=k)==null?void 0:oe.pregap)!=null?re:f,ie!==0&&(q=Le(["arraycolsep"],[]),q.style.width=Ve(ie),F.push(q))}var ve=[];for(r=0;r<i;++r){var qe=l[r],We=qe.cells[s];if(We){var te=qe.pos-I;We.depth=qe.depth,We.height=qe.height,ve.push({type:"elem",elem:We,shift:te})}}var we=Ln({positionType:"individualShift",children:ve}),Se=Le(["col-align-"+(((B=k)==null?void 0:B.align)||"c")],[we]);if(F.push(Se),s<a-1||t.hskipBeforeAndAfter){var Ne,Pt;ie=(Ne=(Pt=k)==null?void 0:Pt.postgap)!=null?Ne:f,ie!==0&&(q=Le(["arraycolsep"],[]),q.style.width=Ve(ie),F.push(q))}}}var at=Le(["mtable"],F);if(c.length>0){for(var vt=vh("hline",n,u),Tt=vh("hdashline",n,u),rt=[{type:"elem",elem:at,shift:0}];c.length>0;){var tt=c.pop(),Qe=tt.pos-I;tt.isDashed?rt.push({type:"elem",elem:Tt,shift:Qe}):rt.push({type:"elem",elem:vt,shift:Qe})}at=Ln({positionType:"individualShift",children:rt})}if(V.length===0)return Le(["mord"],[at],n);var ne=Ln({positionType:"individualShift",children:V}),se=Le(["tag"],[ne],n);return bl([at,se])},Pee={c:"center ",l:"left ",r:"right "},Sa=function(t,n){for(var r=[],s=new Ue("mtd",[],["mtr-glue"]),i=new Ue("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 Ue("mtd",[tr(a[c],n)]));t.tags&&t.tags[o]&&(l.unshift(s),l.push(s),t.leqno?l.unshift(i):l.push(i)),r.push(new Ue("mtr",l))}var u=new Ue("mtable",r),d=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);u.setAttribute("rowspacing",Ve(d));var f="",m="";if(t.cols&&t.cols.length>0){var p=t.cols,y="",w=!1,b=0,v=p.length;p[0].type==="separator"&&(f+="top ",b=1),p[p.length-1].type==="separator"&&(f+="bottom ",v-=1);for(var x=b;x<v;x++){var S=p[x];S.type==="align"?(m+=Pee[S.align],w&&(y+="none "),w=!0):S.type==="separator"&&w&&(y+=S.separator==="|"?"solid ":"dashed ",w=!1)}u.setAttribute("columnalign",m.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var C=t.cols||[],E="",M=1;M<C.length;M++)E+=M%2?"0em ":"1em ";u.setAttribute("columnspacing",E.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var D="",O=t.hLinesBeforeRow;f+=O[0].length>0?"left ":"",f+=O[O.length-1].length>0?"right ":"";for(var A=1;A<O.length-1;A++)D+=O[A].length===0?"none ":O[A][0]?"dashed ":"solid ";return/[sd]/.test(D)&&u.setAttribute("rowlines",D.trim()),f!==""&&(u=new Ue("menclose",[u]),u.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(u=new Ue("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},FL=function(t,n){t.envName.includes("ed")||mb(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=Dc(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:G5(t.envName),emptySingleRow:!0,colSeparationType:s,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 u="",d=0;d<n[0].body.length;d++){var f=nn(n[0].body[d],"textord");u+=f.text}a=Number(u),l=a*2}var m=!l;o.body.forEach(function(b){for(var v=1;v<b.length;v+=2){var x=nn(b[v],"styling"),S=nn(x.body[0],"ordgroup");S.body.unshift(c)}if(m)l<b.length&&(l=b.length);else{var C=b.length/2;if(a<C)throw new $e("Too many math in a row: "+("expected "+a+", but got "+C),b[0])}});for(var p=0;p<l;++p){var y="r",w=0;p%2===1?y="l":p>0&&m&&(w=1),r[p]={type:"align",align:y,pregap:w,postgap:0}}return o.colSeparationType=m?"align":"alignat",o};_a({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=cb(t[0]),r=n?[t[0]]:nn(t[0],"ordgroup").body,s=r.map(function(o){var a=lb(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 $e("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Dc(e.parser,i,K5(e.envName))},htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var s=e.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,!"lcr".includes(n))throw new $e("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Dc(e.parser,r,K5(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:ka,mathmlBuilder:Sa});_a({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Dc(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=cb(t[0]),r=n?[t[0]]:nn(t[0],"ordgroup").body,s=r.map(function(a){var l=lb(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new $e("Unknown column alignment: "+c,a)});if(s.length>1)throw new $e("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=Dc(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new $e("{subarray} can contain only one column");return o},htmlBuilder:ka,mathmlBuilder:Sa});_a({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=Dc(e.parser,t,K5(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:FL,htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){Bee.has(e.envName)&&mb(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:G5(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Dc(e.parser,t,"display")},htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:FL,htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){mb(e);var t={autoTag:G5(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Dc(e.parser,t,"display")},htmlBuilder:ka,mathmlBuilder:Sa});_a({type:"array",names:["CD"],props:{numArgs:0},handler(e){return mb(e),Tee(e.parser)},htmlBuilder:ka,mathmlBuilder:Sa});z("\\nonumber","\\gdef\\@eqnsw{0}");z("\\notag","\\nonumber");ot({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new $e(e.funcName+" valid only within array environment")}});var y9=$L;ot({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];if(s.type!=="ordgroup")throw new $e("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=nn(s.body[o],"textord").text;if(r==="\\begin"){if(!y9.hasOwnProperty(i))throw new $e("No such environment: "+i,s);var a=y9[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",a),u={mode:n.mode,envName:i,parser:n},d=a.handler(u,l,c);n.expect("\\end",!1);var f=n.nextToken,m=nn(n.parseFunction(),"environment");if(m.name!==i)throw new $e("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return d}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var UL=(e,t)=>{var n=e.font,r=t.withFont(n);return Dn(e.body,r)},qL=(e,t)=>{var n=e.font,r=t.withFont(n);return tr(e.body,r)},b9={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ot({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=F1(t[0]),i=r;return i in b9&&(i=b9[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:UL,mathmlBuilder:qL});ot({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:ub(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:gl(r)}}});ot({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:s}=e,{mode:i}=n,o=n.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:UL,mathmlBuilder:qL});var $ee=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var o=Dn(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(s);var c=Dn(e.denom,i,t),u,d,f;e.hasBarLine?(e.barSize?(d=_r(e.barSize,t),u=vh("frac-line",t,d)):u=vh("frac-line",t),d=u.height,f=u.height):(u=null,d=0,f=t.fontMetrics().defaultRuleThickness);var m,p,y;n.size===Gt.DISPLAY.size?(m=t.fontMetrics().num1,d>0?p=3*f:p=7*f,y=t.fontMetrics().denom1):(d>0?(m=t.fontMetrics().num2,p=f):(m=t.fontMetrics().num3,p=3*f),y=t.fontMetrics().denom2);var w;if(u){var v=t.fontMetrics().axisHeight;m-o.depth-(v+.5*d)<p&&(m+=p-(m-o.depth-(v+.5*d))),v-.5*d-(c.height-y)<p&&(y+=p-(v-.5*d-(c.height-y)));var x=-(v-.5*d);w=Ln({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:x},{type:"elem",elem:o,shift:-m}]})}else{var b=m-o.depth-(c.height-y);b<p&&(m+=.5*(p-b),y+=.5*(p-b)),w=Ln({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-m}]})}i=t.havingStyle(n),w.height*=i.sizeMultiplier/t.sizeMultiplier,w.depth*=i.sizeMultiplier/t.sizeMultiplier;var S;n.size===Gt.DISPLAY.size?S=t.fontMetrics().delim1:n.size===Gt.SCRIPTSCRIPT.size?S=t.havingStyle(Gt.SCRIPT).fontMetrics().delim2:S=t.fontMetrics().delim2;var C,E;return e.leftDelim==null?C=G0(t,["mopen"]):C=vx(e.leftDelim,S,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?E=Le([]):e.rightDelim==null?E=G0(t,["mclose"]):E=vx(e.rightDelim,S,!0,t.havingStyle(n),e.mode,["mclose"]),Le(["mord"].concat(i.sizingClasses(t)),[C,Le(["mfrac"],[w]),E],t)},zee=(e,t)=>{var n=new Ue("mfrac",[tr(e.numer,t),tr(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=_r(e.barSize,t);n.setAttribute("linethickness",Ve(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Ue("mo",[new Hr(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var o=new Ue("mo",[new Hr(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return q5(s)}return n},HL=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};ot({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=t[1],o,a=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,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=r==="\\cfrac",u=null;return c||r.startsWith("\\d")?u="display":r.startsWith("\\t")&&(u="text"),HL({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:$ee,mathmlBuilder:zee});ot({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:r}=e,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:s,token:r}}});var v9=["display","text","script","scriptscript"],w9=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};ot({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,r=t[4],s=t[5],i=F1(t[0]),o=i.type==="atom"&&i.family==="open"?w9(i.text):null,a=F1(t[1]),l=a.type==="atom"&&a.family==="close"?w9(a.text):null,c=nn(t[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var f=null,m=t[3];if(m.type==="ordgroup"){if(m.body.length>0){var p=nn(m.body[0],"textord");f=v9[Number(p.text)]}}else m=nn(m,"textord"),f=v9[Number(m.text)];return HL({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l},f)}});ot({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:s}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:nn(t[0],"size").value,token:s}}});ot({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=nn(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:s,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var VL=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?Dn(e.sup,t.havingStyle(n.sup()),t):Dn(e.sub,t.havingStyle(n.sub()),t),s=nn(e.base,"horizBrace")):s=nn(e,"horizBrace");var i=Dn(s.base,t.havingBaseStyle(Gt.DISPLAY)),o=ab(s,t),a;if(s.isOver?a=Ln({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=Ln({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=Le(["minner",s.isOver?"mover":"munder"],[a],t);s.isOver?a=Ln({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Ln({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Le(["minner",s.isOver?"mover":"munder"],[a],t)},Fee=(e,t)=>{var n=ob(e.label);return new Ue(e.isOver?"mover":"munder",[tr(e.base,t),n])};ot({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:t[0]}},htmlBuilder:VL,mathmlBuilder:Fee});ot({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=nn(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:qr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=ss(e.body,t,!1);return eee(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=_c(e.body,t);return n instanceof Ue||(n=new Ue("mrow",[n])),n.setAttribute("href",e.href),n}});ot({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=nn(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<r.length;i++){var o=r[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:qr(a)}}});ot({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:qr(t[0])}},htmlBuilder(e,t){var n=ss(e.body,t.withFont(""),!1);return bl(n)},mathmlBuilder(e,t){return new Ue("mrow",Wi(e.body,t.withFont("")))}});ot({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,token:s}=e,i=nn(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(r){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(","),u=0;u<c.length;u++){var d=c[u],f=d.indexOf("=");if(f<0)throw new $e("\\htmlData key/value '"+d+"' missing equals sign");var m=d.slice(0,f),p=d.slice(f+1);l["data-"+m.trim()]=p}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:qr(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=ss(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=Le(r,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&s.setAttribute(i,e.attributes[i]);return s},mathmlBuilder:(e,t)=>_c(e.body,t)});ot({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:qr(t[0]),mathml:qr(t[1])}},htmlBuilder:(e,t)=>{var n=ss(e.html,t,!1);return bl(n)},mathmlBuilder:(e,t)=>_c(e.mathml,t)});var A4=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 $e("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!aL(r))throw new $e("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};ot({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=nn(n[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var f=d[1].trim();switch(d[0].trim()){case"alt":a=f;break;case"width":s=A4(f);break;case"height":i=A4(f);break;case"totalheight":o=A4(f);break;default:throw new $e("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var m=nn(t[0],"url").url;return a===""&&(a=m,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:r.mode,alt:a,width:s,height:i,totalheight:o,src:m}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=_r(e.height,t),r=0;e.totalheight.number>0&&(r=_r(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=_r(e.width,t));var i={height:Ve(n+r)};s>0&&(i.width=Ve(s)),r>0&&(i.verticalAlign=Ve(-r));var o=new qZ(e.src,e.alt,i);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new Ue("mglyph",[]);n.setAttribute("alt",e.alt);var r=_r(e.height,t),s=0;if(e.totalheight.number>0&&(s=_r(e.totalheight,t)-r,n.setAttribute("valign",Ve(-s))),n.setAttribute("height",Ve(r+s)),e.width.number>0){var i=_r(e.width,t);n.setAttribute("width",Ve(i))}return n.setAttribute("src",e.src),n}});ot({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=nn(t[0],"size");if(n.settings.strict){var i=r[1]==="m",o=s.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(e,t){return mL(e.dimension,t)},mathmlBuilder(e,t){var n=_r(e.dimension,t);return new wL(n)}});ot({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=Le([],[Dn(e.body,t)]),n=Le(["inner"],[n],t)):n=Le(["inner"],[Dn(e.body,t)]);var r=Le(["fix"],[]),s=Le([e.alignment],[n,r],t),i=Le(["strut"]);return i.style.height=Ve(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ve(-s.depth)),s.children.unshift(i),s=Le(["thinbox"],[s],t),Le(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Ue("mpadded",[tr(e.body,t)]);if(e.alignment!=="rlap"){var r=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});ot({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",o=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}});ot({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new $e("Mismatched "+e.funcName)}});var x9=(e,t)=>{switch(t.style.size){case Gt.DISPLAY.size:return e.display;case Gt.TEXT.size:return e.text;case Gt.SCRIPT.size:return e.script;case Gt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ot({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:qr(t[0]),text:qr(t[1]),script:qr(t[2]),scriptscript:qr(t[3])}},htmlBuilder:(e,t)=>{var n=x9(e,t),r=ss(n,t,!1);return bl(r)},mathmlBuilder:(e,t)=>{var n=x9(e,t);return _c(n,t)}});var WL=(e,t,n,r,s,i,o)=>{e=Le([],[e]);var a=n&&gl(n),l,c;if(t){var u=Dn(t,r.havingStyle(s.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=Dn(n,r.havingStyle(s.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var f;if(c&&l){var m=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;f=Ln({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ve(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=e.height-o;f=Ln({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ve(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=Ln({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var w=[f];if(l&&i!==0&&!a){var b=Le(["mspace"],[],r);b.style.marginRight=Ve(i),w.unshift(b)}return Le(["mop","op-limits"],w,r)},GL=new Set(["\\smallint"]),Gh=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=nn(e.base,"op"),s=!0):i=nn(e,"op");var o=t.style,a=!1;o.size===Gt.DISPLAY.size&&i.symbol&&!GL.has(i.name)&&(a=!0);var l,c;if(i.symbol){var u=a?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=Vs(i.name,u,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var f=gL(d+"Size"+(a?"2":"1"),t);l=Ln({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var m=ss(i.body,t,!0);m.length===1&&m[0]instanceof Hi?(l=m[0],l.classes[0]="mop"):l=Le(["mop"],m,t)}else{for(var p=[],y=1;y<i.name.length;y++)p.push(F5(i.name[y],i.mode,t));l=Le(["mop"],p,t)}var w=0,b=0;if((l instanceof Hi||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var v;w=(l.height-l.depth)/2-t.fontMetrics().axisHeight,b=(v=l.italic)!=null?v:0}return s?WL(l,n,r,t,o,b,w):(w&&(l.style.position="relative",l.style.top=Ve(w)),l)},Dm=(e,t)=>{var n;if(e.symbol)n=new Ue("mo",[xo(e.name,e.mode)]),GL.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Ue("mo",Wi(e.body,t));else{n=new Ue("mi",[new Hr(e.name.slice(1))]);var r=new Ue("mo",[xo("⁡","text")]);e.parentIsSupSub?n=new Ue("mrow",[n,r]):n=vL([n,r])}return n},Uee={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};ot({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=r;return s.length===1&&(s=Uee[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Gh,mathmlBuilder:Dm});ot({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:qr(r)}},htmlBuilder:Gh,mathmlBuilder:Dm});var qee={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};ot({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:Gh,mathmlBuilder:Dm});ot({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:Gh,mathmlBuilder:Dm});ot({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,r=n;return r.length===1&&(r=qee[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Gh,mathmlBuilder:Dm});var KL=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=nn(e.base,"operatorname"),s=!0):i=nn(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(d=>{var f="text"in d?d.text:void 0;return typeof f=="string"?{type:"textord",mode:d.mode,text:f}:d}),l=ss(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof Hi&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Le(["mop"],l,t)}else o=Le(["mop"],[],t);return s?WL(o,n,r,t,t.style,0,0):o},Hee=(e,t)=>{for(var n=Wi(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof wL))if(i instanceof Ue)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 Hr?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(u=>u.toText()).join("");n=[new Hr(a)]}var l=new Ue("mi",n);l.setAttribute("mathvariant","normal");var c=new Ue("mo",[xo("⁡","text")]);return e.parentIsSupSub?new Ue("mrow",[l,c]):vL([l,c])};ot({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"operatorname",mode:n.mode,body:qr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:KL,mathmlBuilder:Hee});z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Qu({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?bl(ss(e.body,t,!1)):Le(["mord"],ss(e.body,t,!0),t)},mathmlBuilder(e,t){return _c(e.body,t,!0)}});ot({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=Dn(e.body,t.havingCrampedStyle()),r=vh("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=Ln({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return Le(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Ue("mo",[new Hr("‾")]);n.setAttribute("stretchy","true");var r=new Ue("mover",[tr(e.body,t),n]);return r.setAttribute("accent","true"),r}});ot({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:qr(r)}},htmlBuilder:(e,t)=>{var n=ss(e.body,t.withPhantom(),!1);return bl(n)},mathmlBuilder:(e,t)=>{var n=Wi(e.body,t);return new Ue("mphantom",n)}});z("\\hphantom","\\smash{\\phantom{#1}}");ot({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=Le(["inner"],[Dn(e.body,t.withPhantom())]),r=Le(["fix"],[]);return Le(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=Wi(qr(e.body),t),r=new Ue("mphantom",n),s=new Ue("mpadded",[r]);return s.setAttribute("width","0px"),s}});ot({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=nn(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=Dn(e.body,t),r=_r(e.dy,t);return Ln({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ue("mpadded",[tr(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});ot({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});ot({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,s=n[0],i=nn(t[0],"size"),o=nn(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&nn(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Le(["mord","rule"],[],t),r=_r(e.width,t),s=_r(e.height,t),i=e.shift?_r(e.shift,t):0;return n.style.borderRightWidth=Ve(r),n.style.borderTopWidth=Ve(s),n.style.bottom=Ve(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=_r(e.width,t),r=_r(e.height,t),s=e.shift?_r(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Ue("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Ve(n)),o.setAttribute("height",Ve(r));var a=new Ue("mpadded",[o]);return s>=0?a.setAttribute("height",Ve(s)):(a.setAttribute("height",Ve(s)),a.setAttribute("depth",Ve(-s))),a.setAttribute("voffset",Ve(s)),a}});function YL(e,t,n){for(var r=ss(e,t,!1),s=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var o=r[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[o+1]==="reset-size"+t.size&&(r[i].classes[o+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return bl(r)}var _9=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Vee=(e,t)=>{var n=t.havingSize(e.size);return YL(e.body,n,t)};ot({type:"sizing",names:_9,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:_9.indexOf(r)+1,body:i}},htmlBuilder:Vee,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Wi(e.body,n),s=new Ue("mstyle",r);return s.setAttribute("mathsize",Ve(n.sizeMultiplier)),s}});ot({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,s=!1,i=!1,o=n[0]&&nn(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=lb(c).text,a==="t")s=!0;else if(a==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var u=t[0];return{type:"smash",mode:r.mode,body:u,smashHeight:s,smashDepth:i}},htmlBuilder:(e,t)=>{var n=Le([],[Dn(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 Le(["mord","smash"],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);var s=Ln({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Le(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Ue("mpadded",[tr(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});ot({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,s=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(e,t){var n=Dn(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=wh(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<Gt.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,a=n.height+n.depth+o+s,{span:l,ruleWidth:c,advanceWidth:u}=Nee(a,t),d=l.height-c;d>n.height+n.depth+o&&(o=(o+d-n.height-n.depth)/2);var f=l.height-n.height-o-c;n.style.paddingLeft=Ve(u);var m=Ln({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 p=t.havingStyle(Gt.SCRIPTSCRIPT),y=Dn(e.index,p,t),w=.6*(m.height-m.depth),b=Ln({positionType:"shift",positionData:-w,children:[{type:"elem",elem:y}]}),v=Le(["root"],[b]);return Le(["mord","sqrt"],[v,m],t)}else return Le(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new Ue("mroot",[tr(n,t),tr(r,t)]):new Ue("msqrt",[tr(n,t)])}});var wx={display:Gt.DISPLAY,text:Gt.TEXT,script:Gt.SCRIPT,scriptscript:Gt.SCRIPTSCRIPT};function Wee(e){return e in wx}ot({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!Wee(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var n=wx[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),YL(e.body,r,t)},mathmlBuilder(e,t){var n=wx[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=Wi(e.body,r),i=new Ue("mstyle",s),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 Gee=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Gt.DISPLAY.size||r.alwaysHandleSupSub);return s?Gh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Gt.DISPLAY.size||r.limits);return i?KL:null}else{if(r.type==="accent")return gl(r.base)?V5:null;if(r.type==="horizBrace"){var o=!t.sub;return o===r.isOver?VL:null}else return null}else return null};Qu({type:"supsub",htmlBuilder(e,t){var n=Gee(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,o=Dn(r,t),a,l,c=t.fontMetrics(),u=0,d=0,f=r&&gl(r);if(s){var m=t.havingStyle(t.style.sup());a=Dn(s,m,t),f||(u=o.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var p=t.havingStyle(t.style.sub());l=Dn(i,p,t),f||(d=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/t.sizeMultiplier)}var y;t.style===Gt.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var w=t.sizeMultiplier,b=Ve(.5/c.ptPerEm/w),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 Hi||x){var S;v=Ve(-((S=o.italic)!=null?S:0))}}var C;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var E=c.defaultRuleThickness,M=4*E;if(u-a.depth-(l.height-d)<M){d=M-(u-a.depth)+l.height;var D=.8*c.xHeight-(u-a.depth);D>0&&(u+=D,d-=D)}var O=[{type:"elem",elem:l,shift:d,marginRight:b,marginLeft:v},{type:"elem",elem:a,shift:-u,marginRight:b}];C=Ln({positionType:"individualShift",children:O})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var A=[{type:"elem",elem:l,marginLeft:v,marginRight:b}];C=Ln({positionType:"shift",positionData:d,children:A})}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),C=Ln({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var j=px(o,"right")||"mord";return Le([j],[o,Le(["msupsub"],[C])],t)},mathmlBuilder(e,t){var n=!1,r,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[tr(e.base,t)];e.sub&&i.push(tr(e.sub,t)),e.sup&&i.push(tr(e.sup,t));var o;if(n)o=r?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===Gt.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===Gt.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Gt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Gt.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===Gt.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===Gt.DISPLAY)?o="mover":o="msup"}return new Ue(o,i)}});Qu({type:"atom",htmlBuilder(e,t){return F5(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Ue("mo",[xo(e.text,e.mode)]);if(e.family==="bin"){var r=H5(e,t);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var XL={mi:"italic",mn:"normal",mtext:"normal"};Qu({type:"mathord",htmlBuilder(e,t){return ib(e,t,"mathord")},mathmlBuilder(e,t){var n=new Ue("mi",[xo(e.text,e.mode,t)]),r=H5(e,t)||"italic";return r!==XL[n.type]&&n.setAttribute("mathvariant",r),n}});Qu({type:"textord",htmlBuilder(e,t){return ib(e,t,"textord")},mathmlBuilder(e,t){var n=xo(e.text,e.mode,t),r=H5(e,t)||"normal",s;return e.mode==="text"?s=new Ue("mtext",[n]):/[0-9]/.test(e.text)?s=new Ue("mn",[n]):e.text==="\\prime"?s=new Ue("mo",[n]):s=new Ue("mi",[n]),r!==XL[s.type]&&s.setAttribute("mathvariant",r),s}});var E4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},M4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Qu({type:"spacing",htmlBuilder(e,t){if(M4.hasOwnProperty(e.text)){var n=M4[e.text].className||"";if(e.mode==="text"){var r=ib(e,t,"textord");return r.classes.push(n),r}else return Le(["mspace",n],[F5(e.text,e.mode,t)],t)}else{if(E4.hasOwnProperty(e.text))return Le(["mspace",E4[e.text]],[],t);throw new $e('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(M4.hasOwnProperty(e.text))n=new Ue("mtext",[new Hr(" ")]);else{if(E4.hasOwnProperty(e.text))return new Ue("mspace");throw new $e('Unknown type of space "'+e.text+'"')}return n}});var k9=()=>{var e=new Ue("mtd",[]);return e.setAttribute("width","50%"),e};Qu({type:"tag",mathmlBuilder(e,t){var n=new Ue("mtable",[new Ue("mtr",[k9(),new Ue("mtd",[_c(e.body,t)]),k9(),new Ue("mtd",[_c(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var S9={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},T9={"\\textbf":"textbf","\\textmd":"textmd"},Kee={"\\textit":"textit","\\textup":"textup"},C9=(e,t)=>{var n=e.font;if(n){if(S9[n])return t.withTextFontFamily(S9[n]);if(T9[n])return t.withTextFontWeight(T9[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(Kee[n])};ot({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"text",mode:n.mode,body:qr(s),font:r}},htmlBuilder(e,t){var n=C9(e,t),r=ss(e.body,n,!0);return Le(["mord","text"],r,n)},mathmlBuilder(e,t){var n=C9(e,t);return _c(e.body,n)}});ot({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=Dn(e.body,t),r=vh("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=Ln({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return Le(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Ue("mo",[new Hr("‾")]);n.setAttribute("stretchy","true");var r=new Ue("munder",[tr(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});ot({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=Dn(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return Ln({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ue("mpadded",[tr(e.body,t)],["vcenter"]);return new Ue("mrow",[n])}});ot({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new $e("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=A9(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),r.push(Vs(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return Le(["mord","text"].concat(s.sizingClasses(t)),fL(r),s)},mathmlBuilder(e,t){var n=new Hr(A9(e)),r=new Ue("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var A9=e=>e.body.replace(/ /g,e.star?"␣":" "),Jl=yL,QL=`[ \r
	]`,Yee="\\\\[a-zA-Z@]+",Xee="\\\\[^\uD800-\uDFFF]",Qee="("+Yee+")"+QL+"*",Jee=`\\\\(
|[ \r	]+
?)[ \r	]*`,xx="[̀-ͯ]",Zee=new RegExp(xx+"+$"),ete="("+QL+"+)|"+(Jee+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(xx+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(xx+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Qee)+("|"+Xee+")");class E9{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(ete,"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 Fi("EOF",new fi(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new $e("Unexpected character: '"+t[n]+"'",new Fi(t[n],new fi(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=t.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Fi(s,new fi(this,n,this.tokenRegex.lastIndex))}}class tte{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 $e("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var nte=zL;z("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});z("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});z("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});z("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});z("\\@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}});z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");z("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var M9={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};z("\\char",function(e){var t=e.popToken(),n,r=0;if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")r=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new $e("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=M9[t.text],r==null||r>=n)throw new $e("Invalid base-"+n+" digit "+t.text);for(var s;(s=M9[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var Y5=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new $e("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new $e("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new $e("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(s=e.consumeArg().tokens,s.length===1&&s[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 $e("Invalid number of arguments: "+l);a=parseInt(l),s=e.consumeArg().tokens}return o&&r||e.macros.set(i,{tokens:s,numArgs:a}),""};z("\\newcommand",e=>Y5(e,!1,!0,!1));z("\\renewcommand",e=>Y5(e,!0,!1,!1));z("\\providecommand",e=>Y5(e,!0,!0,!0));z("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});z("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});z("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Jl[n],gr.math[n],gr.text[n]),""});z("\\bgroup","{");z("\\egroup","}");z("~","\\nobreakspace");z("\\lq","`");z("\\rq","'");z("\\aa","\\r a");z("\\AA","\\r A");z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");z("ℬ","\\mathscr{B}");z("ℰ","\\mathscr{E}");z("ℱ","\\mathscr{F}");z("ℋ","\\mathscr{H}");z("ℐ","\\mathscr{I}");z("ℒ","\\mathscr{L}");z("ℳ","\\mathscr{M}");z("ℛ","\\mathscr{R}");z("ℭ","\\mathfrak{C}");z("ℌ","\\mathfrak{H}");z("ℨ","\\mathfrak{Z}");z("\\Bbbk","\\Bbb{k}");z("\\llap","\\mathllap{\\textrm{#1}}");z("\\rlap","\\mathrlap{\\textrm{#1}}");z("\\clap","\\mathclap{\\textrm{#1}}");z("\\mathstrut","\\vphantom{(}");z("\\underbar","\\underline{\\text{#1}}");z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");z("\\ne","\\neq");z("≠","\\neq");z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");z("∉","\\notin");z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");z("⟂","\\perp");z("‼","\\mathclose{!\\mkern-0.8mu!}");z("∌","\\notni");z("⌜","\\ulcorner");z("⌝","\\urcorner");z("⌞","\\llcorner");z("⌟","\\lrcorner");z("©","\\copyright");z("®","\\textregistered");z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");z("⋮","\\vdots");z("\\varGamma","\\mathit{\\Gamma}");z("\\varDelta","\\mathit{\\Delta}");z("\\varTheta","\\mathit{\\Theta}");z("\\varLambda","\\mathit{\\Lambda}");z("\\varXi","\\mathit{\\Xi}");z("\\varPi","\\mathit{\\Pi}");z("\\varSigma","\\mathit{\\Sigma}");z("\\varUpsilon","\\mathit{\\Upsilon}");z("\\varPhi","\\mathit{\\Phi}");z("\\varPsi","\\mathit{\\Psi}");z("\\varOmega","\\mathit{\\Omega}");z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");z("\\boxed","\\fbox{$\\displaystyle{#1}$}");z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var I9={",":"\\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"},rte=new Set(["bin","rel"]);z("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in I9?t=I9[n]:(n.slice(0,4)==="\\not"||n in gr.math&&rte.has(gr.math[n].group))&&(t="\\dotsb"),t});var X5={")":!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};z("\\dotso",function(e){var t=e.future().text;return t in X5?"\\ldots\\,":"\\ldots"});z("\\dotsc",function(e){var t=e.future().text;return t in X5&&t!==","?"\\ldots\\,":"\\ldots"});z("\\cdots",function(e){var t=e.future().text;return t in X5?"\\@cdots\\,":"\\@cdots"});z("\\dotsb","\\cdots");z("\\dotsm","\\cdots");z("\\dotsi","\\!\\cdots");z("\\dotsx","\\ldots\\,");z("\\DOTSI","\\relax");z("\\DOTSB","\\relax");z("\\DOTSX","\\relax");z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");z("\\,","\\tmspace+{3mu}{.1667em}");z("\\thinspace","\\,");z("\\>","\\mskip{4mu}");z("\\:","\\tmspace+{4mu}{.2222em}");z("\\medspace","\\:");z("\\;","\\tmspace+{5mu}{.2777em}");z("\\thickspace","\\;");z("\\!","\\tmspace-{3mu}{.1667em}");z("\\negthinspace","\\!");z("\\negmedspace","\\tmspace-{4mu}{.2222em}");z("\\negthickspace","\\tmspace-{5mu}{.277em}");z("\\enspace","\\kern.5em ");z("\\enskip","\\hskip.5em\\relax");z("\\quad","\\hskip1em\\relax");z("\\qquad","\\hskip2em\\relax");z("\\tag","\\@ifstar\\tag@literal\\tag@paren");z("\\tag@paren","\\tag@literal{({#1})}");z("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new $e("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");z("\\newline","\\\\\\relax");z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var JL=Ve(da["Main-Regular"][84][1]-.7*da["Main-Regular"][65][1]);z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+JL+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+JL+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");z("\\hspace","\\@ifstar\\@hspacer\\@hspace");z("\\@hspace","\\hskip #1\\relax");z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");z("\\ordinarycolon",":");z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');z("∷","\\dblcolon");z("∹","\\eqcolon");z("≔","\\coloneqq");z("≕","\\eqqcolon");z("⩴","\\Coloneqq");z("\\ratio","\\vcentcolon");z("\\coloncolon","\\dblcolon");z("\\colonequals","\\coloneqq");z("\\coloncolonequals","\\Coloneqq");z("\\equalscolon","\\eqqcolon");z("\\equalscoloncolon","\\Eqqcolon");z("\\colonminus","\\coloneq");z("\\coloncolonminus","\\Coloneq");z("\\minuscolon","\\eqcolon");z("\\minuscoloncolon","\\Eqcolon");z("\\coloncolonapprox","\\Colonapprox");z("\\coloncolonsim","\\Colonsim");z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");z("\\imath","\\html@mathml{\\@imath}{ı}");z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");z("⟦","\\llbracket");z("⟧","\\rrbracket");z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");z("⦃","\\lBrace");z("⦄","\\rBrace");z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");z("⦵","\\minuso");z("\\darr","\\downarrow");z("\\dArr","\\Downarrow");z("\\Darr","\\Downarrow");z("\\lang","\\langle");z("\\rang","\\rangle");z("\\uarr","\\uparrow");z("\\uArr","\\Uparrow");z("\\Uarr","\\Uparrow");z("\\N","\\mathbb{N}");z("\\R","\\mathbb{R}");z("\\Z","\\mathbb{Z}");z("\\alef","\\aleph");z("\\alefsym","\\aleph");z("\\Alpha","\\mathrm{A}");z("\\Beta","\\mathrm{B}");z("\\bull","\\bullet");z("\\Chi","\\mathrm{X}");z("\\clubs","\\clubsuit");z("\\cnums","\\mathbb{C}");z("\\Complex","\\mathbb{C}");z("\\Dagger","\\ddagger");z("\\diamonds","\\diamondsuit");z("\\empty","\\emptyset");z("\\Epsilon","\\mathrm{E}");z("\\Eta","\\mathrm{H}");z("\\exist","\\exists");z("\\harr","\\leftrightarrow");z("\\hArr","\\Leftrightarrow");z("\\Harr","\\Leftrightarrow");z("\\hearts","\\heartsuit");z("\\image","\\Im");z("\\infin","\\infty");z("\\Iota","\\mathrm{I}");z("\\isin","\\in");z("\\Kappa","\\mathrm{K}");z("\\larr","\\leftarrow");z("\\lArr","\\Leftarrow");z("\\Larr","\\Leftarrow");z("\\lrarr","\\leftrightarrow");z("\\lrArr","\\Leftrightarrow");z("\\Lrarr","\\Leftrightarrow");z("\\Mu","\\mathrm{M}");z("\\natnums","\\mathbb{N}");z("\\Nu","\\mathrm{N}");z("\\Omicron","\\mathrm{O}");z("\\plusmn","\\pm");z("\\rarr","\\rightarrow");z("\\rArr","\\Rightarrow");z("\\Rarr","\\Rightarrow");z("\\real","\\Re");z("\\reals","\\mathbb{R}");z("\\Reals","\\mathbb{R}");z("\\Rho","\\mathrm{P}");z("\\sdot","\\cdot");z("\\sect","\\S");z("\\spades","\\spadesuit");z("\\sub","\\subset");z("\\sube","\\subseteq");z("\\supe","\\supseteq");z("\\Tau","\\mathrm{T}");z("\\thetasym","\\vartheta");z("\\weierp","\\wp");z("\\Zeta","\\mathrm{Z}");z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");z("\\bra","\\mathinner{\\langle{#1}|}");z("\\ket","\\mathinner{|{#1}\\rangle}");z("\\braket","\\mathinner{\\langle{#1}\\rangle}");z("\\Bra","\\left\\langle#1\\right|");z("\\Ket","\\left|#1\\right\\rangle");var ZL=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,s=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=d=>f=>{e&&(f.macros.set("|",o),s.length&&f.macros.set("\\|",a));var m=d;if(!d&&s.length){var p=f.future();p.text==="|"&&(f.popToken(),m=!0)}return{tokens:m?s:r,numArgs:0}};t.macros.set("|",l(!1)),s.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,u=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};z("\\bra@ket",ZL(!1));z("\\bra@set",ZL(!0));z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");z("\\angln","{\\angl n}");z("\\blue","\\textcolor{##6495ed}{#1}");z("\\orange","\\textcolor{##ffa500}{#1}");z("\\pink","\\textcolor{##ff00af}{#1}");z("\\red","\\textcolor{##df0030}{#1}");z("\\green","\\textcolor{##28ae7b}{#1}");z("\\gray","\\textcolor{gray}{#1}");z("\\purple","\\textcolor{##9d38bd}{#1}");z("\\blueA","\\textcolor{##ccfaff}{#1}");z("\\blueB","\\textcolor{##80f6ff}{#1}");z("\\blueC","\\textcolor{##63d9ea}{#1}");z("\\blueD","\\textcolor{##11accd}{#1}");z("\\blueE","\\textcolor{##0c7f99}{#1}");z("\\tealA","\\textcolor{##94fff5}{#1}");z("\\tealB","\\textcolor{##26edd5}{#1}");z("\\tealC","\\textcolor{##01d1c1}{#1}");z("\\tealD","\\textcolor{##01a995}{#1}");z("\\tealE","\\textcolor{##208170}{#1}");z("\\greenA","\\textcolor{##b6ffb0}{#1}");z("\\greenB","\\textcolor{##8af281}{#1}");z("\\greenC","\\textcolor{##74cf70}{#1}");z("\\greenD","\\textcolor{##1fab54}{#1}");z("\\greenE","\\textcolor{##0d923f}{#1}");z("\\goldA","\\textcolor{##ffd0a9}{#1}");z("\\goldB","\\textcolor{##ffbb71}{#1}");z("\\goldC","\\textcolor{##ff9c39}{#1}");z("\\goldD","\\textcolor{##e07d10}{#1}");z("\\goldE","\\textcolor{##a75a05}{#1}");z("\\redA","\\textcolor{##fca9a9}{#1}");z("\\redB","\\textcolor{##ff8482}{#1}");z("\\redC","\\textcolor{##f9685d}{#1}");z("\\redD","\\textcolor{##e84d39}{#1}");z("\\redE","\\textcolor{##bc2612}{#1}");z("\\maroonA","\\textcolor{##ffbde0}{#1}");z("\\maroonB","\\textcolor{##ff92c6}{#1}");z("\\maroonC","\\textcolor{##ed5fa6}{#1}");z("\\maroonD","\\textcolor{##ca337c}{#1}");z("\\maroonE","\\textcolor{##9e034e}{#1}");z("\\purpleA","\\textcolor{##ddd7ff}{#1}");z("\\purpleB","\\textcolor{##c6b9fc}{#1}");z("\\purpleC","\\textcolor{##aa87ff}{#1}");z("\\purpleD","\\textcolor{##7854ab}{#1}");z("\\purpleE","\\textcolor{##543b78}{#1}");z("\\mintA","\\textcolor{##f5f9e8}{#1}");z("\\mintB","\\textcolor{##edf2df}{#1}");z("\\mintC","\\textcolor{##e0e5cc}{#1}");z("\\grayA","\\textcolor{##f6f7f7}{#1}");z("\\grayB","\\textcolor{##f0f1f2}{#1}");z("\\grayC","\\textcolor{##e3e5e6}{#1}");z("\\grayD","\\textcolor{##d6d8da}{#1}");z("\\grayE","\\textcolor{##babec2}{#1}");z("\\grayF","\\textcolor{##888d93}{#1}");z("\\grayG","\\textcolor{##626569}{#1}");z("\\grayH","\\textcolor{##3b3e40}{#1}");z("\\grayI","\\textcolor{##21242c}{#1}");z("\\kaBlue","\\textcolor{##314453}{#1}");z("\\kaGreen","\\textcolor{##71B307}{#1}");var ej={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class ste{constructor(t,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new tte(nte,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new E9(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,r,s;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new Fi("EOF",r.loc)),this.pushTokens(s),new Fi("",fi.range(n,r))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],r=t&&t.length>0;r||this.consumeSpaces();var s=this.future(),i,o=0,a=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new $e("Extra }",i)}else if(i.text==="EOF")throw new $e("Unexpected end of input in a macro argument, expected '"+(t&&r?t[a]:"}")+"'",i);if(t&&r)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||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new $e("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;s<r.length;s++){var i=this.popToken();if(r[s]!==i.text)throw new $e("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 $e("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||t&&s.unexpandable){if(t&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new $e("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new $e("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 $e("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 Fi(t)]):void 0}expandTokens(t){var n=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(r=>r.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var r=this.lexer.catcodes[t];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new E9(s,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:i};return u}return s}isDefined(t){return this.macros.has(t)||Jl.hasOwnProperty(t)||gr.math.hasOwnProperty(t)||gr.text.hasOwnProperty(t)||ej.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Jl.hasOwnProperty(t)&&!Jl[t].primitive}}var N9=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Dp=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),I4={"́":{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"}},R9={á:"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 tj=class nj{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 ste(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 $e("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 Fi("}")),this.gullet.pushTokens(t);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(t,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(nj.endOfExpression.has(s.text)||n&&s.text===n||t&&Jl[s.text]&&Jl[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(t){for(var n=-1,r,s=0;s<t.length;s++){var i=t[s];if(i.type==="infix"){if(n!==-1)throw new $e("only one infix operator per group",i.token);n=s,r=i.replaceWith}}if(n!==-1&&r){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 u;return r==="\\\\abovefrac"?u=this.callFunction(r,[o,t[n],a],[]):u=this.callFunction(r,[o,a],[]),[u]}else return t}handleSupSubscript(t){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(t)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new $e("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(t){for(var n=[],r=0;r<t.length;r++)n.push({type:"textord",mode:"text",text:t[r]});var s={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(t){var n=this.parseGroup("atom",t);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var o=i.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new $e("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new $e("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new $e("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new $e("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")),r={type:"ordgroup",mode:this.mode,body:l}}else if(Dp[i.text]){var c=N9.test(i.text),u=[];for(u.push(new Fi(Dp[i.text])),this.consume();;){var d=this.fetch().text;if(!Dp[d]||N9.test(d)!==c)break;u.unshift(new Fi(Dp[d])),this.consume()}var f=this.subparse(u);c?s={type:"ordgroup",mode:"math",body:f}:r={type:"ordgroup",mode:"math",body:f}}else break}return r||s?{type:"supsub",mode:this.mode,base:n,sup:r,sub:s}:n}parseFunction(t,n){var r=this.fetch(),s=r.text,i=Jl[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new $e("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new $e("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new $e("Can't use function '"+s+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(s,i);return this.callFunction(s,o,a,r,t)}callFunction(t,n,r,s,i){var o={funcName:t,parser:this,token:s,breakOnTokenText:i},a=Jl[t];if(a&&a.handler)return a.handler(o,n,r);throw new $e("No function handler for "+t)}parseArguments(t,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<r;o++){var 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)s.push(c);else throw new $e("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(t,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new $e("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new $e("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new $e("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(t,n){for(var r=this.fetch(),s=r,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new $e("Invalid "+n+": '"+r.text+"'",r);return r.range(s,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new $e("Invalid color: '"+n.text+"'",n);var s=r[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(t){var n,r=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",r=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!s)throw new $e("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!aL(i))throw new $e("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(t,n){var r=this.gullet.scanArgument(t);if(r==null)return null;var s=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),o}parseGroup(t,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:fi.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!ej.hasOwnProperty(s)){if(this.settings.throwOnError)throw new $e("Undefined control sequence: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){for(var n=t.length-1,r=0;r<n;++r){var s=t[r];if(s.type==="textord"){var i=s.text,o=t[r+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[r+2];r+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:fi.range(s,a),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:fi.range(s,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:fi.range(s,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new $e(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}R9.hasOwnProperty(n[0])&&!gr[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=R9[n[0]]+n.slice(1));var i=Zee.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(gr[this.mode][n]){this.settings.strict&&this.mode==="math"&&ax.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=gr[this.mode][n].group,l=fi.range(t),c;wee(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&&(oL(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:fi.range(t),text:n};else return null;if(this.consume(),i)for(var u=0;u<i[0].length;u++){var d=i[0][u];if(!I4[d])throw new $e("Unknown accent ' "+d+"'",t);var f=I4[d][this.mode]||I4[d].text;if(!f)throw new $e("Accent "+d+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:fi.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};tj.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Q5=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new tj(t,n);delete r.gullet.macros.current["\\df@tag"];var s=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new $e("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new Fi("\\df@tag")])}]}return s},J5=function(t,n,r){n.textContent="";var s=pb(t,r).toNode();n.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),J5=function(){throw new $e("KaTeX doesn't work in quirks mode.")});var rj=function(t,n){var r=pb(t,n).toMarkup();return r},sj=function(t,n){var r=new B5(n);return Q5(t,r)},ij=function(t,n,r){if(r.throwOnError||!(t instanceof $e))throw t;var s=Le(["katex-error"],[new Hi(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},pb=function(t,n){var r=new B5(n);try{var s=Q5(t,r);return hee(s,t,r)}catch(i){return ij(i,t,r)}},oj=function(t,n){var r=new B5(n);try{var s=Q5(t,r);return fee(s,t,r)}catch(i){return ij(i,t,r)}},aj="0.16.47",lj={Span:Vh,Anchor:rb,SymbolNode:Hi,SvgNode:ul,PathNode:wc,LineNode:ox},_x={version:aj,render:J5,renderToString:rj,ParseError:$e,SETTINGS_SCHEMA:O1,__parse:sj,__renderToDomTree:pb,__renderToHTMLTree:oj,__setFontMetrics:dL,__defineSymbol:_,__defineFunction:ot,__defineMacro:z,__domTree:lj};const aEe=Object.freeze(Object.defineProperty({__proto__:null,ParseError:$e,SETTINGS_SCHEMA:O1,__defineFunction:ot,__defineMacro:z,__defineSymbol:_,__domTree:lj,__parse:sj,__renderToDomTree:pb,__renderToHTMLTree:oj,__setFontMetrics:dL,default:_x,get render(){return J5},renderToString:rj,version:aj},Symbol.toStringTag,{value:"Module"})),ite={};function L9(e){const t=this,n=e||ite,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(fZ(n)),i.push(iZ()),o.push(oZ(n))}const j9=/[#.]/g;function ote(e,t){const n=e||"",r={};let s=0,i,o;for(;s<n.length;){j9.lastIndex=s;const a=j9.exec(n),l=n.slice(s,a?a.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,s+=l.length),a&&(i=a[0],s++)}return{type:"element",tagName:o||t||"div",properties:r,children:[]}}function cj(e,t,n){const r=n?ute(n):void 0;function s(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=ote(i,t);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,ate(o))a.unshift(o);else for(const[d,f]of Object.entries(o))lte(e,l.properties,d,f)}for(const c of a)kx(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function ate(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const s=t[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function lte(e,t,n,r){const s=y5(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?s.spaceSeparated?i=t7(r):s.commaSeparated?i=XS(r):s.commaOrSpaceSeparated?i=t7(XS(r).join(" ")):i=D9(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?cte(r):String(r);if(Array.isArray(i)){const o=[];for(const a of i)o.push(D9(s,s.property,a));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function kx(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)kx(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?kx(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function D9(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||q0(n)===q0(t)))return!0}return n}function cte(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function ute(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const dte=["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"],hte=cj(b5,"div"),fte=cj(Uh,"g",dte),N4={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function mte(e,t){return uj(e,{})||{type:"root",children:[]}}function uj(e,t){const n=pte(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function pte(e,t){switch(e.nodeType){case 1:return vte(e,t);case 3:return yte(e);case 8:return bte(e);case 9:return O9(e,t);case 10:return gte();case 11:return O9(e,t);default:return}}function O9(e,t){return{type:"root",children:dj(e,t)}}function gte(){return{type:"doctype"}}function yte(e){return{type:"text",value:e.nodeValue||""}}function bte(e){return{type:"comment",value:e.nodeValue||""}}function vte(e,t){const n=e.namespaceURI,r=n===N4.svg?fte:hte,s=n===N4.html?e.tagName.toLowerCase():e.tagName,i=n===N4.html&&s==="template"?e.content:e,o=e.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=e.getAttribute(o[l])||"";return r(s,a,dj(i,t))}function dj(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=uj(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function wte(e,t){const n=xte(e);return mte(n)}function xte(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const B9=function(e,t,n){const r=Rm(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]},Ju=function(e){if(e==null)return Ste;if(typeof e=="string")return kte(e);if(typeof e=="object")return _te(e);if(typeof e=="function")return Z5(e);throw new Error("Expected function, string, or array as `test`")};function _te(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ju(e[n]);return Z5(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function kte(e){return Z5(t);function t(n){return n.tagName===e}}function Z5(e){return t;function t(n,r,s){return!!(Tte(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function Ste(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function Tte(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const P9=/\n/g,$9=/[\t ]+/g,Sx=Ju("br"),z9=Ju(Lte),Cte=Ju("p"),F9=Ju("tr"),Ate=Ju(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Rte,jte]),hj=Ju(["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 Ete(e,t){const n=t||{},r="children"in e?e.children:[],s=hj(e),i=pj(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...mj(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...fj(r[a],e,{whitespace:i,breakBefore:a?void 0:s,breakAfter:a<r.length-1?Sx(r[a+1]):s}));const l=[];let c;for(a=-1;++a<o.length;){const u=o[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function fj(e,t,n){return e.type==="element"?Mte(e,t,n):e.type==="text"?n.whitespace==="normal"?mj(e,n):Ite(e):[]}function Mte(e,t,n){const r=pj(e,n),s=e.children||[];let i=-1,o=[];if(Ate(e))return o;let a,l;for(Sx(e)||F9(e)&&B9(t,e,F9)?l=`
`:Cte(e)?(a=2,l=2):hj(e)&&(a=1,l=1);++i<s.length;)o=o.concat(fj(s[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<s.length-1?Sx(s[i+1]):l}));return z9(e)&&B9(t,e,z9)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function mj(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){P9.lastIndex=i;const l=P9.exec(n),c=l&&"index"in l?l.index:n.length;r.push(Nte(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<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(s.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&s.push(a),s.push(r[o]),a=0):(o===0||o===r.length-1)&&s.push(0);return s}function Ite(e){return[String(e.value)]}function Nte(e,t,n){const r=[];let s=0,i;for(;s<e.length;){$9.lastIndex=s;const o=$9.exec(e);i=o?o.index:e.length,!s&&!i&&o&&!t&&r.push(""),s!==i&&r.push(e.slice(s,i)),s=o?i+o[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function pj(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 Rte(e){return!!(e.properties||{}).hidden}function Lte(e){return e.tagName==="td"||e.tagName==="th"}function jte(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Dte={},Ote=[];function U9(e){const t=e||Dte;return function(n,r){N5(n,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:Ote,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let u=l;if(!a&&!l&&!c)return;let d=i[i.length-1],f=s;if(s.tagName==="code"&&a&&d&&d.type==="element"&&d.tagName==="pre"&&(f=d,d=i[i.length-2],u=!0),!d)return;const m=Ete(f,{whitespace:"pre"});let p;try{p=_x.renderToString(m,{...t,displayMode:u,throwOnError:!0})}catch(w){const b=w,v=b.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:b,place:s.position,ruleId:v,source:"rehype-katex"});try{p=_x.renderToString(m,{...t,displayMode:u,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=wte(p).children);const y=d.children.indexOf(f);return d.children.splice(y,1,...p),LR})}}const gj=[{id:"abap",name:"ABAP",import:()=>U(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>U(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>U(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>U(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>U(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>U(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>U(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>U(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>U(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>U(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>U(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>U(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>U(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>U(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>U(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>U(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>U(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>U(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>U(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>U(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>U(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>U(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>U(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>U(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>U(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>U(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>U(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>U(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>U(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>U(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>U(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>U(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>U(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>U(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>U(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>U(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>U(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>U(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>U(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>U(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>U(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>U(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>U(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>U(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>U(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>U(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>U(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>U(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>U(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>U(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>U(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>U(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>U(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>U(()=>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:()=>U(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>U(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>U(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>U(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>U(()=>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:()=>U(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>U(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>U(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>U(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>U(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>U(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>U(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>U(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>U(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>U(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>U(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>U(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>U(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>U(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>U(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>U(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>U(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>U(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>U(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>U(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>U(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>U(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>U(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>U(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>U(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>U(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>U(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>U(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>U(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>U(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>U(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>U(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>U(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>U(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>U(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>U(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>U(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>U(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>U(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>U(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>U(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>U(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>U(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>U(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>U(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>U(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>U(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>U(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>U(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>U(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>U(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>U(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>U(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>U(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>U(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>U(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>U(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>U(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>U(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>U(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>U(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>U(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>U(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>U(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>U(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>U(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>U(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>U(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>U(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>U(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>U(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>U(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>U(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>U(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>U(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>U(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>U(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>U(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>U(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>U(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>U(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>U(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>U(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>U(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>U(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>U(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>U(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>U(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>U(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>U(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>U(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>U(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>U(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>U(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>U(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>U(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>U(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>U(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>U(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>U(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>U(()=>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:()=>U(()=>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:()=>U(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>U(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>U(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>U(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>U(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>U(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>U(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>U(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>U(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>U(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>U(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>U(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>U(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>U(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>U(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>U(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>U(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>U(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>U(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>U(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>U(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>U(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>U(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>U(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>U(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>U(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>U(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>U(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>U(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>U(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>U(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>U(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>U(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>U(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>U(()=>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:()=>U(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>U(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>U(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>U(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>U(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>U(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>U(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>U(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>U(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>U(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>U(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>U(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>U(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>U(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>U(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>U(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>U(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>U(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>U(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>U(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>U(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>U(()=>import("./zig-BVz_zdnA.js"),[])}],Bte=Object.fromEntries(gj.map(e=>[e.id,e.import])),Pte=Object.fromEntries(gj.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),$te={...Bte,...Pte},zte=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>U(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>U(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>U(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>U(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>U(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>U(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>U(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>U(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>U(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>U(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>U(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>U(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>U(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>U(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>U(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>U(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>U(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>U(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>U(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>U(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>U(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>U(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>U(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>U(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>U(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>U(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>U(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>U(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>U(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>U(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>U(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>U(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>U(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>U(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>U(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>U(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>U(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>U(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>U(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>U(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>U(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>U(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>U(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>U(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>U(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>U(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>U(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>U(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>U(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>U(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>U(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>U(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>U(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>U(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],Fte=Object.fromEntries(zte.map(e=>[e.id,e.import]));let nl=class extends Error{constructor(t){super(t),this.name="ShikiError"}},ek=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Ute(){return 2147483648}function qte(){return typeof performance<"u"?performance.now():Date.now()}const Hte=(e,t)=>e+(t-e%t)%t;async function Vte(e){let t,n;const r={};function s(m){n=m,r.HEAPU8=new Uint8Array(m),r.HEAPU32=new Uint32Array(m)}function i(m,p,y){r.HEAPU8.copyWithin(m,p,p+y)}function o(m){try{return t.grow(m-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function a(m){const p=r.HEAPU8.length;m=m>>>0;const y=Ute();if(m>y)return!1;for(let w=1;w<=4;w*=2){let b=p*(1+.2/w);b=Math.min(b,m+100663296);const v=Math.min(y,Hte(Math.max(m,b),65536));if(o(v))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,p,y=1024){const w=p+y;let b=p;for(;m[b]&&!(b>=w);)++b;if(b-p>16&&m.buffer&&l)return l.decode(m.subarray(p,b));let v="";for(;p<b;){let x=m[p++];if(!(x&128)){v+=String.fromCharCode(x);continue}const S=m[p++]&63;if((x&224)===192){v+=String.fromCharCode((x&31)<<6|S);continue}const C=m[p++]&63;if((x&240)===224?x=(x&15)<<12|S<<6|C:x=(x&7)<<18|S<<12|C<<6|m[p++]&63,x<65536)v+=String.fromCharCode(x);else{const E=x-65536;v+=String.fromCharCode(55296|E>>10,56320|E&1023)}}return v}function u(m,p){return m?c(r.HEAPU8,m,p):""}const d={emscripten_get_now:qte,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const p=await e({env:d,wasi_snapshot_preview1:d});t=p.memory,s(t.buffer),Object.assign(r,p),r.UTF8ToString=u}return await f(),r}var Wte=Object.defineProperty,Gte=(e,t,n)=>t in e?Wte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zr=(e,t,n)=>(Gte(e,typeof t!="symbol"?t+"":t,n),n);let ds=null;function Kte(e){throw new ek(e.UTF8ToString(e.getLastOnigError()))}class gb{constructor(t){Zr(this,"utf16Length"),Zr(this,"utf8Length"),Zr(this,"utf16Value"),Zr(this,"utf8Value"),Zr(this,"utf16OffsetToUtf8"),Zr(this,"utf8OffsetToUtf16");const n=t.length,r=gb._utf8ByteLength(t),s=r!==n,i=s?new Uint32Array(n+1):null;s&&(i[n]=r);const o=s?new Uint32Array(r+1):null;s&&(o[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=t.charCodeAt(c);let d=u,f=!1;if(u>=55296&&u<=56319&&c+1<n){const m=t.charCodeAt(c+1);m>=56320&&m<=57343&&(d=(u-55296<<10)+65536|m-56320,f=!0)}s&&(i[c]=l,f&&(i[c+1]=l),d<=127?o[l+0]=c:d<=2047?(o[l+0]=c,o[l+1]=c):d<=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)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const i=t.charCodeAt(r);let o=i,a=!1;if(i>=55296&&i<=56319&&r+1<s){const l=t.charCodeAt(r+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&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Zo=class{constructor(e){if(Zr(this,"id",++Zo.LAST_ID),Zr(this,"_onigBinding"),Zr(this,"content"),Zr(this,"utf16Length"),Zr(this,"utf8Length"),Zr(this,"utf16OffsetToUtf8"),Zr(this,"utf8OffsetToUtf16"),Zr(this,"ptr"),!ds)throw new ek("Must invoke loadWasm first.");this._onigBinding=ds,this.content=e;const t=new gb(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Zo._sharedPtrInUse?(Zo._sharedPtr||(Zo._sharedPtr=ds.omalloc(1e4)),Zo._sharedPtrInUse=!0,ds.HEAPU8.set(t.utf8Value,Zo._sharedPtr),this.ptr=Zo._sharedPtr):this.ptr=t.createString(ds)}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===Zo._sharedPtr?Zo._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let Om=Zo;Zr(Om,"LAST_ID",0);Zr(Om,"_sharedPtr",0);Zr(Om,"_sharedPtrInUse",!1);class Yte{constructor(t){if(Zr(this,"_onigBinding"),Zr(this,"_ptr"),!ds)throw new ek("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a<l;a++){const c=new gb(t[a]);n[a]=c.createString(ds),r[a]=c.utf8Length}const s=ds.omalloc(4*t.length);ds.HEAPU32.set(n,s/4);const i=ds.omalloc(4*t.length);ds.HEAPU32.set(r,i/4);const o=ds.createOnigScanner(s,i,t.length);for(let a=0,l=t.length;a<l;a++)ds.ofree(n[a]);ds.ofree(i),ds.ofree(s),o===0&&Kte(ds),this._onigBinding=ds,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new Om(t);const i=this._findNextMatchSync(t,n,!1,s);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,s)}_findNextMatchSync(t,n,r,s){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(o===0)return null;const a=i.HEAPU32;let l=o/4;const c=a[l++],u=a[l++],d=[];for(let f=0;f<u;f++){const m=t.convertUtf8OffsetToUtf16(a[l++]),p=t.convertUtf8OffsetToUtf16(a[l++]);d[f]={start:m,end:p,length:p-m}}return{index:c,captureIndices:d}}}function Xte(e){return typeof e.instantiator=="function"}function Qte(e){return typeof e.default=="function"}function Jte(e){return typeof e.data<"u"}function Zte(e){return typeof Response<"u"&&e instanceof Response}function ene(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 Op;function tne(e){if(Op)return Op;async function t(){ds=await Vte(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Xte(r)?r=await r.instantiator(n):Qte(r)?r=await r.default(n):(Jte(r)&&(r=r.data),Zte(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await nne(r)(n):r=await rne(r)(n):ene(r)?r=await R4(r)(n):r instanceof WebAssembly.Module?r=await R4(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await R4(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Op=t(),Op}function R4(e){return t=>WebAssembly.instantiate(e,t)}function nne(e){return t=>WebAssembly.instantiateStreaming(e,t)}function rne(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let sne;function ine(){return sne}async function yj(e){return e&&await tne(e),{createScanner(t){return new Yte(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Om(t)}}}function one(e){return tk(e)}function tk(e){return Array.isArray(e)?ane(e):e instanceof RegExp?e:typeof e=="object"?lne(e):e}function ane(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=tk(e[n]);return t}function lne(e){let t={};for(let n in e)t[n]=tk(e[n]);return t}function bj(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function vj(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?vj(e.substring(0,e.length-1)):e.substr(~t+1)}var L4=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Bp=class{static hasCaptures(e){return e===null?!1:(L4.lastIndex=0,L4.test(e))}static replaceCaptures(e,t,n){return e.replace(L4,(r,s,i,o)=>{let a=n[parseInt(s||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 r})}};function wj(e,t){return e<t?-1:e>t?1:0}function xj(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let i=wj(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function q9(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 _j(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kj=class{constructor(e){ue(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},U1=class{constructor(e,t,n){ue(this,"_cachedMatchRoot",new kj(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(dne(e),t)}static createFromParsedTheme(e,t){return fne(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>cne(e.parent,s.parentScopes));return r?new Sj(r.fontStyle,r.foreground,r.background):null}},j4=class Og{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Og(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Og(n,t[r]);return n}push(t){return new Og(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function cne(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!une(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function une(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Sj=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function dne(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,i=t.length;s<i;s++){let o=t[s];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let d=o.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),a=d.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let d=o.settings.fontStyle.split(" ");for(let f=0,m=d.length;f<m;f++)switch(d[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"&&q9(o.settings.foreground)&&(c=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&q9(o.settings.background)&&(u=o.settings.background);for(let d=0,f=a.length;d<f;d++){let p=a[d].trim().split(" "),y=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[r++]=new hne(y,w,s,l,c,u)}}return n}var hne=class{constructor(e,t,n,r,s,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},Xa=(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))(Xa||{});function fne(e,t){e.sort((l,c)=>{let u=wj(l.scope,c.scope);return u!==0||(u=xj(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(s=l.background)}let i=new mne(t),o=new Sj(n,i.getId(r),i.getId(s)),a=new gne(new Tx(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let u=e[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new U1(i,o,a)}var mne=class{constructor(e){ue(this,"_isFrozen");ue(this,"_lastColorId");ue(this,"_id2color");ue(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},pne=Object.freeze([]),Tx=class Tj{constructor(t,n,r,s,i){ue(this,"scopeDepth");ue(this,"parentScopes");ue(this,"fontStyle");ue(this,"foreground");ue(this,"background");this.scopeDepth=t,this.parentScopes=n||pne,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new Tj(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},gne=class Cx{constructor(t,n=[],r={}){ue(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const i=n.parentScopes[s].length-t.parentScopes[r].length;if(i!==0)return i;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,i;if(r===-1?(s=t,i=""):(s=t.substring(0,r),i=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Cx._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(n===""){this._doInsertHere(t,r,s,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 u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Cx(this._mainRule.clone(),Tx.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(t+1,c,r,s,i,o)}_doInsertHere(t,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(t,r,s,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let l=this._rulesWithParentScopes[o];if(xj(l.parentScopes,n)===0){l.acceptOverwrite(t,r,s,i);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Tx(t,n,r,s,i))}},xh=class eo{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=eo.getLanguageId(t),r=eo.getTokenType(t),s=eo.getFontStyle(t),i=eo.getForeground(t),o=eo.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,i,o,a){let l=eo.getLanguageId(t),c=eo.getTokenType(t),u=eo.containsBalancedBrackets(t)?1:0,d=eo.getFontStyle(t),f=eo.getForeground(t),m=eo.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),i!==-1&&(d=i),o!==0&&(f=o),a!==0&&(m=a),(l<<0|c<<8|u<<10|d<<11|f<<15|m<<24)>>>0}};function q1(e,t){const n=[],r=yne(e);let s=r.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=o();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();const l=i();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(H9(s)){const l=[];do l.push(s),s=r.next();while(H9(s));return c=>t(l,c)}return null}function o(){const l=[];let c=i();for(;c;)l.push(c),c=i();return u=>l.every(d=>d(u))}function a(){const l=[];let c=o();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=o()}return u=>l.some(d=>d(u))}}function H9(e){return!!e&&!!e.match(/[\w\.:]+/)}function yne(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Cj(e){typeof e.dispose=="function"&&e.dispose()}var K0=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},bne=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},vne=class{constructor(){ue(this,"_references",[]);ue(this,"_seenReferenceKeys",new Set);ue(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},wne=class{constructor(e,t){ue(this,"seenFullScopeRequests",new Set);ue(this,"seenPartialScopeRequests",new Set);ue(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new K0(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new vne;for(const n of e)xne(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof K0){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 xne(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof K0?Bg({baseGrammar:i,selfGrammar:s},r):Ax(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const o=n.injections(e.scopeName);if(o)for(const a of o)r.add(new K0(a))}function Ax(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];H1([r],t,n)}}function Bg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&H1(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&H1(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function H1(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?bj({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&H1(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const o=Aj(i);switch(o.kind){case 0:Bg({...t,selfGrammar:t.baseGrammar},n);break;case 1:Bg(t,n);break;case 2:Ax(o.ruleName,{...t,repository:s},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:s};o.kind===4?Ax(o.ruleName,l,n):Bg(l,n)}else o.kind===4?n.add(new bne(o.scopeName,o.ruleName)):n.add(new K0(o.scopeName));break}}}var _ne=class{constructor(){ue(this,"kind",0)}},kne=class{constructor(){ue(this,"kind",1)}},Sne=class{constructor(e){ue(this,"kind",2);this.ruleName=e}},Tne=class{constructor(e){ue(this,"kind",3);this.scopeName=e}},Cne=class{constructor(e,t){ue(this,"kind",4);this.scopeName=e,this.ruleName=t}};function Aj(e){if(e==="$base")return new _ne;if(e==="$self")return new kne;const t=e.indexOf("#");if(t===-1)return new Tne(e);if(t===0)return new Sne(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new Cne(n,r)}}var Ane=/\\(\d+)/,V9=/\\(\d+)/g,Ene=-1,Ej=-2;var Bm=class{constructor(t,n,r,s){ue(this,"$location");ue(this,"id");ue(this,"_nameIsCapturing");ue(this,"_name");ue(this,"_contentNameIsCapturing");ue(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=Bp.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=Bp.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${vj(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:Bp.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Bp.replaceCaptures(this._contentName,t,n)}},Mne=class extends Bm{constructor(t,n,r,s,i){super(t,n,r,s);ue(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,s){throw new Error("Not supported!")}},Ine=class extends Bm{constructor(t,n,r,s,i){super(t,n,r,null);ue(this,"_match");ue(this,"captures");ue(this,"_cachedCompiledPatterns");this._match=new Y0(s,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X0,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},W9=class extends Bm{constructor(t,n,r,s,i){super(t,n,r,s);ue(this,"hasMissingPatterns");ue(this,"patterns");ue(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X0,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ex=class extends Bm{constructor(t,n,r,s,i,o,a,l,c,u){super(t,n,r,s);ue(this,"_begin");ue(this,"beginCaptures");ue(this,"_end");ue(this,"endHasBackReferences");ue(this,"endCaptures");ue(this,"applyEndPatternLast");ue(this,"hasMissingPatterns");ue(this,"patterns");ue(this,"_cachedCompiledPatterns");this._begin=new Y0(i,this.id),this.beginCaptures=o,this._end=new Y0(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,s)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X0;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},V1=class extends Bm{constructor(t,n,r,s,i,o,a,l,c){super(t,n,r,s);ue(this,"_begin");ue(this,"beginCaptures");ue(this,"whileCaptures");ue(this,"_while");ue(this,"whileHasBackReferences");ue(this,"hasMissingPatterns");ue(this,"patterns");ue(this,"_cachedCompiledPatterns");ue(this,"_cachedCompiledWhilePatterns");this._begin=new Y0(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Y0(a,Ej),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,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X0;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,s){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,s)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new X0,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Mj=class Ms{static createCaptureRule(t,n,r,s,i){return t.registerRule(o=>new Mne(n,o,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new Ine(t.$vscodeTextmateLocation,t.id,t.name,t.match,Ms._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=bj({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new W9(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Ms._compilePatterns(i,n,r))}return t.while?new V1(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Ms._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Ms._compileCaptures(t.whileCaptures||t.captures,n,r),Ms._compilePatterns(t.patterns,n,r)):new Ex(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Ms._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Ms._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Ms._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)s[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let l=0;t[o].patterns&&(l=Ms.getCompiledRuleId(t[o],n,r)),s[a]=Ms.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let l=-1;if(a.include){const c=Aj(a.include);switch(c.kind){case 0:case 1:l=Ms.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=Ms.getCompiledRuleId(u,n,r));break;case 3:case 4:const d=c.scopeName,f=c.kind===4?c.ruleName:null,m=n.getExternalGrammar(d,r);if(m)if(f){let p=m.repository[f];p&&(l=Ms.getCompiledRuleId(p,n,m.repository))}else l=Ms.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=Ms.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof W9||c instanceof Ex||c instanceof V1)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Y0=class Ij{constructor(t,n){ue(this,"source");ue(this,"ruleId");ue(this,"hasAnchor");ue(this,"hasBackReferences");ue(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let s=0,i=[],o=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const c=t.charAt(a+1);c==="z"?(i.push(t.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(o=!0),a++}this.hasAnchor=o,s===0?this.source=t:(i.push(t.substring(s,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Ane.test(this.source):this.hasBackReferences=!1}clone(){return new Ij(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>t.substring(s.start,s.end));return V9.lastIndex=0,this.source.replace(V9,(s,i)=>_j(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],i,o,a,l;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),t[i]=a,n[i]=a,r[i]=a,s[i]=a,a==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",r[i+1]="A",s[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",r[i+1]="",s[i+1]="G"):(t[i+1]=l,n[i+1]=l,r[i+1]=l,s[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},X0=class{constructor(){ue(this,"_items");ue(this,"_hasAnchors");ue(this,"_cached");ue(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new G9(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new G9(e,r,this._items.map(s=>s.ruleId))}},G9=class{constructor(e,t,n){ue(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push("   - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},D4=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Va,Nne=(Va=class{constructor(t,n){ue(this,"_defaultAttributes");ue(this,"_embeddedLanguagesMatcher");ue(this,"_getBasicScopeAttributes",new kj(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new D4(n,r)}));this._defaultAttributes=new D4(t,8),this._embeddedLanguagesMatcher=new Rne(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Va._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Va.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},ue(Va,"_NULL_SCOPE_METADATA",new D4(0,0)),ue(Va,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Va),Rne=class{constructor(e){ue(this,"values");ue(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>_j(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])}},K9=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Nj(e,t,n,r,s,i,o,a){const l=t.content.length;let c=!1,u=-1;if(o){const m=Lne(e,t,n,r,s,i);s=m.stack,r=m.linePos,n=m.isFirstLine,u=m.anchorPosition}const d=Date.now();for(;!c;){if(a!==0&&Date.now()-d>a)return new K9(s,!0);f()}return new K9(s,!1);function f(){const m=jne(e,t,n,r,s,u);if(!m){i.produce(s,l),c=!0;return}const p=m.captureIndices,y=m.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(y===Ene){const b=s.getRule(e);i.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),qf(e,t,n,s,i,b.endCaptures,p),i.produce(s,p[0].end);const v=s;if(s=s.parent,u=v.getAnchorPos(),!w&&v.getEnterPos()===r){s=v,i.produce(s,l),c=!0;return}}else{const b=e.getRule(y);i.produce(s,p[0].start);const v=s,x=b.getName(t.content,p),S=s.contentNameScopesList.pushAttributed(x,e);if(s=s.push(y,r,u,p[0].end===l,null,S,S),b instanceof Ex){const C=b;qf(e,t,n,s,i,C.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const E=C.getContentName(t.content,p),M=S.pushAttributed(E,e);if(s=s.withContentNameScopesList(M),C.endHasBackReferences&&(s=s.withEndRule(C.getEndWithResolvedBackReferences(t.content,p))),!w&&v.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(b instanceof V1){const C=b;qf(e,t,n,s,i,C.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const E=C.getContentName(t.content,p),M=S.pushAttributed(E,e);if(s=s.withContentNameScopesList(M),C.whileHasBackReferences&&(s=s.withEndRule(C.getWhileWithResolvedBackReferences(t.content,p))),!w&&v.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(qf(e,t,n,s,i,b.captures,p),i.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),i.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function Lne(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(e);c instanceof V1&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=Bne(l.rule,e,l.stack.endRule,n,r===o),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==Ej){s=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(i.produce(l.stack,d.captureIndices[0].start),qf(e,t,n,l.stack,i,l.rule.whileCaptures,d.captureIndices),i.produce(l.stack,d.captureIndices[0].end),o=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function jne(e,t,n,r,s,i){const o=Dne(e,t,n,r,s,i),a=e.getInjections();if(a.length===0)return o;const l=One(a,e,t,n,r,s,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:o}function Dne(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=Rj(o,e,s.endRule,n,r===i),c=a.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function One(e,t,n,r,s,i,o){let a=Number.MAX_VALUE,l=null,c,u=0;const d=i.contentNameScopesList.getScopeNames();for(let f=0,m=e.length;f<m;f++){const p=e[f];if(!p.matcher(d))continue;const y=t.getRule(p.ruleId),{ruleScanner:w,findOptions:b}=Rj(y,t,null,r,s===o),v=w.findNextMatchSync(n,s,b);if(!v)continue;const x=v.captureIndices[0].start;if(!(x>=a)&&(a=x,l=v.captureIndices,c=v.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Rj(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function Bne(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function qf(e,t,n,r,s,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),c=[],u=o[0].end;for(let d=0;d<l;d++){const f=i[d];if(f===null)continue;const m=o[d];if(m.length===0)continue;if(m.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,m.start):s.produce(r,m.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,o),w=r.contentNameScopesList.pushAttributed(y,e),b=f.getContentName(a,o),v=w.pushAttributed(b,e),x=r.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,w,v),S=e.createOnigString(a.substring(0,m.end));Nj(e,S,n&&m.start===0,m.start,x,s,!1,0),Cj(S);continue}const p=f.getName(a,o);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new Pne(w,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Pne=class{constructor(e,t){ue(this,"scopes");ue(this,"endPos");this.scopes=e,this.endPos=t}};function $ne(e,t,n,r,s,i,o,a){return new Fne(e,t,n,r,s,i,o,a)}function Y9(e,t,n,r,s){const i=q1(t,W1),o=Mj.getCompiledRuleId(n,r,s.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:s,priority:a.priority})}function W1(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(zne(t[s],r))return n=s+1,!0;return!1})}function zne(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 Fne=class{constructor(e,t,n,r,s,i,o,a){ue(this,"_rootId");ue(this,"_lastRuleId");ue(this,"_ruleId2desc");ue(this,"_includedGrammars");ue(this,"_grammarRepository");ue(this,"_grammar");ue(this,"_injections");ue(this,"_basicScopeAttributesProvider");ue(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new Nne(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=X9(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=q1(l,W1);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[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:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let o in s)Y9(t,o,s[o],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&Y9(t,l,a,this,a)}})}return t.sort((s,i)=>s.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=X9(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Mj.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===Mx.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=xh.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null);let m;f?m=v0.createRootAndLookUpScopeName(f,d,this):m=v0.createRoot("unknown",d),t=new Mx(null,this._rootId,-1,-1,!1,null,m,m)}else s=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new qne(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Nj(this,i,s,0,t,a,!0,r);return Cj(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function X9(e,t){return e=one(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 v0=class ea{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=(t==null?void 0:t.scopePath)??null;for(const i of n)s=j4.push(s,i.scopeNames),r=new ea(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new ea(null,new j4(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new j4(null,t),o=r.themeProvider.themeMatch(i),a=ea.mergeAttributes(n,s,o);return new ea(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return ea.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,i=0,o=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,o=r.backgroundId),xh.set(t,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return ea._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=ea._pushAttributed(s,i,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=ea.mergeAttributes(t.tokenAttributes,s,o);return new ea(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var s;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((s=r.parent)==null?void 0:s.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},ao,Mx=(ao=class{constructor(t,n,r,s,i,o,a,l){ue(this,"_stackElementBrand");ue(this,"_enterPos");ue(this,"_anchorPos");ue(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}equals(t){return t===null?!1:ao._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?v0.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(){ao._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new ao(this,t,n,r,s,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 r,s;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ao(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=v0.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ao(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,v0.fromExtension(r,n.contentNameScopesList))}},ue(ao,"NULL",new ao(null,0,0,0,!1,null,null,null)),ao),Une=class{constructor(e,t){ue(this,"balancedBracketScopes");ue(this,"unbalancedBracketScopes");ue(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):q1(n,W1).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>q1(n,W1).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},qne=class{constructor(e,t,n,r){ue(this,"_emitBinaryTokens");ue(this,"_lineText");ue(this,"_tokens");ue(this,"_binaryTokens");ue(this,"_lastTokenEndIndex");ue(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let s=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(o)&&(s=xh.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(s=xh.set(s,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Hne=class{constructor(e,t){ue(this,"_grammars",new Map);ue(this,"_rawGrammars",new Map);ue(this,"_injectionGrammars",new Map);ue(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,$ne(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},Vne=class{constructor(t){ue(this,"_options");ue(this,"_syncRegistry");ue(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new Hne(U1.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(U1.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Une(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const o=new wne(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,s,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,i)}},Ix=Mx.NULL;const Wne=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Gne=/["&'<>`]/g,Kne=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Yne=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Xne=/[|\\{}()[\]^$+*?.]/g,Q9=new WeakMap;function Qne(e,t){if(e=e.replace(t.subset?Jne(t.subset):Gne,r),t.subset||t.escapeOnly)return e;return e.replace(Kne,n).replace(Yne,r);function n(s,i,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function r(s,i,o){return t.format(s.charCodeAt(0),o.charCodeAt(i+1),t)}}function Jne(e){let t=Q9.get(e);return t||(t=Zne(e),Q9.set(e,t)),t}function Zne(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Xne,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const ere=/[\dA-Fa-f]/;function tre(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!ere.test(String.fromCharCode(t))?r:r+";"}const nre=/\d/;function rre(e,t,n){const r="&#"+String(e);return n&&t&&!nre.test(String.fromCharCode(t))?r:r+";"}const sre=["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"],O4={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:"€"},ire=["cent","copy","divide","gt","lt","not","para","times"],Lj={}.hasOwnProperty,Nx={};let Pp;for(Pp in O4)Lj.call(O4,Pp)&&(Nx[O4[Pp]]=Pp);const ore=/[^\dA-Za-z]/;function are(e,t,n,r){const s=String.fromCharCode(e);if(Lj.call(Nx,s)){const i=Nx[s],o="&"+i;return n&&sre.includes(i)&&!ire.includes(i)&&(!r||t&&t!==61&&ore.test(String.fromCharCode(t)))?o:o+";"}return""}function lre(e,t,n){let r=tre(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=are(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=rre(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Jd(e,t){return Qne(e,Object.assign({format:lre},t))}const cre=/^>|^->|<!--|-->|--!>|<!-$/g,ure=[">"],dre=["<",">"];function hre(e,t,n,r){return r.settings.bogusComments?"<?"+Jd(e.value,Object.assign({},r.settings.characterReferences,{subset:ure}))+">":"<!--"+e.value.replace(cre,s)+"-->";function s(i){return Jd(i,Object.assign({},r.settings.characterReferences,{subset:dre}))}}function fre(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const is=Dj(1),jj=Dj(-1),mre=[];function Dj(e){return t;function t(n,r,s){const i=n?n.children:mre;let o=(r||0)+e,a=i[o];if(!s)for(;a&&Qy(a);)o+=e,a=i[o];return a}}const pre={}.hasOwnProperty;function Oj(e){return t;function t(n,r,s){return pre.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const nk=Oj({body:yre,caption:B4,colgroup:B4,dd:xre,dt:wre,head:B4,html:gre,li:vre,optgroup:_re,option:kre,p:bre,rp:J9,rt:J9,tbody:Tre,td:Z9,tfoot:Cre,th:Z9,thead:Sre,tr:Are});function B4(e,t,n){const r=is(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Qy(r.value.charAt(0)))}function gre(e,t,n){const r=is(n,t);return!r||r.type!=="comment"}function yre(e,t,n){const r=is(n,t);return!r||r.type!=="comment"}function bre(e,t,n){const r=is(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function vre(e,t,n){const r=is(n,t);return!r||r.type==="element"&&r.tagName==="li"}function wre(e,t,n){const r=is(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function xre(e,t,n){const r=is(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function J9(e,t,n){const r=is(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function _re(e,t,n){const r=is(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function kre(e,t,n){const r=is(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Sre(e,t,n){const r=is(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Tre(e,t,n){const r=is(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Cre(e,t,n){return!is(n,t)}function Are(e,t,n){const r=is(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Z9(e,t,n){const r=is(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Ere=Oj({body:Nre,colgroup:Rre,head:Ire,html:Mre,tbody:Lre});function Mre(e){const t=is(e,-1);return!t||t.type!=="comment"}function Ire(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Nre(e){const t=is(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Qy(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Rre(e,t,n){const r=jj(n,t),s=is(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&nk(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Lre(e,t,n){const r=jj(n,t),s=is(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&nk(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const $p={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 jre(e,t,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;s.space==="html"&&e.tagName==="svg"&&(r.schema=Uh);const c=Dre(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(o=!1),(c||!i||!Ere(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!nk(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function Dre(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=Ore(e,s,t[s]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function Ore(e,t,n){const r=y5(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Jd(r.attribute,Object.assign({},e.settings.characterReferences,{subset:$p.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?JN:oR)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Jd(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:$p.unquoted[s][i]}))),a!==n&&(e.settings.quoteSmart&&j1(n,o)>j1(n,e.alternative)&&(o=e.alternative),a=o+Jd(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?$p.single:$p.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const Bre=["<","&"];function Bj(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Jd(e.value,Object.assign({},r.settings.characterReferences,{subset:Bre}))}function Pre(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Bj(e,t,n,r)}function $re(e,t,n,r){return r.all(e)}const zre=DQ("type",{invalid:Fre,unknown:Ure,handlers:{comment:hre,doctype:fre,element:jre,raw:Pre,root:$re,text:Bj}});function Fre(e){throw new Error("Expected node, not `"+e+"`")}function Ure(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const qre={},Hre={},Vre=[];function Wre(e,t){const n=qre,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Gre,all:Kre,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||Wne,characterReferences:n.characterReferences||Hre,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Uh:b5,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Gre(e,t,n){return zre(e,t,n,this)}function Kre(e){const t=[],n=e&&e.children||Vre;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Yre(e){return Array.isArray(e)?e:[e]}function yb(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];s.push([a,r]),r+=n[o].length,r+=((i=n[o+1])==null?void 0:i.length)||0}return s}function rk(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Pj(e){return e==="ansi"||rk(e)}function sk(e){return e==="none"}function $j(e){return sk(e)}function zj(e,t){var r;if(!t)return e;e.properties||(e.properties={}),(r=e.properties).class||(r.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const s of n)s&&!e.properties.class.includes(s)&&e.properties.class.push(s);return e}function Xre(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Qre(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,s)=>r-s);return n.length?e.map(r=>r.flatMap(s=>{const i=n.filter(o=>s.offset<o&&o<s.offset+s.content.length).map(o=>o-s.offset).sort((o,a)=>o-a);return i.length?Xre(s,i):s})):e}async function Fj(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function G1(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[s]=i:s===r&&Object.assign(n,i);return n}function hu(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function Uj(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Xa.Italic&&(t["font-style"]="italic"),e.fontStyle&Xa.Bold&&(t["font-weight"]="bold"),e.fontStyle&Xa.Underline&&(t["text-decoration"]="underline")),t}function Jre(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function Zre(e){const t=yb(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=s,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let a=0;a<s;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:r}}class Gs extends Error{constructor(t){super(t),this.name="ShikiError"}}const qj=new WeakMap;function bb(e,t){qj.set(e,t)}function Q0(e){return qj.get(e)}class Kh{constructor(...t){ue(this,"_stacks",{});ue(this,"lang");if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Kh(Object.fromEntries(Yre(n).map(r=>[r,Ix])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return eT(this._stacks[this.theme])}getScopes(t=this.theme){return eT(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function eT(e){const t=[],n=new Set;function r(s){var o;if(n.has(s))return;n.add(s);const i=(o=s==null?void 0:s.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),s.parent&&r(s.parent)}return r(e),t}function ese(e,t){if(!(e instanceof Kh))throw new Gs("Invalid grammar state");return e.getInternalStack(t)}function tse(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new Gs(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...s.indexToPos(o),offset:o}}else{const a=s.lines[o.line];if(a===void 0)throw new Gs(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);if(o.character<0||o.character>a.length)throw new Gs(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:s.posToIndex(o.line,o.character)}}};const s=Zre(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));nse(i),e.set(n.meta,{decorations:i,converter:s,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const s=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return Qre(n,s)},code(n){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const r=t(this),s=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(s.length!==r.converter.lines.length)throw new Gs(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(d,f,m,p){const y=s[d];let w="",b=-1,v=-1;if(f===0&&(b=0),m===0&&(v=0),m===Number.POSITIVE_INFINITY&&(v=y.children.length),b===-1||v===-1)for(let S=0;S<y.children.length;S++)w+=Hj(y.children[S]),b===-1&&w.length===f&&(b=S+1),v===-1&&w.length===m&&(v=S+1);if(b===-1)throw new Gs(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(v===-1)throw new Gs(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const x=y.children.slice(b,v);if(!p.alwaysWrap&&x.length===y.children.length)a(y,p,"line");else if(!p.alwaysWrap&&x.length===1&&x[0].type==="element")a(x[0],p,"token");else{const S={type:"element",tagName:"span",properties:{},children:x};a(S,p,"wrapper"),y.children.splice(b,x.length,S)}}function o(d,f){s[d]=a(s[d],f,"line")}function a(d,f,m){var w;const p=f.properties||{},y=f.transform||(b=>b);return d.tagName=f.tagName||"span",d.properties={...d.properties,...p,class:d.properties.class},(w=f.properties)!=null&&w.class&&zj(d,f.properties.class),d=y(d,m)||d,d}const l=[],c=r.decorations.sort((d,f)=>f.start.offset-d.start.offset);for(const d of c){const{start:f,end:m}=d;if(f.line===m.line)i(f.line,f.character,m.character,d);else if(f.line<m.line){i(f.line,f.character,Number.POSITIVE_INFINITY,d);for(let p=f.line+1;p<m.line;p++)l.unshift(()=>o(p,d));i(m.line,0,m.character,d)}}l.forEach(d=>d())}}}function nse(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Gs(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[r],i=n.start.offset<s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<n.end.offset,a=s.start.offset<n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<s.end.offset;if(i||o||a||l){if(o&&o||a&&l)continue;throw new Gs(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Hj(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Hj).join(""):""}const rse=[tse()];function K1(e){return[...e.transformers||[],...rse]}var fu=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],P4={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function sse(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const r=e.indexOf("m",n);return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function tT(e,t){let n=1;const r=e[t+n++];let s;if(r==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(o=>Number.parseInt(o));i.length===3&&!i.some(o=>Number.isNaN(o))&&(s={type:"rgb",rgb:i})}else if(r==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(s={type:"table",index:Number(i)})}return[n,s]}function ise(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)P4[s]&&t.push({type:"setDecoration",value:P4[s]});else if(s<=29){const i=P4[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:fu[s-30]}});else if(s===38){const[i,o]=tT(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:fu[s-40]}});else if(s===48){const[i,o]=tT(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else s===49?t.push({type:"resetBackgroundColor"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:fu[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:fu[s-100+8]}})}return t}function ose(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=sse(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0&&s.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const l=ise(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<r.length);return s}}}var ase={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 lse(e=ase){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 r;function s(){if(r)return r;r=[];for(let c=0;c<fu.length;c++)r.push(t(fu[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let d=0;d<6;d++)r.push(n([a[c],a[u],a[d]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(a){return s()[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 cse(e,t,n){const r=G1(e,n),s=yb(t),i=lse(Object.fromEntries(fu.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=ose();return s.map(a=>o.parse(a[0]).map(l=>{let c,u;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,u=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,u=l.background?i.value(l.background):void 0),c=hu(c,r),u=hu(u,r),l.decorations.has("dim")&&(c=use(c));let d=Xa.None;return l.decorations.has("bold")&&(d|=Xa.Bold),l.decorations.has("italic")&&(d|=Xa.Italic),l.decorations.has("underline")&&(d|=Xa.Underline),{content:l.value,offset:a[1],color:c,bgColor:u,fontStyle:d}}))}function use(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const r=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${r}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(r=>`${r}${r}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function ik(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(rk(r)||sk(s))return yb(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if(r==="ansi")return cse(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new nl(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new nl(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return hse(t,a,i,o,n)}function dse(...e){if(e.length===2)return Q0(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(rk(s)||sk(i))throw new nl("Plain language does not have grammar state");if(s==="ansi")throw new nl("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new Kh(Y1(n,l,o,a,r).stateStack,l.name,o.name)}function hse(e,t,n,r,s){const i=Y1(e,t,n,r,s),o=new Kh(Y1(e,t,n,r,s).stateStack,t.name,n.name);return bb(i.tokens,o),i.tokens}function Y1(e,t,n,r,s){const i=G1(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=yb(e);let c=s.grammarState?ese(s.grammarState,n.name)??Ix:s.grammarContextCode!=null?Y1(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Ix,u=[];const d=[];for(let f=0,m=l.length;f<m;f++){const[p,y]=l[f];if(p===""){u=[],d.push([]);continue}if(o>0&&p.length>=o){u=[],d.push([{content:p,offset:y,color:"",fontStyle:0}]);continue}let w,b,v;s.includeExplanation&&(w=t.tokenizeLine(p,c),b=w.tokens,v=0);const x=t.tokenizeLine2(p,c,a),S=x.tokens.length/2;for(let C=0;C<S;C++){const E=x.tokens[2*C],M=C+1<S?x.tokens[2*C+2]:p.length;if(E===M)continue;const D=x.tokens[2*C+1],O=hu(r[xh.getForeground(D)],i),A=xh.getFontStyle(D),j={content:p.substring(E,M),offset:y+E,color:O,fontStyle:A};if(s.includeExplanation){const I=[];if(s.includeExplanation!=="scopeName")for(const F of n.settings){let q;switch(typeof F.scope){case"string":q=F.scope.split(/,/).map(R=>R.trim());break;case"object":q=F.scope;break;default:continue}I.push({settings:F,selectors:q.map(R=>R.split(/ /))})}j.explanation=[];let P=0;for(;E+P<M;){const F=b[v],q=p.substring(F.startIndex,F.endIndex);P+=q.length,j.explanation.push({content:q,scopes:s.includeExplanation==="scopeName"?fse(F.scopes):mse(I,F.scopes)}),v+=1}}u.push(j)}d.push(u),u=[],c=x.ruleStack}return{tokens:d,stateStack:c}}function fse(e){return e.map(t=>({scopeName:t}))}function mse(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:gse(e,i,t.slice(0,r))}}return n}function nT(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function pse(e,t,n){if(!nT(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)nT(e[r],n[s])&&(r-=1),s-=1;return r===-1}function gse(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const o of s)if(pse(o,t,n)){r.push(i);break}return r}function Vj(e,t,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=ik(e,t,{...n,theme:l.theme}),u=Q0(c),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:d}}),i=yse(...s.map(l=>l.tokens)),o=i[0].map((l,c)=>l.map((u,d)=>{const f={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=u.explanation),i.forEach((m,p)=>{const{content:y,explanation:w,offset:b,...v}=m[c][d];f.variants[r[p].color]=v}),f})),a=s[0].state?new Kh(Object.fromEntries(s.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),s[0].state.lang):void 0;return a&&bb(o,a),o}function yse(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(l=>l[r]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const o=s.map(()=>0),a=s.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 u=a[c];u.content.length===l?(i[c].push(u),o[c]+=1,a[c]=s[c][o[c]]):(i[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return t}function X1(e,t,n){let r,s,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-"}=n,d=Object.entries(n.themes).filter(w=>w[1]).map(w=>({color:w[0],theme:w[1]})).sort((w,b)=>w.color===c?-1:b.color===c?1:0);if(d.length===0)throw new nl("`themes` option must not be empty");const f=Vj(e,t,n);if(l=Q0(f),c&&!d.find(w=>w.color===c))throw new nl(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=d.map(w=>e.getTheme(w.theme)),p=d.map(w=>w.color);i=f.map(w=>w.map(b=>bse(b,p,u,c))),l&&bb(i,l);const y=d.map(w=>G1(w.theme,n));s=d.map((w,b)=>(b===0&&c?"":`${u+w.color}:`)+(hu(m[b].fg,y[b])||"inherit")).join(";"),r=d.map((w,b)=>(b===0&&c?"":`${u+w.color}-bg:`)+(hu(m[b].bg,y[b])||"inherit")).join(";"),o=`shiki-themes ${m.map(w=>w.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=G1(n.theme,n);i=ik(e,t,n);const u=e.getTheme(n.theme);r=hu(u.bg,c),s=hu(u.fg,c),o=u.name,l=Q0(i)}else throw new nl("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function bse(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>Uj(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,c)=>{for(const u of o){const d=l[u]||"inherit";if(c===0&&r)a[u]=d;else{const f=u==="color"?"":u==="background-color"?"-bg":`-${u}`,m=n+t[c]+(u==="color"?"":f);a[m]=d}}}),s.htmlStyle=a,s}function Q1(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>Q1(e,s,i),codeToTokens:(s,i)=>X1(e,s,i)}){var m,p;let s=t;for(const y of K1(n))s=((m=y.preprocess)==null?void 0:m.call(r,s,n))||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=X1(e,s,n);const{mergeWhitespaces:d=!0}=n;d===!0?i=wse(i):d==="never"&&(i=xse(i));const f={...r,get source(){return s}};for(const y of K1(n))i=((p=y.tokens)==null?void 0:p.call(f,i))||i;return vse(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,u)}function vse(e,t,n,r=Q0(e)){var p,y,w;const s=K1(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(([b])=>!b.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const d=[],f={...n,structure:a,addClassToHast:zj,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return u},get lines(){return d}};if(e.forEach((b,v)=>{var C,E;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:[]},S=0;for(const M of b){let D={type:"element",tagName:"span",properties:{...M.htmlAttrs},children:[{type:"text",value:M.content}]};M.htmlStyle;const O=Jre(M.htmlStyle||Uj(M));O&&(D.properties.style=O);for(const A of s)D=((C=A==null?void 0:A.span)==null?void 0:C.call(f,D,v+1,S,x,M))||D;a==="inline"?o.children.push(D):a==="classic"&&x.children.push(D),S+=M.content.length}if(a==="classic"){for(const M of s)x=((E=M==null?void 0:M.line)==null?void 0:E.call(f,x,v+1))||x;d.push(x),i.push(x)}}),a==="classic"){for(const b of s)u=((p=b==null?void 0:b.code)==null?void 0:p.call(f,u))||u;c.children.push(u);for(const b of s)c=((y=b==null?void 0:b.pre)==null?void 0:y.call(f,c))||c;o.children.push(c)}let m=o;for(const b of s)m=((w=b==null?void 0:b.root)==null?void 0:w.call(f,m))||m;return r&&bb(m,r),m}function wse(e){return e.map(t=>{const n=[];let r="",s=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&Xa.Underline);l&&i.content.match(/^\s+$/)&&t[o+1]?(s||(s=i.offset),r+=i.content):r?(l?n.push({...i,offset:s,content:r+i.content}):n.push({content:r,offset:s},i),s=0,r=""):n.push(i)}),n})}function xse(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,i,o]=r;if(!s&&!o)return n;const a=[{...n,offset:n.offset+s.length,content:i}];return s&&a.unshift({content:s,offset:n.offset}),o&&a.push({content:o,offset:n.offset+s.length+i.length}),a}))}function _se(e,t,n){var i;const r={meta:{},options:n,codeToHast:(o,a)=>Q1(e,o,a),codeToTokens:(o,a)=>X1(e,o,a)};let s=Wre(Q1(e,t,n,r));for(const o of K1(n))s=((i=o.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const rT={light:"#333333",dark:"#bbbbbb"},sT={light:"#fffffe",dark:"#1e1e1e"},iT="__shiki_resolved";function ok(e){var a,l,c,u,d;if(e!=null&&e[iT])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const f=t.settings?t.settings.find(m=>!m.name&&!m.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(r=f.settings.foreground),(l=f==null?void 0:f.settings)!=null&&l.background&&(n=f.settings.background),!r&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((u=t==null?void 0:t.colors)!=null&&u["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?rT.light:rT.dark),n||(n=t.type==="light"?sT.light:sT.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const i=new Map;function o(f){var p;if(i.has(f))return i.get(f);s+=1;const m=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(p=t.colorReplacements)!=null&&p[`#${m}`]?o(f):(i.set(f,m),m)}t.settings=t.settings.map(f=>{var w,b;const m=((w=f.settings)==null?void 0:w.foreground)&&!f.settings.foreground.startsWith("#"),p=((b=f.settings)==null?void 0:b.background)&&!f.settings.background.startsWith("#");if(!m&&!p)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(p){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"))&&!((d=t.colors[f])!=null&&d.startsWith("#"))){const m=o(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,iT,{enumerable:!1,writable:!1,value:!0}),t}async function Wj(e){return Array.from(new Set((await Promise.all(e.filter(t=>!Pj(t)).map(async t=>await Fj(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Gj(e){return(await Promise.all(e.map(async n=>$j(n)?null:ok(await Fj(n))))).filter(n=>!!n)}class kse extends Vne{constructor(n,r,s,i={}){super(n);ue(this,"_resolvedThemes",new Map);ue(this,"_resolvedGrammars",new Map);ue(this,"_langMap",new Map);ue(this,"_langGraph",new Map);ue(this,"_textmateThemeCache",new WeakMap);ue(this,"_loadedThemesCache",null);ue(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=s,this._alias=i,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=ok(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=U1.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){if(this._alias[n]){const r=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],r.has(n))throw new Gs(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,c;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(u=>{var d;return(d=u.embeddedLangsLazy)==null?void 0:d.includes(n.name)}));this._resolver.addLanguage(n);const s={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,s);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(u=>{this._alias[u]=n.name}),this._loadedLanguagesCache=null,r.size)for(const u of r)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(u.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),s=r.filter(([i,o])=>!o);if(s.length){const i=r.filter(([o,a])=>{var l;return a&&((l=a.embeddedLangs)==null?void 0:l.some(c=>s.map(([u])=>u).includes(c)))}).filter(o=>!s.includes(o));throw new Gs(`Missing languages ${s.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of r)this._resolver.addLanguage(o);for(const[i,o]of r)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class Sse{constructor(t,n){ue(this,"_langs",new Map);ue(this,"_scopeToLang",new Map);ue(this,"_injections",new Map);ue(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let s=1;s<=n.length;s++){const i=n.slice(0,s).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let Sf=0;function Tse(e){Sf+=1,e.warnings!==!1&&Sf>=10&&Sf%10===0&&console.warn(`[Shiki] ${Sf} 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 Gs("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(ok),s=new Sse(e.engine,n),i=new kse(s,r,n,e.langAlias);let o;function a(v){w();const x=i.getGrammar(typeof v=="string"?v:v.name);if(!x)throw new Gs(`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"};w();const x=i.getTheme(v);if(!x)throw new Gs(`Theme \`${v}\` not found, you may need to load it first`);return x}function c(v){w();const x=l(v);o!==v&&(i.setTheme(x),o=v);const S=i.getColorMap();return{theme:x,colorMap:S}}function u(){return w(),i.getLoadedThemes()}function d(){return w(),i.getLoadedLanguages()}function f(...v){w(),i.loadLanguages(v.flat(1))}async function m(...v){return f(await Wj(v))}function p(...v){w();for(const x of v.flat(1))i.loadTheme(x)}async function y(...v){return w(),p(await Gj(v))}function w(){if(t)throw new Gs("Shiki instance has been disposed")}function b(){t||(t=!0,i.dispose(),Sf-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:d,loadLanguage:m,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:b,[Symbol.dispose]:b}}async function Cse(e={}){e.loadWasm;const[t,n,r]=await Promise.all([Gj(e.themes||[]),Wj(e.langs||[]),e.engine||yj(e.loadWasm||ine())]);return Tse({...e,themes:t,langs:n,engine:r})}async function Ase(e={}){const t=await Cse(e);return{getLastGrammarState:(...n)=>dse(t,...n),codeToTokensBase:(n,r)=>ik(t,n,r),codeToTokensWithThemes:(n,r)=>Vj(t,n,r),codeToTokens:(n,r)=>X1(t,n,r),codeToHast:(n,r)=>Q1(t,n,r),codeToHtml:(n,r)=>_se(t,n,r),...t,getInternalContext:()=>t}}function Ese(e,t,n){let r,s,i;{const a=e;r=a.langs,s=a.themes,i=a.engine}async function o(a){function l(m){if(typeof m=="string"){if(Pj(m))return[];const p=r[m];if(!p)throw new nl(`Language \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}function c(m){if($j(m))return"none";if(typeof m=="string"){const p=s[m];if(!p)throw new nl(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}const u=(a.themes??[]).map(m=>c(m)),d=(a.langs??[]).map(m=>l(m)),f=await Ase({engine:a.engine??i(),...a,themes:u,langs:d});return{...f,loadLanguage(...m){return f.loadLanguage(...m.map(l))},loadTheme(...m){return f.loadTheme(...m.map(c))}}}return o}const Mse=Ese({langs:$te,themes:Fte,engine:()=>yj(U(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Ise=["github-light-default","github-dark-default"];let zp=null,Rx=null;const Lx=new Set,$4=new Map,oT=new Set,Nse=128,Hf=new Map;function Kj(e,t,n){return`${t}\0${n}\0${e}`}function Rse(e,t){if(Hf.size>=Nse){const n=Hf.keys().next().value;n!==void 0&&Hf.delete(n)}Hf.set(e,t)}function Lse(e,t,n){return Hf.get(Kj(e,t,n))??null}function jse(){return zp||(zp=Mse({langs:[],themes:Ise}).then(e=>(Rx=e,e)).catch(e=>{throw zp=null,e})),zp}async function Dse(e){const t=await jse();if(Lx.has(e))return t;if(oT.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=$4.get(e);return n||(n=t.loadLanguage(e).then(()=>{Lx.add(e)}).catch(r=>{throw oT.add(e),r}).finally(()=>{$4.delete(e)}),$4.set(e,n)),await n,t}const Ose=1e5,Bse=2e4;function Pse(e){if(e.length>Ose)return!0;let t=0;const n=e.length;for(let r=0;r<=n;r++)if(r===n||e.charCodeAt(r)===10){if(r-t>Bse)return!0;t=r+1}return!1}function aT(e,t,n,r=!0){if(Rx&&Lx.has(t))try{const s=Rx.codeToHtml(e,{lang:t,theme:n});return r&&Rse(Kj(e,t,n),s),s}catch(s){return console.warn("[web-shell] sync highlight failed for lang=%s",t,s),null}return null}const $se="_tableShell_111ca_1",zse="_toolbar_111ca_11",Fse="_summary_111ca_22",Use="_hint_111ca_27",qse="_selection_111ca_31",Hse="_copyButton_111ca_36",Vse="_secondaryButton_111ca_37",Wse="_primaryButton_111ca_38",Gse="_copyCheck_111ca_47",Kse="_scroller_111ca_71",Yse="_table_111ca_1",Xse="_headerCell_111ca_91",Qse="_cell_111ca_92",Jse="_headerControls_111ca_115",Zse="_headerButton_111ca_121",eie="_filterTrigger_111ca_138",tie="_headerText_111ca_142",nie="_sortIcon_111ca_149",rie="_filterTriggerActive_111ca_165",sie="_filterMenu_111ca_170",iie="_filterMenuTitle_111ca_186",oie="_filterMenuSection_111ca_196",aie="_filterMenuAction_111ca_204",lie="_activeAction_111ca_217",cie="_filterSearch_111ca_226",uie="_conditionInput_111ca_227",die="_conditionSelect_111ca_228",hie="_filterOptionList_111ca_244",fie="_filterOption_111ca_244",mie="_optionLabel_111ca_270",pie="_optionCount_111ca_278",gie="_optionLimitHint_111ca_284",yie="_conditionTitle_111ca_290",bie="_conditionInputs_111ca_295",vie="_filterFooter_111ca_300",wie="_footerSpacer_111ca_307",xie="_dragging_111ca_324",_ie="_evenRow_111ca_328",kie="_selectedCell_111ca_336",Sie="_actionHeaderCell_111ca_343",Tie="_actionCell_111ca_344",Cie="_rowDetailButton_111ca_357",Aie="_detailRow_111ca_372",Eie="_detailCell_111ca_376",Mie="_detailPanel_111ca_383",Iie="_detailTitle_111ca_389",Nie="_detailItem_111ca_394",Rie="_detailLabel_111ca_400",Lie="_detailValue_111ca_405",jie="_emptyState_111ca_412",ft={tableShell:$se,toolbar:zse,summary:Fse,hint:Use,selection:qse,copyButton:Hse,secondaryButton:Vse,primaryButton:Wse,copyCheck:Gse,scroller:Kse,table:Yse,headerCell:Xse,cell:Qse,headerControls:Jse,headerButton:Zse,filterTrigger:eie,headerText:tie,sortIcon:nie,filterTriggerActive:rie,filterMenu:sie,filterMenuTitle:iie,filterMenuSection:oie,filterMenuAction:aie,activeAction:lie,filterSearch:cie,conditionInput:uie,conditionSelect:die,filterOptionList:hie,filterOption:fie,optionLabel:mie,optionCount:pie,optionLimitHint:gie,conditionTitle:yie,conditionInputs:bie,filterFooter:vie,footerSpacer:wie,dragging:xie,evenRow:_ie,selectedCell:kie,actionHeaderCell:Sie,actionCell:Tie,rowDetailButton:Cie,detailRow:Aie,detailCell:Eie,detailPanel:Mie,detailTitle:Iie,detailItem:Nie,detailLabel:Rie,detailValue:Lie,emptyState:jie},Die={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"},Oie={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"},Bie=500,Pie=50,$ie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function zie(e){return Array.from(e.querySelectorAll($ie)).filter(t=>!t.hasAttribute("hidden"))}function lT(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function Fie(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function mu(e,t){return g.isValidElement(e)&&e.type===t}function Uie(e){return e.replace(/\s+/g," ").trim()}function jx(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(jx).join(""):g.isValidElement(e)?e.type==="img"?e.props.alt??"":jx(e.props.children):""}function qie(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",isHeader:!1}}function Yj(e,t){const n=g.Children.toArray(e.props.children).filter(r=>mu(r,"td")||mu(r,"th"));return{key:t,cells:n.map((r,s)=>{var i;return{key:`${t}-${s}`,content:r.props.children,text:Uie(jx(r.props.children)),isHeader:r.type==="th",textAlign:(i=r.props.style)==null?void 0:i.textAlign}})}}function z4(e,t){return g.Children.toArray(e.props.children).filter(n=>mu(n,"tr")).map((n,r)=>Yj(n,`${t}-${r}`))}function Hie(e,t){return{...e,cells:Array.from({length:t},(n,r)=>e.cells[r]??qie(e.key,r))}}function Vie(e,t){const n=g.Children.toArray(e),r=[],s=[],i=[];if(n.forEach((u,d)=>{mu(u,"thead")?r.push(...z4(u,`head-${d}`)):mu(u,"tbody")?s.push(...z4(u,`body-${d}`)):mu(u,"tfoot")?s.push(...z4(u,`foot-${d}`)):mu(u,"tr")&&i.push(Yj(u,`row-${d}`))}),i.length>0){const[u,...d]=i;u!=null&&u.cells.some(f=>f.isHeader)?(r.push(u),s.push(...d)):s.push(...i)}const o=[...r,...s],a=Math.max(0,...o.map(u=>u.cells.length)),l=r[0];return{headers:Array.from({length:a},(u,d)=>{const f=l==null?void 0:l.cells[d];if(f)return f;const m=t(d);return{key:`header-${d}`,content:m,text:m,isHeader:!0}}),rows:s.map(u=>Hie(u,a)),columnCount:a}}function hc(e){const t=e.trim(),n=t.endsWith("%"),s=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(s))return null;const i=Number(s);return n?i/100:i}function Xj(e,t){const n=hc(e),r=hc(t);return n!==null&&r!==null&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function ak(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow),minCol:Math.min(e.anchorCol,e.focusCol),maxCol:Math.max(e.anchorCol,e.focusCol)}}function Dx(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"");return/^[=+\-@]/.test(t)?`'${e}`:e}function cT(e,t,n){if(!e)return"";const{minRow:r,maxRow:s,minCol:i,maxCol:o}=ak(e),a=n.filter(c=>c>=i&&c<=o);if(a.length===0)return"";const l=[];for(let c=r;c<=s;c++){const u=t[c];u&&l.push(a.map(d=>{var f;return Dx(((f=u.cells[d])==null?void 0:f.text)??"")}).join("	"))}return l.join(`
`)}function Wie(e,t,n){return n.length===0?"":[n.map(s=>{var i;return Dx(((i=e[s])==null?void 0:i.text)??"")}).join("	"),...t.map(s=>n.map(i=>{var o;return Dx(((o=s.cells[i])==null?void 0:o.text)??"")}).join("	"))].join(`
`)}function Gie(e,t){if(!e)return 0;const{minRow:n,maxRow:r,minCol:s,maxCol:i}=ak(e),o=t.filter(a=>a>=s&&a<=i).length;return(r-n+1)*o}function w0(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 Kie(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),r=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===r;case"notEquals":return n!==r;case"startsWith":return n.startsWith(r);case"endsWith":return n.endsWith(r);case"contains":default:return n.includes(r)}}function Yie(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=hc(e),r=hc(t.value);if(n===null||r===null)return!1;switch(t.operator){case"gt":return n>r;case"gte":return n>=r;case"lt":return n<r;case"lte":return n<=r;case"between":{const s=hc(t.valueTo??"");if(s===null)return!1;const i=Math.min(r,s),o=Math.max(r,s);return n>=i&&n<=o}default:return!0}}function Xie(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:Kie(e,t.textFilter)&&Yie(e,t.numberFilter)}function uT(e,t,n){const r=Object.entries(t).map(([s,i])=>[Number(s),i]).filter(([s,i])=>s!==n&&w0(i));return r.length===0?e:e.filter(s=>r.every(([i,o])=>{var a;return Xie(((a=s.cells[i])==null?void 0:a.text)??"",o)}))}function Qie(e,t){return t?e.map((n,r)=>({row:n,index:r})).sort((n,r)=>{var o,a;const s=Xj(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=r.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?s:-s;return i===0?n.index-r.index:i}).map(({row:n})=>n):e}function Jie(e,t,n){const r=new Map;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";r.set(i,(r.get(i)??0)+1)}),Array.from(r.entries()).map(([s,i])=>({value:s,label:s||n,count:i})).sort((s,i)=>Xj(s.value,i.value))}function Zie(e,t){let n=0,r=0;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";i&&(n+=1,hc(i)!==null&&(r+=1))}),n>0&&r/n>=.7}function eoe(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function toe(e,t){var r,s,i;const n={};if(e.selectedValues!==void 0&&!eoe(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(r=e.textFilter)!=null&&r.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(s=e.numberFilter)!=null&&s.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();hc(o)!==null&&(e.numberFilter.operator!=="between"||hc(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return w0(n)?n:void 0}function noe({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:r}=ht();return h.jsxs("div",{className:ft.filterMenuSection,children:[h.jsx("button",{className:`${ft.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?ft.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:r("markdownTable.sort.asc")}),h.jsx("button",{className:`${ft.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?ft.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:r("markdownTable.sort.desc")}),h.jsx("button",{className:ft.filterMenuAction,type:"button",onClick:()=>n(e,null),children:r("markdownTable.sort.clear")})]})}function roe({onHideColumn:e}){const{t}=ht();return h.jsx("div",{className:ft.filterMenuSection,children:h.jsx("button",{className:ft.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function soe({columnIndex:e,columnName:t,search:n,searchInputRef:r,filteredOptions:s,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:c,onToggleValue:u}){const{t:d}=ht();return h.jsxs("div",{className:ft.filterMenuSection,children:[h.jsx("input",{ref:r,className:ft.filterSearch,value:n,onChange:f=>l(f.currentTarget.value),placeholder:d("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":d("markdownTable.filter.searchAria",{column:t})}),h.jsxs("label",{className:ft.filterOption,children:[h.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:f=>c(f.currentTarget.checked)}),h.jsx("span",{children:d("markdownTable.filter.selectVisible")}),h.jsx("span",{className:ft.optionCount,children:s.length})]}),h.jsxs("div",{className:ft.filterOptionList,children:[i.map((f,m)=>h.jsxs("label",{className:ft.filterOption,children:[h.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${m}`,checked:o.has(f.value),onChange:()=>u(f.value)}),h.jsx("span",{className:ft.optionLabel,children:f.label}),h.jsx("span",{className:ft.optionCount,children:f.count})]},f.value)),s.length>i.length&&h.jsx("div",{className:ft.optionLimitHint,children:d("markdownTable.filter.optionLimit",{count:i.length})}),s.length===0&&h.jsx("div",{className:ft.optionLimitHint,children:d("markdownTable.filter.noOptions")})]})]})}function ioe({columnIndex:e,columnName:t,isNumeric:n,textOperator:r,textValue:s,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:c,onNumberOperatorChange:u,onNumberValueChange:d,onNumberValueToChange:f}){const{t:m}=ht();return h.jsxs("div",{className:ft.filterMenuSection,children:[h.jsx("div",{className:ft.conditionTitle,children:m("markdownTable.filter.custom")}),n?h.jsxs(h.Fragment,{children:[h.jsx("select",{className:ft.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:p=>u(p.currentTarget.value),"aria-label":m("markdownTable.filter.numberAria",{column:t}),children:Object.entries(Oie).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsxs("div",{className:ft.conditionInputs,children:[h.jsx("input",{className:ft.conditionInput,value:o,onChange:p=>d(p.currentTarget.value),placeholder:m("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&h.jsx("input",{className:ft.conditionInput,value:a,onChange:p=>f(p.currentTarget.value),placeholder:m("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("select",{className:ft.conditionSelect,value:r,name:`markdown-table-text-operator-${e}`,onChange:p=>l(p.currentTarget.value),"aria-label":m("markdownTable.filter.textAria",{column:t}),children:Object.entries(Die).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsx("input",{className:ft.conditionInput,value:s,onChange:p=>c(p.currentTarget.value),placeholder:m("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function ooe({onClear:e,onClose:t,onApply:n}){const{t:r}=ht();return h.jsxs("div",{className:ft.filterFooter,children:[h.jsx("button",{className:ft.secondaryButton,type:"button",onClick:e,children:r("markdownTable.filter.reset")}),h.jsx("span",{className:ft.footerSpacer}),h.jsx("button",{className:ft.secondaryButton,type:"button",onClick:t,children:r("markdownTable.filter.cancel")}),h.jsx("button",{className:ft.primaryButton,type:"button",onClick:n,children:r("markdownTable.filter.confirm")})]})}function aoe({id:e,columnName:t,columnIndex:n,filter:r,isNumeric:s,options:i,sort:o,style:a,menuRef:l,canHideColumn:c,onApply:u,onClose:d,onHideColumn:f,onSort:m}){var B,k,Q,ce,pe;const p=g.useMemo(()=>i.map(be=>be.value),[i]),[y,w]=g.useState(""),[b,v]=g.useState(()=>new Set((r==null?void 0:r.selectedValues)??p)),[x,S]=g.useState(((B=r==null?void 0:r.textFilter)==null?void 0:B.operator)??"contains"),[C,E]=g.useState(((k=r==null?void 0:r.textFilter)==null?void 0:k.value)??""),[M,D]=g.useState(((Q=r==null?void 0:r.numberFilter)==null?void 0:Q.operator)??"gt"),[O,A]=g.useState(((ce=r==null?void 0:r.numberFilter)==null?void 0:ce.value)??""),[j,I]=g.useState(((pe=r==null?void 0:r.numberFilter)==null?void 0:pe.valueTo)??""),P=g.useRef(null);g.useEffect(()=>{var be;(be=P.current)==null||be.focus()},[]);const F=g.useMemo(()=>{const be=y.trim().toLowerCase();return be?i.filter(ye=>ye.label.toLowerCase().includes(be)):i},[i,y]),q=F.slice(0,500),R=F.length>0&&F.every(be=>b.has(be.value)),V=be=>{v(ye=>{const ie=new Set(ye);return F.forEach(re=>{be?ie.add(re.value):ie.delete(re.value)}),ie})},J=be=>{v(ye=>{const ie=new Set(ye);return ie.has(be)?ie.delete(be):ie.add(be),ie})},ee=()=>{u(n,toe({selectedValues:Array.from(b),textFilter:{operator:x,value:C},numberFilter:{operator:M,value:O,valueTo:j}},p))},N=()=>{u(n,void 0)},G=(o==null?void 0:o.columnIndex)===n?o:null;return h.jsxs("div",{ref:l,id:e,className:ft.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[h.jsx("div",{id:`${e}-title`,className:ft.filterMenuTitle,children:t}),h.jsx(noe,{columnIndex:n,sortedThisColumn:G,onSort:m}),c&&h.jsx(roe,{onHideColumn:()=>f(n)}),h.jsx(soe,{columnIndex:n,columnName:t,search:y,searchInputRef:P,filteredOptions:F,visibleOptions:q,selectedValues:b,allFilteredSelected:R,onSearchChange:w,onFilteredSelectionChange:V,onToggleValue:J}),h.jsx(ioe,{columnIndex:n,columnName:t,isNumeric:s,textOperator:x,textValue:C,numberOperator:M,numberValue:O,numberValueTo:j,onTextOperatorChange:S,onTextValueChange:E,onNumberOperatorChange:D,onNumberValueChange:A,onNumberValueToChange:I}),h.jsx(ooe,{onClear:N,onClose:d,onApply:ee})]})}function loe({children:e,fallback:t,toolbarExtra:n}){const{t:r}=ht(),s=g.useMemo(()=>Vie(e,i=>r("markdownTable.column",{index:i+1})),[e,r]);return s.columnCount===0?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):s.rows.length>Bie||s.columnCount>Pie?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):h.jsx(coe,{table:s,toolbarExtra:n})}function coe({table:e,toolbarExtra:t}){const{t:n}=ht(),r=g.useId(),[s,i]=g.useState(null),[o,a]=g.useState({}),[l,c]=g.useState(null),[u,d]=g.useState(null),[f,m]=g.useState(()=>new Set),[p,y]=g.useState(null),[w,b]=g.useState(!1),[v,x]=g.useState(!1),[S,C]=g.useState(!1),E=g.useRef(!1),M=g.useRef(null),D=g.useRef(null),O=g.useRef(0),A=g.useRef(0),j=g.useRef(!0),I=g.useRef(null),P=g.useRef(null),F=g.useRef(null),q=g.useRef(null),R=g.useRef(0),V=g.useRef(null),J=g.useRef(0),ee=g.useMemo(()=>`${e.columnCount}\0${e.headers.map(he=>he.text).join("\0")}`,[e.columnCount,e.headers]),N=g.useRef(ee),G=g.useCallback(()=>{R.current&&cancelAnimationFrame(R.current),R.current=requestAnimationFrame(()=>{R.current=0;const he=q.current;he!=null&&he.isConnected&&he.focus()})},[]),B=g.useCallback(()=>{d(null),G()},[G]),k=g.useCallback(()=>{O.current+=1,M.current&&(clearTimeout(M.current),M.current=null),x(!1)},[]),Q=g.useCallback(()=>{A.current+=1,D.current&&(clearTimeout(D.current),D.current=null),C(!1)},[]),ce=g.useCallback(()=>{J.current&&(cancelAnimationFrame(J.current),J.current=0);const he=V.current;V.current=null,he&&c(Y=>Y&&{...Y,focusRow:he.rowIndex,focusCol:he.columnIndex})},[]),pe=g.useCallback(()=>{ce(),E.current=!1,b(!1)},[ce]);g.useEffect(()=>{const he=()=>{document.hidden&&pe()};return window.addEventListener("mouseup",pe),window.addEventListener("blur",pe),document.addEventListener("visibilitychange",he),()=>{window.removeEventListener("mouseup",pe),window.removeEventListener("blur",pe),document.removeEventListener("visibilitychange",he),J.current&&cancelAnimationFrame(J.current),R.current&&cancelAnimationFrame(R.current)}},[pe]),g.useEffect(()=>{N.current!==ee&&(N.current=ee,i(null),a({}),c(null),d(null),m(new Set),y(null),k(),Q(),E.current=!1,b(!1))},[Q,k,ee]),g.useEffect(()=>{Q()},[Q,l]),g.useEffect(()=>(j.current=!0,()=>{j.current=!1,M.current&&(clearTimeout(M.current),M.current=null),D.current&&(clearTimeout(D.current),D.current=null)}),[]),g.useEffect(()=>{if(!u)return;const he=Ke=>{var Et,Ze;const _t=Ke.target;!((Et=F.current)!=null&&Et.contains(_t))&&!((Ze=q.current)!=null&&Ze.contains(_t))&&d(null)},Y=Ke=>{var yn;if(Ke.key==="Escape"){B();return}if(Ke.key!=="Tab")return;const _t=F.current,Et=document.activeElement;if(!_t||!(Et instanceof Node)||!_t.contains(Et))return;const Ze=zie(_t);if(Ze.length===0)return;const Kt=Et instanceof HTMLElement?Ze.indexOf(Et):-1,Wn=Ke.shiftKey?Kt<=0?Ze.length-1:Kt-1:Kt===-1||Kt===Ze.length-1?0:Kt+1;Ke.preventDefault(),(yn=Ze[Wn])==null||yn.focus()},me=Ke=>{var Et;const _t=Ke.target;_t instanceof Node&&((Et=F.current)!=null&&Et.contains(_t))||d(null)},le=()=>d(null);return document.addEventListener("mousedown",he),document.addEventListener("keydown",Y),document.addEventListener("scroll",me,!0),window.addEventListener("resize",le),()=>{document.removeEventListener("mousedown",he),document.removeEventListener("keydown",Y),document.removeEventListener("scroll",me,!0),window.removeEventListener("resize",le)}},[B,u]);const be=g.useMemo(()=>uT(e.rows,o),[o,e.rows]),ye=g.useMemo(()=>Qie(be,s),[be,s]),ie=g.useMemo(()=>{if(!u)return[];const he=u.columnIndex;return Jie(uT(e.rows,o,he),he,n("markdownTable.blank"))},[o,u,n,e.rows]),re=g.useMemo(()=>e.headers.map((he,Y)=>Zie(e.rows,Y)),[e.headers,e.rows]),oe=g.useMemo(()=>e.headers.map((he,Y)=>Y).filter(he=>!f.has(he)),[f,e.headers]);g.useEffect(()=>{k()},[k,oe,ye]),g.useEffect(()=>{p&&!ye.some(he=>he.key===p)&&y(null)},[p,ye]);const ve=(he,Y)=>{c(null),a(me=>{const le={...me};return Y&&w0(Y)?le[he]=Y:delete le[he],le}),B()},qe=(he,Y)=>{c(null),i(Y?{columnIndex:he,direction:Y}:null)},We=he=>{c(null),i(Y=>(Y==null?void 0:Y.columnIndex)!==he?{columnIndex:he,direction:"asc"}:Y.direction==="asc"?{columnIndex:he,direction:"desc"}:null)},te=(he,Y)=>{c(null),q.current=he.currentTarget;const me=he.currentTarget.getBoundingClientRect(),le=300,Ke=430,_t={columnIndex:Y,left:Math.max(6,Math.min(me.right-le,window.innerWidth-le-6)),top:window.innerHeight-me.bottom<Ke?Math.max(8,me.top-Ke-2):me.bottom+2};d(Et=>(Et==null?void 0:Et.columnIndex)===Y?null:_t)},we=he=>{oe.length<=1||(c(null),B(),a(Y=>{const me={...Y};return delete me[he],me}),i(Y=>(Y==null?void 0:Y.columnIndex)===he?null:Y),m(Y=>{const me=new Set(Y);return me.add(he),me}))},Se=()=>{c(null),m(new Set)},Ne=he=>{c(null),y(Y=>Y===he?null:he)},Pt=g.useMemo(()=>l?ak(l):null,[l]),at=(he,Y)=>{if(!Pt)return!1;const{minRow:me,maxRow:le,minCol:Ke,maxCol:_t}=Pt;return he>=me&&he<=le&&Y>=Ke&&Y<=_t},vt=(he,Y)=>{u!==null&&d(null),E.current=!0,c({anchorRow:he,anchorCol:Y,focusRow:he,focusCol:Y})},Tt=(he,Y,me)=>{var le;he.button!==0||lT(he.target)||(he.preventDefault(),(le=P.current)==null||le.focus({preventScroll:!0}),vt(Y,me))},rt=(he,Y)=>{E.current&&(b(!0),V.current={rowIndex:he,columnIndex:Y},!J.current&&(J.current=requestAnimationFrame(()=>{J.current=0;const me=V.current;V.current=null,me&&c(le=>le&&{...le,focusRow:me.rowIndex,focusCol:me.columnIndex})})))},tt=he=>{var _t;const Y=document.elementFromPoint(he.clientX,he.clientY),me=Y==null?void 0:Y.closest("[data-row-index][data-column-index]");if(!me||!((_t=I.current)!=null&&_t.contains(me)))return null;const le=Number(me.dataset.rowIndex),Ke=Number(me.dataset.columnIndex);return!Number.isInteger(le)||!Number.isInteger(Ke)?null:{rowIndex:le,columnIndex:Ke}},Qe=(he,Y,me)=>{he.touches.length!==1||lT(he.target)||vt(Y,me)},ne=he=>{if(!E.current||he.touches.length!==1)return;const Y=he.touches[0];if(!Y)return;const me=tt(Y);me&&(he.preventDefault(),rt(me.rowIndex,me.columnIndex))},se=()=>{const he=cT(l,ye,oe);if(!he||!navigator.clipboard)return;const Y=A.current;navigator.clipboard.writeText(he).then(()=>{j.current&&A.current===Y&&(D.current&&clearTimeout(D.current),C(!0),D.current=setTimeout(()=>C(!1),2e3))}).catch(me=>console.warn("[web-shell] clipboard write failed:",me))},De=()=>{const he=Wie(e.headers,ye,oe);if(!he||!navigator.clipboard)return;const Y=O.current;navigator.clipboard.writeText(he).then(()=>{j.current&&O.current===Y&&(M.current&&clearTimeout(M.current),x(!0),M.current=setTimeout(()=>x(!1),2e3))}).catch(me=>console.warn("[web-shell] clipboard write failed:",me))},lt=he=>{if(Fie())return;const Y=cT(l,ye,oe);Y&&(he.preventDefault(),he.clipboardData.setData("text/plain",Y))},ae=Gie(l,oe),ze=Object.values(o).filter(w0).length,Je=ye.length===e.rows.length?n("markdownTable.rows",{count:e.rows.length}):n("markdownTable.rowsFiltered",{visible:ye.length,total:e.rows.length}),Nt=u===null?void 0:e.headers[u.columnIndex],Ut=Nt&&u?Nt.text||n("markdownTable.column",{index:u.columnIndex+1}):"";return h.jsxs("div",{ref:I,className:`${ft.tableShell} ${w?ft.dragging:""}`,children:[h.jsxs("div",{className:ft.toolbar,children:[h.jsx("span",{className:ft.summary,children:Je}),h.jsx("span",{className:ft.hint,children:n("markdownTable.hint")}),h.jsx("button",{className:ft.copyButton,type:"button",onClick:De,children:v?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ft.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyVisible")}),f.size>0&&h.jsx("button",{className:ft.copyButton,type:"button",onClick:Se,children:n("markdownTable.showHiddenColumns",{count:f.size})}),ze>0&&h.jsx("span",{className:ft.selection,children:n("markdownTable.filtersActive",{count:ze})}),ae>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ft.selection,children:n("markdownTable.cellsSelected",{count:ae})}),h.jsx("button",{className:ft.copyButton,type:"button",onClick:se,children:S?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ft.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyTsv")})]}),t]}),h.jsxs("div",{ref:P,className:ft.scroller,tabIndex:0,onCopy:lt,children:[h.jsxs("table",{className:ft.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{className:`${ft.headerCell} ${ft.actionHeaderCell}`,children:n("markdownTable.actions")}),oe.map(he=>{const Y=e.headers[he];if(!Y)return null;const me=(s==null?void 0:s.columnIndex)===he,le=w0(o[he]),Ke=(u==null?void 0:u.columnIndex)===he,_t=me?s.direction==="asc"?"↑":"↓":"↕",Et=Y.text||n("markdownTable.column",{index:he+1}),Ze=me?n(s.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:Et}):n("markdownTable.sortByColumn",{column:Et}),Kt=me?s.direction==="asc"?"ascending":"descending":"none",Wn=`${r}-filter-${he}`,yn=Y.textAlign?{textAlign:Y.textAlign}:void 0;return h.jsx("th",{className:ft.headerCell,"aria-sort":Kt,style:yn,children:h.jsxs("div",{className:ft.headerControls,children:[h.jsxs("button",{className:ft.headerButton,type:"button",onClick:()=>We(he),"aria-label":Ze,style:yn,children:[h.jsx("span",{className:ft.headerText,style:yn,children:Y.content}),h.jsx("span",{className:ft.sortIcon,"aria-hidden":"true",children:_t})]}),h.jsx("button",{className:`${ft.filterTrigger} ${le?ft.filterTriggerActive:""}`,type:"button",onClick:Sn=>te(Sn,he),"aria-label":n("markdownTable.filterColumn",{column:Et}),"aria-expanded":Ke,"aria-controls":Ke?Wn:void 0,children:"▾"})]})},Y.key)})]})}),h.jsx("tbody",{children:ye.map((he,Y)=>{const me=p===he.key,le=`${r}-detail-${he.key}`;return h.jsxs(g.Fragment,{children:[h.jsxs("tr",{className:Y%2===1?ft.evenRow:void 0,children:[h.jsx("td",{className:`${ft.cell} ${ft.actionCell}`,children:h.jsx("button",{className:ft.rowDetailButton,type:"button",onClick:()=>Ne(he.key),"aria-expanded":me,"aria-controls":le,"aria-label":n(me?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Y+1}),children:n("markdownTable.rowDetails")})}),oe.map(Ke=>{const _t=he.cells[Ke];if(!_t)return null;const Et=_t.textAlign?{textAlign:_t.textAlign}:void 0;return h.jsx("td",{className:`${ft.cell} ${at(Y,Ke)?ft.selectedCell:""}`,style:Et,"data-row-index":Y,"data-column-index":Ke,onMouseDown:Ze=>Tt(Ze,Y,Ke),onMouseEnter:()=>rt(Y,Ke),onTouchStart:Ze=>Qe(Ze,Y,Ke),onTouchMove:ne,onTouchEnd:pe,onTouchCancel:pe,children:_t.content},_t.key)})]}),me&&h.jsx("tr",{id:le,className:ft.detailRow,children:h.jsx("td",{className:ft.detailCell,colSpan:oe.length+1,children:h.jsxs("div",{className:ft.detailPanel,children:[h.jsx("div",{className:ft.detailTitle,children:n("markdownTable.detailsHeader")}),oe.map(Ke=>{const _t=e.headers[Ke],Et=he.cells[Ke];if(!_t||!Et)return null;const Ze=_t.textAlign?{textAlign:_t.textAlign}:void 0,Kt=Et.textAlign?{textAlign:Et.textAlign}:void 0;return h.jsxs("div",{className:ft.detailItem,children:[h.jsx("div",{className:ft.detailLabel,style:Ze,children:_t.content}),h.jsx("div",{className:ft.detailValue,style:Kt,children:Et.content})]},`${he.key}-detail-${Ke}`)})]})})})]},he.key)})})]}),ye.length===0&&h.jsx("div",{className:ft.emptyState,children:e.rows.length===0?n("markdownTable.empty"):n("markdownTable.emptyFiltered")})]}),u&&Nt&&h.jsx(aoe,{id:`${r}-filter-${u.columnIndex}`,columnName:Ut,columnIndex:u.columnIndex,filter:o[u.columnIndex],isNumeric:re[u.columnIndex]??!1,options:ie,sort:s,style:{left:u.left,top:u.top},menuRef:F,canHideColumn:oe.length>1,onApply:ve,onClose:B,onHideColumn:we,onSort:qe},u.columnIndex)]})}const uoe="_content_n5mo3_1",doe="_inlineCode_n5mo3_127",hoe="_link_n5mo3_139",foe="_tableWrapper_n5mo3_149",moe="_table_n5mo3_149",poe="_image_n5mo3_179",goe="_codeBlock_n5mo3_187",yoe="_codeBlockHeader_n5mo3_196",boe="_codeBlockLang_n5mo3_206",voe="_codeBlockCopy_n5mo3_214",woe="_codeBlockContent_n5mo3_232",xoe="_codeBlockPlain_n5mo3_251",_oe="_mermaidBlock_n5mo3_269",koe="_mermaidInline_n5mo3_281",Soe="_mermaidLoading_n5mo3_300",Toe="_mermaidActions_n5mo3_307",Nn={content:uoe,inlineCode:doe,link:hoe,tableWrapper:foe,table:moe,image:poe,codeBlock:goe,codeBlockHeader:yoe,codeBlockLang:boe,codeBlockCopy:voe,codeBlockContent:woe,codeBlockPlain:xoe,mermaidBlock:_oe,mermaidInline:koe,mermaidLoading:Soe,mermaidActions:Toe},Coe=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","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"]),dT={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 Aoe(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(dT,t)?dT[t]:t,r=Coe.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:r}}const Qj=/^(https?:|mailto:)/i,Eoe=/^data:image\/(png|jpeg|gif|webp);base64,/i;function Moe(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:Qj.test(t):!1}function Jj(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||Eoe.test(t)?!0:Qj.test(t):!1}let hT,Ioe=0;function Noe({code:e}){const{t}=ht(),n=m5(),[r,s]=g.useState(null),[i,o]=g.useState(null),[a,l]=g.useState("diagram"),[c,u]=g.useState(!1),d=n==="light"?"default":"dark";g.useEffect(()=>{let m=!1;s(null),o(null);const p=setTimeout(()=>{U(()=>import("./mermaid.core-Bkagz0ng.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const w=y.default;hT!==d&&(w.initialize({startOnLoad:!1,theme:d,securityLevel:"strict",suppressErrorRendering:!0}),hT=d);try{const b=`mermaid-${++Ioe}`,{svg:v}=await w.render(b,e.trim());m||s(v)}catch(b){m||o(b instanceof Error?b.message:"Mermaid render failed")}})},150);return()=>{m=!0,clearTimeout(p)}},[e,d]);const f=()=>{navigator.clipboard.writeText(e).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)},()=>{})};return i?h.jsxs("div",{className:Nn.codeBlock,children:[h.jsx("div",{className:Nn.codeBlockHeader,children:h.jsx("span",{className:Nn.codeBlockLang,children:"mermaid (error)"})}),h.jsx("pre",{className:`${Nn.codeBlockContent} ${Nn.codeBlockPlain}`,children:h.jsx("code",{children:e})})]}):h.jsxs("div",{className:Nn.codeBlock,children:[h.jsxs("div",{className:Nn.codeBlockHeader,children:[h.jsx("span",{className:Nn.codeBlockLang,children:"mermaid"}),h.jsxs("span",{className:Nn.mermaidActions,children:[h.jsx("button",{className:Nn.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),h.jsx("button",{className:Nn.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?h.jsx("pre",{className:`${Nn.codeBlockContent} ${Nn.codeBlockPlain}`,children:h.jsx("code",{children:e})}):r?h.jsx("div",{className:`${Nn.mermaidBlock} ${Nn.mermaidInline}`,dangerouslySetInnerHTML:{__html:r}}):h.jsx("div",{className:`${Nn.mermaidBlock} ${Nn.mermaidLoading} ${Nn.mermaidInline}`,children:h.jsx("span",{children:t("mermaid.rendering")})})]})}function Roe({className:e,children:t,isStreaming:n}){const{t:r}=ht(),s=m5(),[i,o]=g.useState(null),[a,l]=g.useState(!1),c=e==null?void 0:e.match(/language-(\w+)/),{label:u,lang:d,resolvedLang:f}=Aoe(c==null?void 0:c[1]),m=String(t).replace(/\n$/,""),p=s==="light"?"github-light-default":"github-dark-default";g.useEffect(()=>{if(d==="mermaid"||f==="text"||Pse(m)){o(null);return}const w=Lse(m,f,p);if(w!==null){o(w);return}const b=!n,v=aT(m,f,p,b);if(v!==null){o(v);return}o(null);let x=!1;return Dse(f).then(()=>{if(x)return;const S=aT(m,f,p,b);S!==null&&o(S)}).catch(S=>{x||(console.warn("[web-shell] highlight failed for lang=%s",f,S),o(null))}),()=>{x=!0}},[m,d,f,p,n]);const y=()=>{navigator.clipboard.writeText(m).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?h.jsx(Noe,{code:m}):h.jsxs("div",{className:Nn.codeBlock,children:[h.jsxs("div",{className:Nn.codeBlockHeader,children:[h.jsx("span",{className:Nn.codeBlockLang,children:u}),h.jsx("button",{className:Nn.codeBlockCopy,onClick:y,children:r(a?"code.copied":"code.copy")})]}),i!==null?h.jsx("div",{className:Nn.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):h.jsx("pre",{className:`${Nn.codeBlockContent} ${Nn.codeBlockPlain}`,children:h.jsx("code",{children:m})})]})}function Loe({children:e}){return h.jsx("code",{className:Nn.inlineCode,children:e})}function fT({children:e}){return h.jsx("div",{className:Nn.tableWrapper,children:h.jsx("table",{className:Nn.table,children:e})})}class joe extends g.Component{constructor(){super(...arguments);ue(this,"state",{hasError:!1,resetKey:this.props.resetKey})}static getDerivedStateFromError(){return{hasError:!0}}static getDerivedStateFromProps(n,r){return n.resetKey!==r.resetKey?{hasError:!1,resetKey:n.resetKey}:null}componentDidCatch(n,r){console.error("[web-shell] enhanced markdown table failed:",n,r.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const Zj=g.createContext(!1);function Doe({className:e,children:t}){const n=g.useContext(Zj);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?h.jsx(Roe,{className:e,isStreaming:n,children:String(t)}):h.jsx(Loe,{children:t})}function Ooe({children:e}){return h.jsx(h.Fragment,{children:e})}function Boe({href:e,children:t}){const n=Moe(e)?e:void 0;return h.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:Nn.link,children:t})}function Poe({src:e,alt:t}){const n=Jj(e)?e:void 0;return h.jsx("img",{src:n,alt:t||"",className:Nn.image})}function eD(e="basic",t=""){return{code:Doe,pre:Ooe,a:Boe,img:Poe,table({children:n}){if(e==="advanced"){const r=h.jsx(fT,{children:n});return h.jsx(joe,{fallback:r,resetKey:t,children:h.jsx(loe,{fallback:r,children:n})})}return h.jsx(fT,{children:n})}}}const $oe=eD(),Pm=g.memo(function({content:t,source:n,isStreaming:r,tableMode:s}){const{markdown:i,markdownTableMode:o}=Lc(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,c=r?"basic":s??o??"basic",u=g.useMemo(()=>c==="advanced"?eD("advanced",l):$oe,[c,l]),d=a==null?void 0:a.components,f=g.useMemo(()=>d?{...u,...d,...c==="advanced"?{table:u.table}:{}}:u,[u,c,d]);if(!t)return null;const m=a!=null&&a.remarkPlugins?[G7,L9,...a.remarkPlugins]:[G7,L9],p=a!=null&&a.rehypePlugins?[U9,...a.rehypePlugins]:[U9];return h.jsx("div",{className:n!=="thinking"?Nn.content:void 0,"data-markdown-source":n,children:h.jsx(Zj.Provider,{value:!!r,children:h.jsx(WX,{remarkPlugins:m,rehypePlugins:p,components:f,children:l})})})}),zoe="_chatMessageRow_1majp_41",Foe="_chatBubble_1majp_48",Uoe="_chatContent_1majp_61",qoe="_chatContentCollapsed_1majp_66",Hoe="_toggleButton_1majp_71",Voe="_toggleIcon_1majp_92",Woe="_toggleIconExpanded_1majp_99",Goe="_chatImages_1majp_103",Koe="_chatImageThumb_1majp_110",Oa={chatMessageRow:zoe,chatBubble:Foe,chatContent:Uoe,chatContentCollapsed:qoe,toggleButton:Hoe,toggleIcon:Voe,toggleIconExpanded:Woe,chatImages:Goe,chatImageThumb:Koe},Yoe=g.memo(function({content:t,images:n}){const{t:r}=ht(),s=g.useRef(null),[i,o]=g.useState(!1),[a,l]=g.useState(!1),c=g.useCallback(()=>{const u=s.current;u&&l(u.scrollHeight>400)},[]);return g.useLayoutEffect(()=>{o(!1),c()},[t,n==null?void 0:n.length,c]),g.useEffect(()=>{const u=s.current;if(!u||typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(u),()=>d.disconnect()},[c]),h.jsx("div",{className:Oa.chatMessageRow,children:h.jsxs("div",{className:Oa.chatBubble,children:[h.jsxs("div",{ref:s,className:`${Oa.chatContent} ${a&&!i?Oa.chatContentCollapsed:""}`,children:[n&&n.length>0&&h.jsx("div",{className:Oa.chatImages,children:n.map((u,d)=>{const f=u.data.startsWith("data:")?u.data:`data:${u.mimeType};base64,${u.data}`;return Jj(f)?h.jsx("img",{src:f,alt:`User uploaded image ${d+1}`,className:Oa.chatImageThumb,onLoad:c},d):null})}),t]}),a&&h.jsxs("button",{type:"button",className:Oa.toggleButton,onClick:()=>o(u=>!u),children:[h.jsx("span",{children:r(i?"userMessage.showLess":"userMessage.showMore")}),h.jsx("svg",{className:`${Oa.toggleIcon} ${i?Oa.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})}),Xoe="_message_1hsrm_1",Qoe="_messageFooter_1hsrm_7",Joe="_copyButton_1hsrm_23",Zoe="_footerTime_1hsrm_49",eae="_thinking_1hsrm_61",tae="_thinkingBody_1hsrm_73",nae="_thinkingSummary_1hsrm_104",rae="_thinkingSummaryTextActive_1hsrm_126",sae="_thinkingSummaryIcon_1hsrm_132",iae="_thinkingSummaryText_1hsrm_126",oae="_thinkingChevronRight_1hsrm_189",aae="_thinkingChevronDown_1hsrm_190",lae="_thinkingExpandedWrap_1hsrm_217",cae="_thinkingExpandedClip_1hsrm_221",uae="_thinkingExpandedCollapsed_1hsrm_229",dae="_thinkingExpandedInner_1hsrm_233",hae="_content_1hsrm_281",fae="_contentBody_1hsrm_286",Cr={message:Xoe,messageFooter:Qoe,copyButton:Joe,footerTime:Zoe,thinking:eae,thinkingBody:tae,thinkingSummary:nae,thinkingSummaryTextActive:rae,thinkingSummaryIcon:sae,thinkingSummaryText:iae,thinkingChevronRight:oae,thinkingChevronDown:aae,thinkingExpandedWrap:lae,thinkingExpandedClip:cae,thinkingExpandedCollapsed:uae,thinkingExpandedInner:dae,content:hae,contentBody:fae},mae=g.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:o=!1}){const{t:a}=ht(),[l,c]=g.useState(!1),u=!!t&&!n&&i,d=g.useCallback(()=>{var m;const f=(m=navigator.clipboard)==null?void 0:m.writeText(t);f&&f.then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)}).catch(()=>{})},[t]);return h.jsxs("div",{className:Cr.message,children:[t&&h.jsx("div",{className:Cr.content,children:h.jsx("div",{className:Cr.contentBody,children:h.jsx(Pm,{content:t,source:"assistant",isStreaming:n})})}),u&&h.jsxs("div",{className:Cr.messageFooter,children:[h.jsx("button",{type:"button",className:Cr.copyButton,title:a("assistant.copy"),"aria-label":a("assistant.copy"),onClick:d,children:l?h.jsx(gae,{}):h.jsx(pae,{})}),o&&s&&h.jsx("button",{type:"button",className:Cr.copyButton,title:a("assistant.branch"),"aria-label":a("assistant.branch"),onClick:s,children:h.jsx(yae,{})}),r!==void 0&&h.jsx("span",{className:Cr.footerTime,"aria-hidden":"true",children:gh(r)})]})]})});function pae(){return h.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[h.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"}),h.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function gae(){return h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function yae(){return h.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[h.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"}),h.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"}),h.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const bae=g.memo(function({content:t,isStreaming:n,timestamp:r}){const{t:s}=ht(),i=g.useContext(Zh),[o,a]=g.useState(!1),l=vae({isStreaming:n}),c=l==="thinking.running",u=g.useRef(r??Date.now()),d=g.useRef(c),[f,m]=g.useState(()=>Date.now()),[p,y]=g.useState(null);g.useEffect(()=>{if(!t||!c)return;m(Date.now());const v=setInterval(()=>m(Date.now()),1e3);return()=>clearInterval(v)},[t,c]),g.useEffect(()=>{if(t){if(c){d.current=!0,y(null);return}d.current&&p===null&&y(Date.now())}},[t,p,c]);const w=c||p?wae((c?f:p)-u.current):"",b=g.useCallback(()=>{a(v=>!v)},[]);return h.jsx("div",{className:Cr.message,children:t&&!i&&h.jsx("div",{className:Cr.thinking,children:h.jsxs("div",{className:Cr.thinkingBody,children:[h.jsxs("button",{type:"button",className:Cr.thinkingSummary,onClick:b,"aria-expanded":o,title:s(o?"thinking.collapse":"thinking.expand"),children:[h.jsx("span",{className:Cr.thinkingSummaryIcon,"aria-hidden":"true",children:h.jsx(xae,{})}),h.jsx("span",{className:c?`${Cr.thinkingSummaryText} ${Cr.thinkingSummaryTextActive}`:Cr.thinkingSummaryText,children:s(l,c?{duration:w}:{})}),h.jsx("span",{className:o?Cr.thinkingChevronDown:Cr.thinkingChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:o?Cr.thinkingExpandedClip:`${Cr.thinkingExpandedClip} ${Cr.thinkingExpandedCollapsed}`,children:h.jsx("div",{className:Cr.thinkingExpandedInner,children:h.jsx("div",{className:Cr.thinkingExpandedWrap,children:h.jsx(Pm,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function vae({isStreaming:e}){return e?"thinking.running":"thinking.done"}function wae(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function xae(){return h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[h.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),h.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),h.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"}),h.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 _ae="_panel_8ng9u_1",kae="_title_8ng9u_16",Sae="_metaLine_8ng9u_22",Tae="_progress_8ng9u_32",Cae="_spacer_8ng9u_38",Aae="_row_8ng9u_42",Eae="_detailRow_8ng9u_43",Mae="_subDetailRow_8ng9u_44",Iae="_symbol_8ng9u_65",Nae="_label_8ng9u_69",Rae="_value_8ng9u_73",Lae="_detailName_8ng9u_80",jae="_sectionTitle_8ng9u_88",Dae="_detailSection_8ng9u_94",Oae="_skillBlock_8ng9u_100",Bae="_hint_8ng9u_105",Pae="_detailCommand_8ng9u_111",$ae="_bodyLoaded_8ng9u_132",zae="_accent_8ng9u_137",Fae="_secondary_8ng9u_141",Uae="_warning_8ng9u_145",qae="_error_8ng9u_149",Hae="_success_8ng9u_153",$t={panel:_ae,title:kae,metaLine:Sae,progress:Tae,spacer:Cae,row:Aae,detailRow:Eae,subDetailRow:Mae,symbol:Iae,label:Nae,value:Rae,detailName:Lae,sectionTitle:jae,detailSection:Dae,skillBlock:Oae,hint:Bae,detailCommand:Pae,bodyLoaded:$ae,accent:zae,secondary:Fae,warning:Uae,error:qae,success:Hae},Ox="web-shell:context-usage:v1:",Nl="█",tD="▒",nD="░",rD=30;function Vae(e){return`${Ox}${JSON.stringify(e)}`}function Wae(e){if(!e.startsWith(Ox))return null;try{const t=JSON.parse(e.slice(Ox.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function sD(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function _h(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Gae(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function Kae(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function Yae({usedPercentage:e,bufferPercentage:t}){const r=Math.round(Math.min(e,100)/100*56),s=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-r-s),o=e>80?$t.error:e>60?$t.warning:$t.accent;return h.jsxs("div",{className:$t.progress,"aria-hidden":"true",children:[h.jsx("span",{className:o,children:Nl.repeat(Math.max(0,r))}),h.jsx("span",{className:$t.secondary,children:nD.repeat(Math.max(0,i))}),h.jsx("span",{className:$t.warning,children:tD.repeat(Math.max(0,s))})]})}function Ba({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=$t.secondary,isOverLimit:o}){return h.jsxs("div",{className:$t.row,children:[h.jsx("span",{className:`${$t.symbol} ${i}`,children:e}),h.jsx("span",{className:$t.label,children:t}),h.jsxs("span",{className:o?$t.error:$t.value,children:[_h(n)," ",r," (",Gae(n,s),"%)"]})]})}const F4="/context detail";function Xae({hint:e,onShowDetail:t}){const n=t?e.indexOf(F4):-1;return n<0?h.jsx("div",{className:$t.hint,children:e}):h.jsxs("div",{className:$t.hint,children:[e.slice(0,n),h.jsx("button",{type:"button",className:$t.detailCommand,onClick:t,children:F4}),e.slice(n+F4.length)]})}function Qae({name:e,tokens:t,tokenLabel:n}){return h.jsxs("div",{className:$t.detailRow,children:[h.jsxs("span",{className:$t.secondary,children:["└"," "]}),h.jsx("span",{className:$t.detailName,title:e,children:sD(e,rD)}),h.jsxs("span",{className:$t.value,children:[_h(t)," ",n]})]})}function U4({title:e,items:t,getName:n,tokenLabel:r}){const s=Kae(t);return s.length===0?null:h.jsxs("section",{className:$t.detailSection,children:[h.jsx("div",{className:$t.sectionTitle,children:e}),s.map(i=>h.jsx(Qae,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function Jae({skills:e,labels:t}){const n=[...e].sort((r,s)=>r.loaded!==s.loaded?r.loaded?-1:1:s.tokens+(s.bodyTokens??0)-(r.tokens+(r.bodyTokens??0)));return n.length===0?null:h.jsxs("section",{className:$t.detailSection,children:[h.jsx("div",{className:$t.sectionTitle,children:t.skills}),n.map(r=>h.jsxs("div",{className:$t.skillBlock,children:[h.jsxs("div",{className:$t.detailRow,children:[h.jsxs("span",{className:$t.secondary,children:["└"," "]}),h.jsxs("span",{className:$t.detailName,title:r.name,children:[sD(r.name,rD),r.loaded&&h.jsxs("span",{className:$t.success,children:[" ",t.active]})]}),h.jsxs("span",{className:$t.value,children:[_h(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&h.jsxs("div",{className:$t.subDetailRow,children:[h.jsxs("span",{className:$t.secondary,children:["  └"," "]}),h.jsx("span",{className:$t.bodyLoaded,children:t.bodyLoaded}),h.jsxs("span",{className:$t.success,children:["+",_h(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function Zae({status:e,onShowDetail:t}){const{t:n}=ht(),{usage:r}=e,{breakdown:s,contextWindowSize:i}=r,o=i>0?r.totalTokens/i*100:0,a=o>100,l=i>0?s.autocompactBuffer/i*100:0;return h.jsxs("div",{className:$t.panel,children:[h.jsx("div",{className:$t.title,children:n("contextUsage.title")}),r.isEstimated?h.jsx(h.Fragment,{children:h.jsxs("div",{className:$t.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",_h(i)," ",n("contextUsage.tokens")]})]})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:$t.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",_h(i)," ",n("contextUsage.tokens")]})]}),a&&h.jsx("div",{className:$t.error,children:n("contextUsage.overLimit")})]}),h.jsx(Yae,{usedPercentage:Math.min(o,100),bufferPercentage:l}),h.jsx("div",{className:$t.spacer}),h.jsx(Ba,{symbol:Nl,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?$t.error:$t.accent,isOverLimit:a}),h.jsx(Ba,{symbol:nD,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),h.jsx(Ba,{symbol:tD,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.warning}),h.jsx("div",{className:$t.spacer}),h.jsx("div",{className:$t.sectionTitle,children:n("contextUsage.usageByCategory")}),h.jsx(Ba,{symbol:Nl,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.accent}),h.jsx(Ba,{symbol:Nl,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.accent}),s.mcpTools>0&&h.jsx(Ba,{symbol:Nl,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.accent}),h.jsx(Ba,{symbol:Nl,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.accent}),h.jsx(Ba,{symbol:Nl,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.accent}),!r.isEstimated&&h.jsx(Ba,{symbol:Nl,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:$t.accent}),r.showDetails?h.jsxs(h.Fragment,{children:[h.jsx(U4,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(U4,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(U4,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),h.jsx(Jae,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):h.jsx(Xae,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const ele={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",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 iD(e){if(!e.trim())return"Tool";const t=ele[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function vl(e,t){const n=iD(e),r=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const s of r){const i=t(s);if(i!==s)return i}return n}function Yh(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function js(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const Bx=2e3;function oD(e,t){const n=nle(e,t);if(n)return js(n,Bx);const r=rle(e,t);return r?js(r,Bx):""}function ga(e){var t;if(!e.content)return $x(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return $x(e.rawOutput)}function tle(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=mT(($x(e.rawOutput)??"").trim());if(o)return o}const n=ga(e);if(!n)return"";const r=n.split(`
`),s=r.length;if(t==="read"||t==="read_file"||t==="readfile")return`${s} line(s)`;if(t==="glob")return`Found ${r.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${r.filter(a=>a.trim()).length} item(s)`;if(kc(t)){if(s>3)return`${s} lines of output`;const o=r[0]||"";return js(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=mT(n.trim());return o||`${r.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=r[0]||"";return js(o,80)}if(t==="websearch"||t==="web_search"){const o=r.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:r[0]||""}if(Yh(t))return"";const i=r[0]||"";return js(i,80)}function nle(e,t){if(!e.title)return null;const n=iD(e.toolName),r=e.title.trim();if(r===e.toolName||r===n)return null;const s=[n,e.toolName];for(const i of s)if(r.startsWith(i)){const o=r.slice(i.length);if(/^(:\s*|\s+)/.test(o))return pT(o.replace(/^:\s*|\s+/,""),t)}return pT(r,t)}function mT(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function rle(e,t){const n=e.args||{},r=e.toolName.toLowerCase();if(n.command){let s=String(n.command);return n.directory&&r!=="shell"&&(s+=` [in ${Bd(String(n.directory),t)}]`),n.is_background?s+=" [background]":n.timeout&&(s+=` [timeout: ${String(n.timeout)}ms]`),n.description&&(s+=` (${String(n.description).replace(/\n/g," ")})`),js(s,Bx)}if(r==="grep_search"||r==="grep"||r==="search"){const s=n.pattern??n.query;if(s){let i=`'${String(s)}'`;return n.path?i+=` in path '${String(n.path)}'`:(r==="grep_search"||r==="grep")&&(i+=" in path './'"),n.glob&&(i+=` (filter: '${String(n.glob)}')`),i}}if(r==="glob"&&n.pattern){let s=`'${String(n.pattern)}'`;return n.path&&(s+=` in path '${String(n.path)}'`),s}if(n.file_path)return n.description?String(n.description):Bd(String(n.file_path),t);if(n.url){const s=String(n.url),i=typeof n.prompt=="string"?n.prompt:void 0,o=i?`${s} — "${js(i,40)}"`:s;return js(o,80)}if(n.path)return Bd(String(n.path),t);if(n.query)return js(String(n.query),60);if(r==="list_directory"||r==="listfiles"){const s=n.path||n.directory||"";return Bd(String(s),t)}return n.description?String(n.description):""}function kc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function dl(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>dl(r,t)))??!1}function pT(e,t){const n=e.trim();return aD(Px(n))?Bd(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>Bd(r,t))}function Bd(e,t){const n=Px(e),r=t?Px(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":aD(n)?sle(n):n}function Px(e){return e.replace(/\\/g,"/")}function aD(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function sle(e){return e.replace(/\/+$/,"").split("/").pop()||e}function $m(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function lk(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 J0(e){if(e.status==="failed")return"failed";if(!e.rawOutput||typeof e.rawOutput!="object")return e.status;const t=e.rawOutput,n=typeof t.status=="string"?t.status.toLowerCase():"",r=lk(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function ck(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const ile="general-purpose";function uk(e){var r;const t=$m(e.rawOutput);if(t){const s=t.subagentName;if(typeof s=="string"&&s)return s}const n=(r=e.args)==null?void 0:r.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":ile}function dk(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=$m(e.rawOutput),r=n==null?void 0:n.taskDescription;if(typeof r=="string"&&r.trim())return r.trim();const s=(o=e.args)==null?void 0:o.prompt;return typeof s=="string"&&s.trim()?s.trim().split(`
`)[0]??"":""}function ole(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const r=n[n.length-1];if(r.status!=="in_progress"&&r.status!=="pending")return"";let s=vl(r.toolName??"",t);if(r.title){const a=r.title.indexOf(": ");s+=" "+(a>0?r.title.slice(a+2):r.title)}else(i=r.args)!=null&&i.command?s+=" "+String(r.args.command):(o=r.args)!=null&&o.file_path&&(s+=" "+String(r.args.file_path));return js(s,50)}function $x(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 ale="_panel_1xezz_1",lle="_title_1xezz_17",cle="_sectionTitle_1xezz_23",ule="_spacer_1xezz_29",dle="_pivotRow_1xezz_35",hle="_metricCell_1xezz_41",fle="_metricCellSection_1xezz_48",mle="_metricCellSub_1xezz_56",ple="_modelCell_1xezz_64",gle="_modelCellHeader_1xezz_71",yle="_divider_1xezz_79",ble="_kvRow_1xezz_87",vle="_kvSubRow_1xezz_94",wle="_kvLabel_1xezz_102",xle="_kvValue_1xezz_106",_le="_tableRow_1xezz_115",kle="_tableNameCol_1xezz_121",Sle="_tableToolCol_1xezz_129",Tle="_tableNumCol_1xezz_137",Cle="_success_1xezz_147",Ale="_error_1xezz_151",Ele="_secondary_1xezz_155",Mle="_warning_1xezz_159",He={panel:ale,title:lle,sectionTitle:cle,spacer:ule,pivotRow:dle,metricCell:hle,metricCellSection:fle,metricCellSub:mle,modelCell:ple,modelCellHeader:gle,divider:yle,kvRow:ble,kvSubRow:vle,kvLabel:wle,kvValue:xle,tableRow:_le,tableNameCol:kle,tableToolCol:Sle,tableNumCol:Tle,success:Cle,error:Ale,secondary:Ele,warning:Mle},zx="web-shell:session-stats:v1:";function Ile(e,t="overview"){return`${zx}${JSON.stringify({_view:t,...e})}`}function Nle(e){if(!e.startsWith(zx))return null;try{const t=JSON.parse(e.slice(zx.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 fc(e){if(e<=0)return"0s";if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),r>0&&i.push(`${r}m`),s>0&&i.push(`${s}s`),i.join(" ")||"0s"}function cu({label:e,children:t}){return h.jsxs("div",{className:He.kvRow,children:[h.jsx("span",{className:He.kvLabel,children:e}),h.jsx("span",{className:He.kvValue,children:t})]})}function x0({label:e,children:t}){return h.jsxs("div",{className:He.kvSubRow,children:[h.jsxs("span",{className:He.secondary,children:["»"," ",e]}),h.jsx("span",{className:He.kvValue,children:t})]})}function lD(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const r=t.split("::"),s=r[0],i=r[1],o=i?`${s} (${i})`:s;return{key:t,label:o,metrics:n}})}function Rle(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function Lle(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function jle(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Ko({metric:e,values:t,variant:n="normal"}){const r=n==="section"?He.metricCellSection:n==="sub"?He.metricCellSub:He.metricCell;return h.jsxs("div",{className:He.pivotRow,children:[h.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>h.jsx("span",{className:He.modelCell,children:s},i))]})}function Dle({status:e}){const{t}=ht(),{models:n,tools:r,files:s}=e,i=Object.values(n).reduce((y,w)=>y+w.api.totalLatencyMs,0),o=r.totalDurationMs,a=i+o,l=a>0?i/a*100:0,c=a>0?o/a*100:0,u=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,d=lD(n),f=d.reduce((y,w)=>y+w.metrics.tokens.cached,0),m=d.reduce((y,w)=>y+w.metrics.tokens.prompt,0),p=m>0?f/m*100:0;return h.jsxs("div",{className:He.panel,children:[h.jsx("div",{className:He.title,children:t("stats.title")}),h.jsx("div",{className:He.sectionTitle,children:t("stats.overview")}),h.jsx(cu,{label:t("stats.duration"),children:fc(e.durationMs)}),h.jsx(cu,{label:t("stats.prompts"),children:e.promptCount}),h.jsx(cu,{label:t("stats.toolCalls"),children:h.jsxs("span",{children:[r.totalCalls," ",h.jsx("span",{className:He.secondary,children:"("}),h.jsxs("span",{className:He.success,children:["✓",r.totalSuccess]})," ",h.jsxs("span",{className:He.error,children:["✗",r.totalFail]}),h.jsx("span",{className:He.secondary,children:")"})]})}),h.jsx(cu,{label:t("stats.successRate"),children:h.jsxs("span",{className:u>=90?He.success:u>=70?He.warning:He.error,children:[u.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&h.jsx(cu,{label:t("stats.codeChanges"),children:h.jsxs("span",{children:[h.jsxs("span",{className:He.success,children:["+",s.totalLinesAdded]})," ",h.jsxs("span",{className:He.error,children:["-",s.totalLinesRemoved]})]})}),h.jsx("div",{className:He.spacer}),h.jsx("div",{className:He.sectionTitle,children:t("stats.performance")}),h.jsxs(x0,{label:t("stats.apiTime"),children:[fc(i)," ",h.jsxs("span",{className:He.secondary,children:["(",l.toFixed(1),"%)"]})]}),h.jsxs(x0,{label:t("stats.toolTime"),children:[fc(o)," ",h.jsxs("span",{className:He.secondary,children:["(",c.toFixed(1),"%)"]})]}),d.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:He.spacer}),h.jsx("div",{className:He.sectionTitle,children:t("stats.modelUsage")}),h.jsx("div",{className:He.spacer}),h.jsxs("div",{className:He.tableRow,children:[h.jsx("span",{className:He.tableNameCol,children:t("stats.modelUsage")}),h.jsx("span",{className:He.tableNumCol,children:t("stats.reqs")}),h.jsx("span",{className:He.tableNumCol,children:t("stats.inputTokens")}),h.jsx("span",{className:He.tableNumCol,children:t("stats.outputTokens")})]}),h.jsx("div",{className:He.divider}),d.map(y=>h.jsxs("div",{className:He.tableRow,children:[h.jsx("span",{className:He.tableNameCol,children:y.label}),h.jsx("span",{className:He.tableNumCol,children:y.metrics.api.totalRequests}),h.jsx("span",{className:`${He.tableNumCol} ${He.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),h.jsx("span",{className:`${He.tableNumCol} ${He.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),p>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:He.spacer}),h.jsxs("div",{children:[h.jsx("span",{className:He.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",p.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),h.jsxs("div",{className:He.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function Ole({status:e}){const{t}=ht(),n=lD(e.models);if(n.length===0)return h.jsxs("div",{className:He.panel,children:[h.jsx("div",{className:He.title,children:t("stats.modelStats")}),h.jsx("div",{children:t("stats.noApiCalls")})]});const r=n.some(o=>o.metrics.tokens.cached>0),s=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return h.jsxs("div",{className:He.panel,children:[h.jsx("div",{className:He.title,children:t("stats.modelStats")}),h.jsx("div",{className:He.spacer}),h.jsxs("div",{className:He.pivotRow,children:[h.jsx("span",{className:He.metricCellSection,children:t("stats.metric")}),n.map(o=>h.jsx("span",{className:He.modelCellHeader,children:o.label},o.key))]}),h.jsx("div",{className:He.divider}),h.jsx(Ko,{metric:t("stats.api"),values:[],variant:"section"}),h.jsx(Ko,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),h.jsx(Ko,{metric:t("stats.errors"),values:i(o=>{const a=Rle(o);return h.jsxs("span",{className:o.api.totalErrors>0?He.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),h.jsx(Ko,{metric:t("stats.avgLatency"),values:i(o=>fc(Lle(o)))}),h.jsx("div",{className:He.spacer}),h.jsx(Ko,{metric:t("stats.tokens"),values:[],variant:"section"}),h.jsx(Ko,{metric:t("stats.total"),values:i(o=>h.jsx("span",{className:He.warning,children:o.tokens.total.toLocaleString()}))}),h.jsx(Ko,{metric:t("stats.prompt"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),r&&h.jsx(Ko,{metric:t("stats.cached"),values:i(o=>h.jsxs("span",{className:He.success,children:[o.tokens.cached.toLocaleString()," (",jle(o).toFixed(1),"%)"]})),variant:"sub"}),s&&h.jsx(Ko,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"}),h.jsx(Ko,{metric:t("stats.output"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"})]})}function Ble(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 Ple({status:e}){const{t}=ht(),n=Ble(e.tools.byName);if(n.length===0)return h.jsxs("div",{className:He.panel,children:[h.jsx("div",{className:He.title,children:t("stats.toolStats")}),h.jsx("div",{children:t("stats.noToolCalls")})]});const r=Object.values(e.tools.byName).reduce((o,a)=>{var l,c,u;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+=((u=a.decisions)==null?void 0:u.modify)??0,o},{accept:0,reject:0,modify:0}),s=r.accept+r.reject+r.modify,i=s>0?r.accept/s*100:0;return h.jsxs("div",{className:He.panel,children:[h.jsx("div",{className:He.title,children:t("stats.toolStats")}),h.jsx("div",{className:He.spacer}),h.jsxs("div",{className:He.tableRow,children:[h.jsx("span",{className:He.tableToolCol,children:t("stats.toolName")}),h.jsx("span",{className:He.tableNumCol,children:t("stats.calls")}),h.jsx("span",{className:He.tableNumCol,children:t("stats.successRate")}),h.jsx("span",{className:He.tableNumCol,children:t("stats.avgDuration")})]}),h.jsx("div",{className:He.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 h.jsxs("div",{className:He.tableRow,children:[h.jsx("span",{className:`${He.tableToolCol} ${He.metricCell}`,children:vl(o.name,t)}),h.jsx("span",{className:He.tableNumCol,children:o.stats.count}),h.jsxs("span",{className:`${He.tableNumCol} ${a>=90?He.success:a>=70?He.warning:He.error}`,children:[a.toFixed(1),"%"]}),h.jsx("span",{className:He.tableNumCol,children:fc(l)})]},o.name)}),h.jsx("div",{className:He.spacer}),h.jsx("div",{className:He.sectionTitle,children:t("stats.decisionSummary")}),h.jsx(cu,{label:t("stats.totalReviewed"),children:s}),h.jsx(x0,{label:t("stats.accepted"),children:h.jsx("span",{className:He.success,children:r.accept})}),h.jsx(x0,{label:t("stats.rejected"),children:h.jsx("span",{className:He.error,children:r.reject})}),h.jsx(x0,{label:t("stats.modified"),children:h.jsx("span",{className:He.warning,children:r.modify})}),h.jsx("div",{className:He.divider}),h.jsx(cu,{label:t("stats.agreementRate"),children:h.jsx("span",{className:s>0?i>=90?He.success:i>=70?He.warning:He.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function $le({view:e,status:t}){switch(e){case"model":return h.jsx(Ole,{status:t});case"tools":return h.jsx(Ple,{status:t});default:return h.jsx(Dle,{status:t})}}function vb(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 zle="_panel_13hcg_1",Fle="_title_13hcg_17",Ule="_row_13hcg_23",qle="_rowGap_13hcg_31",Hle="_label_13hcg_35",Vle="_value_13hcg_41",Wle="_accent_13hcg_46",pu={panel:zle,title:Fle,row:Ule,rowGap:qle,label:Hle,value:Vle,accent:Wle},{serialize:Gle,parse:Kle}=vb("web-shell:status:v1:");function Co({label:e,children:t,gap:n}){return h.jsxs("div",{className:`${pu.row}${n?` ${pu.rowGap}`:""}`,children:[h.jsx("span",{className:pu.label,children:e}),h.jsx("span",{className:pu.value,children:t})]})}function Yle({info:e}){const{t}=ht();return h.jsxs("div",{className:pu.panel,children:[h.jsx("div",{className:pu.title,children:t("about.title")}),e.cliVersion&&h.jsx(Co,{label:t("about.qwenCode"),children:h.jsx("span",{className:pu.accent,children:e.cliVersion})}),e.runtime&&h.jsx(Co,{label:t("about.runtime"),children:e.runtime}),e.platform&&h.jsx(Co,{label:t("about.platform"),children:e.platform}),e.auth&&h.jsx(Co,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&h.jsx(Co,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&h.jsx(Co,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&h.jsx(Co,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&h.jsx(Co,{label:t("about.sessionId"),children:e.sessionId}),h.jsx(Co,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),h.jsx(Co,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&h.jsx(Co,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function Z0(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function Xle(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function cD(e,t,n=50){const r=g.useRef(e);g.useEffect(()=>{r.current=e},[e]),g.useEffect(()=>{const s=o=>{o.defaultPrevented||Z0(o.target)&&!Xle(o.target)||r.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}const Qle="_panel_1jx2a_1",Jle="_title_1jx2a_13",Zle="_header_1jx2a_18",ece="_startup_1jx2a_24",tce="_note_1jx2a_28",nce="_secondary_1jx2a_29",rce="_row_1jx2a_39",sce="_selected_1jx2a_48",ice="_disabled_1jx2a_52",oce="_pointer_1jx2a_56",ace="_nameCell_1jx2a_62",lce="_truncate_1jx2a_69",cce="_separator_1jx2a_75",uce="_sectionTitle_1jx2a_79",dce="_groupTitle_1jx2a_80",hce="_success_1jx2a_84",fce="_warning_1jx2a_88",mce="_error_1jx2a_92",pce="_group_1jx2a_80",gce="_list_1jx2a_102",yce="_description_1jx2a_108",bce="_schema_1jx2a_113",vce="_shortcuts_1jx2a_131",wce="_detail_1jx2a_137",xce="_serverFields_1jx2a_143",_ce="_serverField_1jx2a_143",kce="_serverFieldLabel_1jx2a_156",Sce="_detailBlock_1jx2a_160",Tce="_parameters_1jx2a_161",Cce="_invalidBlock_1jx2a_162",Ace="_parameterRow_1jx2a_172",Ece="_actionMessage_1jx2a_177",Mce="_oauthPage_1jx2a_183",Ice="_scrollHint_1jx2a_189",ut={panel:Qle,title:Jle,header:Zle,startup:ece,note:tce,secondary:nce,row:rce,selected:sce,disabled:ice,pointer:oce,nameCell:ace,truncate:lce,separator:cce,sectionTitle:uce,groupTitle:dce,success:hce,warning:fce,error:mce,group:pce,list:gce,description:yce,schema:bce,shortcuts:vce,detail:wce,serverFields:xce,serverField:_ce,serverFieldLabel:kce,detailBlock:Sce,parameters:Tce,invalidBlock:Cce,parameterRow:Ace,actionMessage:Ece,oauthPage:Mce,scrollHint:Ice},Fx="web-shell:mcp-panel-active",Yc=10,{parse:Nce}=vb("web-shell:mcp-status:v1:");function Rce(e){const t=Nce(e);return!t||!t.status?null:t}function Fp(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:ut.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:ut.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:ut.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:ut.error}}}function uD(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 Lce(e){const t=uD(e);return t?JSON.stringify(t,null,2):""}function jce(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Dce(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function Oce(e,t){var r;const n=e.config;if(n!=null&&n.httpUrl)return`${n.httpUrl} (http)`;if(n!=null&&n.url)return`${n.url} (sse)`;if(n!=null&&n.command){const s=((r=n.args)==null?void 0:r.join(" "))??"";return`${n.command} ${s} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function q4(e,t){const n=e.annotations??{},r=[];return n.destructiveHint&&r.push(t("mcp.annotation.destructive")),n.readOnlyHint&&r.push(t("mcp.annotation.readOnly")),n.openWorldHint&&r.push(t("mcp.annotation.openWorld")),n.idempotentHint&&r.push(t("mcp.annotation.idempotent")),r.join(", ")}function gT(e,t){window.dispatchEvent(new CustomEvent(Fx,{detail:{id:e,active:t}}))}function yT(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const s=n.details;if(typeof s=="string"&&s)return s}const r=t.error;if(typeof r=="string"&&r)return r}if(e instanceof Error&&e.message)return e.message}return String(e)}function Up(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function Bce(e,t){return e?t("mcp.required"):""}function Pce(e,t){const n=uD(e),r=n==null?void 0:n.properties,s=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object"){const o=Lce(e);return o?h.jsx("pre",{className:ut.schema,children:o}):null}const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:ut.parameters,children:[h.jsx("div",{className:ut.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:ut.parameterRow,children:`• ${o}${Bce(s.has(o),t)}: ${c}${u?` - ${u}`:""}`},o)})]})}function $ce({message:e}){var G;const{t}=ht(),n=FN({autoLoad:!1}),[r,s]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(null),[c,u]=g.useState(!1),d=g.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,m]=g.useState(!0),[p,y]=g.useState("servers"),[w,b]=g.useState(0),[v,x]=g.useState(0),[S,C]=g.useState(0),E=g.useMemo(()=>r.servers??[],[r.servers]),M=E[w]??null,D=g.useMemo(()=>{var B;return M?((B=i[M.name])==null?void 0:B.tools)??[]:[]},[M,i]),O=D[S]??null,A=g.useMemo(()=>D.length<=Yc||S<Yc-1?0:Math.min(S-Yc+1,D.length-Yc),[S,D.length]),j=g.useMemo(()=>D.slice(A,A+Yc),[D,A]),I=E.filter(B=>!B.disabled&&B.mcpStatus==="connecting").length,P=g.useMemo(()=>{const B=[];for(const k of E){const Q=jce(k,t),ce=B.find(pe=>pe.label===Q);ce?ce.servers.push(k):B.push({label:Q,servers:[k]})}return B},[E,t]),F=g.useMemo(()=>E.length===0?20:Math.min(Math.max(...E.map(B=>B.name.length))+2,35),[E]),q=g.useMemo(()=>D.length===0?30:Math.min(Math.max(...D.map(B=>B.name.length))+2,50),[D]),R=g.useMemo(()=>{if(!M)return[];const B=[];return!M.disabled&&D.length>0&&B.push({id:"view-tools",label:t("mcp.action.tools")}),!M.disabled&&M.mcpStatus==="disconnected"&&B.push({id:"reconnect",label:t("mcp.action.reconnect")}),B.push({id:M.disabled?"enable":"disable",label:M.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),M.disabled||(B.push({id:"authenticate",label:M.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),M.hasOAuthTokens&&B.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),B},[M,D.length,t]),V=g.useCallback(async()=>{var k;const B=await n.reload();if(B){s(B);const Q=((k=B.servers)==null?void 0:k.find(ce=>ce.name===(M==null?void 0:M.name)))??null;if(Q){const ce=await n.loadTools(Q.name);o(pe=>({...pe,[Q.name]:ce}))}}},[n,M==null?void 0:M.name]),J=g.useCallback(async B=>{if(!(!M||B.disabled||c)){if(B.id==="view-tools"){y("tools"),C(0),l(null);return}u(!0),B.id==="authenticate"&&y("oauth"),l(B.id==="authenticate"?Up(M.name,t):t("mcp.action.running",{action:B.label}));try{let k=null;if(B.id==="reconnect")await n.restartServer(M.name);else{const Q=await n.manageServer(M.name,B.id),ce=[...Q.messages??[],...Q.authUrl?[Q.authUrl]:[]].join(`
`);ce&&(k=B.id==="authenticate"?Up(M.name,t,ce):ce)}await V(),l(k??t("mcp.action.done",{action:B.label}))}catch(k){l(B.id==="authenticate"?Up(M.name,t,yT(k)):t("mcp.action.failed",{error:yT(k)}))}finally{u(!1)}}},[c,n,V,M,t]);if(g.useEffect(()=>{const B=d.current;return gT(B,f),()=>gT(B,!1)},[f]),g.useEffect(()=>{const B=k=>{const Q=k.detail;Q!=null&&Q.active&&Q.id&&Q.id!==d.current&&m(!1)};return window.addEventListener(Fx,B),()=>window.removeEventListener(Fx,B)},[]),cD(B=>{if(f){if(B.key==="Escape"){B.preventDefault(),B.stopPropagation(),p==="servers"?m(!1):p==="server"?(y("servers"),x(0),l(null)):p==="oauth"?(y("server"),l(null)):p==="tools"?(y("server"),C(0)):y("tools");return}if(B.key==="ArrowUp"||B.key==="ArrowDown"){B.preventDefault(),B.stopPropagation();const k=B.key==="ArrowUp"?-1:1;p==="servers"?(b(Q=>Math.min(Math.max(Q+k,0),E.length-1)),x(0)):p==="server"?x(Q=>Math.min(Math.max(Q+k,0),R.length-1)):p==="tools"&&C(Q=>Math.min(Math.max(Q+k,0),D.length-1));return}if(B.key==="Enter")if(B.preventDefault(),B.stopPropagation(),p==="servers"&&E.length>0)y("server"),x(0);else if(p==="server"&&R.length>0){const k=R[v];k&&J(k)}else p==="tools"&&D.length>0&&y("tool")}},[f,v,D.length,R,J,E.length,p]),!f)return null;if(E.length===0)return h.jsxs("div",{className:ut.panel,"data-keyboard-scope":!0,children:[h.jsxs("div",{className:ut.header,children:[h.jsx("div",{className:ut.title,children:t("mcp.manageServers")}),h.jsx("div",{className:ut.secondary,children:t("mcp.servers",{count:0})})]}),h.jsx("div",{className:ut.secondary,children:t("mcp.empty")}),h.jsx("div",{className:ut.shortcuts,children:t("mcp.shortcut.close")})]});const ee=p==="servers"?t("mcp.manageServers"):p==="server"?(M==null?void 0:M.name)??t("mcp.manageServers"):p==="oauth"?t("mcp.oauth.title"):p==="tools"?t("mcp.toolsForServer",{name:(M==null?void 0:M.name)??"Server"}):(O==null?void 0:O.name)??t("mcp.toolDetail"),N=p==="servers"?t("mcp.servers",{count:E.length}):p==="server"||p==="oauth"?"":p==="tools"?t(D.length===1?"mcp.toolCount":"mcp.toolsCount",{count:D.length}):(O==null?void 0:O.serverToolName)??(M==null?void 0:M.name)??"";return h.jsxs("div",{className:ut.panel,"data-keyboard-scope":!0,children:[I>0&&h.jsxs("div",{children:[h.jsx("div",{className:ut.startup,children:t("mcp.starting",{count:I})}),h.jsx("div",{className:ut.note,children:t("mcp.startingNote")})]}),h.jsxs("div",{className:ut.header,children:[h.jsx("div",{className:ut.title,children:ee}),N&&h.jsx("div",{className:ut.secondary,children:N})]}),p==="servers"&&h.jsx("div",{className:ut.list,children:P.map(B=>{let k=0;for(const Q of P){if(Q===B)break;k+=Q.servers.length}return h.jsxs("div",{className:ut.group,children:[h.jsx("div",{className:ut.groupTitle,children:B.label}),B.servers.map((Q,ce)=>{const pe=k+ce,be=pe===w,ye=Fp(Q,t);return h.jsxs("div",{className:be?`${ut.row} ${ut.selected}`:ut.row,onClick:()=>{b(pe),y("server"),x(0)},onMouseEnter:()=>b(pe),children:[h.jsx("span",{className:ut.pointer,children:be?"❯":""}),h.jsx("span",{className:ut.nameCell,style:{width:`${F}ch`},children:Q.name}),h.jsx("span",{className:ut.separator,children:"·"}),h.jsxs("span",{className:ye.className,children:[ye.icon," ",ye.text]})]},Q.name)})]},B.label)})}),p==="server"&&M&&h.jsxs("div",{className:ut.detail,children:[h.jsxs("div",{className:ut.serverFields,children:[h.jsxs("div",{className:ut.serverField,children:[h.jsxs("span",{className:ut.serverFieldLabel,children:[t("mcp.status"),":"]}),h.jsxs("span",{className:Fp(M,t).className,children:[Fp(M,t).icon," ",Fp(M,t).text]})]}),h.jsxs("div",{className:ut.serverField,children:[h.jsxs("span",{className:ut.serverFieldLabel,children:[t("mcp.source"),":"]}),h.jsx("span",{children:Dce(M,t)})]}),h.jsxs("div",{className:ut.serverField,children:[h.jsxs("span",{className:ut.serverFieldLabel,children:[t("mcp.command"),":"]}),h.jsx("span",{className:ut.truncate,children:Oce(M,t)})]}),((G=M.config)==null?void 0:G.cwd)&&h.jsxs("div",{className:ut.serverField,children:[h.jsxs("span",{className:ut.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),h.jsx("span",{className:ut.truncate,children:M.config.cwd})]}),!M.disabled&&h.jsxs("div",{className:ut.serverField,children:[h.jsxs("span",{className:ut.serverFieldLabel,children:[t("mcp.tools"),":"]}),h.jsx("span",{children:t(D.length===1?"mcp.toolCount":"mcp.toolsCount",{count:D.length})})]})]}),h.jsx("div",{className:ut.list,children:R.map((B,k)=>{const Q=k===v,ce=[ut.row,Q?ut.selected:"",B.disabled?ut.disabled:""].filter(Boolean).join(" ");return h.jsxs("div",{className:ce,onClick:()=>{x(k),J(B)},children:[h.jsx("span",{className:ut.pointer,children:Q?"❯":""}),h.jsx("span",{children:B.label})]},B.id)})}),a&&h.jsx("pre",{className:ut.actionMessage,children:a})]}),p==="oauth"&&h.jsx("div",{className:ut.oauthPage,children:h.jsx("pre",{className:ut.actionMessage,children:a??(M?Up(M.name,t):t("mcp.status.unknown"))})}),p==="tools"&&h.jsx("div",{className:ut.list,children:D.length===0?h.jsx("div",{className:ut.secondary,children:t("mcp.emptyTools")}):j.map((B,k)=>{const Q=A+k,ce=Q===S,pe=q4(B,t);return h.jsxs("div",{className:ce?`${ut.row} ${ut.selected}`:ut.row,onClick:()=>{C(Q),y("tool")},onMouseEnter:()=>C(Q),children:[h.jsx("span",{className:ut.pointer,children:ce?"❯":""}),h.jsx("span",{className:ut.nameCell,style:{width:`${q}ch`},children:B.name}),B.isValid?pe?h.jsx("span",{className:ut.secondary,children:pe}):null:h.jsx("span",{className:ut.warning,children:t("mcp.invalidReason",{reason:B.invalidReason||t("mcp.status.unknown")})})]},B.name)})}),p==="tools"&&D.length>Yc&&h.jsxs("div",{className:ut.scrollHint,children:[A>0?"↑ ":"  ",t("mcp.scrollPosition",{current:S+1,total:D.length}),A+Yc<D.length?" ↓":""]}),p==="tool"&&O&&h.jsxs("div",{className:ut.detail,children:[!O.isValid&&h.jsxs("div",{className:ut.invalidBlock,children:[h.jsx("div",{className:ut.sectionTitle,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",O.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:ut.secondary,children:t("mcp.invalidToolHelp")})]}),O.description&&h.jsxs("div",{className:ut.detailBlock,children:[h.jsx("div",{className:ut.sectionTitle,children:t("mcp.description")}),h.jsx("div",{className:ut.description,children:O.description.trim()})]}),q4(O,t)&&h.jsxs("div",{className:ut.detailBlock,children:[h.jsx("span",{className:ut.sectionTitle,children:t("mcp.annotations")})," ",h.jsx("span",{children:q4(O,t)})]}),Pce(O,t)]}),h.jsx("div",{className:ut.shortcuts,children:t(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const zce=3;function J1(e){return e.kind==="agent"&&typeof e.id=="string"}function Fce(e){const t=e.filter(J1),n=new Map;for(const c of t)n.set(c.id,c);const r=new Map,s=[];for(const c of t){const u=c.parentAgentId;if(u!=null&&u!==c.id&&n.has(u)){const d=r.get(u);d?d.push(c):r.set(u,[c])}else s.push(c)}if(r.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 u of r.get(c.id)??[])a(u)}};for(const c of s)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=>J1(c)?i[l++]:c)}function dD(e,t){const n=[],r=new Set(e.id!=null?[e.id]:[]);let s=e.parentAgentId;for(;;){if(s==null)return{chain:n,terminatedBy:"root"};if(r.has(s))return{chain:n,terminatedBy:"cycle"};const i=t(s);if(!i)return{chain:n,terminatedBy:"missing"};r.add(s),n.push(i),s=i.parentAgentId}}function Uce(e){const t=new Map;for(const r of e)J1(r)&&t.set(r.id,r);const n=new Map;for(const r of t.values()){const{chain:s,terminatedBy:i}=dD(r,o=>t.get(o));n.set(r.id,{visibleDepth:i==="cycle"?0:s.length,orphaned:s.length===0&&i==="missing"})}return n}function qce(e){const t=new Map;for(const r of e)J1(r)&&t.set(r.id,r);const n=new Set;for(const r of t.values()){if(r.isBackgrounded!==!1)continue;const{chain:s,terminatedBy:i}=dD(r,o=>t.get(o));i==="root"&&s.every(o=>o.isBackgrounded===!1)&&n.add(r.id)}return n}function Ux(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60);if(r===0)return`${n}s`;const s=r%60,i=Math.floor(r/60);return i===0?`${s}m ${n}s`:`${i}h ${s}m`}const Hce="_panel_1a4og_1",Vce="_embeddedPanel_1a4og_12",Wce="_title_1a4og_19",Gce="_sectionTitle_1a4og_24",Kce="_overflowHint_1a4og_28",Yce="_header_1a4og_33",Xce="_secondary_1a4og_39",Qce="_row_1a4og_43",Jce="_selected_1a4og_51",Zce="_pointer_1a4og_55",eue="_nameCell_1a4og_61",tue="_treeMarker_1a4og_70",nue="_orphanNote_1a4og_74",rue="_status_1a4og_78",sue="_chevronCell_1a4og_84",iue="_chevron_1a4og_84",oue="_chevronExpanded_1a4og_101",aue="_separator_1a4og_111",lue="_list_1a4og_115",cue="_task_1a4og_121",uue="_taskExpanded_1a4og_127",due="_success_1a4og_132",hue="_warning_1a4og_136",fue="_error_1a4og_140",mue="_detail_1a4og_144",pue="_detailTop_1a4og_153",gue="_detailTopMain_1a4og_160",yue="_inlineDetail_1a4og_200",bue="_taskIcon_1a4og_216",vue="_detailField_1a4og_245",wue="_detailFieldLabel_1a4og_252",xue="_detailContent_1a4og_258",_ue="_compactSummary_1a4og_265",kue="_actionBar_1a4og_274",Sue="_actionHint_1a4og_283",Tue="_actionButton_1a4og_288",Cue="_dangerButton_1a4og_308",Aue="_shortcuts_1a4og_312",Eue="_confirmHint_1a4og_318",Mue="_statusBadge_1a4og_322",Iue="_activityCurrent_1a4og_328",Nue="_activityPast_1a4og_335",Rue="_promptContent_1a4og_342",Ge={panel:Hce,embeddedPanel:Vce,title:Wce,sectionTitle:Gce,overflowHint:Kce,header:Yce,secondary:Xce,row:Qce,selected:Jce,pointer:Zce,nameCell:eue,treeMarker:tue,orphanNote:nue,status:rue,chevronCell:sue,chevron:iue,chevronExpanded:oue,separator:aue,list:lue,task:cue,taskExpanded:uue,success:due,warning:hue,error:fue,detail:mue,detailTop:pue,detailTopMain:gue,inlineDetail:yue,taskIcon:bue,detailField:vue,detailFieldLabel:wue,detailContent:xue,compactSummary:_ue,actionBar:kue,actionHint:Sue,actionButton:Tue,dangerButton:Cue,shortcuts:Aue,confirmHint:Eue,statusBadge:Mue,activityCurrent:Iue,activityPast:Nue,promptContent:Rue},em="web-shell:tasks-panel-active",Lue=3e3,bT=8,{parse:jue}=vb("web-shell:tasks-status:v1:");function Due(e){const t=jue(e);return!t||!t.snapshot?null:t}function vT(e,t){window.dispatchEvent(new CustomEvent(em,{detail:{id:e,active:t}}))}function wT(e){return e.status==="running"||e.status==="paused"}function Oue(e){return[...e].sort((t,n)=>{const r=wT(t),s=wT(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function H4(e){return Fce(Oue(e))}function xT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function hD(e){switch(e){case"running":return Ge.success;case"paused":return Ge.warning;case"completed":return Ge.success;case"failed":return Ge.error;case"cancelled":return Ge.warning;default:return""}}function Bue(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 Pue(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function $ue({expanded:e}){return h.jsx("svg",{className:`${Ge.chevron} ${e?Ge.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function zue(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 Fue(e,t){if(e.length<=bT)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,bT-2),r=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),s=Math.min(e.length,r+n);return{visible:e.slice(r,s),windowStart:r,hiddenAbove:r,hiddenBelow:e.length-s}}function Uue(e,t,n){const r=vl(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"";return s?`${r}(${s})`:r}function fD({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r}){const{t:s}=ht(),i=Ky(),[o,a]=g.useState(()=>H4(e.snapshot.tasks)),[l,c]=g.useState(!0),[u,d]=g.useState("list"),[f,m]=g.useState(0),[p,y]=g.useState(null),[w,b]=g.useState(!1),[v,x]=g.useState(!1),[S,C]=g.useState(null),E=g.useRef(`tasks-${Math.random().toString(36).slice(2)}`),M=g.useRef(!1),D=g.useRef(null),O=o.length===0?0:Math.min(f,o.length-1),A=o[O]??null,j=g.useMemo(()=>Uce(o),[o]),I=g.useMemo(()=>qce(o),[o]);g.useEffect(()=>{if(!l)return;const Q=setInterval(()=>{M.current||(M.current=!0,i.getTasks().then(ce=>{a(H4(ce.tasks)),x(!1)}).catch(ce=>{console.warn("[web-shell] failed to refresh tasks:",ce),x(!0)}).finally(()=>{M.current=!1}))},Lue);return()=>clearInterval(Q)},[l,i]),g.useEffect(()=>{o.length===0&&f!==0&&m(0),f>=o.length&&o.length>0&&m(o.length-1)},[o.length,f]),g.useEffect(()=>{if(!l||u!=="detail"){D.current=null;return}if(!A){D.current=null,d("list");return}const k=D.current;if(!k||k.taskId!==A.id){D.current={taskId:A.id,status:A.status};return}k.status==="running"&&A.status!=="running"&&(y(null),d("list"))},[l,u,A]),g.useEffect(()=>{if(!n)return;const k=E.current;return vT(k,l),()=>vT(k,!1)},[l,n]),g.useEffect(()=>{if(!n)return;const k=Q=>{const ce=Q.detail;ce!=null&&ce.active&&ce.id&&ce.id!==E.current&&c(!1)};return window.addEventListener(em,k),()=>window.removeEventListener(em,k)},[n]),g.useEffect(()=>{l||r==null||r()},[l,r]);const P=g.useCallback(async k=>{if(w)return;const Q=k.status==="running",ce=k.kind==="agent"&&k.status==="paused";if(!Q&&!ce)return;if(k.kind==="agent"&&I.has(k.id)&&p!==k.id){y(k.id);return}y(null),b(!0);try{if(!(await i.cancelTask(k.id,k.kind)).cancelled){C(s("tasks.alreadyStopped"));return}const ye=await i.getTasks();a(H4(ye.tasks)),C(null)}catch(be){console.warn("[web-shell] failed to cancel task:",be),C(s("tasks.cancelFailed"))}finally{b(!1)}},[i,w,I,p,s]);if(cD(k=>{if(l){if(k.key==="Escape"){if(k.preventDefault(),k.stopPropagation(),p){y(null);return}u==="detail"?d("list"):c(!1);return}if(k.key==="ArrowLeft"){k.preventDefault(),k.stopPropagation(),u==="detail"?(y(null),d("list")):c(!1);return}if((k.key==="ArrowUp"||k.key==="ArrowDown")&&u==="list"){if(k.preventDefault(),k.stopPropagation(),o.length===0)return;const Q=k.key==="ArrowUp"?-1:1;m(ce=>Math.min(Math.max(ce+Q,0),o.length-1)),y(null);return}if(k.key==="Enter"){k.preventDefault(),k.stopPropagation(),u==="list"&&A?d("detail"):u==="detail"&&c(!1);return}if(k.key===" "&&u==="detail"){k.preventDefault(),k.stopPropagation(),c(!1);return}if(k.key==="x"&&!k.ctrlKey&&!k.metaKey){k.preventDefault(),k.stopPropagation(),A&&P(A);return}}},[l,u,o.length,A,P,p]),!l)return null;const F=p!==null&&A!==null&&p===A.id,q=[];F?(q.push(s("tasks.confirmStop")),q.push(s("tasks.shortcut.cancelConfirm"))):(q.push(s("tasks.shortcut.select")),q.push(s("tasks.shortcut.view")),(A==null?void 0:A.status)==="running"?q.push(s("tasks.shortcut.stop")):(A==null?void 0:A.kind)==="agent"&&(A==null?void 0:A.status)==="paused"&&q.push(s("tasks.shortcut.abandon")),q.push(s("tasks.shortcut.listClose")));const R=[];if(F?(R.push(s("tasks.confirmStop")),R.push(s("tasks.shortcut.cancelConfirm"))):(R.push(s("tasks.shortcut.detailBack")),R.push(s("tasks.shortcut.detailClose")),(A==null?void 0:A.status)==="running"?R.push(s("tasks.shortcut.stop")):(A==null?void 0:A.kind)==="agent"&&(A==null?void 0:A.status)==="paused"&&R.push(s("tasks.shortcut.abandon"))),o.length===0)return h.jsxs("div",{className:t?`${Ge.panel} ${Ge.embeddedPanel}`:Ge.panel,"data-keyboard-scope":!0,children:[(v||S||!t)&&h.jsxs("div",{className:Ge.header,children:[!t&&h.jsx("div",{className:Ge.title,children:s("tasks.title")}),v&&h.jsx("div",{className:Ge.warning,children:s("tasks.refreshStale")}),S&&h.jsx("div",{className:Ge.error,children:S})]}),h.jsx("div",{children:h.jsx("div",{className:Ge.secondary,children:s("tasks.empty")})}),!t&&h.jsx("div",{className:Ge.shortcuts,children:s("tasks.shortcut.close")})]});const{visible:V,windowStart:J,hiddenAbove:ee,hiddenBelow:N}=Fue(o,O),G=t?o:V,B=t?0:J;return h.jsxs("div",{className:t?`${Ge.panel} ${Ge.embeddedPanel}`:Ge.panel,"data-keyboard-scope":!0,children:[(t||u==="list")&&(v||S||!t)&&h.jsxs("div",{className:Ge.header,children:[!t&&h.jsx("div",{className:Ge.title,children:s("tasks.title")}),v&&h.jsx("div",{className:Ge.warning,children:s("tasks.refreshStale")}),S&&h.jsx("div",{className:Ge.error,children:S})]}),(t||u==="list")&&h.jsxs("div",{className:Ge.list,children:[!t&&h.jsxs("div",{className:Ge.sectionTitle,children:[s("tasks.title")," ",h.jsxs("span",{className:Ge.secondary,children:["(",o.length,")"]})]}),!t&&ee>0&&h.jsx("div",{className:Ge.overflowHint,children:s("tasks.moreAbove",{count:ee})}),G.map((k,Q)=>{const ce=B+Q,pe=ce===O,be=hD(k.status),ye=Bue(k.status,s),ie=t&&pe&&u==="detail",re=t?ie:pe,oe=k.kind==="agent"?j.get(k.id):void 0,ve=Math.min((oe==null?void 0:oe.visibleDepth)??0,zce),qe=k.kind==="agent"&&k.parentAgentId!=null,We=oe!=null&&oe.orphaned?k.kind==="agent"&&k.parentName?s("tasks.row.from",{parent:k.parentName}):s("tasks.row.nested"):null;return h.jsxs("div",{className:`${Ge.task} ${ie?Ge.taskExpanded:""}`,children:[h.jsxs("div",{className:re?`${Ge.row} ${Ge.selected}`:Ge.row,onClick:()=>{m(ce),d(t&&ie?"list":"detail")},onMouseEnter:()=>{t||m(ce)},children:[h.jsx("span",{className:Ge.pointer,children:re?"❯":""}),t&&h.jsx("span",{className:Ge.taskIcon,"aria-hidden":"true"}),h.jsxs("span",{className:Ge.nameCell,style:ve>0?{paddingLeft:`${ve*16}px`}:void 0,children:[qe&&h.jsx("span",{className:Ge.treeMarker,"aria-hidden":"true",children:"↳ "}),zue(k,I.has(k.id)),We&&h.jsxs("span",{className:Ge.orphanNote,children:[" · ",We]})]}),h.jsx("span",{className:`${Ge.status} ${be}`,children:ye}),h.jsx("span",{className:Ge.chevronCell,children:h.jsx($ue,{expanded:ie})})]}),ie&&h.jsx("div",{className:Ge.inlineDetail,children:h.jsx(_T,{task:k,t:s,hideHeader:!0,busy:w,showCancelConfirm:p===k.id,onCancel:()=>void P(k),onCancelConfirmDismiss:()=>y(null)})})]},k.id)}),!t&&N>0&&h.jsx("div",{className:Ge.overflowHint,children:s("tasks.moreBelow",{count:N})})]}),!t&&u==="detail"&&A&&h.jsxs(h.Fragment,{children:[S&&h.jsx("div",{className:Ge.error,children:S}),h.jsx(_T,{task:A,t:s,busy:w,showCancelConfirm:p===A.id,onCancel:()=>void P(A),onCancelConfirmDismiss:()=>y(null)})]}),!t&&h.jsx("div",{className:F?`${Ge.shortcuts} ${Ge.confirmHint}`:Ge.shortcuts,children:(u==="list"?q:R).join(" · ")})]})}function que(e,t){switch(e.kind){case"agent":return`${e.subagentType??"Agent"} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function _T({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,S,C;const a=Pue(e.status),l=hD(e.status),c=e.kind==="agent"&&e.status==="paused",u=e.status==="running"||c,d=t(c?"tasks.action.abandon":"tasks.action.stop"),f=t(c?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),m=[Ux(e.runtimeMs)],p=[{label:t("tasks.detail.runtime"),value:Ux(e.runtimeMs)}],y=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((S=e.stats)==null?void 0:S.totalTokens):void 0;y&&(m.push(t("tasks.detail.tokens",{count:xT(y)})),p.push({label:t("tasks.detail.tokenCount"),value:xT(y)})),e.kind==="agent"&&((C=e.stats)==null?void 0:C.toolUses)!==void 0&&(m.push(t("tasks.detail.toolCalls",{count:e.stats.toolUses})),p.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 w=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],b=u&&i?h.jsx("div",{className:Ge.actionBar,children:s?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Ge.actionHint,children:t("tasks.action.confirmHint")}),h.jsx("button",{type:"button",className:`${Ge.actionButton} ${Ge.dangerButton}`,disabled:r,onClick:i,children:f}),h.jsx("button",{type:"button",className:Ge.actionButton,onClick:o,children:t("common.cancel")})]}):h.jsx("button",{type:"button",className:`${Ge.actionButton} ${Ge.dangerButton}`,disabled:r,onClick:i,children:d})}):null,v=n?p.length>0?h.jsx("div",{className:Ge.compactSummary,children:p.map(E=>`${E.label} ${E.value}`).join(" · ")}):null:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ge.title,children:que(e,t)}),h.jsxs("div",{className:Ge.statusBadge,children:[a&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),h.jsx("span",{className:Ge.separator,children:"·"})]}),h.jsx("span",{className:Ge.secondary,children:m.join(" · ")})]})]});return h.jsxs("div",{className:Ge.detail,children:[(v||b)&&h.jsxs("div",{className:Ge.detailTop,children:[v&&h.jsx("div",{className:Ge.detailTopMain,children:v}),b]}),e.kind==="shell"&&h.jsxs(h.Fragment,{children:[h.jsx(md,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&h.jsx(md,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&h.jsx(md,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&h.jsx(md,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&h.jsx(md,{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&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:t("tasks.detail.progress")}),h.jsx("div",{className:Ge.detailContent,children:e.recentActivities.slice(-5).map((E,M,D)=>{const O=M===D.length-1,A=Uue(E.name,E.description,t);return h.jsxs("div",{className:O?Ge.activityCurrent:Ge.activityPast,children:[O?"> ":"  ",A]},`${E.at}-${M}`)})})]}),e.kind==="agent"&&e.prompt&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:t("tasks.detail.prompt")}),h.jsx("div",{className:Ge.promptContent,children:w.slice(0,5).map((E,M,D)=>h.jsx("div",{children:M===D.length-1&&w.length>5?`${E}…`:E||" "},M))})]}),e.kind==="agent"&&e.outputFile&&h.jsx(md,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:`${Ge.detailFieldLabel} ${Ge.error}`,children:t("tasks.detail.resumeBlocked")}),h.jsx("div",{className:Ge.error,children:e.resumeBlockedReason})]}),e.error&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:`${Ge.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?Ge.warning:Ge.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),h.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?Ge.warning:Ge.error,children:e.error})]})]})}function md({label:e,value:t}){return h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:e}),h.jsx("div",{className:Ge.detailContent,children:t})]})}const Hue="_message_fm8gc_1",Vue="_body_fm8gc_15",Wue="_title_fm8gc_20",Gue="_muted_fm8gc_24",Kue="_accent_fm8gc_28",Yue="_success_fm8gc_32",Xue="_error_fm8gc_36",Que="_warning_fm8gc_40",Jue="_row_fm8gc_44",Zue="_label_fm8gc_50",ede="_value_fm8gc_55",hi={message:Hue,body:Vue,title:Wue,muted:Gue,accent:Kue,success:Yue,error:Xue,warning:Que,row:Jue,label:Zue,value:ede},qx="web-shell-goal-status-active",{serialize:kT,parse:tde}=vb(SH),nde=new Set(["set","achieved","cleared","failed","aborted","checking"]);function Z1(e){const t=typeof e=="string"?tde(e):e;return rde(t)}function rde(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!nde.has(n)||typeof r!="string")return null;const s=V4(t.iterations),i=V4(t.durationMs),o=V4(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:r,...s!==void 0?{iterations:s}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function V4(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function sde(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function ide(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:hi.muted};case"set":return{title:t("goal.set"),colorClass:hi.accent};case"achieved":return{title:t("goal.achieved"),colorClass:hi.success};case"cleared":return{title:t("goal.cleared"),colorClass:hi.muted};case"failed":return{title:t("goal.failed"),colorClass:hi.error};case"aborted":return{title:t("goal.aborted"),colorClass:hi.warning}}}function ode({status:e,activateFooter:t=!1}){var l;const{t:n}=ht();g.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(qx,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const r=ide(e,n),s=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&s.push(sde(e.iterations,n)),typeof e.durationMs=="number"&&s.push(Ux(e.durationMs)));const i=s.length>0?` · ${s.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 h.jsx("div",{className:hi.message,children:h.jsxs("div",{className:hi.body,children:[h.jsxs("div",{className:`${hi.title} ${r.colorClass}`,children:[r.title,i&&h.jsx("span",{className:hi.muted,children:i})]}),h.jsxs("div",{className:hi.row,children:[h.jsxs("span",{className:hi.label,children:[n("goal.label"),":"]}),h.jsx("span",{className:hi.value,children:e.condition})]}),o&&h.jsxs("div",{className:hi.muted,children:[a,": ",o]})]})})}const ade="_message_u8kmd_1",lde="_flushMessage_u8kmd_12",cde="_noMarker_u8kmd_26",ude="_content_u8kmd_30",dde="_info_u8kmd_49",hde="_recap_u8kmd_54",fde="_modelSwitch_u8kmd_67",mde="_error_u8kmd_71",pde="_warning_u8kmd_77",gde="_retryHint_u8kmd_83",yde="_retryButton_u8kmd_90",bde="_cancelled_u8kmd_108",ai={message:ade,flushMessage:lde,noMarker:cde,content:ude,info:dde,recap:hde,modelSwitch:fde,error:mde,warning:pde,retryHint:gde,retryButton:yde,cancelled:bde},vde=g.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=ht();if(r==="prompt_cancelled")return h.jsx("div",{className:ai.cancelled,role:"status",children:h.jsx("span",{children:c("turn.stopped")})});const u=n==="info"?Wae(t):null;if(u)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(Zae,{status:u,onShowDetail:i})});const d=n==="info"?Nle(t):null;if(d)return h.jsx("div",{className:ai.flushMessage,children:h.jsx($le,{view:d.view,status:d.status})});const f=n==="info"?Kle(t):null;if(f)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(Yle,{info:f})});const m=n==="info"?Rce(t):null;if(m)return h.jsx("div",{className:ai.flushMessage,children:h.jsx($ce,{message:m})});const p=n==="info"?Due(t):null;if(p)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(fD,{message:p})});const y=n==="info"?Z1(r==="goal"?s:t):null;if(y)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(ode,{status:y,activateFooter:o})});const w=n==="info"&&r==="model_switch_summary",b=n==="info"&&r==="recap";return h.jsx("div",{className:`${ai.message} ${ai[n]} ${w?ai.modelSwitch:""} ${b?ai.recap:""}`,children:h.jsxs("div",{className:ai.content,children:[w?h.jsx("pre",{children:t}):n==="info"?h.jsx(Pm,{content:t}):h.jsx("pre",{children:t}),a&&l&&h.jsx("div",{className:ai.retryHint,children:h.jsx("button",{type:"button",className:ai.retryButton,onClick:l,children:c("retry.hint")})})]})})}),wde="_group_9dxmn_1",xde="_chatSummaryGroup_9dxmn_14",_de="_line_9dxmn_22",kde="_chatSummary_9dxmn_14",Sde="_chatSummaryTextActive_9dxmn_49",Tde="_chatSummaryIcon_9dxmn_55",Cde="_chatSummaryToolIcon_9dxmn_69",Ade="_chatSummaryText_9dxmn_49",Ede="_chatChevronRight_9dxmn_112",Mde="_chatChevronDown_9dxmn_113",Ide="_chatSummaryContentClip_9dxmn_140",Nde="_chatSummaryContentCollapsed_9dxmn_148",Rde="_chatSummaryContentInner_9dxmn_152",Lde="_lineMain_9dxmn_157",jde="_icon_9dxmn_164",Dde="_iconError_9dxmn_172",Ode="_lineName_9dxmn_176",Bde="_lineArg_9dxmn_183",Pde="_lineElapsed_9dxmn_193",$de="_lineExpandable_9dxmn_200",zde="_lineOutput_9dxmn_215",Fde="_lineFullArg_9dxmn_227",Ude="_lineDetail_9dxmn_239",qde="_expandedBash_9dxmn_242",Hde="_expandedRead_9dxmn_243",Vde="_expandedOutput_9dxmn_247",Wde="_expandedEdit_9dxmn_260",Gde="_expandBtn_9dxmn_274",Kde="_todoProgress_9dxmn_293",Yde="_todoBody_9dxmn_300",Xde="_compactGroup_9dxmn_304",Qde="_compactHeader_9dxmn_311",Jde="_compactCount_9dxmn_318",Zde="_compactHint_9dxmn_324",At={group:wde,chatSummaryGroup:xde,line:_de,chatSummary:kde,chatSummaryTextActive:Sde,chatSummaryIcon:Tde,chatSummaryToolIcon:Cde,chatSummaryText:Ade,chatChevronRight:Ede,chatChevronDown:Mde,chatSummaryContentClip:Ide,chatSummaryContentCollapsed:Nde,chatSummaryContentInner:Rde,lineMain:Lde,icon:jde,iconError:Dde,lineName:Ode,lineArg:Bde,lineElapsed:Pde,lineExpandable:$de,lineOutput:zde,lineFullArg:Fde,lineDetail:Ude,expandedBash:qde,expandedRead:Hde,expandedOutput:Vde,expandedEdit:Wde,expandBtn:Gde,todoProgress:Kde,todoBody:Yde,compactGroup:Xde,compactHeader:Qde,compactCount:Jde,compactHint:Zde};function Ou({status:e}){const{t}=ht();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return h.jsx("span",{className:`${At.icon} ${At.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function zm(e,t){if(!e)return"";const n=Math.round(((t||Date.now())-e)/1e3);if(n<3)return"";if(n<60)return`${n}s`;const r=Math.floor(n/60),s=n%60;return`${r}m ${s}s`}function mD(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return`${n}m ${r}s`}function pD(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}const ehe="_panel_1k01a_1",the="_header_1k01a_12",nhe="_desc_1k01a_24",rhe="_toggle_1k01a_33",she="_meta_1k01a_39",ihe="_body_1k01a_45",ohe="_content_1k01a_56",ahe="_stream_1k01a_71",lhe="_streamCollapsed_1k01a_81",che="_scrollWindow_1k01a_88",uhe="_expandToggle_1k01a_93",dhe="_tabBar_1k01a_108",hhe="_tab_1k01a_108",fhe="_tabActive_1k01a_130",mhe="_tools_1k01a_135",phe="_toolTimeRow_1k01a_152",ghe="_toolTimeTip_1k01a_156",mr={panel:ehe,header:the,desc:nhe,toggle:rhe,meta:she,body:ihe,content:ohe,stream:ahe,streamCollapsed:lhe,scrollWindow:che,expandToggle:uhe,tabBar:dhe,tab:hhe,tabActive:fhe,tools:mhe,toolTimeRow:phe,toolTimeTip:ghe};function gD(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function yhe({timestamp:e,children:t}){return e===void 0?h.jsx(h.Fragment,{children:t}):h.jsxs("div",{className:mr.toolTimeRow,children:[t,h.jsx("span",{className:mr.toolTimeTip,"aria-hidden":"true",children:gh(e)})]})}const bhe=g.memo(function({tool:t}){const n=t.subTools||t.subContent?h.jsx(hk,{tool:t}):h.jsx(Wx,{tool:t});return h.jsx(yhe,{timestamp:t.startTime,children:n})});function vhe({tc:e}){const{t}=ht(),n=e.description||"";return h.jsx("div",{className:At.line,children:h.jsxs("div",{className:At.lineMain,children:[h.jsx(Ou,{status:e.status}),h.jsx("span",{className:At.lineName,children:vl(e.name,t)}),n&&h.jsx("span",{className:At.lineArg,children:js(n,70)})]})})}function whe(e){var t;if(e.rawOutput&&gD(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 xhe({text:e}){const{compactThinking:t}=Lc(),{t:n}=ht(),[r,s]=g.useState(!1),[i,o]=g.useState(!1),a=g.useRef(null),l=t&&!r;return g.useEffect(()=>{const c=a.current;!c||!l||(o(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,e]),g.useEffect(()=>{const c=a.current;if(!c||!l)return;const u=()=>o(c.scrollHeight>c.clientHeight),d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[l]),h.jsxs("div",{children:[h.jsx("pre",{ref:a,className:l?`${mr.stream} ${mr.streamCollapsed}`:mr.stream,children:e}),t&&(i||r)&&h.jsx("button",{className:mr.expandToggle,onClick:()=>s(c=>!c),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function _he({content:e}){const{compactThinking:t}=Lc();return h.jsx("div",{className:t?mr.scrollWindow:void 0,children:h.jsx(Pm,{content:e,source:"assistant"})})}function ST({pinTail:e,itemCount:t,children:n}){const{compactThinking:r}=Lc(),s=g.useRef(null);return g.useEffect(()=>{const i=s.current;!i||!r||(i.scrollTop=e?i.scrollHeight:0)},[r,e,t]),h.jsx("div",{ref:s,className:r?`${mr.tools} ${mr.scrollWindow}`:mr.tools,children:n})}function hk({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var E,M,D,O;const s=e.status==="completed"||e.status==="failed",i=J0(e),[o,a]=g.useState(t??!1),[l,c]=g.useState("result"),u=gD(e.rawOutput)?e.rawOutput:null,d=((E=e.subTools)==null?void 0:E.length)||((M=u==null?void 0:u.toolCalls)==null?void 0:M.length)||0,f=dk(e),m=uk(e),p=zm(e.startTime,e.endTime)||mD((D=u==null?void 0:u.executionSummary)==null?void 0:D.totalDurationMs),y=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(O=u==null?void 0:u.executionSummary)==null?void 0:O.outputTokens,w=y?ck(y):"",b=s?whe(e):"",v=g.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),x=!!(e.subContent||b),S=!!(e.subTools&&e.subTools.length>0||v&&v.length>0),C=x&&S;return h.jsxs("div",{className:r?void 0:mr.panel,children:[!n&&h.jsxs("div",{className:mr.header,onClick:()=>a(!o),children:[h.jsx(Ou,{status:i}),h.jsxs("span",{className:At.lineName,children:[m,":"]}),f&&h.jsx("span",{className:mr.desc,children:js(f,50)}),s&&d>0&&h.jsxs("span",{className:mr.meta,children:["· ",d," tools"]}),p&&h.jsxs("span",{className:mr.meta,children:["· ",p]}),w&&h.jsxs("span",{className:mr.meta,children:["· ",w]}),!s&&h.jsx("span",{className:mr.toggle,children:o?"▼":"▶"})]}),(o||n)&&h.jsxs("div",{className:mr.body,children:[C&&h.jsxs("div",{className:mr.tabBar,children:[h.jsx("button",{className:`${mr.tab} ${l==="result"?mr.tabActive:""}`,onClick:()=>c("result"),children:"Result"}),h.jsxs("button",{className:`${mr.tab} ${l==="tools"?mr.tabActive:""}`,onClick:()=>c("tools"),children:["Tools (",d,")"]})]}),(!C||l==="result")&&x&&h.jsx("div",{className:mr.content,children:s?h.jsx(_he,{content:e.subContent||b}):e.subContent&&h.jsx(xhe,{text:e.subContent})}),(!C||l==="tools")&&h.jsxs(h.Fragment,{children:[e.subTools&&e.subTools.length>0&&h.jsx(ST,{pinTail:!s,itemCount:e.subTools.length,children:e.subTools.map(A=>h.jsx(bhe,{tool:A},A.callId))}),v&&v.length>0&&h.jsx(ST,{pinTail:!s,itemCount:v.length,children:v.map(A=>h.jsx(vhe,{tc:A},A.callId))})]})]})]})}const khe="_view_13muf_1",She="_stats_13muf_9",The="_statAdd_13muf_18",Che="_statDel_13muf_22",Ahe="_lines_13muf_26",Ehe="_line_13muf_26",Mhe="_lineAdd_13muf_38",Ihe="_lineDel_13muf_42",Nhe="_lineHeader_13muf_46",Rhe="_lineContext_13muf_52",Lhe="_lineNo_13muf_56",jhe="_marker_13muf_66",Dhe="_content_13muf_81",Yo={view:khe,stats:She,statAdd:The,statDel:Che,lines:Ahe,line:Ehe,lineAdd:Mhe,lineDel:Ihe,lineHeader:Nhe,lineContext:Rhe,lineNo:Lhe,marker:jhe,content:Dhe};function Ohe(e){let t=0,n=0;const r=[];let s=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(s=parseInt(a[1],10),i=parseInt(a[2],10)),r.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,r.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,r.push({type:"del",content:o.slice(1),oldLine:s}),s++):(r.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:s,newLine:i}),s++,i++);return{lines:r,additions:t,deletions:n}}const Bhe=g.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=Ohe(t);return h.jsxs("div",{className:Yo.view,children:[h.jsxs("div",{className:Yo.stats,children:[r>0&&h.jsxs("span",{className:Yo.statAdd,children:["+",r]}),s>0&&h.jsxs("span",{className:Yo.statDel,children:["-",s]})]}),h.jsx("div",{className:Yo.lines,children:n.map((i,o)=>h.jsxs("div",{className:`${Yo.line} ${Yo[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[h.jsx("span",{className:Yo.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),h.jsx("span",{className:Yo.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),h.jsx("span",{className:Yo.content,children:i.content})]},o))})]})}),TT={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 Phe(e){const t=[];let n,r=!1,s=!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:r,dim:s}),i=a.index+a[0].length;const l=a[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,r=!1,s=!1):c===1?r=!0:c===2?s=!0:c===22?(r=!1,s=!1):c>=30&&c<=37||c>=90&&c<=97?n=TT[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function $he(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Xh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function W4(e){const t=e.flatMap((n,r)=>{const s=ty(n),i=qp(s,"content");return i?[{id:qp(s,"id")??`plan-${r}`,content:i,status:Qhe(qp(s,"status")),priority:Jhe(qp(s,"priority"))}]:[]});return t.length>0?t:void 0}function fk(e){if(!Xh(e.toolName)&&e.kind!=="other")return;const t=AT(e.args);if(t)return W4(t);const n=ty(e.rawOutput),r=AT(n);if(r)return W4(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?W4(s):void 0}function zhe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function ey(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const CT={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Fhe(e){let t=[],n=null,r=null,s=!1;for(const o of e){if(o.role==="user"){s=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,r=null,s=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const l=fk(a);l&&(t=l,n=o.id,r=a.callId,s=!1)}}if(t.length===0)return CT;const i=!zhe(t);return i&&s?CT:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function mk(e){return JSON.stringify([e.id,e.content])}function wb(e){if(e.role==="plan")return[{key:e.id,todos:e.todos}];if(e.role==="tool_group"){const t=[];for(const n of e.tools){const r=fk(n);r&&t.push({key:n.callId,todos:r,stats:Vhe(n)})}return t}return[]}function Uhe(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of wb(r)){const o=[];for(const a of i){const l=mk(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(s,{events:o})}return t}function qhe(e){const t=[];for(const n of e)for(const{key:r,todos:s}of wb(n))t.push(JSON.stringify([r,s.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function Hhe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const r of n.tools)!Xh(r.toolName)&&(r.startTime!==void 0||r.endTime!==void 0)&&t.push(JSON.stringify(["span",r.callId,r.startTime,r.endTime]));for(const{key:r,todos:s,stats:i}of wb(n))t.push(JSON.stringify([r,n.timestamp,s.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function Vhe(e){var o;const t=ty((o=ty(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},r=n("promptTokens"),s=n("cachedTokens"),i=n("candidateTokens");if(!(r===void 0||s===void 0||i===void 0))return{promptTokens:r,cachedTokens:s,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function Whe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools){if(Xh(r.toolName))continue;const{startTime:s,endTime:i}=r;typeof s=="number"&&typeof i=="number"&&i>=s&&t.push({start:s,end:i})}return t.sort((n,r)=>n.start-r.start),t}function Ghe(e,t,n){let r=0,s=e.length;for(;r<s;){const o=r+s>>>1;e[o].start<t?r=o+1:s=o}let i=0;for(let o=r;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function Khe(e,t){const n=(r,s)=>Math.max(0,s-r);return{inputTokens:n(e.promptTokens,t.promptTokens),cachedTokens:n(e.cachedTokens,t.cachedTokens),outputTokens:n(e.candidateTokens,t.candidateTokens),apiTimeMs:n(e.apiTimeMs,t.apiTimeMs)}}function Yhe(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 Xhe(e){var a;const t=new Map,n=new Map,r=new Map,s=new Set,i=Whe(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:u,stats:d}of wb(l))for(const f of u){const m=mk(f),p=n.get(m);if(f.status==="in_progress"&&p!=="in_progress")s.has(m)&&(s.delete(m),r.delete(m),t.delete(m)),r.get(m)===void 0&&(r.set(m,d),c!==void 0&&(o(m).startTs=c));else if(f.status==="completed"&&p!=="completed"&&p!==void 0){const y=r.get(m),w=y&&d?Khe(y,d):void 0,b=(a=t.get(m))==null?void 0:a.startTs,v=b!==void 0&&c!==void 0?Ghe(i,b,c):void 0,x=Yhe(w,v);if(c!==void 0||x){const S=o(m);c!==void 0&&(S.endTs=c),x&&(S.resources=x)}}f.status==="completed"&&s.add(m),n.set(m,f.status)}}return t}function AT(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function Qhe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function Jhe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function ty(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function qp(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const Pg=new Set;let Tf=null,yD=Date.now();function Zhe(){yD=Date.now();for(const e of Pg)e()}function efe(e){return Pg.add(e),Tf||(Tf=setInterval(Zhe,1e3)),()=>{Pg.delete(e),Pg.size===0&&Tf&&(clearInterval(Tf),Tf=null)}}function pk(e){const[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{if(e)return n(Date.now()),efe(()=>n(yD))},[e]),t}const tfe="_list_1bo8s_1",nfe="_summary_1bo8s_2",rfe="_row_1bo8s_8",sfe="_num_1bo8s_16",ife="_icon_1bo8s_23",ofe="_text_1bo8s_29",afe="_inProgress_1bo8s_43",lfe="_completed_1bo8s_48",cfe="_item_1bo8s_62",ufe="_rowButton_1bo8s_69",dfe="_detailChevron_1bo8s_82",hfe="_detail_1bo8s_82",ffe="_detailSection_1bo8s_100",mfe="_detailSectionTitle_1bo8s_106",pfe="_detailRows_1bo8s_114",gfe="_detailLabel_1bo8s_122",yfe="_detailValue_1bo8s_126",bfe="_detailDuration_1bo8s_132",vfe="_detailHint_1bo8s_136",_n={list:tfe,summary:nfe,row:rfe,num:sfe,icon:ife,text:ofe,inProgress:afe,completed:lfe,item:cfe,rowButton:ufe,detailChevron:dfe,detail:hfe,detailSection:ffe,detailSectionTitle:mfe,detailRows:pfe,detailLabel:gfe,detailValue:yfe,detailDuration:bfe,detailHint:vfe};function Hx(e){switch(e){case"completed":return _n.completed;case"in_progress":return _n.inProgress;case"pending":return""}}function bD({todos:e,events:t}){const{t:n}=ht();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return h.jsx("div",{className:_n.summary,children:h.jsxs("div",{className:`${_n.row} ${_n.completed}`,children:[h.jsx("span",{className:_n.icon,"aria-hidden":"true",children:"✓"}),h.jsx("span",{className:_n.text,children:n("todo.allDone")})]})});const s=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return s?h.jsx("div",{className:_n.summary,children:h.jsxs("div",{className:`${_n.row} ${Hx(s.status)}`,children:[h.jsx("span",{className:_n.icon,"aria-hidden":"true",children:ey(s.status)}),h.jsx("span",{className:_n.text,children:s.content})]})}):null}return h.jsx("div",{className:_n.summary,children:t.map(r=>h.jsxs("div",{className:`${_n.row} ${r.kind==="completed"?_n.completed:_n.inProgress}`,children:[h.jsx("span",{className:_n.icon,"aria-hidden":"true",children:ey(r.kind==="completed"?"completed":"in_progress")}),h.jsx("span",{className:_n.text,children:r.content})]},`${r.kind}-${r.id}`))})}function Xc({label:e,value:t,suffix:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:_n.detailLabel,children:e}),h.jsxs("span",{className:_n.detailValue,children:[t,n]})]})}function G4({title:e,children:t}){return h.jsxs("div",{className:_n.detailSection,children:[h.jsx("div",{className:_n.detailSectionTitle,children:e}),h.jsx("div",{className:_n.detailRows,children:t})]})}function wfe({detail:e}){const{t}=ht(),{startTs:n,endTs:r,resources:s}=e,i=n!==void 0||r!==void 0,o=(s==null?void 0:s.inputTokens)!==void 0,a=(s==null?void 0:s.apiTimeMs)!==void 0||(s==null?void 0:s.toolTimeMs)!==void 0;return h.jsxs("div",{className:_n.detail,children:[i&&h.jsxs(G4,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&h.jsx(Xc,{label:t("todo.detail.start"),value:gh(n)}),r!==void 0&&h.jsx(Xc,{label:t("todo.detail.end"),value:gh(r),suffix:n!==void 0?h.jsxs("span",{className:_n.detailDuration,children:[" ","(",fc(r-n),")"]}):void 0})]}),o&&h.jsxs(G4,{title:t("todo.detail.sectionTokens"),children:[h.jsx(Xc,{label:t("todo.detail.input"),value:((s==null?void 0:s.inputTokens)??0).toLocaleString()}),h.jsx(Xc,{label:t("todo.detail.output"),value:((s==null?void 0:s.outputTokens)??0).toLocaleString()}),h.jsx(Xc,{label:t("todo.detail.cached"),value:((s==null?void 0:s.cachedTokens)??0).toLocaleString()})]}),a&&h.jsxs(G4,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&h.jsx(Xc,{label:t("todo.detail.api"),value:fc(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&h.jsx(Xc,{label:t("todo.detail.tool"),value:fc(s.toolTimeMs)})]}),!s&&h.jsx("div",{className:_n.detailHint,children:t("todo.detail.noResources")})]})}function xfe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function vD({todos:e,numbered:t=!1}){const{t:n}=ht(),r=g.useContext(TP),[s,i]=g.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsx("div",{className:_n.list,children:e.map((l,c)=>{const u=l.id||String(c),d=r.get(mk(l)),f=xfe(d),m=f&&s.has(u),p=h.jsxs(h.Fragment,{children:[t&&h.jsxs("span",{className:_n.num,style:{minWidth:o},children:[c+1,"."]}),h.jsx("span",{className:_n.icon,"aria-hidden":"true",children:ey(l.status)}),h.jsx("span",{className:_n.text,children:l.content}),f&&h.jsx("span",{className:_n.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return h.jsxs("div",{className:_n.item,children:[f?h.jsx("button",{type:"button",className:`${_n.row} ${_n.rowButton} ${Hx(l.status)}`,onClick:y=>{y.stopPropagation(),a(u)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:p}):h.jsx("div",{className:`${_n.row} ${Hx(l.status)}`,children:p}),m&&d&&h.jsx(wfe,{detail:d})]},u)})})}const wD=5;function _fe(e){const t=e.toolName.toLowerCase();if(Yh(e.toolName))return!!ga(e);if(t==="write_file"||t==="writefile")return!!Lfe(e)||ET(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(kc(t)){const n=ga(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(t==="edit"||t==="write"||t==="editfile")return ET(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=ga(e);return!!n&&n.split(`
`).length>3}return!1}function kfe(e){const t=e.toolName.toLowerCase();return kc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||Yh(e.toolName)}function Sfe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!xD(e)}function ET(e){return Sfe(e)||!!ga(e)}function Tfe(e){const t=xD(e);if(t)return t;if(e.content){const n=e.content.find(r=>r.type==="diff");if(n&&n.type==="diff")return Efe(n.oldText||"",n.newText||"")}return""}function xD(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(Cfe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function Cfe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const Afe=25e4;function Efe(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>Afe){const u=n.map(f=>f?`-${f}`:"-"),d=r.map(f=>f?`+${f}`:"+");return[...u,...d].join(`
`)}const o=Array.from({length:s+1},()=>Array(i+1).fill(0));for(let u=1;u<=s;u++)for(let d=1;d<=i;d++)o[u][d]=n[u-1]===r[d-1]?o[u-1][d-1]+1:Math.max(o[u-1][d],o[u][d-1]);const a=[];let l=s,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(a.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||o[l][c-1]>=o[l-1][c])?(a.push(`+${r[c-1]}`),c--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const K4=150,MT=25,Mfe=60;function Ife(e){const t=e.find(s=>s.key==="ui.shellOutputMaxLines"),n=t==null?void 0:t.values.effective;return Math.max(0,Math.floor((typeof n=="number"?n:wD)||0))}function IT(e,t){return e.length<=t?e:e.slice(0,t)+" …"}function Nfe({tool:e,maxLines:t}){const{t:n}=ht(),[r,s]=g.useState(!1),i=g.useMemo(()=>ga(e)||"",[e]),o=g.useMemo(()=>i.split(`
`),[i]),a=t>0&&o.length>t,l=Math.max(0,o.length-t),c=g.useMemo(()=>o.some(m=>m.length>K4),[o]),u=a||c,d=g.useMemo(()=>r?i:a?[`... first ${l} lines hidden ...`,...o.slice(-t).map(m=>IT(m,K4))].join(`
`):o.map(m=>IT(m,K4)).join(`
`),[l,a,o,t,i,r]),f=g.useMemo(()=>$he(d)?Phe(d):null,[d]);return h.jsxs("div",{className:At.expandedBash,children:[h.jsx("pre",{className:At.expandedOutput,children:f?f.map((m,p)=>h.jsx("span",{style:{color:m.color,fontWeight:m.bold?"bold":void 0,opacity:m.dim?.6:void 0},children:m.text},p)):d}),u&&h.jsx("button",{className:At.expandBtn,onClick:()=>s(!r),"aria-expanded":r,children:r?n("tool.showLess"):a?n("tool.showAll",{count:o.length}):n("tool.showFullLines")})]})}function Rfe({tool:e}){const{t}=ht(),[n,r]=g.useState(!1),s=g.useMemo(()=>ga(e)||"",[e]),i=g.useMemo(()=>s.split(`
`),[s]),o=i.length>MT,a=g.useMemo(()=>o&&!n?i.slice(0,MT).join(`
`):s,[s,o,i,n]);return h.jsxs("div",{className:At.expandedRead,children:[h.jsx("pre",{className:At.expandedOutput,children:a}),o&&h.jsx("button",{className:At.expandBtn,onClick:()=>r(!n),"aria-expanded":n,children:n?t("tool.showLess"):t("tool.linesTotal",{count:i.length})})]})}function NT({tool:e}){const t=g.useMemo(()=>Tfe(e),[e]),n=g.useMemo(()=>ga(e)||"",[e]);return!t&&!n?null:h.jsx("div",{className:At.expandedEdit,children:t?h.jsx(Bhe,{diff:t}):h.jsx("pre",{className:At.expandedOutput,children:n})})}function Lfe(e){var n,r;if((n=e.args)!=null&&n.content)return e.args.content;if((r=e.args)!=null&&r.new_string)return e.args.new_string;const t=ga(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const s=e.rawOutput;if(typeof s.content=="string")return s.content;if(typeof s.newContent=="string")return s.newContent}return""}function jfe({tool:e,todos:t,expanded:n}){var i;const s=((i=g.useContext(i6).get(e.callId))==null?void 0:i.events)??[];return h.jsx("div",{className:At.todoBody,children:n?h.jsx(vD,{todos:t}):h.jsx(bD,{todos:t,events:s})})}function Dfe(e,t){var m,p;const n=$m(e.rawOutput),r=lk(e),s=J0(e),i=uk(e),o=Ofe(e),a=dk(e),l=((m=e.subTools)==null?void 0:m.length)||((p=n==null?void 0:n.toolCalls)==null?void 0:p.length)||0,c=n==null?void 0:n.executionSummary,u=c&&typeof c.totalDurationMs=="number"?mD(c.totalDurationMs):zm(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),d=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,f=d>0?ck(d):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:u,tokens:f,status:s,reason:r}}function Ofe(e){var s;const t=$m(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const r=(s=e.args)==null?void 0:s.subagent_type;return typeof r=="string"&&r.trim()?r.trim():""}function RT(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Yh(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||kc(t))}function Bfe({tool:e}){const t=ga(e)||"";return h.jsx("pre",{className:At.expandedOutput,children:t})}function gk(e){const t=e.toolName.toLowerCase();return Xy(e)?"agent":kc(t)?"shell":bk(t)?"fetch":Xh(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 Pfe({description:e,elapsed:t}){return h.jsxs(h.Fragment,{children:[e&&h.jsx("span",{className:At.lineArg,children:e}),t&&h.jsx("span",{className:At.lineElapsed,children:t})]})}function Vx({info:e}){const{renderToolHeaderExtra:t}=Lc(),n=t==null?void 0:t(e);return n?h.jsx(h.Fragment,{children:n}):h.jsx(Pfe,{description:e.description,elapsed:e.elapsed})}function $fe(e){return e.length>Mfe||e.includes(`
`)}function _D(e){return e==="in_progress"||e==="pending"||e==="running"}function yk(e){return e.find(t=>_D(t.status))??e[e.length-1]}function zfe(e,t,n){if(kD(e)){const r=yk(e);return t("toolGroup.running",{name:vl(r.toolName,t),count:e.length,duration:n??""})}return t("toolGroup.summary",{count:e.length})}function kD(e){return e.some(t=>_D(t.status))}function Ffe(){return h.jsxs("svg",{className:At.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:[h.jsx("path",{d:"M12 20h9"}),h.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function SD(){return h.jsxs("svg",{className:At.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[h.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),h.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),h.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Ufe(){return h.jsxs("svg",{className:At.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[h.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),h.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 qfe(){return h.jsxs("svg",{className:At.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[h.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),h.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function Hfe(){return h.jsx("svg",{className:At.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:h.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 Vfe(){return h.jsx("svg",{className:At.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:h.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 Wfe({tool:e}){const t=gk(e);return t==="agent"?h.jsx(Vfe,{}):t==="edit"||t==="write"?h.jsx(Ffe,{}):t==="fetch"?h.jsx(Ufe,{}):t==="read"?h.jsx(qfe,{}):t==="todo"?h.jsx(Hfe,{}):h.jsx(SD,{})}function bk(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const Gfe=J0;function Kfe({tools:e,workspaceCwd:t}){const{t:n}=ht(),r=yk(e),s=vl(r.toolName,n),i=Gfe(r),o=oD(r,t),a=kc(r.toolName)||bk(r.toolName)?"":zm(r.startTime,r.endTime);return h.jsxs("div",{className:At.compactGroup,children:[h.jsxs("div",{className:At.compactHeader,children:[h.jsx(Ou,{status:i}),h.jsx("span",{className:At.lineName,children:s}),e.length>1&&h.jsxs("span",{className:At.compactCount,children:["× ",e.length]}),h.jsx(Vx,{info:{kind:gk(r),tool:r,displayName:s,description:o,elapsed:a,workspaceCwd:t}})]}),h.jsx("div",{className:At.compactHint,children:n("compact.hint")})]})}function Yfe(e,t){var s,i;if(((s=e.approval)==null?void 0:s.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.shellOutputMaxLines!==t.shellOutputMaxLines||e.summaryOnly!==t.summaryOnly)return!1;const n=e.tool,r=t.tool;return n.callId===r.callId&&n.toolName===r.toolName&&n.status===r.status&&n.startTime===r.startTime&&n.endTime===r.endTime&&n.subContent===r.subContent&&n.rawOutput===r.rawOutput&&n.args===r.args&&n.content===r.content&&n.title===r.title&&Xfe(n.subTools,r.subTools)}function Xfe(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],s=t[n];if(r.callId!==s.callId||r.toolName!==s.toolName||r.status!==s.status||r.endTime!==s.endTime||r.rawOutput!==s.rawOutput||r.args!==s.args||r.subContent!==s.subContent||r.title!==s.title)return!1}return!0}const Wx=g.memo(function({tool:t,approval:n,workspaceCwd:r,shellOutputMaxLines:s=wD,summaryOnly:i=!1}){const{t:o}=ht(),a=g.useContext(Zh),[l,c]=g.useState(()=>!a&&RT(t)),u=g.useRef(!1);g.useEffect(()=>{c(a?!1:RT(t)),u.current=!1},[a,t.callId,t.toolName]);const d=Xy(t),f=n&&n.toolCallId===t.callId,m=!f&&(n==null?void 0:n.toolCallId)&&d&&dl(t,n.toolCallId),p=d&&t.status==="in_progress",y=pk(p);if(g.useEffect(()=>{!d&&t.status==="completed"&&!u.current&&c(!1)},[d,t.status]),d){const P=Dfe(t,y),F=P.explicitAgentType?`${o("agent.label")} (${P.explicitAgentType})`:o("agent.label"),q=t.status==="completed"||t.status==="failed",V=[t.status==="pending"?"pending":"running",P.elapsed].filter(Boolean).join(" · "),J=[P.subToolCount>0?`${P.subToolCount} tools`:"",P.elapsed,P.tokens,P.reason?js(P.reason,80):""].filter(Boolean).join(" · "),ee=l||!!f||!!m;return h.jsxs("div",{className:At.line,children:[h.jsxs("div",{className:`${At.lineMain} ${At.lineExpandable}`,onClick:()=>c(!l),children:[h.jsx(Ou,{status:q?P.status:t.status}),h.jsx("span",{className:At.lineName,children:F}),h.jsx(Vx,{info:{kind:"agent",tool:t,displayName:F,description:P.description?js(P.description,60):"",elapsed:q?J:V,workspaceCwd:r}})]}),ee&&h.jsx("div",{className:At.lineDetail,children:h.jsx(hk,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0})})]})}const w=oD(t,r),b=tle(t),v=vl(t.toolName,o),x=kc(t.toolName)||bk(t.toolName)?"":zm(t.startTime,t.endTime),S=t.toolName.toLowerCase(),C=Xh(S),E=C?fk(t):void 0,M=!!E&&E.length>0,D=E?E.filter(P=>P.status==="completed").length:0,O=!C&&$fe(w),A=C?M:_fe(t)||O,j=l&&O,I=kfe(t);return h.jsxs("div",{className:At.line,children:[h.jsxs("div",{className:`${At.lineMain} ${A?At.lineExpandable:""}`,title:A?o(l?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":A?l:void 0,role:A?"button":void 0,tabIndex:A?0:void 0,onClick:A?()=>{u.current=!0,c(P=>!P)}:void 0,onKeyDown:A?P=>{P.key!=="Enter"&&P.key!==" "||(P.preventDefault(),u.current=!0,c(F=>!F))}:void 0,children:[h.jsx(Ou,{status:t.status}),h.jsx("span",{className:At.lineName,children:v}),C&&M&&h.jsxs("span",{className:At.todoProgress,children:[D,"/",E.length]}),h.jsx(Vx,{info:{kind:gk(t),tool:t,displayName:v,description:C||j?"":w,elapsed:C?"":x,workspaceCwd:r}})]}),(!i||l)&&C&&M&&h.jsx(jfe,{tool:t,todos:E,expanded:l}),(!i||l)&&C&&!M&&b&&h.jsx("div",{className:At.lineOutput,children:b}),j&&h.jsx("div",{className:At.lineFullArg,children:w}),!C&&b&&(!l||!I)&&(!i||l)&&h.jsx("div",{className:At.lineOutput,children:b}),!C&&l&&I&&h.jsxs("div",{className:At.lineDetail,children:[kc(S)&&h.jsx(Nfe,{tool:t,maxLines:s}),(S==="write_file"||S==="writefile")&&h.jsx(NT,{tool:t}),(S==="edit"||S==="write"||S==="editfile")&&h.jsx(NT,{tool:t}),(S==="read"||S==="read_file"||S==="readfile")&&h.jsx(Rfe,{tool:t}),Yh(t.toolName)&&h.jsx(Bfe,{tool:t})]})]})},Yfe),Qfe=g.memo(function({tools:t,pendingApproval:n,workspaceCwd:r,shellOutputMaxLines:s}){const{t:i}=ht(),o=g.useContext(Zh),[a,l]=g.useState(!1),c=kD(t),u=t.length>0?yk(t):void 0,d=t[0]??u,f=g.useRef(Date.now()),m=pk(c),p=(n==null?void 0:n.toolCallId)&&t.some(b=>dl(b,n.toolCallId)),y=o&&!p,w=c?pD(m-f.current):void 0;return g.useEffect(()=>{c&&(f.current=Date.now())},[c,u==null?void 0:u.callId]),y?h.jsx(Kfe,{tools:t,workspaceCwd:r}):p?h.jsx("div",{className:At.group,children:t.map(b=>h.jsx(Wx,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s},b.callId))}):h.jsxs("div",{children:[h.jsxs("button",{type:"button",className:At.chatSummary,onClick:()=>l(b=>!b),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:At.chatSummaryIcon,"aria-hidden":"true",children:d?h.jsx(Wfe,{tool:d}):h.jsx(SD,{})}),h.jsx("span",{className:c?`${At.chatSummaryText} ${At.chatSummaryTextActive}`:At.chatSummaryText,children:zfe(t,i,w)}),h.jsx("span",{className:a?At.chatChevronDown:At.chatChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:a?At.chatSummaryContentClip:`${At.chatSummaryContentClip} ${At.chatSummaryContentCollapsed}`,children:h.jsx("div",{className:At.chatSummaryContentInner,children:h.jsx("div",{className:`${At.group} ${At.chatSummaryGroup}`,children:t.map(b=>h.jsx(Wx,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s,summaryOnly:!0},b.callId))})})})]})}),Jfe="_message_kwepu_1",Zfe="_header_kwepu_6",e0e="_chevron_kwepu_20",t0e="_title_kwepu_26",n0e="_progress_kwepu_35",Cf={message:Jfe,header:Zfe,chevron:e0e,title:t0e,progress:n0e};function r0e({id:e,todos:t}){var s;const r=((s=g.useContext(i6).get(e))==null?void 0:s.events)??[];return h.jsx(bD,{todos:t,events:r})}const s0e=g.memo(function({id:t,todos:n}){const{t:r}=ht(),[s,i]=g.useState(!1);if(n.length===0)return null;const o=n.length,a=n.filter(l=>l.status==="completed").length;return h.jsxs("div",{className:Cf.message,children:[h.jsxs("button",{type:"button",className:Cf.header,onClick:()=>i(l=>!l),"aria-expanded":s,title:r(s?"todo.collapse":"todo.expand"),children:[h.jsx("span",{className:Cf.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),h.jsx("span",{className:Cf.title,children:r("plan.title")}),h.jsxs("span",{className:Cf.progress,children:[a,"/",o]})]}),s?h.jsx(vD,{todos:n,numbered:!0}):h.jsx(r0e,{id:t,todos:n})]})}),i0e="_message_1abcu_1",o0e="_content_1abcu_11",a0e="_question_1abcu_17",l0e="_prefix_1abcu_24",c0e="_answer_1abcu_28",u0e="_pending_1abcu_32",d0e="_shortcuts_1abcu_36",Qc={message:i0e,content:o0e,question:a0e,prefix:l0e,answer:c0e,pending:u0e,shortcuts:d0e},TD=g.memo(function({question:t,answer:n,isPending:r}){const{t:s}=ht();return h.jsxs("div",{className:Qc.message,children:[h.jsxs("div",{className:Qc.content,children:[h.jsxs("div",{className:Qc.question,children:[h.jsx("span",{className:Qc.prefix,children:"/btw "}),h.jsx("span",{children:t})]}),h.jsx("div",{className:Qc.answer,children:r?h.jsx("span",{className:Qc.pending,children:s("btw.answering")}):h.jsx(Pm,{content:n})})]}),h.jsx("div",{className:Qc.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),h0e="_message_1q4dw_1",f0e="_compact_1q4dw_16",m0e="_header_1q4dw_21",p0e="_status_1q4dw_30",g0e="_name_1q4dw_35",y0e="_command_1q4dw_42",b0e="_output_1q4dw_51",v0e="_compactHint_1q4dw_62",Pa={message:h0e,compact:f0e,header:m0e,status:p0e,name:g0e,command:y0e,output:b0e,compactHint:v0e},w0e=g.memo(function({command:t,output:n}){const r=g.useContext(Zh),{t:s}=ht();return h.jsxs("div",{className:r?`${Pa.message} ${Pa.compact}`:Pa.message,children:[h.jsxs("div",{className:Pa.header,children:[h.jsx("span",{className:Pa.status,children:"✓"}),h.jsx("span",{className:Pa.name,children:s("shell.command")}),t&&h.jsx("span",{className:Pa.command,children:t})]}),r?h.jsx("div",{className:Pa.compactHint,children:s("compact.hint")}):n&&h.jsx("pre",{className:Pa.output,children:n})]})}),x0e="_progress_1j3ys_1",_0e="_spinner_1j3ys_12",k0e="_bar_1j3ys_19",S0e="_stage_1j3ys_25",T0e="_icon_1j3ys_29",C0e="_done_1j3ys_35",A0e="_error_1j3ys_43",E0e="_detail_1j3ys_51",M0e="_path_1j3ys_56",us={progress:x0e,spinner:_0e,bar:k0e,stage:S0e,icon:T0e,done:C0e,error:A0e,detail:E0e,path:M0e},LT=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function I0e({progress:e}){const{stage:t,progress:n,detail:r,isComplete:s,error:i}=e,[o,a]=g.useState(0),l=30,c=Math.round(n/100*l),u=l-c,d="█".repeat(Math.max(0,c))+"░".repeat(Math.max(0,u));return g.useEffect(()=>{if(s||i)return;const f=setInterval(()=>{a(m=>(m+1)%LT.length)},120);return()=>clearInterval(f)},[s,i]),i?h.jsxs("div",{className:`${us.progress} ${us.error}`,children:[h.jsx("span",{className:us.icon,children:"✕"}),h.jsx("span",{className:us.stage,children:t}),h.jsx("div",{className:us.detail,children:i})]}):s?h.jsxs("div",{className:`${us.progress} ${us.done}`,children:[h.jsx("span",{className:us.icon,children:"✓"}),h.jsx("span",{className:us.stage,children:t})]}):h.jsxs("div",{className:us.progress,children:[h.jsx("span",{className:us.spinner,children:LT[o]}),h.jsx("span",{className:us.bar,children:d}),h.jsxs("span",{className:us.stage,children:[t,r?` (${r})`:""]})]})}function N0e({path:e}){const{t}=ht();return h.jsxs("div",{className:`${us.progress} ${us.done}`,children:[h.jsx("span",{className:us.icon,children:"✓"}),h.jsx("span",{className:us.stage,children:t("insight.ready")}),h.jsx("span",{className:us.path,children:e})]})}const R0e=g.memo(function({message:t,pendingApproval:n,onShowContextDetail:r,workspaceCwd:s,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:c=!1,showAssistantBranch:u=!1,shellOutputMaxLines:d}){const f=(()=>{switch(t.role){case"user":return h.jsx(Yoe,{content:t.content,images:t.images});case"assistant":return h.jsx(mae,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:u});case"thinking":return h.jsx(bae,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp});case"tool_group":return h.jsx(Qfe,{tools:t.tools,pendingApproval:n,workspaceCwd:s,shellOutputMaxLines:d});case"plan":return h.jsx(s0e,{id:t.id,todos:t.todos});case"system":return h.jsx(vde,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:r,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return h.jsx(w0e,{command:t.command,output:t.output});case"btw":return h.jsx(TD,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return h.jsx(I0e,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return h.jsx(N0e,{path:t.path});case"insight_error":return h.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(f===null)return null;const m=h.jsx(YN,{label:`message:${t.role}`,resetKeys:[t],fallback:h.jsx(L0e,{align:t.role==="user"?"end":"start"}),children:f}),p=h.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:m});return t.role==="assistant"?c?p:h.jsx(Ww,{timestamp:t.timestamp,children:p}):t.role==="system"&&t.source==="prompt_cancelled"?p:h.jsx(Ww,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:"Copy",children:p})},j0e);function L0e({align:e}){const{t}=ht();return h.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:h.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function j0e(e,t){var n,r;return((n=e.pendingApproval)==null?void 0:n.id)!==((r=t.pendingApproval)==null?void 0:r.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.shellOutputMaxLines!==t.shellOutputMaxLines?!1:D0e(e.message,t.message)}function D0e(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&&P0e(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"&&O0e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>CD(n,t.tools[r]));default:return!1}}function O0e(e,t){return e.length===t.length&&e.every((n,r)=>{const s=t[r];return s&&n.id===s.id&&n.content===s.content&&n.status===s.status&&n.priority===s.priority})}function CD(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&&Ml(e.args)===Ml(t.args)&&Ml(e.rawOutput)===Ml(t.rawOutput)&&Ml(e.locations)===Ml(t.locations)&&Ml(e.content)===Ml(t.content)&&B0e(e.subTools,t.subTools):!1}function B0e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>CD(n,t[r]))}const jT=new WeakMap;function P0e(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>n.data===t[r].data&&n.mimeType===t[r].mimeType)}function Ml(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=jT.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return jT.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const $0e="_wrap_wsysp_1",z0e="_summary_wsysp_5",F0e="_summaryTextActive_wsysp_27",U0e="_summaryIcon_wsysp_33",q0e="_summaryStatus_wsysp_47",H0e="_summaryToolIcon_wsysp_54",V0e="_summaryText_wsysp_27",W0e="_summaryDot_wsysp_96",G0e="_chevronRight_wsysp_100",K0e="_chevronDown_wsysp_101",Y0e="_group_wsysp_127",X0e="_list_wsysp_156",Q0e="_row_wsysp_164",J0e="_rowStats_wsysp_178",Z0e="_rowDesc_wsysp_186",eme="_rowTool_wsysp_196",tme="_detail_wsysp_200",cs={wrap:$0e,summary:z0e,summaryTextActive:F0e,summaryIcon:U0e,summaryStatus:q0e,summaryToolIcon:H0e,summaryText:V0e,summaryDot:W0e,chevronRight:G0e,chevronDown:K0e,group:Y0e,list:X0e,row:Q0e,rowStats:J0e,rowDesc:Z0e,rowTool:eme,detail:tme};function nme(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function rme(e,t){const n=[],r=$m(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?nme(s.totalDurationMs):zm(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=r&&typeof r.tokenCount=="number"&&r.tokenCount>0?r.tokenCount:s&&typeof s.outputTokens=="number"&&s.outputTokens>0?s.outputTokens:0;o>0&&n.push(ck(o));const a=lk(e);return a&&n.push(js(a,80)),n.join(" · ")}function sme(){return h.jsx("svg",{className:cs.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:h.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 ime({agents:e,pendingApproval:t}){const{t:n}=ht(),[r,s]=g.useState(!1),[i,o]=g.useState(null),[a,l]=g.useState(()=>Date.now()),c=g.useRef(Date.now()),u=e.some(b=>b.status==="in_progress");g.useEffect(()=>{u&&(c.current=Date.now(),l(Date.now()))},[u]),g.useEffect(()=>{if(!u)return;const b=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(b)},[u]);const d=u?pD(a-c.current):"",f=e.filter(b=>b.status==="completed"||b.status==="failed").length,m=e.length,p=t!=null&&t.toolCallId?e.find(b=>dl(b,t.toolCallId)):void 0,y=r||!!p,w=e.some(b=>J0(b)==="failed")?"failed":u?"in_progress":"completed";return h.jsxs("div",{className:cs.wrap,children:[h.jsxs("button",{type:"button",className:cs.summary,onClick:()=>s(b=>!b),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[w==="failed"?h.jsx("span",{className:cs.summaryStatus,children:h.jsx(Ou,{status:w})}):h.jsx("span",{className:cs.summaryIcon,"aria-hidden":"true",children:h.jsx(sme,{})}),h.jsxs("span",{className:u?`${cs.summaryText} ${cs.summaryTextActive}`:cs.summaryText,children:[n("parallelAgents.title"),d&&h.jsxs(h.Fragment,{children:[" ",d]}),h.jsx("span",{className:cs.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:m})]}),h.jsx("span",{className:y?cs.chevronDown:cs.chevronRight,"aria-hidden":"true"})]}),y&&h.jsx("div",{className:cs.group,children:h.jsx("div",{className:cs.list,children:e.map(b=>{const v=uk(b),x=dk(b),S=ole(b,n),C=rme(b,a),E=J0(b),M=i===b.callId;return h.jsxs("div",{children:[h.jsxs("div",{className:cs.row,onClick:()=>o(M?null:b.callId),children:[h.jsx(Ou,{status:E}),h.jsxs("span",{className:cs.rowDesc,children:[js(x||v,50),S&&h.jsx("span",{className:cs.rowTool,children:` (${S})`})]}),C&&h.jsx("span",{className:cs.rowStats,children:C})]}),M&&h.jsx("div",{className:cs.detail,children:h.jsx(hk,{tool:b,hideHeader:!0})})]},b.callId)})})})]})}const ome="_collapseRow_d7f01_1",ame="_collapseRowClickable_d7f01_14",lme="_collapseLabel_d7f01_19",cme="_processedLabel_d7f01_36",ume="_processedMeta_d7f01_43",dme="_hiddenMetrics_d7f01_47",hme="_summaryMetrics_d7f01_51",fme="_collapseIcon_d7f01_59",mme="_chevronRight_d7f01_72",pme="_chevronDown_d7f01_73",Ao={collapseRow:ome,collapseRowClickable:ame,collapseLabel:lme,processedLabel:cme,processedMeta:ume,hiddenMetrics:dme,summaryMetrics:hme,collapseIcon:fme,chevronRight:mme,chevronDown:pme},gme="_list_u6y17_1",yme="_loadingSkeleton_u6y17_33",bme="_srOnly_u6y17_41",vme="_loadingSkeletonUserRow_u6y17_53",wme="_loadingSkeletonAssistantRow_u6y17_59",xme="_loadingSkeletonUserBubble_u6y17_65",_me="_loadingSkeletonUserBubbleCompact_u6y17_66",kme="_loadingSkeletonAssistantBlock_u6y17_80",Sme="_loadingSkeletonLineWide_u6y17_88",Tme="_loadingSkeletonLineMedium_u6y17_89",Cme="_loadingSkeletonLineShort_u6y17_90",Ame="_loadingSkeletonLineNarrow_u6y17_91",Eme="_rowFlash_u6y17_131",Mme="_turnStatusRow_u6y17_136",Ime="_turnAnswerRow_u6y17_137",Nme="_turnContentRow_u6y17_145",Rme="_turnContentClip_u6y17_149",Lme="_turnContentCollapsed_u6y17_157",jme="_turnContentInner_u6y17_161",Dme="_sessionTimelineLayer_u6y17_166",Ome="_sessionTimelinePanel_u6y17_179",Bme="_sessionTimelineList_u6y17_190",Pme="_sessionTimelineItem_u6y17_200",$me="_sessionTimelineButton_u6y17_205",zme="_sessionTimelineTick_u6y17_224",Fme="_sessionTimelineButtonInRange_u6y17_311",Ume="_sessionTimelineButtonCurrent_u6y17_315",qme="_sessionTimelineDetails_u6y17_326",vn={list:gme,loadingSkeleton:yme,srOnly:bme,loadingSkeletonUserRow:vme,loadingSkeletonAssistantRow:wme,loadingSkeletonUserBubble:xme,loadingSkeletonUserBubbleCompact:_me,loadingSkeletonAssistantBlock:kme,loadingSkeletonLineWide:Sme,loadingSkeletonLineMedium:Tme,loadingSkeletonLineShort:Cme,loadingSkeletonLineNarrow:Ame,rowFlash:Eme,turnStatusRow:Mme,turnAnswerRow:Ime,turnContentRow:Nme,turnContentClip:Rme,turnContentCollapsed:Lme,turnContentInner:jme,sessionTimelineLayer:Dme,sessionTimelinePanel:Ome,sessionTimelineList:Bme,sessionTimelineItem:Pme,sessionTimelineButton:$me,sessionTimelineTick:zme,sessionTimelineButtonInRange:Fme,sessionTimelineButtonCurrent:Ume,sessionTimelineDetails:qme};function Hme(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 Vme(e){return e[e.length-1]}function Wme(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&Qh(n))return n.id}return null}function DT(e){return e.role==="tool_group"&&e.tools.length===1&&Xy(e.tools[0])}function Y4(e){return e.role==="tool_group"&&e.tools.length===1&&VN(e.tools[0])}function OT(e){return e.role==="thinking"}function BT(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>dl(n,t.toolCallId)))}function PT(e){return e.role==="thinking"}function Gme(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||BT(s,t)){PT(s)||n.push(s),r++;continue}const i=[s];let o=r,a=r+1;for(;a<e.length;){const c=e[a];if(PT(c)){a++;continue}if(c.role==="tool_group"&&!BT(c,t)){i.push(c),o=a,a++;continue}break}if(i.length===1){n.push(s),r++;continue}const l=i.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),r=o+1}return n}function AD(e){const t=[];let n=0;for(;n<e.length;){if(Y4(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(Y4(i)){r.push(i),s++;continue}if(OT(i)){let o=s+1;for(;o<e.length&&OT(e[o]);)o++;if(o<e.length&&Y4(e[o])){s=o;continue}}break}if(r.length>=2){t.push({type:"parallel_agents",key:`par-${r[0].id}`,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp}),n=s;continue}}if(DT(e[n])){const r=n;for(;n<e.length&&DT(e[n]);)n++;if(n-r>=2){const s=e.slice(r,n);t.push({type:"parallel_agents",key:`par-${s[0].id}`,agents:s.map(i=>i.tools[0]),timestamp:s[0].timestamp})}else t.push({type:"message",key:e[r].id,message:e[r]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function $T(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 Kme(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function vk(e,t,n){let r=t;for(let s=n;s>t;s--)if(ED(e[s])){r=s;break}for(let s=n;s>r;s--)if(Kme(e[s]))return s;return-1}function Yme(e,t){const n=[];for(let s=0;s<e.length;s++){const i=e[s];i.type==="message"&&Qh(i.message)&&n.push(s)}const r=new Set;for(let s=0;s<n.length;s++){if(s===n.length-1&&t)continue;const i=n[s],o=(s+1<n.length?n[s+1]:e.length)-1,a=vk(e,i,o);if(a<0)continue;const l=e[a];l.type==="message"&&l.message.role==="assistant"&&r.add(l.message.id)}return r}function Gx(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=>Gx(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return wk(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 wk(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 Xme(e){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:"Parallel agents"};if(e.type!=="message")return{kind:"none"};const{message:t}=e;switch(t.role){case"thinking":return{kind:"thought",timestamp:t.timestamp,label:"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:t.timestamp}:Bu(t.content,1)?{kind:"commentary",timestamp:t.timestamp,label:"Assistant update"}:{kind:"none",timestamp:t.timestamp};case"tool_group":{const n=t.tools.length;return{kind:"tool",timestamp:t.timestamp,label:`${n} tool call${n===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:t.timestamp,label:"Plan update"};case"system":return wk(t)?{kind:"status",timestamp:t.timestamp,label:"Status update"}:{kind:"none",timestamp:t.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:t.timestamp};default:return{kind:"none"}}}function Bu(e,t,n={}){const s=(n.stripMarkdown===!0?Qme(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!s)return"";const i=Array.from(s);return i.length>t?`${i.slice(0,t-1).join("")}…`:s}function Qme(e){if(!e)return"";const t=[],n=s=>{const i=`\0${t.length}\0`;return t.push(s),i};let r=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(s,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(s,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");r=X4(r,"~~"),r=X4(r,"**"),r=X4(r,"__"),r=r.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[s,i]of t.entries())r=r.split(`\0${s}\0`).join(i);return r}function X4(e,t){let n="",r=0;for(;r<e.length;){const s=e.indexOf(t,r);if(s===-1)return n+e.slice(r);const i=s+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(r);const a=e.slice(i,o);n+=a.trim().length===0?e.slice(r,o+t.length):e.slice(r,s)+a,r=o+t.length}return n}function Jme(e){const t=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",n=Bu(t,32);return n||"User turn"}function Qh(e){return e.role==="user"||e.role==="user_shell"}function Zme(e){switch(e.role){case"thinking":return jD.thought;case"assistant":return Bu(e.content,120,{stripMarkdown:!0});case"tool_group":{const t=e.tools.length;return`${t} tool call${t===1?"":"s"}`}case"plan":return"plan update";case"system":return wk(e)?Bu(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 epe(e){if(e.type==="parallel_agents"){const t=e.agents.length;return`${t} parallel agent${t===1?"":"s"}`}return e.type!=="message"?"":Zme(e.message)}function tpe(e,t,n){if(t!==null)for(const i of e){if(i.type!=="message")continue;const{message:o}=i;if(o.id!==t||o.role!=="assistant")continue;const a=Bu(o.content,180,{stripMarkdown:!0});if(a)return a}const r=[];for(let i=0;i<e.length;i+=1){const o=e[i];if(o.type==="message"&&t!==null&&o.message.id===t)continue;const a=epe(o);a&&r.push(a)}const s=Bu(r.join(" · "),180);return s||(n.length>0?n.map(i=>jD[i]).join(" · "):"No activity")}function npe(e){const t=[];let n=null,r=[];const s=()=>{if(!n)return;const i=AD(r),o=vk(i,-1,i.length-1),a=o>=0?i[o]:null,l=(a==null?void 0:a.type)==="message"&&a.message.role==="assistant"&&!a.message.isStreaming&&Bu(a.message.content,1,{stripMarkdown:!0}).length>0?a.message.id:null,c=[];for(const u of i){if(u.type==="message"&&l!==null&&u.message.id===l)continue;const d=Xme(u);d.kind!=="none"&&!c.includes(d.kind)&&c.push(d.kind)}t.push({id:n.id,label:Jme(n),detail:tpe(i,l,c),timestamp:n.timestamp,nodeKinds:c})};for(const i of e){if(Qh(i)){s(),n=i,r=[];continue}n&&r.push(i)}return s(),t}function rpe(e){var n,r,s;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",((n=e.subTools)==null?void 0:n.length)??0,String(((r=e.args)==null?void 0:r.subagent_type)??""),((s=e.args)==null?void 0:s.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function spe(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(rpe).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 ED(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(ED):e.message.role==="tool_group"||e.message.role==="plan"}function zT(e){return e==="pending"||e==="running"||e==="in_progress"}function MD(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const r=MD(e.items[n]);if(r)return r}return null}if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){const n=e.agents.filter(r=>zT(r.status));return n.length===0?null:`agents:${e.key}:${n.map(r=>r.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>zT(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function ipe(e){for(let t=e.length-1;t>=0;t--){const n=MD(e[t]);if(n)return n}return null}function ope(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 ape(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 lpe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function ID(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+ID(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function ND(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const r=e[n];if(r.type==="message"&&Qh(r.message))return r.message.id}return null}function RD(e){const t=[];let n=null;for(const r of e)r.type==="message"&&Qh(r.message)&&(n=r.message.id),t.push(n);return t}function FT(e,t,n,r){const s=r===void 0?ND(e,t):r[t]??null;return s?n.get(s)??null:null}function cpe(e,t,n,r,s=RD(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const l of t){if(l<0||l>=e.length)continue;const c=FT(e,l,n,s);c!==null&&(i=Math.min(i,c),o=Math.max(o,c))}if(o<0)return null;const a=r==null?null:FT(e,r,n,s);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function upe(e,t,n,r){if(!r)return!1;for(let s=t;s<=n;s++){const i=e[s];if(i.type==="parallel_agents"){if(i.agents.some(o=>dl(o,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>dl(o,r)))return!0}return!1}function dpe(e,{overrides:t,isResponding:n,activeTurnStartedAt:r,pendingApprovalCallId:s,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"&&Qh(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],u=(l+1<o.length?o[l+1]:e.length)-1,d=e[c],f=d.message.id,m=d.message.timestamp,p=l===o.length-1&&n,y=upe(e,c,u,s),w=vk(e,c,u);let b=0,v,x,S=0,C=0,E=0,M=0,D=0,O=!1;for(let G=c+1;G<=u;G++){const B=e[G];Gx(B,G===w)&&b++,M+=ID(B),B.type==="message"&&B.message.role==="thinking"&&D++;const Q=ope(B);Q!==void 0&&(v=v===void 0?Q:Math.max(v,Q));const ce=ape(B);ce!==void 0&&(x=x===void 0?ce:Math.max(x,ce));const pe=lpe(B);pe&&(S+=pe.inputTokens,C+=pe.outputTokens,E+=pe.cachedTokens??0,O=!0)}const A=p?r??m??Date.now():void 0,j=v??x,I=m!==void 0&&j!==void 0&&j>=m?j-m:void 0;if(y||b===0&&!(O||I!==void 0||A!==void 0)){for(let G=c;G<=u;G++)a.push(e[G]);continue}const q=!(b===0?!0:t.has(f)?t.get(f):p);let R=0;const V=G=>{G.length!==0&&a.push({type:"turn_content",key:`${f}-content-${R++}`,turnId:f,collapsed:q,items:G})};a.push({type:"message",key:d.key,message:d.message});const J={turnId:f,collapsed:q,hiddenCount:b,...I!==void 0?{elapsedMs:I}:{},...O?{inputTokens:S,outputTokens:C}:{},...E>0?{cachedTokens:E}:{},...M>0?{toolCallCount:M}:{},...D>0?{thinkingCount:D}:{},...A!==void 0?{liveStartedAt:A}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:J}),!q){let G=[];for(let B=c+1;B<=u;B++){const k=e[B];B===w&&k.type==="message"&&k.message.role==="assistant"?(V(G),G=[],a.push({...k,turnCollapse:J})):G.push(k)}V(G);continue}const ee=[],N=[];for(let G=c+1;G<=u;G++){const B=e[G];if(!(G===w&&p)){if(G===w&&B.type==="message"&&B.message.role==="assistant"){N.push({...B,turnCollapse:J});continue}if(Gx(B,G===w)){ee.push(B);continue}N.push(B)}}V(ee),a.push(...N)}return a}function $g(e,t,n){for(let r=0;r<e.length;r++){const s=e[r];if(s.type==="message"){if(s.message.id===t||n&&s.message.role==="tool_group"&&s.message.tools.some(i=>dl(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>dl(i,n)))return r;if(s.type==="turn_content"&&$g(s.items,t,n)>=0)return r}}return-1}const Q4=0,hpe=120,J4=80,fpe=32,mpe=240,Z4=30,LD=200,ppe=4;function gpe(e,t=LD){return e>t}function ype(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t-n*60;return`${n}m ${r}s`}function ev(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function bpe(e){return e!==void 0?ype(e):""}function vpe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${ev(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${ev(e.inputTokens)}${r} ↓${ev(e.outputTokens)}`}function UT(e,t){const n=[],r=vpe(e,t);return r&&n.push(r),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" · ")}function wpe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const xpe=g.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=ht(),s=t.hiddenCount>0,i=t.liveStartedAt,o=s||i!==void 0||wpe(t),a=pk(i!==void 0&&o),l=g.useRef(0),c=g.useRef(i);c.current!==i&&(c.current=i,l.current=0);let u;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),u=l.current):o&&t.elapsedMs!==void 0?(l.current=0,u=t.elapsedMs):(l.current=0,u=void 0);const d=bpe(u),f=UT(t,r),m=UT(t,r),p=r(i!==void 0?"turn.processing":"turn.processed"),y=!!d&&o,w=!!f&&o,b=!!m&&o;if(!o)return null;const v=()=>{if(!s)return;const x=t.collapsed;n(t.turnId,x)};return h.jsxs("div",{className:s?`${Ao.collapseRow} ${Ao.collapseRowClickable}`:Ao.collapseRow,role:s?"button":void 0,tabIndex:s?0:void 0,"aria-expanded":s?!t.collapsed:void 0,"aria-label":s?t.collapsed?r("turn.expand"):r("turn.collapse"):void 0,title:s?t.collapsed?r("turn.expand"):r("turn.collapse"):void 0,onClick:s?v:void 0,onKeyDown:s?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),v())}:void 0,children:[h.jsxs("span",{className:Ao.collapseLabel,children:[h.jsxs("span",{className:Ao.processedLabel,children:[p,y&&h.jsxs("span",{className:Ao.processedMeta,children:[" ",d]})]}),b&&h.jsx("span",{className:Ao.summaryMetrics,children:m}),w&&h.jsx("span",{className:Ao.hiddenMetrics,children:f})]}),s&&h.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Ao.collapseIcon,onClick:x=>{x.stopPropagation(),v()},children:h.jsx("span",{className:t.collapsed?Ao.chevronRight:Ao.chevronDown,"aria-hidden":"true"})})]})});function qT(e){if(e.type==="turn_collapse")return vn.turnStatusRow;if(e.type==="turn_content")return vn.turnContentRow;if(e.type==="message"&&e.turnCollapse)return vn.turnAnswerRow}const _pe=g.memo(function({collapsed:t,children:n}){const r=xk(vn.turnContentClip,t?vn.turnContentCollapsed:void 0);return h.jsx("div",{className:r,"data-collapsed":t?"true":"false",children:h.jsx("div",{className:vn.turnContentInner,children:n})})}),jD={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},kpe=g.memo(function({entries:t,currentTurnId:n,currentRange:r,hidden:s,onSelect:i}){return s||t.length===0?null:h.jsx("div",{className:vn.sessionTimelineLayer,"aria-hidden":"false",children:h.jsx("nav",{className:vn.sessionTimelinePanel,"aria-label":"Session timeline","data-testid":"session-timeline",children:h.jsx("ol",{className:vn.sessionTimelineList,children:t.map((o,a)=>{const l=r!==null&&a>=r.startIndex&&a<=r.endIndex,c=r!==null?a===r.currentIndex:o.id===n,u=o.nodeKinds.join(","),d=[`Turn ${a+1}: ${o.label}`,c?"Current turn":null].filter(Boolean).join(". ");return h.jsx("li",{className:vn.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":o.id,"data-node-kinds":u,"data-in-current-range":l?"true":void 0,children:h.jsxs("button",{type:"button",className:xk(vn.sessionTimelineButton,l?vn.sessionTimelineButtonInRange:void 0,c?vn.sessionTimelineButtonCurrent:void 0),"aria-current":c?"step":void 0,"aria-label":d,onClick:()=>i(o.id),children:[h.jsx("span",{className:vn.sessionTimelineTick}),h.jsx("span",{className:vn.sessionTimelineDetails,"data-testid":"session-timeline-detail","data-title":o.label,"data-detail":o.detail,"aria-hidden":"true"})]})},o.id)})})})})});function xk(...e){return e.filter(Boolean).join(" ")||void 0}const Spe=[];function Tpe({label:e}){return h.jsxs(h.Fragment,{children:[h.jsx("div",{role:"status","aria-live":"polite",className:vn.srOnly,children:e}),h.jsxs("div",{className:vn.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[h.jsx("div",{className:vn.loadingSkeletonUserRow,children:h.jsxs("div",{className:vn.loadingSkeletonUserBubble,children:[h.jsx("span",{className:vn.loadingSkeletonLineWide}),h.jsx("span",{className:vn.loadingSkeletonLineShort})]})}),h.jsx("div",{className:vn.loadingSkeletonAssistantRow,children:h.jsxs("div",{className:vn.loadingSkeletonAssistantBlock,children:[h.jsx("span",{className:vn.loadingSkeletonLineMedium}),h.jsx("span",{className:vn.loadingSkeletonLineWide}),h.jsx("span",{className:vn.loadingSkeletonLineNarrow})]})}),h.jsx("div",{className:vn.loadingSkeletonUserRow,children:h.jsx("div",{className:vn.loadingSkeletonUserBubbleCompact,children:h.jsx("span",{className:vn.loadingSkeletonLineMedium})})}),h.jsx("div",{className:vn.loadingSkeletonAssistantRow,children:h.jsxs("div",{className:vn.loadingSkeletonAssistantBlock,children:[h.jsx("span",{className:vn.loadingSkeletonLineWide}),h.jsx("span",{className:vn.loadingSkeletonLineMedium})]})})]})]})}const Cpe=g.memo(g.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:r,loadingTranscript:s,catchingUp:i,isResponding:o=!1,activeTurnStartedAt:a,welcomeHeader:l,workspaceCwd:c,tailContent:u,tailKey:d="tail",virtualScrollThreshold:f=LD,shellOutputMaxLines:m,autoScrollTailIntoView:p=!1,hideSessionTimeline:y=!1,showRetryHint:w=!1,onRetryClick:b,onBranchSession:v,onCanScrollToBottomChange:x},S){var So;const{t:C}=ht(),E=g.useContext(Zh),M=g.useMemo(()=>E?Gme(t,n):t,[E,t,n]),D=g.useMemo(()=>AD(M),[M]),[O,A]=g.useState(!1),j=g.useRef(null),I=g.useMemo(()=>{var Be;if(!O)return Spe;const xe=spe(M);return((Be=j.current)==null?void 0:Be.signature)!==xe&&(j.current={signature:xe,entries:npe(M)}),j.current.entries},[O,M]),P=g.useMemo(()=>new Map(I.map((xe,Be)=>[xe.id,Be])),[I]),F=g.useMemo(()=>Wme(M),[M]),[q,R]=g.useState(null),V=q!==null?((So=I[q.currentIndex])==null?void 0:So.id)??F:F,J=g.useMemo(()=>{var xe;if(o)return null;for(let Be=M.length-1;Be>=0;Be-=1){const Dt=M[Be];if(Dt&&(Dt.role==="tool_group"||Dt.role==="plan"))return null;if((Dt==null?void 0:Dt.role)==="assistant"&&!Dt.isStreaming&&((xe=Dt.content)!=null&&xe.trim()))return Dt.id}return null},[o,M]),ee=g.useMemo(()=>Yme(D,o),[D,o]),{collapseCompletedTurns:N}=Lc(),G=N??!0,[B,k]=g.useState(()=>new Map),Q=g.useRef(!0),ce=g.useRef(0),pe=g.useRef(!1),be=g.useRef(0),ye=g.useRef(null),ie=g.useRef(null),re=g.useRef(!1),oe=g.useRef(null),ve=g.useRef(!1),qe=g.useRef(s),We=g.useRef(null),te=g.useRef(i),we=g.useRef(i),Se=g.useRef(!1),Ne=g.useRef(!1),Pt=g.useRef(void 0),at=g.useRef(void 0),vt=g.useRef(void 0);we.current=i;const Tt=g.useRef(null),rt=g.useCallback(()=>{const xe=Tt.current,Be=xe?xe.scrollHeight-xe.scrollTop-xe.clientHeight:0,Dt=!Q.current&&Be>1;ie.current!==Dt&&(ie.current=Dt,x==null||x(Dt))},[x]),tt=g.useCallback(()=>{vt.current!==void 0&&window.cancelAnimationFrame(vt.current),vt.current=window.requestAnimationFrame(rt)},[rt]),Qe=g.useCallback(xe=>{Q.current!==xe&&(Q.current=xe,tt())},[tt]),ne=g.useMemo(()=>dpe(D,{overrides:B,isResponding:o,activeTurnStartedAt:a,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:G}),[D,B,o,a,n==null?void 0:n.toolCallId,G]),se=g.useMemo(()=>RD(ne),[ne]),De=I.length>=ppe;g.useLayoutEffect(()=>{if(y){A(rn=>rn&&!1);return}const xe=Tt.current;if(!xe)return;const Be=()=>{const qt=xe.getBoundingClientRect().width>=1160;A(on=>on===qt?on:qt)};if(Be(),typeof ResizeObserver>"u")return;const Dt=new ResizeObserver(Be);return Dt.observe(xe),()=>Dt.disconnect()},[y]);const lt=u!=null,ae=!!s,ze=!!l,Je=ze?1:0,Nt=Je+ne.length,Ut=Nt+(lt?1:0),he=gpe(Ut,f),Y=g.useCallback(()=>Tt.current,[]),me=g.useCallback(()=>{const xe=Tt.current;if(!xe)return;const Be=xe.scrollHeight-xe.scrollTop-xe.clientHeight;Qe(Be<Z4),tt()},[tt,Qe]),le=g.useCallback(()=>{Ne.current=!0,Pt.current!==void 0&&window.cancelAnimationFrame(Pt.current),at.current!==void 0&&window.clearTimeout(at.current),Pt.current=window.requestAnimationFrame(me),at.current=window.setTimeout(()=>{Ne.current=!1,Pt.current=void 0,at.current=void 0,me()},220)},[me]);g.useEffect(()=>()=>{Pt.current!==void 0&&window.cancelAnimationFrame(Pt.current),at.current!==void 0&&window.clearTimeout(at.current),vt.current!==void 0&&window.cancelAnimationFrame(vt.current)},[]);const Ke=g.useCallback((xe,Be)=>{const Dt=Tt.current;(!Dt||Dt.scrollHeight>Dt.clientHeight+1)&&Qe(!1),le(),k(rn=>{const qt=new Map(rn);return qt.set(xe,Be),qt})},[le,Qe]),_t=g.useCallback(xe=>{const Be=xe.target;Be instanceof HTMLElement&&Be.closest("[aria-expanded]")&&(Qe(!1),le())},[le,Qe]),Et=g.useCallback(xe=>{if(ze&&xe===Q4)return"slot:header";if(lt&&xe===Nt)return`slot:tail:${d}`;const Be=ne[xe-Je];return Be?$T(Be):`slot:row:${xe}`},[ze,lt,Nt,d,ne,Je]),Ze=g.useCallback((xe="auto")=>{const Be=Y();if(!Be||Be.scrollHeight<=Be.clientHeight)return;be.current+=1;const Dt=be.current;pe.current=!0,xe==="smooth"?Be.scrollTo({top:Be.scrollHeight,behavior:xe}):Be.scrollTop=Be.scrollHeight,tt(),ce.current=Math.max(0,Be.scrollHeight-Be.clientHeight),rt();const rn=()=>{be.current===Dt&&(pe.current=!1)};xe==="smooth"?setTimeout(rn,350):requestAnimationFrame(rn)},[Y,rt,tt]),Kt=g.useCallback((xe="smooth")=>{Qe(!0),Ze(xe)},[Ze,Qe]),Wn=eW({count:Ut,enabled:he,getScrollElement:Y,getItemKey:Et,estimateSize:xe=>{if(ze&&xe===Q4)return hpe;if(lt&&xe===Nt)return mpe;const Be=ne[xe-Je];return(Be==null?void 0:Be.type)==="turn_collapse"?fpe:(Be==null?void 0:Be.type)==="turn_content"?Math.max(J4,Be.items.length*J4):J4},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),yn=Wn.getVirtualItems(),Sn=Wn.getTotalSize(),Ie=g.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});Ie.current={entryIndexById:P,headerOffset:Je,isVisible:O,turnIdByDisplayIndex:se,visibleItems:ne};const bt=g.useCallback(()=>{const xe=Y(),Be=Ie.current;if(!xe||!Be.isVisible||Be.entryIndexById.size===0){R(sn=>sn===null?sn:null);return}const Dt=xe.getBoundingClientRect(),rn=Dt.top,qt=Dt.bottom,on=rn+(qt-rn)/2,nr=[];let Kr=null,Yr=Number.POSITIVE_INFINITY;xe.querySelectorAll("[data-index]").forEach(sn=>{const mt=sn.dataset.index;if(mt===void 0)return;const Aa=Number(mt);if(!Number.isFinite(Aa))return;const br=Aa-Be.headerOffset;if(br<0||br>=Be.visibleItems.length)return;const or=sn.getBoundingClientRect();if(or.bottom<rn||or.top>qt)return;nr.push(br);const os=or.top+(or.bottom-or.top)/2,zo=Math.abs(os-on);zo<Yr&&(Yr=zo,Kr=br)});const fn=cpe(Be.visibleItems,nr,Be.entryIndexById,Kr,Be.turnIdByDisplayIndex);R(sn=>(sn==null?void 0:sn.startIndex)===(fn==null?void 0:fn.startIndex)&&(sn==null?void 0:sn.endIndex)===(fn==null?void 0:fn.endIndex)&&(sn==null?void 0:sn.currentIndex)===(fn==null?void 0:fn.currentIndex)?sn:fn)},[Y]),Qt=g.useCallback(()=>{ye.current!==null&&cancelAnimationFrame(ye.current),ye.current=requestAnimationFrame(()=>{ye.current=null,bt()})},[bt]);g.useEffect(()=>()=>{ye.current!==null&&(cancelAnimationFrame(ye.current),ye.current=null)},[]),g.useEffect(()=>{Qt()},[Qt,Ut,Sn,he,yn.length,O]);const[Wr,ni]=g.useState(null);g.useEffect(()=>{if(!Wr)return;const xe=setTimeout(()=>ni(null),1600);return()=>clearTimeout(xe)},[Wr]);const Gi=g.useCallback(xe=>{var rn,qt;Qe(!1),be.current+=1;const Be=be.current;pe.current=!0,he?Wn.scrollToIndex(xe,{align:"center"}):(qt=(rn=Tt.current)==null?void 0:rn.querySelector(`[data-index="${xe}"]`))==null||qt.scrollIntoView({block:"center"}),setTimeout(()=>{be.current===Be&&(pe.current=!1,Qt(),tt())},150);const Dt=Et(xe);ni(null),requestAnimationFrame(()=>ni(Dt))},[he,Wn,Et,Qe,Qt,tt]),Po=g.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Po.current={visibleItems:ne,displayItems:D,headerOffset:Je,performScrollToRow:Gi};const Gn=g.useRef(null),kr=g.useCallback((xe,Be)=>{const{visibleItems:Dt,displayItems:rn,headerOffset:qt,performScrollToRow:on}=Po.current,nr=$g(Dt,xe,Be);if(nr>=0){const fn=Dt[nr];return(fn==null?void 0:fn.type)==="turn_content"&&fn.collapsed?(Gn.current={messageId:xe,callId:Be},k(sn=>{if(sn.get(fn.turnId)===!0)return sn;const mt=new Map(sn);return mt.set(fn.turnId,!0),mt}),!0):(Gn.current=null,on(nr+qt),!0)}const Kr=$g(rn,xe,Be);if(Kr<0)return!1;const Yr=ND(rn,Kr);return Yr?(Gn.current={messageId:xe,callId:Be},k(fn=>{if(fn.get(Yr)===!0)return fn;const sn=new Map(fn);return sn.set(Yr,!0),sn}),!0):!1},[]);g.useImperativeHandle(S,()=>({scrollToMessage:kr,scrollToBottom:Kt}),[kr,Kt]),g.useEffect(()=>{const xe=Gn.current;if(!xe)return;const Be=$g(ne,xe.messageId,xe.callId);Be<0||(Gn.current=null,Gi(Be+Je))},[ne,Je,Gi]);const Gr=g.useCallback(()=>{const xe=Y();if(!xe)return;if(pe.current){ce.current=xe.scrollTop;return}Qt();const Be=ce.current,Dt=xe.scrollTop;ce.current=Dt;const rn=xe.scrollHeight-Dt-xe.clientHeight;if(tt(),Dt<Be-1){Qe(rn<Z4);return}rn<Z4&&Qe(!0)},[Y,tt,Qt,Qe]);g.useEffect(()=>{const xe=Y();if(xe)return xe.addEventListener("scroll",Gr,{passive:!0}),()=>xe.removeEventListener("scroll",Gr)},[Y,Gr]),g.useEffect(()=>{const xe=Y();if(!xe||typeof ResizeObserver>"u")return;const Be=new ResizeObserver(tt);Be.observe(xe);for(const rn of Array.from(xe.children))Be.observe(rn);const Dt=new MutationObserver(rn=>{for(const qt of rn){for(const on of Array.from(qt.addedNodes))on instanceof HTMLElement&&Be.observe(on);for(const on of Array.from(qt.removedNodes))on instanceof HTMLElement&&Be.unobserve(on)}tt()});return Dt.observe(xe,{childList:!0}),tt(),()=>{Be.disconnect(),Dt.disconnect()}},[Y,tt]),g.useEffect(()=>{t.length===0&&(Qe(!0),Gn.current=null,k(xe=>xe.size?new Map:xe))},[t.length,Qe]),g.useEffect(()=>{const xe=Tt.current;if(!xe)return;const Be=new ResizeObserver(()=>{Qt(),!we.current&&Q.current&&requestAnimationFrame(()=>{!we.current&&Q.current&&Ze()})});return Be.observe(xe),()=>Be.disconnect()},[Ze,Qt]),g.useLayoutEffect(()=>{const xe=Hme(t);if(i||s||qe.current){oe.current=xe,re.current=!0,ve.current=!1,qe.current=s;return}if(qe.current=s,!re.current){oe.current=xe,re.current=!0,ve.current=!1;return}const Be=Vme(t);xe&&(Be==null?void 0:Be.role)==="user"&&xe!==oe.current?(Qe(!0),Gn.current=null,ve.current=!0):ve.current=!1,oe.current=xe},[t,i,s,Qe]),g.useLayoutEffect(()=>{te.current&&!i&&(Qe(!0),Ze("auto")),te.current=i},[i,Ze,Qe]);const An=g.useMemo(()=>ipe(ne),[ne]);g.useLayoutEffect(()=>{if(!i){if(!An){We.current=null;return}An!==We.current&&(We.current=An,Q.current&&requestAnimationFrame(()=>{Q.current&&Ze()}))}},[i,An,Ze]),g.useEffect(()=>{p&&lt&&!Se.current&&(Qe(!0),requestAnimationFrame(()=>{Q.current&&Ze()})),Se.current=lt},[p,lt,Ze,Qe]);const $o=g.useCallback(xe=>{const Be=(qt,on)=>qt.type==="parallel_agents"?h.jsx(Ww,{timestamp:qt.timestamp,children:h.jsx(ime,{agents:qt.agents,pendingApproval:n})}):qt.type==="turn_collapse"?h.jsx(xpe,{turnCollapse:qt.turnCollapse,onToggleCollapse:Ke}):qt.type==="turn_content"?h.jsx(_pe,{collapsed:qt.collapsed,children:qt.items.map(nr=>h.jsx("div",{className:qT(nr),children:Be(nr,!1)},$T(nr)))}):h.jsx(R0e,{message:qt.message,pendingApproval:n,onShowContextDetail:r,workspaceCwd:c,isLatest:on,showRetryHint:w,onRetryClick:b,onBranchSession:v,showAssistantActions:qt.message.role==="assistant"&&ee.has(qt.message.id),showAssistantBranch:qt.message.role==="assistant"&&qt.message.id===J,shellOutputMaxLines:m});if(ze&&xe===Q4)return l;if(lt&&xe===Nt)return u;const Dt=xe-Je,rn=ne[Dt];return rn?Be(rn,Dt===ne.length-1):null},[ze,l,lt,u,Nt,n,r,Je,ne,ee,J,c,w,b,v,m,Ke]),Cs=g.useCallback((xe,Be)=>xk(Wr===xe?vn.rowFlash:void 0,Be?qT(Be):void 0),[Wr]);return g.useLayoutEffect(()=>{if(i)return;const xe=ve.current;pe.current&&!xe||Ne.current&&!xe||(Q.current||xe)&&(Ze(xe?"smooth":"auto"),ve.current=!1)},[Sn,t,Ut,i,Ze]),g.useLayoutEffect(()=>{tt()},[t,tt,Ut,Sn]),h.jsxs("div",{ref:Tt,className:vn.list,onClickCapture:_t,children:[ae&&h.jsx(Tpe,{label:C("editor.sessionLoading")}),h.jsx(kpe,{entries:I,currentTurnId:V,currentRange:q,hidden:!O||!De,onSelect:kr}),he?h.jsx("div",{style:{height:Sn,width:"100%",position:"relative"},children:yn.map(xe=>h.jsx("div",{"data-index":xe.index,ref:Wn.measureElement,className:Cs(String(xe.key),ne[xe.index-Je]),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${xe.start}px)`},children:$o(xe.index)},xe.key))}):Array.from({length:Ut},(xe,Be)=>{const Dt=Et(Be),rn=ne[Be-Je];return h.jsx("div",{"data-index":Be,className:Cs(Dt,rn),children:$o(Be)},Dt)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function Ape(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 Epe(e){const t=new Set,n=[];for(const r of(e==null?void 0:e.providers)??[])for(const s of r.models??[]){const i=s.baseModelId;!i||s.isRuntime||!Ape(i)||t.has(i)||(t.add(i),n.push({id:i,...s.name?{label:s.name}:{},...r.authType?{authType:r.authType}:{},...s.baseUrl?{baseUrl:s.baseUrl}:{},...typeof s.contextLimit=="number"?{contextWindow:s.contextLimit}:{},modalities:{audio:!0}}))}return n}let Kx=[],DD=[];(()=>{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?DD:Kx).push(n=n+e[t])})();function Mpe(e){if(e<768)return!1;for(let t=0,n=Kx.length;;){let r=t+n>>1;if(e<Kx[r])n=r;else if(e>=DD[r])t=r+1;else return!0;if(t==n)return!1}}function HT(e){return e>=127462&&e<=127487}const VT=8205;function Ipe(e,t,n=!0,r=!0){return(n?OD:Npe)(e,t,r)}function OD(e,t,n){if(t==e.length)return t;t&&BD(e.charCodeAt(t))&&PD(e.charCodeAt(t-1))&&t--;let r=tv(e,t);for(t+=WT(r);t<e.length;){let s=tv(e,t);if(r==VT||s==VT||n&&Mpe(s))t+=WT(s),r=s;else if(HT(s)){let i=0,o=t-2;for(;o>=0&&HT(tv(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function Npe(e,t,n){for(;t>0;){let r=OD(e,t-2,n);if(r<t)return r;t--}return 0}function tv(e,t){let n=e.charCodeAt(t);if(!PD(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return BD(r)?(n-55296<<10)+(r-56320)+65536:n}function BD(e){return e>=56320&&e<57344}function PD(e){return e>=55296&&e<56320}function WT(e){return e<65536?1:2}class Cn{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=kh(this,t,n);let s=[];return this.decompose(0,t,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),ia.from(s,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=kh(this,t,n);let r=[];return this.decompose(t,n,r,0),ia.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),s=new _0(this),i=new _0(t);for(let o=n,a=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(t=1){return new _0(this,t)}iterRange(t,n=this.length){return new $D(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(t).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new zD(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Cn.empty:t.length<=32?new Ir(t):ia.from(Ir.split(t,[]))}}class Ir extends Cn{constructor(t,n=Rpe(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((n?r:a)>=t)return new Lpe(s,a,r,o);s=a+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new Ir(GT(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),a=zg(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new Ir(a,o.length+i.length));else{let l=a.length>>1;r.push(new Ir(a.slice(0,l)),new Ir(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof Ir))return super.replace(t,n,r);[t,n]=kh(this,t,n);let s=zg(this.text,zg(r.text,GT(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new Ir(s,i):ia.from(Ir.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=kh(this,t,n);let s="";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&&(s+=r),t<l&&n>i&&(s+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return s}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],s=-1;for(let i of t)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Ir(r,s)),r=[],s=-1);return s>-1&&n.push(new Ir(r,s)),n}}class ia extends Cn{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=r+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,r,s);s=a+1,r=l+1}}decompose(t,n,r,s){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=s&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?r.push(a):a.decompose(t-o,n-o,r,c)}o=l+1}}replace(t,n,r){if([t,n]=kh(this,t,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(t>=i&&n<=a){let l=o.replace(t-i,n-i,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new ia(u,this.length-(n-t)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
`){[t,n]=kh(this,t,n);let s="";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&&(s+=r),t<l&&n>o&&(s+=a.sliceString(t-o,n-o,r)),o=l+1}return s}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof ia))return 0;let r=0,[s,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==a)return r;let l=this.children[s],c=t.children[i];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(t,n=t.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let m of t)r+=m.lines;if(r<32){let m=[];for(let p of t)p.flatten(m);return new Ir(m,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,c=-1,u=[];function d(m){let p;if(m.lines>i&&m instanceof ia)for(let y of m.children)d(y);else m.lines>o&&(l>o||!l)?(f(),a.push(m)):m instanceof Ir&&l&&(p=u[u.length-1])instanceof Ir&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new Ir(p.text.concat(m.text),p.length+1+m.length)):(l+m.lines>s&&f(),l+=m.lines,c+=m.length+1,u.push(m))}function f(){l!=0&&(a.push(u.length==1?u[0]:ia.from(u,c)),c=-1,l=u.length=0)}for(let m of t)d(m);return f(),a.length==1?a[0]:new ia(a,n)}}Cn.empty=new Ir([""],0);function Rpe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function zg(e,t,n=0,r=1e9){for(let s=0,i=0,o=!0;i<e.length&&s<=r;i++){let a=e[i],l=s+a.length;l>=n&&(l>r&&(a=a.slice(0,r-s)),s<n&&(a=a.slice(n-s)),o?(t[t.length-1]+=a,o=!1):t.push(a)),s=l+1}return t}function GT(e,t,n){return zg(e,[""],t,n)}class _0{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 Ir?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],o=i>>1,a=s instanceof Ir?s.text.length:s.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(s instanceof Ir){let l=s.text[o+(n<0?-1:0)];if(this.offsets[r]+=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=s.children[o+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof Ir?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 $D{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new _0(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class zD{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:s}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Cn.prototype[Symbol.iterator]=function(){return this.iter()},_0.prototype[Symbol.iterator]=$D.prototype[Symbol.iterator]=zD.prototype[Symbol.iterator]=function(){return this});class Lpe{constructor(t,n,r,s){this.from=t,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function kh(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Ds(e,t,n=!0,r=!0){return Ipe(e,t,n,r)}function jpe(e){return e>=56320&&e<57344}function Dpe(e){return e>=55296&&e<56320}function Dl(e,t){let n=e.charCodeAt(t);if(!Dpe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return jpe(r)?(n-55296<<10)+(r-56320)+65536:n}function Ope(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function _d(e){return e<65536?1:2}const Yx=/\r\n?|\n/;var Li=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Li||(Li={}));class ya{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];t+=r<0?this.sections[n]:r}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(t,n=!1){Xx(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?t.push(r,s):t.push(s,r)}return new ya(t)}composeDesc(t){return this.empty?t:t.empty?this:FD(this,t)}mapDesc(t,n=!1){return t.empty?this:Qx(this,t,n)}mapPos(t,n=-1,r=Li.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>t)return i+(t-s);i+=a}else{if(r!=Li.Simple&&c>=t&&(r==Li.TrackDel&&s<t&&c>t||r==Li.TrackBefore&&s<t||r==Li.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==s||n<0?i:i+l;i+=l}s=c}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return i}touchesRange(t,n=t){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],a=s+i;if(o>=0&&s<=n&&a>=t)return s<t&&a>n?"cover":!0;s=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];t+=(t?" ":"")+r+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ya(t)}static create(t){return new ya(t)}}class es extends ya{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 Xx(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return Qx(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],a=n[s+1];if(a>=0){n[s]=a,n[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(Cn.empty);r.push(o?t.slice(i,i+o):Cn.empty)}i+=o}return new es(n,r)}compose(t){return this.empty?t:t.empty?this:FD(this,t,!0)}map(t,n=!1){return t.empty?this:Qx(this,t,n,!0)}iterChanges(t,n=!1){Xx(this,t,n)}get desc(){return ya.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new tm(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 u=Math.min(i.len,l-a);Is(s,u,-1);let d=i.ins==-1?-1:i.off==0?i.ins:0;Is(n,u,d),d>0&&Zl(r,n,i.text),i.forward(u),a+=u}let c=t[o++];for(;a<c;){if(i.done)break e;let u=Math.min(i.len,c-a);Is(n,u,-1),Is(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new es(n,r),filtered:ya.create(s)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?t.push(r):s==0?t.push([r]):t.push([r].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,r){let s=[],i=[],o=0,a=null;function l(u=!1){if(!u&&!s.length)return;o<n&&Is(s,n-o,-1);let d=new es(s,i);a=a?a.compose(d.map(a)):d,s=[],i=[],o=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof es){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:d,to:f=d,insert:m}=u;if(d>f||d<0||f>n)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${n})`);let p=m?typeof m=="string"?Cn.of(m.split(r||Yx)):m:Cn.empty,y=p.length;if(d==f&&y==0)return;d<o&&l(),d>o&&Is(s,d-o,-1),Is(s,f-d,y),Zl(i,s,p),o=f}}return c(t),l(!a),a}static empty(t){return new es(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(Cn.empty);r[s]=Cn.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new es(n,r)}static createSet(t,n){return new es(t,n)}}function Is(e,t,n,r=!1){if(t==0&&n<=0)return;let s=e.length-2;s>=0&&n<=0&&n==e[s+1]?e[s]+=t:s>=0&&t==0&&e[s]==0?e[s+1]+=n:r?(e[s]+=t,e[s+1]+=n):e.push(t,n)}function Zl(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(Cn.empty);e.push(n)}}function Xx(e,t,n){let r=e.inserted;for(let s=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)s+=a,i+=a;else{let c=s,u=i,d=Cn.empty;for(;c+=a,u+=l,l&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(s,c,i,u,d),s=c,i=u}}}function Qx(e,t,n,r=!1){let s=[],i=r?[]:null,o=new tm(e),a=new tm(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);Is(s,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(Is(s,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Is(s,0,o.ins),i&&Zl(i,s,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Is(s,c,l<o.i?o.ins:0),i&&l<o.i&&Zl(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?es.createSet(s,i):ya.create(s);throw new Error("Mismatched change set lengths")}}}function FD(e,t,n=!1){let r=[],s=n?[]:null,i=new tm(e),o=new tm(t);for(let a=!1;;){if(i.done&&o.done)return s?es.createSet(r,s):ya.create(r);if(i.ins==0)Is(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)Is(r,0,o.ins,a),s&&Zl(s,r,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=r.length;if(i.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Is(r,l,u,a),s&&u&&Zl(s,r,o.text)}else o.ins==-1?(Is(r,i.off?0:i.len,l,a),s&&Zl(s,r,i.textBit(l))):(Is(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&Zl(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),i.forward2(l),o.forward(l)}}}}class tm{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?Cn.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Cn.empty:n[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class gu{constructor(t,n,r){this.from=t,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let r,s;return this.empty?r=s=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new gu(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Oe.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Oe.range(this.anchor,s,void 0,void 0,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Oe.range(t.anchor,t.head)}static create(t,n,r){return new gu(t,n,r)}}class Oe{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Oe.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(t.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Oe([this.main],0)}addRange(t,n=!0){return Oe.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,Oe.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Oe(t.ranges.map(n=>gu.fromJSON(n)),t.main)}static single(t,n=t){return new Oe([Oe.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<t.length;s++){let i=t[s];if(i.empty?i.from<=r:i.from<r)return Oe.normalized(t.slice(),n);r=i.to}return new Oe(t,n)}static cursor(t,n=0,r,s){return gu.create(t,t,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(t,n,r,s,i){let o=(r??16777215)<<6|(s==null?7:Math.min(6,s));return!i&&t!=n&&(i=n<t?1:-1),n<t?gu.create(n,t,48|o):gu.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let r=t[n];t.sort((s,i)=>s.from-i.from),n=t.indexOf(r);for(let s=1;s<t.length;s++){let i=t[s],o=t[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=n&&n--,t.splice(--s,2,i.anchor>i.head?Oe.range(l,a):Oe.range(a,l))}}return new Oe(t,n)}}function UD(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let _k=0;class Lt{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=_k++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new Lt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:kk),!!t.static,t.enables)}of(t){return new Fg([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fg(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fg(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function kk(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class Fg{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=_k++}dynamicSlot(t){var n;let r=this.value,s=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=t[d.id])!==null&&n!==void 0?n:1)&1||u.push(t[d.id]);return{create(d){return d.values[o]=r(d),1},update(d,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Jx(d,u)){let m=r(d);if(a?!KT(m,d.values[o],s):!s(m,d.values[o]))return d.values[o]=m,1}return 0},reconfigure:(d,f)=>{let m,p=f.config.address[i];if(p!=null){let y=ry(f,p);if(this.dependencies.every(w=>w instanceof Lt?f.facet(w)===d.facet(w):w instanceof Ta?f.field(w,!1)==d.field(w,!1):!0)||(a?KT(m=r(d),y,s):s(m=r(d),y)))return d.values[o]=y,0}else m=r(d);return d.values[o]=m,1}}}}function KT(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Jx(e,t){let n=!1;for(let r of t)k0(e,r)&1&&(n=!0);return n}function Bpe(e,t,n){let r=n.map(l=>e[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let d=ry(l,r[u]);if(s[u]==2)for(let f of d)c.push(f);else c.push(d)}return t.combine(c)}return{create(l){for(let c of r)k0(l,c);return l.values[o]=a(l),1},update(l,c){if(!Jx(l,i))return 0;let u=a(l);return t.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Jx(l,r),d=c.config.facets[t.id],f=c.facet(t);if(d&&!u&&kk(n,d))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 Hp=Lt.define({static:!0});class Ta{constructor(t,n,r,s,i){this.id=t,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(t){let n=new Ta(_k++,t.create,t.update,t.compare||((r,s)=>r===s),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(Hp).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet(Hp),o=s.facet(Hp),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,Hp.of({field:this,create:t})]}get extension(){return this}}const uu={lowest:4,low:3,default:2,high:1,highest:0};function Af(e){return t=>new qD(t,e)}const Zu={highest:Af(uu.highest),high:Af(uu.high),default:Af(uu.default),low:Af(uu.low),lowest:Af(uu.lowest)};class qD{constructor(t,n){this.inner=t,this.prec=n}}class ed{of(t){return new Zx(this,t)}reconfigure(t){return ed.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Zx{constructor(t,n){this.compartment=t,this.inner=n}}class ny{constructor(t,n,r,s,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,r){let s=[],i=Object.create(null),o=new Map;for(let f of Ppe(t,n,o))f instanceof Ta?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of s)a[f.id]=c.length<<1,c.push(m=>f.slot(m));let u=r==null?void 0:r.config.facets;for(let f in i){let m=i[f],p=m[0].facet,y=u&&u[f]||[];if(m.every(w=>w.type==0))if(a[p.id]=l.length<<1|1,kk(y,m))l.push(r.facet(p));else{let w=p.combine(m.map(b=>b.value));l.push(r&&p.compare(w,r.facet(p))?r.facet(p):w)}else{for(let w of m)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(b=>w.dynamicSlot(b)));a[p.id]=c.length<<1,c.push(w=>Bpe(w,p,m))}}let d=c.map(f=>f(a));return new ny(t,o,d,a,l,i)}}function Ppe(e,t,n){let r=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof Zx&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof Zx){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 qD)i(o.inner,o.prec);else if(o instanceof Ta)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof Fg)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,uu.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,uu.default),r.reduce((o,a)=>o.concat(a))}function k0(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let s=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|s}function ry(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const HD=Lt.define(),e3=Lt.define({combine:e=>e.some(t=>t),static:!0}),VD=Lt.define({combine:e=>e.length?e[0]:void 0,static:!0}),WD=Lt.define(),GD=Lt.define(),KD=Lt.define(),YD=Lt.define({combine:e=>e.length?e[0]:!1});class wl{constructor(t,n){this.type=t,this.value=n}static define(){return new $pe}}class $pe{of(t){return new wl(this,t)}}class zpe{constructor(t){this.map=t}of(t){return new Hn(this,t)}}class Hn{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 Hn(this.type,n)}is(t){return this.type==t}static define(t={}){return new zpe(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let s of t){let i=s.map(n);i&&r.push(i)}return r}}Hn.reconfigure=Hn.define();Hn.appendConfig=Hn.define();class ns{constructor(t,n,r,s,i,o){this.startState=t,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&UD(r,n.newLength),i.some(a=>a.type==ns.time)||(this.annotations=i.concat(ns.time.of(Date.now())))}static create(t,n,r,s,i,o){return new ns(t,n,r,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(ns.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}ns.time=wl.define();ns.userEvent=wl.define();ns.addToHistory=wl.define();ns.remote=wl.define();function Fpe(e,t){let n=[];for(let r=0,s=0;;){let i,o;if(r<e.length&&(s==t.length||t[s]>=e[r]))i=e[r++],o=e[r++];else if(s<t.length)i=t[s++],o=t[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function XD(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=es.empty(t.changes.length),o=e.changes.compose(t.changes)):(s=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(i):(r=e.selection)===null||r===void 0?void 0:r.map(s),effects:Hn.mapEffects(e.effects,s).concat(Hn.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function t3(e,t,n){let r=t.selection,s=Zd(t.annotations);return t.userEvent&&(s=s.concat(ns.userEvent.of(t.userEvent))),{changes:t.changes instanceof es?t.changes:es.of(t.changes||[],n,e.facet(VD)),selection:r&&(r instanceof Oe?r:Oe.single(r.anchor,r.head)),effects:Zd(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function QD(e,t,n){let r=t3(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;r=XD(r,t3(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=ns.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return qpe(n?Upe(s):s)}function Upe(e){let t=e.startState,n=!0;for(let s of t.facet(WD)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:Fpe(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=es.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=ns.create(t,s,e.selection&&e.selection.map(i),Hn.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(GD);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof ns?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof ns?e=i[0]:e=QD(t,Zd(i),!1)}return e}function qpe(e){let t=e.startState,n=t.facet(KD),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=XD(r,t3(t,i,e.changes.newLength),!0))}return r==e?e:ns.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const Hpe=[];function Zd(e){return e==null?Hpe:Array.isArray(e)?e:[e]}var Qa=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Qa||(Qa={}));const Vpe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let n3;try{n3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Wpe(e){if(n3)return n3.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Vpe.test(n)))return!0}return!1}function Gpe(e){return t=>{if(!/\S/.test(t))return Qa.Space;if(Wpe(t))return Qa.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Qa.Word;return Qa.Other}}class Bn{constructor(t,n,r,s,i,o){this.config=t,this.doc=n,this.selection=r,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)k0(this,a<<1);this.computeSlot=null}field(t,n=!0){let r=this.config.address[t.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return k0(this,r),ry(this,r)}update(...t){return QD(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let a of t.effects)a.is(ed.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,c)=>s.set(c,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(Hn.reconfigure)?(n=null,r=a.value):a.is(Hn.appendConfig)&&(n=null,r=Zd(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=ny.resolve(r,s,this),i=new Bn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet(e3)?t.newSelection:t.newSelection.asSingle();new Bn(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:Oe.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=Zd(r.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),u=c.map(s);for(let f=0;f<a;f++)i[f]=i[f].map(u);let d=s.mapDesc(c,!0);i.push(l.range.map(d)),s=s.compose(u),o=Hn.mapEffects(o,u).concat(Hn.mapEffects(Zd(l.effects),d))}return{changes:s,selection:Oe.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof es?t:es.of(t,this.doc.length,this.facet(Bn.lineSeparator))}toText(t){return Cn.of(t.split(this.facet(Bn.lineSeparator)||Yx))}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:(k0(this,n),ry(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let r in t){let s=t[r];s instanceof Ta&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(t[r]),this))}return n}static fromJSON(t,n={},r){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(t,i)){let o=r[i],a=t[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Bn.create({doc:t.doc,selection:Oe.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=ny.resolve(t.extensions||[],new Map),r=t.doc instanceof Cn?t.doc:Cn.of((t.doc||"").split(n.staticFacet(Bn.lineSeparator)||Yx)),s=t.selection?t.selection instanceof Oe?t.selection:Oe.single(t.selection.anchor,t.selection.head):Oe.single(0);return UD(s,r.length),n.staticFacet(e3)||(s=s.asSingle()),new Bn(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(Bn.tabSize)}get lineBreak(){return this.facet(Bn.lineSeparator)||`
`}get readOnly(){return this.facet(YD)}phrase(t,...n){for(let r of this.facet(Bn.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),t}languageDataAt(t,n,r=-1){let s=[];for(let i of this.facet(HD))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return Gpe(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:s}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-r,a=t-r;for(;o>0;){let l=Ds(n,o,!1);if(i(n.slice(l,o))!=Qa.Word)break;o=l}for(;a<s;){let l=Ds(n,a);if(i(n.slice(a,l))!=Qa.Word)break;a=l}return o==a?null:Oe.range(o+r,a+r)}}Bn.allowMultipleSelections=e3;Bn.tabSize=Lt.define({combine:e=>e.length?e[0]:4});Bn.lineSeparator=VD;Bn.readOnly=YD;Bn.phrases=Lt.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(s=>e[s]==t[s])}});Bn.languageData=HD;Bn.changeFilter=WD;Bn.transactionFilter=GD;Bn.transactionExtender=KD;ed.reconfigure=Hn.define();function xb(e,t,n={}){let r={};for(let s of e)for(let i of Object.keys(s)){let o=s[i],a=r[i];if(a===void 0)r[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in t)r[s]===void 0&&(r[s]=t[s]);return r}class Sc{eq(t){return this==t}range(t,n=t){return r3.create(t,n,this)}}Sc.prototype.startSide=Sc.prototype.endSide=0;Sc.prototype.point=!1;Sc.prototype.mapMode=Li.TrackDel;function Sk(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let r3=class JD{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new JD(t,n,r)}};function s3(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Tk{constructor(t,n,r,s){this.from=t,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,s=0){let i=r?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-t||(r?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,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let r=[],s=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+t,d=this.to[l]+t,f,m;if(u==d){let p=n.mapPos(u,c.startSide,c.mapMode);if(p==null||(f=m=p,c.startSide!=c.endSide&&(m=n.mapPos(u,c.endSide),m<f)))continue}else if(f=n.mapPos(u,c.startSide),m=n.mapPos(d,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)),r.push(c),s.push(f-o),i.push(m-o))}return{mapped:r.length?new Tk(s,i,r,a):null,pos:o}}}class zn{constructor(t,n,r,s){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(t,n,r,s){return new zn(t,n,r,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(s3)),this.isEmpty)return n.length?zn.of(n):this;let a=new ZD(this,null,-1).goto(0),l=0,c=[],u=new Pu;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(r3.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?zn.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=t.touchesRange(a,a+l.length);if(c===!1)s=Math.max(s,l.maxPoint),n.push(l),r.push(t.mapPos(a));else if(c===!0){let{mapped:u,pos:d}=l.map(a,t);u&&(s=Math.max(s,u.maxPoint),n.push(u),r.push(d))}}let i=this.nextLayer.map(t);return n.length==0?i:new zn(r,n,i||zn.empty,s)}between(t,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return nm.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return nm.from(t).goto(n)}static compare(t,n,r,s,i=-1){let o=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),l=YT(o,a,r),c=new Ef(o,l,i),u=new Ef(a,l,i);r.iterGaps((d,f,m)=>XT(c,d,u,f,m,s)),r.empty&&r.length==0&&XT(c,0,u,0,0,s)}static eq(t,n,r=0,s){s==null&&(s=999999999);let i=t.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&t.indexOf(u)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=YT(i,o),l=new Ef(i,a,0).goto(r),c=new Ef(o,a,0).goto(r);for(;;){if(l.to!=c.to||!i3(l.active,c.active)||l.point&&(!c.point||!Sk(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(t,n,r,s,i=-1){let o=new Ef(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),d=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);s.point(a,c,o.point,u,d,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(t,n=!1){let r=new Pu;for(let s of t instanceof r3?[t]:n?Kpe(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return zn.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=zn.empty;s=s.nextLayer)n=new zn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}zn.empty=new zn([],[],null,-1);function Kpe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(s3(t,r)>0)return e.slice().sort(s3);t=r}return e}zn.empty.nextLayer=zn.empty;class Pu{finishChunk(t){this.chunks.push(new Tk(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new Pu)).add(t,n,r)}addInner(t,n,r){let s=t-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(zn.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=zn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function YT(e,t,n){let r=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=r.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&s.add(i.chunk[o])}return s}class ZD{constructor(t,n,r,s=0){this.layer=t,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,n,!1),this}gotoInner(t,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<t||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(t,n){(this.to-t||this.endSide-n)<0&&this.gotoInner(t,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=t+n.from[this.rangeIndex];if(this.from=r,this.to=t+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class nm{constructor(t){this.heap=t}static from(t,n=null,r=-1){let s=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new ZD(o,n,r,i));return s.length==1?s[0]:new nm(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)nv(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)nv(this.heap,r);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),nv(this.heap,0)}}}function nv(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let s=e[r];if(r+1<e.length&&s.compare(e[r+1])>=0&&(s=e[r+1],r++),n.compare(s)<0)break;e[r]=n,e[t]=s,t=r}}class Ef{constructor(t,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=nm.from(t,n,r)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){Vp(this.active,t),Vp(this.activeTo,t),Vp(this.activeRank,t),this.minActive=QT(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;Wp(this.active,n,r),Wp(this.activeTo,n,s),Wp(this.activeRank,n,i),t&&Wp(t,n,this.cursor.from),this.minActive=QT(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Vp(r,s)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<t;s--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function XT(e,t,n,r,s,i){e.goto(t),n.goto(r);let o=r+s,a=r,l=r-t,c=!!i.boundChange;for(let u=!1;;){let d=e.to+l-n.to,f=d||e.endSide-n.endSide,m=f<0?e.to+l:n.to,p=Math.min(m,o);if(e.point||n.point?(e.point&&n.point&&Sk(e.point,n.point)&&i3(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,p,e.point,n.point),u=!1):(u&&i.boundChange(a),p>a&&!i3(e.active,n.active)&&i.compareRange(a,p,e.active,n.active),c&&p<o&&(d||e.openEnd(m)!=n.openEnd(m))&&(u=!0)),m>o)break;a=m,f<=0&&e.next(),f>=0&&n.next()}}function i3(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!Sk(e[n],t[n]))return!1;return!0}function Vp(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Wp(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function QT(e,t){let n=-1,r=1e9;for(let s=0;s<t.length;s++)(t[s]-r||e[s].endSide-e[n].endSide)<0&&(n=s,r=t[s]);return n}function Fm(e,t,n=e.length){let r=0;for(let s=0;s<n&&s<e.length;)e.charCodeAt(s)==9?(r+=t-r%t,s++):(r++,s=Ds(e,s));return r}function Ype(e,t,n,r){for(let s=0,i=0;;){if(i>=t)return s;if(s==e.length)break;i+=e.charCodeAt(s)==9?n-i%n:1,s=Ds(e,s)}return e.length}const o3="ͼ",JT=typeof Symbol>"u"?"__"+o3:Symbol.for(o3),a3=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ZT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Tc{constructor(t,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let u=[],d=/^@(\w+)\b/.exec(o[0]),f=d&&d[1]=="keyframes";if(d&&a==null)return l.push(o[0]+";");for(let m in a){let p=a[m];if(/&/.test(m))i(m.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),p,l);else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");i(s(m),p,u,f)}else p!=null&&u.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(u.length||f)&&l.push((r&&!d&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in t)i(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=ZT[JT]||1;return ZT[JT]=t+1,o3+t.toString(36)}static mount(t,n,r){let s=t[a3],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Xpe(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let eC=new Map;class Xpe{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=eC.get(r);if(i)return t[a3]=i;this.sheet=new s.CSSStyleSheet,eC.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[a3]=this}mount(t,n){let r=this.sheet,s=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),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=a.rules.length,i++}}if(r)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 Cc={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:"'"},rm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qpe=typeof navigator<"u"&&/Mac/.test(navigator.platform),Jpe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ws=0;ws<10;ws++)Cc[48+ws]=Cc[96+ws]=String(ws);for(var ws=1;ws<=24;ws++)Cc[ws+111]="F"+ws;for(var ws=65;ws<=90;ws++)Cc[ws]=String.fromCharCode(ws+32),rm[ws]=String.fromCharCode(ws);for(var rv in Cc)rm.hasOwnProperty(rv)||(rm[rv]=Cc[rv]);function Zpe(e){var t=Qpe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Jpe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?rm:Cc)[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 Ws=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},l3=typeof document<"u"?document:{documentElement:{style:{}}};const c3=/Edge\/(\d+)/.exec(Ws.userAgent),eO=/MSIE \d/.test(Ws.userAgent),u3=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ws.userAgent),_b=!!(eO||u3||c3),tC=!_b&&/gecko\/(\d+)/i.test(Ws.userAgent),sv=!_b&&/Chrome\/(\d+)/.exec(Ws.userAgent),nC="webkitFontSmoothing"in l3.documentElement.style,d3=!_b&&/Apple Computer/.test(Ws.vendor),rC=d3&&(/Mobile\/\w+/.test(Ws.userAgent)||Ws.maxTouchPoints>2);var dt={mac:rC||/Mac/.test(Ws.platform),windows:/Win/.test(Ws.platform),linux:/Linux|X11/.test(Ws.platform),ie:_b,ie_version:eO?l3.documentMode||6:u3?+u3[1]:c3?+c3[1]:0,gecko:tC,gecko_version:tC?+(/Firefox\/(\d+)/.exec(Ws.userAgent)||[0,0])[1]:0,chrome:!!sv,chrome_version:sv?+sv[1]:0,ios:rC,android:/Android\b/.test(Ws.userAgent),webkit:nC,webkit_version:nC?+(/\bAppleWebKit\/(\d+)/.exec(Ws.userAgent)||[0,0])[1]:0,safari:d3,safari_version:d3?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ws.userAgent)||[0,0])[1]:0,tabSize:l3.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Ck(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 sy=Object.create(null);function Ak(e,t,n){if(e==t)return!0;e||(e=sy),t||(t=sy);let r=Object.keys(e),s=Object.keys(t);if(r.length-0!=s.length-0)return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function ege(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function sC(e,t,n){let r=!1;if(t)for(let s in t)n&&s in n||(r=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(r=!0,s=="style"?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return r}function tge(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}class Ca{eq(t){return!1}updateDOM(t,n,r){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var Js=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Js||(Js={}));class gn extends Sc{constructor(t,n,r,s){super(),this.startSide=t,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(t){return new Um(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return n+=r&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new $u(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,s;if(t.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:o}=tO(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new $u(t,r,s,n,t.widget||null,!0)}static line(t){return new qm(t)}static set(t,n=!1){return zn.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}gn.none=zn.empty;class Um extends gn{constructor(t){let{start:n,end:r}=tO(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?Ck(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||sy}eq(t){return this==t||t instanceof Um&&this.tagName==t.tagName&&Ak(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)}}Um.prototype.point=!1;class qm extends gn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof qm&&this.spec.class==t.spec.class&&Ak(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)}}qm.prototype.mapMode=Li.TrackBefore;qm.prototype.point=!0;class $u extends gn{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?Li.TrackBefore:Li.TrackAfter:Li.TrackDel}get type(){return this.startSide!=this.endSide?Js.WidgetRange:this.startSide<=0?Js.WidgetBefore:Js.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof $u&&nge(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)}}$u.prototype.point=!0;function tO(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function nge(e,t){return e==t||!!(e&&t&&e.compare(t))}function eh(e,t,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=e?n[s]=Math.max(n[s],t):n.push(e,t)}class sm extends Sc{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof sm&&this.tagName==t.tagName&&Ak(this.attributes,t.attributes)}static create(t){return new sm(t.tagName,t.attributes||sy,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return zn.of(t,n)}}sm.prototype.startSide=sm.prototype.endSide=-1;function im(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function h3(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function S0(e,t){if(!t.anchorNode)return!1;try{return h3(e,t.anchorNode)}catch{return!1}}function T0(e){return e.nodeType==3?am(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function C0(e,t,n,r){return n?iC(e,t,n,r,-1)||iC(e,t,n,r,1):!1}function Ac(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function iy(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function iC(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:hl(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Ac(e)+(s<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=s<0?hl(e):0}else return!1}}function hl(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function om(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function rge(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 nO(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function sge(e,t,n,r,s,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let f,m=u==l.body,p=1,y=1;if(m)f=rge(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let v=u.getBoundingClientRect();({scaleX:p,scaleY:y}=nO(u,v)),f={left:v.left,right:v.left+u.clientWidth*p,top:v.top,bottom:v.top+u.clientHeight*y}}let w=0,b=0;if(s=="nearest")t.top<f.top+o?(b=t.top-(f.top+o),n>0&&t.bottom>f.bottom+b&&(b=t.bottom-f.bottom+o)):t.bottom>f.bottom-o&&(b=t.bottom-f.bottom+o,n<0&&t.top-b<f.top&&(b=t.top-(f.top+o)));else{let v=t.bottom-t.top,x=f.bottom-f.top;b=(s=="center"&&v<=x?t.top+v/2-x/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-x+o)-f.top}if(r=="nearest"?t.left<f.left+i?(w=t.left-(f.left+i),n>0&&t.right>f.right+w&&(w=t.right-f.right+i)):t.right>f.right-i&&(w=t.right-f.right+i,n<0&&t.left<f.left+w&&(w=t.left-(f.left+i))):w=(r=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:r=="start"==a?t.left-i:t.right-(f.right-f.left)+i)-f.left,w||b)if(m)c.scrollBy(w,b);else{let v=0,x=0;if(b){let S=u.scrollTop;u.scrollTop+=b/y,x=(u.scrollTop-S)*y}if(w){let S=u.scrollLeft;u.scrollLeft+=w/p,v=(u.scrollLeft-S)*p}t={left:t.left-v,top:t.top-x,right:t.right-v,bottom:t.bottom-x},v&&Math.abs(v-w)<1&&(r="nearest"),x&&Math.abs(x-b)<1&&(s="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)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function rO(e,t=!0){let n=e.ownerDocument,r=null,s=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||r)&&s);)if(i.nodeType==1)!s&&i.scrollHeight>i.clientHeight&&(s=i),t&&!r&&i.scrollWidth>i.clientWidth&&(r=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:r,y:s}}class ige{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:r}=t;this.set(n,Math.min(t.anchorOffset,n?hl(n):0),r,Math.min(t.focusOffset,r?hl(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let ru=null;dt.safari&&dt.safari_version>=26&&(ru=!1);function sO(e){if(e.setActive)return e.setActive();if(ru)return e.focus(ru);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(ru==null?{get preventScroll(){return ru={preventScroll:!0},!0}}:void 0),!ru){ru=!1;for(let n=0;n<t.length;){let r=t[n++],s=t[n++],i=t[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let oC;function am(e,t,n=t){let r=oC||(oC=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function th(e,t,n,r){let s={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function oge(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function age(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,hl(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=hl(n))}else{if(n==e)return!0;r=Ac(n),n=n.parentNode}}function iO(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 oO(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=hl(n)}else if(n.parentNode&&!iy(n))r=Ac(n),n=n.parentNode;else return null}}function aO(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!iy(n))r=Ac(n)+1,n=n.parentNode;else return null}}class No{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new No(t.parentNode,Ac(t),n)}static after(t,n){return new No(t.parentNode,Ac(t)+1,n)}}var dr=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(dr||(dr={}));const zu=dr.LTR,Ek=dr.RTL;function lO(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const lge=lO("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),cge=lO("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),f3=Object.create(null),Xo=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);f3[t]=n,f3[n]=-t}function cO(e){return e<=247?lge[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?cge[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const uge=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ha{get dir(){return this.level%2?Ek:zu}constructor(t,n,r){this.from=t,this.to=n,this.level=r}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,r,s){let i=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(i<0||(s!=0?s<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 uO(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!uO(r.inner,s.inner))return!1}return!0}const Jn=[];function dge(e,t,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:t,a=i<r.length?r[i].from:n,l=i?256:s;for(let c=o,u=l,d=l;c<a;c++){let f=cO(e.charCodeAt(c));f==512?f=u:f==8&&d==4&&(f=16),Jn[c]=f==4?2:f,f&7&&(d=f),u=f}for(let c=o,u=l,d=l;c<a;c++){let f=Jn[c];if(f==128)c<a-1&&u==Jn[c+1]&&u&24?f=Jn[c]=u:Jn[c]=256;else if(f==64){let m=c+1;for(;m<a&&Jn[m]==64;)m++;let p=c&&u==8||m<n&&Jn[m]==8?d==1?1:8:256;for(let y=c;y<m;y++)Jn[y]=p;c=m-1}else f==8&&d==1&&(Jn[c]=1);u=f,f&7&&(d=f)}}}function hge(e,t,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let d=c,f,m,p;d<u;d++)if(m=f3[f=e.charCodeAt(d)])if(m<0){for(let y=a-3;y>=0;y-=3)if(Xo[y+1]==-m){let w=Xo[y+2],b=w&2?s:w&4?w&1?i:s:0;b&&(Jn[d]=Jn[Xo[y]]=b),a=y;break}}else{if(Xo.length==189)break;Xo[a++]=d,Xo[a++]=f,Xo[a++]=l}else if((p=Jn[d])==2||p==1){let y=p==s;l=y?0:1;for(let w=a-3;w>=0;w-=3){let b=Xo[w+2];if(b&2)break;if(y)Xo[w+2]|=2;else{if(b&4)break;Xo[w+2]|=4}}}}}function fge(e,t,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t;for(let l=o;l<a;){let c=Jn[l];if(c==256){let u=l+1;for(;;)if(u==a){if(s==n.length)break;u=n[s++].to,a=s<n.length?n[s].from:t}else if(Jn[u]==256)u++;else break;let d=i==1,f=(u<t?Jn[u]:r)==1,m=d==f?d?1:2:r;for(let p=u,y=s,w=y?n[y-1].to:e;p>l;)p==w&&(p=n[--y].from,w=y?n[y-1].to:e),Jn[--p]=m;l=u}else i=c,l++}}}function m3(e,t,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=t,c=0;l<n;){let u=!0,d=!1;if(c==i.length||l<i[c].from){let y=Jn[l];y!=a&&(u=!1,d=y==16)}let f=!u&&a==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c<i.length&&p==i[c].from){if(d)break e;let y=i[c];if(!u)for(let w=y.to,b=c+1;;){if(w==n)break e;if(b<i.length&&i[b].from==w)w=i[b++].to;else{if(Jn[w]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new ha(l,y.from,m));let w=y.direction==zu!=!(m%2);p3(e,w?r+1:r,s,y.inner,y.from,y.to,o),l=y.to}p=y.to}else{if(p==n||(u?Jn[p]!=a:Jn[p]==a))break;p++}f?m3(e,l,p,r+1,s,f,o):l<p&&o.push(new ha(l,p,m)),l=p}else for(let l=n,c=i.length;l>t;){let u=!0,d=!1;if(!c||l>i[c-1].to){let y=Jn[l-1];y!=a&&(u=!1,d=y==16)}let f=!u&&a==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c&&p==i[c-1].to){if(d)break e;let y=i[--c];if(!u)for(let w=y.from,b=c;;){if(w==t)break e;if(b&&i[b-1].to==w)w=i[--b].from;else{if(Jn[w-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new ha(y.to,l,m));let w=y.direction==zu!=!(m%2);p3(e,w?r+1:r,s,y.inner,y.from,y.to,o),l=y.from}p=y.from}else{if(p==t||(u?Jn[p-1]!=a:Jn[p-1]==a))break;p--}f?m3(e,p,l,r+1,s,f,o):p<l&&o.push(new ha(p,l,m)),l=p}}function p3(e,t,n,r,s,i,o){let a=t%2?2:1;dge(e,s,i,r,a),hge(e,s,i,r,a),fge(s,i,r,a),m3(e,s,i,t,n,r,o)}function mge(e,t,n){if(!e)return[new ha(0,0,t==Ek?1:0)];if(t==zu&&!n.length&&!uge.test(e))return dO(e.length);if(n.length)for(;e.length>Jn.length;)Jn[Jn.length]=256;let r=[],s=t==zu?0:1;return p3(e,s,s,n,0,e.length,r),r}function dO(e){return[new ha(0,e,0)]}let hO="";function pge(e,t,n,r,s){var i;let o=r.head-e.from,a=ha.find(t,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=t[a],c=l.side(s,n);if(o==c){let f=a+=s?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],o=l.side(!s,n),c=l.side(s,n)}let u=Ds(e.text,o,l.forward(s,n));(u<l.from||u>l.to)&&(u=c),hO=e.text.slice(Math.min(o,u),Math.max(o,u));let d=a==(s?t.length-1:0)?null:t[a+(s?1:-1)];return d&&u==c&&d.level+(s?0:1)<l.level?Oe.cursor(d.side(!s,n)+e.from,d.forward(s,n)?1:-1,d.level):Oe.cursor(u+e.from,l.forward(s,n)?-1:1,l.level)}function gge(e,t,n){for(let r=t;r<n;r++){let s=cO(e.charCodeAt(r));if(s==1)return zu;if(s==2||s==4)return Ek}return zu}const fO=Lt.define(),mO=Lt.define(),pO=Lt.define(),gO=Lt.define(),g3=Lt.define(),yO=Lt.define(),bO=Lt.define(),Mk=Lt.define(),Ik=Lt.define(),vO=Lt.define({combine:e=>e.some(t=>t)}),wO=Lt.define({combine:e=>e.some(t=>t)}),xO=Lt.define();class nh{constructor(t,n,r,s,i,o=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new nh(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 nh(Oe.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Gp=Hn.define({map:(e,t)=>e.map(t)}),_O=Hn.define();function Di(e,t,n){let r=e.facet(gO);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Ha=Lt.define({combine:e=>e.length?e[0]:!0});let yge=0;const Pd=Lt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}});class wi{constructor(t,n,r,s,i){this.id=t,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Pd.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Pd.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new wi(yge++,t,r,s,a=>{let l=[];return o&&l.push(kb.of(c=>{let u=c.plugin(a);return u?o(u):gn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return wi.define((r,s)=>new t(r,s),n)}}class iv{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Di(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){Di(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Di(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const kO=Lt.define(),Nk=Lt.define(),kb=Lt.define(),SO=Lt.define(),Rk=Lt.define(),Hm=Lt.define(),TO=Lt.define();function aC(e,t){let n=e.state.facet(TO);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return zn.spans(r,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,u=o-t.from,d=s;for(let f=a.length-1;f>=0;f--,l--){let m=a[f].spec.bidiIsolate,p;if(m==null&&(m=gge(t.text,c,u)),l>0&&d.length&&(p=d[d.length-1]).to==c&&p.direction==m)p.to=u,d=p.inner;else{let y={from:c,to:u,direction:m,inner:[]};d.push(y),d=y.inner}}}}),s}const CO=Lt.define();function Lk(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(CO)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:r,bottom:s}}const Vf=Lt.define();class fo{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new fo(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let s=t[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),t.splice(n-1,1)}}return t.splice(n,0,r),t}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let s=0,i=0,o=0;;){let a=s<t.length?t[s].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,d=c,f=u;for(;;)if(i<n.length&&n[i]<=d){let m=n[i+1];i+=2,d=Math.max(d,m);for(let p=s;p<t.length&&t[p].fromB<=d;p++)o=t[p].toA-t[p].toB;f=Math.max(f,m+o)}else if(s<t.length&&t[s].fromB<=d){let m=t[s++];d=Math.max(d,m.toB),f=Math.max(f,m.toA),o=m.toA-m.toB}else break;r.push(new fo(u,f,c,d))}return r}}class oy{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=es.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new fo(i,o,a,l))),this.changedRanges=s}static create(t,n,r){return new oy(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const bge=[];class Er{constructor(t,n,r=0){this.dom=t,this.length=n,this.flags=r,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return bge}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&&ege(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let r=n;for(let s of this.children){if(s==t)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n){return null}domPosFor(t,n){let r=Ac(this.dom),s=this.length?t>0:n>0;return new No(this.parent.dom,r+(s?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof Tb)return t;return null}static get(t){return t.cmTile}}class Sb extends Er{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,r=null,s,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,s=r?r.nextSibling:n.firstChild,i&&s!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;s&&s!=a.dom;)s=lC(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=lC(s);this.length=o}}function lC(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Tb extends Sb{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=Er.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,s=0,i=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&i++,s=n.pop()}else{let o=r.children[s++];if(o instanceof rl)n.push(s),r=o,s=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 r,s=-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&&(r=void 0)}(l<t||t==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=t-l),(c>t||t==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-l)}}),!r&&!i)throw new Error("No tile at position "+t);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:o}}}class rl extends Sb{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new rl(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class Sh extends Sb{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new Sh(n||document.createElement("div"),t);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,n,r){let s=null,i=-1,o=null,a=-1;function l(u,d){for(let f=0,m=0;f<u.children.length&&m<=d;f++){let p=u.children[f],y=m+p.length;y>=d&&(p.isComposite()?l(p,d-m):(!o||o.isHidden&&(n>0||r&&wge(o,p)))&&(y>d||p.flags&32)?(o=p,a=d-m):(m<d||p.flags&16&&!p.isHidden)&&(s=p,i=d-m)),m=y}}l(this,t);let c=(n<0?s:o)||s||o;return c?{tile:c,offset:c==s?i:a}:null}coordsIn(t,n){let r=this.resolveInline(t,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):vge(this)}domIn(t,n){let r=this.resolveInline(t,n);if(r){let{tile:s,offset:i}=r;if(this.dom.contains(s.dom))return s.isText()?new No(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new No(l.dom,0);l==r.tile&&(a=!0)}}return new No(this.dom,0)}}function vge(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=T0(t);return n[n.length-1]||null}function wge(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class pi extends Sb{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new pi(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class yu extends Er{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let r=this.dom.nodeValue.length;t>r&&(t=r);let s=t,i=t,o=0;t==0&&n<0||t==r&&n>=0?dt.chrome||dt.gecko||(t?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=am(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return dt.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?om(l,o<0):l||null}static of(t,n){let r=new yu(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Fu extends Er{constructor(t,n,r,s){super(t,n,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,r){let s=this.widget.coordsAt(this.dom,t,n);if(s)return s;if(r)return om(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 om(o,!a)}}get overrideDOMText(){if(!this.length)return Cn.empty;let{root:t}=this;if(!t)return Cn.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,s,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new Fu(i,r,t,s)}}class ay extends Er{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 Cn.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class xge{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:s,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(s.isComposite())if(o){if(!t)break;r&&r.break(),t--,o=!1}else if(i==s.children.length){if(!t&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++}else{let l=s.children[i],c=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,t-=l.length):(a.push({tile:s,index:i}),s=l,i=0,r&&l.isComposite()&&r.enter(l))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++;else if(t){let l=Math.min(t,s.length-i);r&&r.skip(s,i,i+l),t-=l,i+=l}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class _ge{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class kge{constructor(t,n,r){this.cache=t,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,r,s){var i;this.flushBuffer();let o=this.ensureMarks(n,r),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 yu(a.dom,a.text+t);l.parent=o}else o.append(s||yu.of(t,(i=this.cache.find(yu))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?ov(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=s.lastChild;if(c instanceof pi&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(ov(l.dom)),s=c;else{if(this.cache.reused.get(l)){let d=Er.get(l.dom);d&&d.setDOM(ov(l.dom))}let u=pi.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=Er.get(t.text);i&&this.cache.reused.set(i,2);let o=new yu(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,s.append(o)}addInlineWidget(t,n,r){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let i=this.ensureMarks(n,r);!s&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var r;t||(t=AO);let s=Sh.start(t,n||((r=this.cache.find(Sh))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var r;let s=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=s.lastChild)&&a instanceof pi&&a.mark.eq(o))s=a,n--;else{let l=pi.of(o,(r=this.cache.find(pi,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!cC(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(dt.ios&&cC(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(av,0,32)||new Fu(av.toDOM(),0,av,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let n=t.rank*102+t.value.rank,r=new _ge(t.from,t.to,t.value,n),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-r.rank||this.wrappers[s-1].to-r.to)<0;)s--;this.wrappers.splice(s,0,r)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof rl&&s.wrapper.eq(r.wrapper))n=s;else{let i=rl.of(r.wrapper,(t=this.cache.find(rl,o=>o.wrapper.eq(r.wrapper)))===null||t===void 0?void 0:t.dom);n.append(i),n=i}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),r=this.cache.find(ay,void 0,1);return r&&(r.flags=n),r||new ay(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Sge{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(t,s.length);return i?null:s.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const ly=[Fu,Sh,yu,pi,ay,rl,Tb];for(let e=0;e<ly.length;e++)ly[e].bucket=e;class Tge{constructor(t){this.view=t,this.buckets=ly.map(()=>[]),this.index=ly.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let s=t.bucket,i=this.buckets[s],o=this.index[s];for(let 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[s]--,this.reused.set(c,r),c}return null}findWidget(t,n,r){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let a=s[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 s.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new Fu(a.dom,n,t,a.flags&-498|r))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class Cge{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new Tge(t),this.text=new Sge(t.state.doc),this.builder=new kge(this.cache,new Tb(t,t.contentDOM),zn.iter(r)),this.cache.reused.set(n,2),this.old=new xge(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 r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!o,!a),s=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,r),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,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,r){let s=Mge(this.old),i=this.openMarks;this.old.advance(t,r?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?Fu.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,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof ay)this.cache.add(o);else if(o instanceof pi)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof pi&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof pi&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,s=this.builder,i=0,o=zn.spans(this.decorations,t,n,{point:(a,l,c,u,d,f)=>{if(c instanceof $u){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=u.length,d>u.length)s.continueWidget(l-a);else{let m=c.widget||(c.block?Th.block:Th.inline),p=Age(c),y=this.cache.findWidget(m,l-a,p)||Fu.of(m,this.view,l-a,p);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(y)):(s.ensureLine(r),s.addInlineWidget(y,u,d))}r=null}else r=Ege(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let d=a;d<l;){let f=this.text.next(Math.min(512,l-d));f==null?(s.addLineStartIfNotCovered(r),s.addBreak(),d++):(s.ensureLine(r),s.addText(f,c,d==a?u:c.length),d+=f.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>i,this.openMarks=o}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let s=t.parentNode;;s=s.parentNode){let i=Er.get(s);if(s==this.view.contentDOM)break;i instanceof pi?n.push(i):i!=null&&i.isLine()?r=i:i instanceof rl||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new Sh(s,AO):r||n.push(pi.of(new Um({tagName:s.nodeName.toLowerCase(),attributes:tge(s)}),s)))}return{line:r,marks:n}}}function cC(e,t){let n=r=>{for(let s of r.children)if((t?s.isText():s.length)||n(s))return!0;return!1};return n(e)}function Age(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 AO={class:"cm-line"};function Ege(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&Ck(n,e),r&&(e.class+=" "+r)),e}function Mge(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof pi&&t.push(r.mark)}return t}function ov(e){let t=Er.get(e);return t&&t.setDOM(e.cloneNode()),e}class Th extends Ca{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}}Th.inline=new Th("span");Th.block=new Th("div");const av=new class extends Ca{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class uC{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=gn.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 Tb(t,t.contentDOM),this.updateInner([new fo(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:d})=>d<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!Pge(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?Nge(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new fo(u,d,t.changes.mapPos(u,-1),t.changes.mapPos(d,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(dt.ie||dt.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=jge(o,this.decorations,t.changes);l.length&&(r=fo.extendWithRanges(r,l));let c=Oge(a,this.blockWrappers,t.changes);return c.length&&(r=fo.extendWithRanges(r,c)),i&&!r.some(u=>u.fromA<=i.range.fromA&&u.toA>=i.range.toA)&&(r=i.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let o=this.tile,a=new Cge(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Er.get(n.text)&&a.cache.reused.set(Er.get(n.text),2),this.tile=a.run(t,n),y3(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=dt.chrome||dt.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||r.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof lv&&s.push(i.dom);r.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let r of n.effects)r.is(_O)&&(this.editContextFormatting=r.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,i=s==r,o=!i&&!(this.view.state.facet(Ha)||r.tabIndex>-1)&&S0(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),dt.gecko&&l.empty&&!this.hasComposition&&Ige(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new No(f,0),a=!0}let d=this.view.observer.selectionRange;(a||!d.focusNode||(!C0(c.node,c.offset,d.anchorNode,d.anchorOffset)||!C0(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{dt.android&&dt.chrome&&r.contains(d.focusNode)&&Bge(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=im(this.view.root);if(f)if(l.empty){if(dt.gecko){let m=Rge(c.node,c.offset);if(m&&m!=3){let p=(m==1?oO:aO)(c.node,c.offset);p&&(c=new No(p.node,p.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(u.node,u.offset)}catch{}}else{let m=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),m.setEnd(u.node,u.offset),m.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(m)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new No(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new No(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&C0(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,r=im(t.root),{anchorNode:s,anchorOffset:i}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let 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 u=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&r.collapse(s,i)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let i;if(t==r.dom)i=r.dom.childNodes[n];else{let o=hl(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==r.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==r.dom.firstChild)return s;for(;i&&!Er.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return r.isText()?t==r.dom?s+n:s+(n?r.length:0):s}domAtPos(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(t,n):r.domIn(s,n)}inlineDOMNearPos(t,n){let r,s=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=t)return!0;c.flags&16&&(i=!0)}else{let d=u+c.length;if(u<=t&&(r=c,s=t-u,i=d<t),d>=t&&!o&&(o=c,a=t-u,l=u>t),u>t&&o)return!0}}),!r&&!o?this.domAtPos(t,n):(i&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(s,n):o.domIn(a,n))}coordsAt(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof lv?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function s(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=Ds(i.text,o);if(a==o)return null;let l=am(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return s(n,r)}measureVisibleLineHeights(t){let n=[],{from:r,to:s}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==dr.LTR,c=0,u=(d,f,m)=>{for(let p=0;p<d.children.length&&!(f>s);p++){let y=d.children[p],w=f+y.length,b=y.dom.getBoundingClientRect(),{height:v}=b;if(m&&!p&&(c+=b.top-m.top),y instanceof rl)w>r&&u(y,f,b);else if(f>=r&&(c>0&&n.push(-c),n.push(v+c),c=0,o)){let x=y.dom.lastChild,S=x?T0(x):[];if(S.length){let C=S[S.length-1],E=l?C.right-b.left:b.right-C.left;E>a&&(a=E,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=w)}}m&&p==d.children.length-1&&(c+=m.bottom-b.bottom),f=w+y.breakAfter}};return u(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?dr.RTL:dr.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 u=T0(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[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"),r,s,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=T0(n.firstChild)[0];r=n.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(gn.replace({widget:new lv(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return gn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(kb).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(Rk).map((i,o)=>{let a=typeof i=="function";return a&&(r=!0),a?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[t++]=r,n.push(zn.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(SO).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(t){var n;if(t.isSnapshot){let u=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=u.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let u of this.view.state.facet(xO))try{if(u(this.view,t.range,t))return!0}catch(d){Di(this.view.state,d,"scroll handler")}let{range:r}=t,s=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),i;if(!s)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(s={left:Math.min(s.left,i.left),top:Math.min(s.top,i.top),right:Math.max(s.right,i.right),bottom:Math.max(s.bottom,i.bottom)});let o=Lk(this.view),a={left:s.left-o.left,top:s.top-o.top,right:s.right+o.right,bottom:s.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(sge(this.view.scrollDOM,a,r.head<r.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==dr.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(r.head,1);u&&u.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){y3(this.tile)}}function y3(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)y3(r,t)}}function Ige(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 EO(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=oO(n.focusNode,n.focusOffset),s=aO(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=Er.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=Er.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function Nge(e,t,n){let r=EO(e,n);if(!r)return null;let{node:s,from:i,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new fo(l.mapPos(i),l.mapPos(o),i,o),text:s}}function Rge(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 Lge=class{constructor(){this.changes=[]}compareRange(t,n){eh(t,n,this.changes)}comparePoint(t,n){eh(t,n,this.changes)}boundChange(t){eh(t,t,this.changes)}};function jge(e,t,n){let r=new Lge;return zn.compare(e,t,n,r),r.changes}class Dge{constructor(){this.changes=[]}compareRange(t,n){eh(t,n,this.changes)}comparePoint(){}boundChange(t){eh(t,t,this.changes)}}function Oge(e,t,n){let r=new Dge;return zn.compare(e,t,n,r),r.changes}function Bge(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 Pge(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class lv extends Ca{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 $ge(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return Oe.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=Ds(s.text,i,!1):a=Ds(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let c=Ds(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=Ds(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return Oe.range(o+s.from,a+s.from)}function zge(e,t,n,r,s){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,l=Math.floor((s-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+Ype(o,i,e.state.tabSize)}function b3(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!s||i.type==Js.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function Fge(e,t,n,r){let s=b3(e,t.head,t.assoc||-1),i=!r||s.type!=Js.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(s.from),l=e.posAtCoords({x:n==(a==dr.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Oe.cursor(l,n?-1:1)}return Oe.cursor(n?s.to:s.from,n?-1:1)}function dC(e,t,n,r){let s=e.state.doc.lineAt(t.head),i=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let a=t,l=null;;){let c=pge(s,i,o,a,n),u=hO;if(!c){if(s.number==(n?e.state.doc.lines:1))return a;u=`
`,s=e.state.doc.line(s.number+(n?1:-1)),i=e.bidiSpans(s),c=e.visualLineSide(s,!n)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function Uge(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==Qa.Space&&(s=o),s==o}}function qge(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return Oe.cursor(s,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let p=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(s-p.from))),a=(i<0?p.top:p.bottom)+u}let d=l.left+o,f=e.viewState.heightOracle.textHeight>>1,m=r??f;for(let p=0;;p+=f){let y=a+(m+p)*i,w=v3(e,{x:d,y},!1,i);if(n?y>l.bottom:y<l.top)return Oe.cursor(w.pos,w.assoc);let b=e.coordsAtPos(w.pos,w.assoc),v=b?(b.top+b.bottom)/2:0;if(!b||(n?v>a:v<a))return Oe.cursor(w.pos,w.assoc,void 0,o)}}function A0(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let l=r||n||(t-i<o-t?-1:1);t=l<0?i:o,r=l}});if(!r)return t}}function MO(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let s=t.ranges[r],i=null;if(s.empty){let o=A0(e,s.from,0);o!=s.from&&(i=Oe.cursor(o,-1))}else{let o=A0(e,s.from,-1),a=A0(e,s.to,1);(o!=s.from||a!=s.to)&&(i=Oe.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?Oe.create(n,t.mainIndex):t}function cv(e,t,n){let r=A0(e.state.facet(Hm).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Oe.cursor(r,r<n.from?1:-1)}class oa{constructor(t,n){this.pos=t,this.assoc=n}}function v3(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new oa(0,1);if(l>e.viewState.docHeight)return new oa(e.state.doc.length,-1);if(c=e.elementAtHeight(l),r==null)break;if(c.type==Js.Text){if(r<0?c.to<e.viewport.from:c.from>e.viewport.to)break;let f=e.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(f&&(r<0?f.top<=l+i:f.bottom>=l+i))break}let d=e.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+d:c.top-d}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==Js.Text){let d=zge(e,s,c,o,a);return new oa(d,d==c.from?1:-1)}}if(c.type!=Js.Text)return l<(c.top+c.bottom)/2?new oa(c.from,1):new oa(c.to,-1);let u=e.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=e.docView.lineAt(c.from,-2)),new Hge(e,o,a,e.textDirectionAt(c.from)).scanTile(u,c.from)}class Hge{constructor(t,n,r,s){this.view=t,this.x=n,this.y=r,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[ha.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[ha.find(s,t-r.from,-1,n)].dir}bidiIn(t,n){let{spans:r,line:s}=this.bidiSpansAt(t);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(t,n,r=!1){let s=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),l,c,u=-1,d=1e9,f;e:for(;s<i;){let p=i-s,y=s+i>>1;t:if(o.has(y)){let b=s+Math.floor(Math.random()*p);for(let v=0;v<p;v++){if(!o.has(b)){y=b;break t}b++,b==i&&(b=s)}break e}o.add(y);let w=n(y);if(w)for(let b=0;b<w.length;b++){let v=w[b],x=0;if(!(v.width==0&&w.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 S=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,C=Math.abs(S);C<d&&(u=y,d=C,f=v),S&&(x=S<0==(this.baseDir==dr.LTR)?-1:1)}x==-1&&(!a||this.baseDirAt(t[y],1))?i=y:x==1&&(!a||this.baseDirAt(t[y+1],-1))&&(s=y+1)}}}if(!f){if(!c&&!l)return{i:t[0],after:!1};let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(t,n,!0)}if(d&&!r){let{top:p,bottom:y}=f;if(l&&l.bottom>(p+p+y)/3)return this.y=l.bottom-1,this.scan(t,n,!0);if(c&&c.top<(p+y+y)/3)return this.y=c.top+1,this.scan(t,n,!0)}let m=(a?this.dirAt(t[u],1):this.baseDir)==dr.LTR;return{i:u,after:this.x>(f.left+f.right)/2==m}}scanText(t,n){let r=[];for(let i=0;i<t.length;i=Ds(t.text,i))r.push(n+i);r.push(n+t.length);let s=this.scan(r,i=>{let o=r[i]-n,a=r[i+1]-n;return am(t.dom,o,a).getClientRects()});return s.after?new oa(r[s.i+1],-1):new oa(r[s.i],1)}scanTile(t,n){if(!t.length)return new oa(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 r=[n];for(let a=0,l=n;a<t.children.length;a++)r.push(l+=t.children[a].length);let s=this.scan(r,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:am(l.dom,0,l.length)).getClientRects()}),i=t.children[s.i],o=r[s.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):s.after?new oa(r[s.i+1],-1):new oa(o,1)}}const kd="";class Vge{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(Bn.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=kd}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let s=t;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let o=Er.get(s),a=s.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Er.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:iy(s))||iy(a)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!Gge(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(r,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);r=i+o}}readNode(t){let n=Er.get(t),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(t,n){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(Wge(t,r.node,r.offset)?n:0))}}function Wge(e,t,n){for(;;){if(!t||n<hl(t))return!1;if(t==e)return!0;n=Ac(t)+1,t=t.parentNode}}function Gge(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=Er.get(e);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class hC{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class Kge{constructor(t,n,r,s){this.typeOver=s,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=IO(t.docView.tile,n,r,0))){let l=i||o?[]:Xge(t),c=new Vge(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Qge(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!h3(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!h3(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=t.viewport;if((dt.ios||dt.chrome)&&a.main.empty&&c!=u&&(d.from>0||d.to<t.state.doc.length)){let f=Math.min(c,u),m=Math.max(c,u),p=d.from-f,y=d.to-m;(p==0||p==1||f==0)&&(y==0||y==-1||m==t.state.doc.length)&&(c=0,u=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Oe.range(u,c));else if(t.lineWrapping&&u==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=Oe.create([Oe.cursor(c,m)])}else this.newSel=Oe.single(u,c)}}}function IO(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<e.children.length;l++){let d=e.children[l],f=c+d.length;if(c<t&&f>n)return IO(d,t,n,c);if(f>=t&&s==-1&&(s=l,i=c),c>n&&d.dom.parentNode==e.dom){o=l,a=u;break}u=f,c=f+d.breakAfter}return{from:i,to:a<0?r+e.length:a,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function NO(e,t){let n,{newSel:r}=t,{state:s}=e,i=s.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:l}=t.bounds,c=i.from,u=null;(o===8||dt.android&&t.text.length<l-a)&&(c=i.to,u="end");let d=s.doc.sliceString(a,l,kd),f,m;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||d!=t.text)&&d.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&d.slice(i.to-a)==t.text.slice(f=t.text.length-(d.length-(i.to-a)))?n={from:i.from,to:i.to,insert:Cn.of(t.text.slice(i.from-a,f).split(kd))}:(m=RO(d,t.text,c-a,u))&&(dt.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==kd+kd&&m.toB--,n={from:a+m.from,to:a+m.toA,insert:Cn.of(t.text.slice(m.from,m.toB).split(kd))})}else r&&(!e.hasFocus&&s.facet(Ha)||cy(r,i))&&(r=null);if(!n&&!r)return!1;if((dt.mac||dt.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Oe.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Cn.of([n.insert.toString().replace("."," ")])}):s.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:s.toText(e.inputState.insertingText)}:dt.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=Oe.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Cn.of([" "])}),n)return jk(e,n,r,o);if(r&&!cy(r,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"&&(r=MO(s.facet(Hm).map(c=>c(e)),r))),e.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function jk(e,t,n,r=-1){if(dt.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(dt.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&e.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&th(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&th(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&th(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=Yge(e,t,n));return e.state.facet(yO).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function Yge(e,t,n){let r,s=e.state,i=s.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let l=t.from<i.from?-1:1,c=l<0?i.from:i.to,u=A0(s.facet(Hm).map(d=>d(e)),c,l);t.from==u&&(o=u)}if(o>-1)r={changes:t,selection:Oe.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?s.sliceDoc(i.from,t.from):"",c=i.to>t.to?s.sliceDoc(t.to,i.to):"";r=s.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=s.changes(t),c=n&&n.main.to<=l.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let u=e.state.sliceDoc(t.from,t.to),d,f=n&&EO(e,n.main.head);if(f){let p=t.insert.length-(t.to-t.from);d={from:f.from,to:f.to-p}}else d=e.state.doc.lineAt(i.head);let m=i.to-t.to;r=s.changeByRange(p=>{if(p.from==i.from&&p.to==i.to)return{changes:l,range:c||p.map(l)};let y=p.to-m,w=y-u.length;if(e.state.sliceDoc(w,y)!=u||y>=d.from&&w<=d.to)return{range:p};let b=s.changes({from:w,to:y,insert:t.insert}),v=p.to-i.to;return{changes:b,range:c?Oe.range(Math.max(0,c.anchor+v),Math.max(0,c.head+v)):p.map(b)}})}else r={changes:l,selection:c&&s.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)),s.update(r,{userEvent:a,scrollIntoView:!0})}function RO(e,t,n,r){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==s&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(r=="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 Xge(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new hC(n,r)),(s!=n||i!=r)&&t.push(new hC(s,i))),t}function Qge(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?Oe.single(n+t,r+t):null}function cy(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Jge{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,dt.safari&&t.contentDOM.addEventListener("input",()=>null),dt.gecko&&f1e(t.contentDOM.ownerDocument)}handleEvent(t){!o1e(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let r=this.handlers[t];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=Zge(t),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=r[i];a&&o!=!a.handlers.length&&(s.removeEventListener(i,this.handleEvent),a=null),a||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&jO.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),dt.android&&dt.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return dt.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=LO.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||e1e.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,th(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:dt.safari&&!dt.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 fC(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){Di(n.state,s)}}}function Zge(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(fC(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(fC(r.value,l))}}for(let r in Lo)n(r).handlers.push(Lo[r]);for(let r in xi)n(r).observers.push(xi[r]);return t}const LO=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],e1e="dthko",jO=[16,17,18,20,91,92,224,225],Kp=6;function Yp(e){return Math.max(0,e)*.7+8}function t1e(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class n1e{constructor(t,n,r,s){this.view=t,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=rO(t.contentDOM),this.atoms=t.state.facet(Hm).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(Bn.allowMultipleSelections)&&r1e(t,n),this.dragging=i1e(t,n)&&BO(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&&t1e(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,s=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Lk(this.view);t.clientX-l.left<=s+Kp?n=-Yp(s-t.clientX):t.clientX+l.right>=o-Kp&&(n=Yp(t.clientX-o)),t.clientY-l.top<=i+Kp?r=-Yp(i-t.clientY):t.clientY+l.bottom>=a-Kp&&(r=Yp(t.clientY-a)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,r=MO(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function r1e(e,t){let n=e.state.facet(fO);return n.length?n[0](t):dt.mac?t.metaKey:t.ctrlKey}function s1e(e,t){let n=e.state.facet(mO);return n.length?n[0](t):dt.mac?!t.altKey:!t.ctrlKey}function i1e(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=im(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function o1e(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Er.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const Lo=Object.create(null),xi=Object.create(null),DO=dt.ie&&dt.ie_version<15||dt.ios&&dt.webkit_version<604;function a1e(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(),OO(e,n.value)},50)}function Cb(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function OO(e,t){t=Cb(e.state,Mk,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(w3!=null&&n.selection.ranges.every(l=>l.empty)&&w3==i.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((o?i.line(s++).text:t)+n.lineBreak);return{changes:{from:u.from,insert:d},range:Oe.cursor(c.from+d.length)}})}else o?r=n.changeByRange(l=>{let c=i.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Oe.cursor(l.from+c.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}xi.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};xi.wheel=xi.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Lo.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);xi.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};xi.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Lo.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(pO))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=c1e(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new n1e(e,t,n,r)),r&&e.observer.ignore(()=>{sO(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function mC(e,t,n,r){if(r==1)return Oe.cursor(t,n);if(r==2)return $ge(e.state,t,n);{let s=e.docView.lineAt(t,n),i=e.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,Oe.range(o,a)}}const l1e=dt.ie&&dt.ie_version<=11;let pC=null,gC=0,yC=0;function BO(e){if(!l1e)return e.detail;let t=pC,n=yC;return pC=e,yC=Date.now(),gC=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(gC+1)%3:1}function c1e(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=BO(t),s=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,a){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=mC(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let d=mC(e,n.pos,n.assoc,r),f=Math.min(d.from,u.from),m=Math.max(d.to,u.to);u=f<u.from?Oe.range(f,m,u.assoc):Oe.range(m,f,u.assoc)}return o?s.replaceRange(s.main.extend(u.from,u.to,u.assoc)):a&&r==1&&s.ranges.length>1&&(c=u1e(s,l.pos))?c:a?s.addRange(u):Oe.create([u])}}}function u1e(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:s}=e.ranges[n];if(r<=t&&s>=t)return Oe.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}Lo.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.tile.nearest(t.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=Oe.range(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",Cb(e.state,Ik,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Lo.dragend=e=>(e.inputState.draggedContent=null,!1);function bC(e,t,n,r){if(n=Cb(e.state,Mk,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&s1e(e,t)?{from:i.from,to:i.to}:null,a={from:s,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Lo.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&bC(e,t,r.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)||(r[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return bC(e,t,r,!0),!0}return!1};Lo.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=DO?null:t.clipboardData;return n?(OO(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(a1e(e),!1)};function d1e(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function h1e(e){let t=[],n=[],r=!1;for(let s of e.selection.ranges)s.empty||(t.push(e.sliceDoc(s.from,s.to)),n.push(s));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>s&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Cb(e,Ik,t.join(e.lineBreak)),ranges:n,linewise:r}}let w3=null;Lo.copy=Lo.cut=(e,t)=>{if(!S0(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=h1e(e.state);if(!n&&!s)return!1;w3=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=DO?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(d1e(e,n),!1)};const PO=wl.define();function $O(e,t){let n=[];for(let r of e.facet(bO)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:PO.of(!0)}):null}function zO(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=$O(e.state,t);n?e.dispatch(n):e.update([])}},10)}xi.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),zO(e)};xi.blur=e=>{e.observer.clearSelectionRange(),zO(e)};xi.compositionstart=xi.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};xi.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,dt.chrome&&dt.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};xi.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Lo.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let a=o[0],l=e.posAtDOM(a.startContainer,a.startOffset),c=e.posAtDOM(a.endContainer,a.endOffset);return jk(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let s;if(dt.chrome&&dt.android&&(s=LO.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return dt.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),dt.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>xi.compositionend(e,t),20),!1};const vC=new Set;function f1e(e){vC.has(e)||(vC.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const wC=["pre-wrap","normal","pre-line","break-spaces"];let Ch=!1;function xC(){Ch=!1}class m1e{constructor(t){this.lineWrapping=t,this.doc=Cn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return wC.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r<t.length;r++){let s=t[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(t,n,r,s,i,o){let a=wC.indexOf(t)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class p1e{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Io{constructor(t,n,r,s,i){this.from=t,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?Js.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 $u?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 Io(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var sr=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(sr||(sr={}));const Ug=.001;class Zs{constructor(t,n,r=2){this.length=t,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Ug&&(Ch=!0),this.height=t)}replace(t,n,r){return Zs.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let i=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=s[a],f=i.lineAt(l,sr.ByPosNoHeight,r.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,sr.ByPosNoHeight,r,0,0);for(d+=m.to-c,c=m.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,u=s[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,sr.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let p=Dk.build(r.setDoc(o),t,u,d);i=uy(i,i.replace(l,c,p))}return i.updateHeight(r,0)}static empty(){return new Ii(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(i>s*2){let a=t[r];a.break?t.splice(r,1,a.left,null,a.right):t.splice(r,1,a.left,a.right),r+=2+a.break,i-=a.size}else break;else if(s<i){let a=t[n++];a&&(s+=a.size)}else{let a=t[--r];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,r++),new y1e(Zs.of(t.slice(0,n)),o,Zs.of(t.slice(r)))}}function uy(e,t){return e==t?e:(e.constructor!=t.constructor&&(Ch=!0),t)}Zs.prototype.size=1;const g1e=gn.replace({});class FO extends Zs{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new Io(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,r,s){return this.spaceAbove&&t<r+this.spaceAbove?new Io(s,0,r,this.spaceAbove,g1e):this.mainBlock(r,s)}lineAt(t,n,r,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(o):o}forEachLine(t,n,r,s,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,sr.ByPos,r,s,i))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ii extends FO{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new Io(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let s=r[0];return r.length==1&&(s instanceof Ii||s instanceof vs&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof vs?s=new Ii(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Zs.of(r)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class vs extends Zs{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,s=t.doc.lineAt(n+this.length).number,i=s-r+1,o,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:r,lastLine:s,perLine:o,perChar:a}}blockAt(t,n,r,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s);if(n.lineWrapping){let c=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,f=Math.max(r,t-d/2);return new Io(u.from,u.length,f,d,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-r)/a))),{from:u,length:d}=n.doc.line(i+c);return new Io(u,d,r+a*c,a,0)}}lineAt(t,n,r,s,i){if(n==sr.ByHeight)return this.blockAt(t,r,s,i);if(n==sr.ByPosNoHeight){let{from:m,to:p}=r.doc.lineAt(t);return new Io(m,p-m,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),c=r.doc.lineAt(t),u=a+c.length*l,d=c.number-o,f=s+a*d+l*(c.from-i-d);return new Io(c.from,c.length,Math.max(s,Math.min(f,s+this.height-u)),u,0)}forEachLine(t,n,r,s,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,i);for(let u=t,d=s;u<=n;){let f=r.doc.lineAt(u);if(u==t){let p=f.number-a;d+=l*p+c*(t-i-p)}let m=l+c*f.length;o(new Io(f.from,f.length,d,m,0)),d+=m,u=f.to+1}}replace(t,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof vs?r[r.length-1]=new vs(i.length+s):r.push(null,new vs(s-1))}if(t>0){let i=r[0];i instanceof vs?r[0]=new vs(t+i.length):r.unshift(new vs(t-1),null)}return Zs.of(r)}decomposeLeft(t,n){n.push(new vs(t-1),null)}decomposeRight(t,n){n.push(null,new vs(this.length-t-1))}updateHeight(t,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],a=Math.max(n,s.from),l=-1;for(s.from>n&&o.push(new vs(s.from-n-1).updateHeight(t,n));a<=i&&s.more;){let u=t.doc.lineAt(a).length;o.length&&o.push(null);let d=s.heights[s.index++],f=0;d<0&&(f=-d,d=s.heights[s.index++]),l==-1?l=d:Math.abs(d-l)>=Ug&&(l=-2);let m=new Ii(u,d,f);m.outdated=!1,o.push(m),a+=u+1}a<=i&&o.push(null,new vs(i-a).updateHeight(t,a));let c=Zs.of(o);return(l<0||Math.abs(c.height-this.height)>=Ug||Math.abs(l-this.heightMetrics(t,n).perLine)>=Ug)&&(Ch=!0),uy(this,c)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class y1e extends Zs{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,s){let i=r+this.left.height;return t<i?this.left.blockAt(t,n,r,s):this.right.blockAt(t,n,i,s+this.left.length+this.break)}lineAt(t,n,r,s,i){let o=s+this.left.height,a=i+this.left.length+this.break,l=n==sr.ByHeight?t<o:t<a,c=l?this.left.lineAt(t,n,r,s,i):this.right.lineAt(t,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==sr.ByPosNoHeight?sr.ByPosNoHeight:sr.ByPos;return l?c.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,s,i).join(c)}forEachLine(t,n,r,s,i,o){let a=s+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,r,s,i,o),n>=l&&this.right.forEachLine(t,n,r,a,l,o);else{let c=this.lineAt(l,sr.ByPos,r,s,i);t<c.from&&this.left.forEachLine(t,c.from-1,r,s,i,o),c.to>=t&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(t,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(t,n,r),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,n-s,r));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of r)i.push(a);if(t>0&&_C(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),_C(i,a)}return Zs.of(i)}decomposeLeft(t,n){let r=this.left.length;if(t<=r)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(r++,t>=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,s=r+this.break;if(t>=s)return this.right.decomposeRight(t-s,n);t<r&&this.left.decomposeRight(t,n),this.break&&t<s&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Zs.of(this.break?[t,null,n]:[t,n]):(this.left=uy(this.left,t),this.right=uy(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,r=!1,s){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return s&&s.from<=n+i.length&&s.more?l=i=i.updateHeight(t,n,r,s):i.updateHeight(t,n,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(t,a,r,s):o.updateHeight(t,a,r),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 _C(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof vs&&(r=e[t+1])instanceof vs&&e.splice(t-1,3,new vs(n.length+1+r.length))}const b1e=5;class Dk{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Ii?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ii(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-t;r.block?this.addBlock(new FO(o,s,r)):(o||i||s>=b1e)&&this.addLineDeco(s,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new Ii(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new vs(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ii)return t;let n=new Ii(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Ii)&&!this.isCovered?this.nodes.push(new Ii(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=t;for(let s of this.nodes)s instanceof Ii&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new Dk(r,t);return zn.spans(n,r,s,i,0),i.finish(r)}}function v1e(e,t,n){let r=new w1e;return zn.compare(e,t,n,r,0),r.changes}class w1e{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&eh(t,n,this.changes,5)}}function x1e(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(s.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let f=u.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?s.innerHeight:l,f.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.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 _1e(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 k1e(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class uv{constructor(t,n,r,s){this.from=t,this.to=n,this.size=r,this.displaySize=s}static same(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let s=t[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(t,n){return gn.replace({widget:new S1e(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class S1e extends Ca{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 kC{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=SC,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=dr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(Nk).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new m1e(r),this.stateDeco=TC(n),this.heightMap=Zs.empty().applyChanges(this.stateDeco,Cn.empty,this.heightOracle.setDoc(n.doc),[new fo(0,0,0,n.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=gn.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!t.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);t.push(new Xp(i,o))}}return this.viewports=t.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?SC:new Ok(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(Wf(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=TC(this.state);let s=t.changedRanges,i=fo.extendWithRanges(s,v1e(r,this.stateDeco,t?t.changes:es.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);xC(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Ch)&&(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(wO)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?dr.RTL:dr.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,u=0;if(a.width&&a.height){let{scaleX:C,scaleY:E}=nO(n,a);(C>.005&&Math.abs(this.scaleX-C)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=C,this.scaleY=E,c|=16,o=l=!0)}let d=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,c|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=16);let m=rO(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=iO(this.scrollParent||t.win);let y=(this.printing?k1e:x1e)(n,this.paddingTop),w=y.top-this.pixelViewport.top,b=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&&!_1e(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 C=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(C)&&(o=!0),o||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:M,textHeight:D}=t.docView.measureTextSize();o=E>0&&s.refresh(i,E,M,D,Math.max(5,x/M),C),o&&(t.docView.minWidth=0,c|=16)}w>0&&b>0?u=Math.max(w,b):w<0&&b<0&&(u=Math.min(w,b)),xC();for(let E of this.viewports){let M=E.from==this.viewport.from?C:t.docView.measureVisibleLineHeights(E);this.heightMap=(o?Zs.empty().applyChanges(this.stateDeco,Cn.empty,this.heightOracle,[new fo(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new p1e(E.from,M))}Ch&&(c|=2)}let S=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||S)&&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 r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Xp(s.lineAt(o-r*1e3,sr.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,sr.ByHeight,i,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=s.lineAt(c,sr.ByPos,i,0,0),f;n.y=="center"?f=(d.top+d.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=d.top:f=d.bottom-u,l=new Xp(s.lineAt(f-1e3/2,sr.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,sr.ByHeight,i,0,0).to)}}return l}mapViewport(t,n){let r=n.mapPos(t.from,-1),s=n.mapPos(t.to,1);return new Xp(this.heightMap.lineAt(r,sr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,sr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,sr.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,sr.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||s<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let r=[];for(let s of t)n.touchesRange(s.from,s.to)||r.push(new uv(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(t,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=dr.LTR&&!r)return[];let a=[],l=(u,d,f,m)=>{if(d-u<i)return;let p=this.state.selection.main,y=[p.from];p.empty||y.push(p.to);for(let b of y)if(b>u&&b<d){l(u,b-10,f,m),l(b+10,d,f,m);return}let w=C1e(t,b=>b.from>=f.from&&b.to<=f.to&&Math.abs(b.from-u)<i&&Math.abs(b.to-d)<i&&!y.some(v=>b.from<v&&b.to>v));if(!w){if(d<f.to&&n&&r&&n.visibleRanges.some(x=>x.from<=d&&x.to>=d)){let x=n.moveToLineBoundary(Oe.cursor(d),!1,!0).head;x>u&&(d=x)}let b=this.gapSize(f,u,d,m),v=r||b<2e6?b:2e6;w=new uv(u,d,b,v)}a.push(w)},c=u=>{if(u.length<o||u.type!=Js.Text)return;let d=T1e(u.from,u.to,this.stateDeco);if(d.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,m,p;if(r){let y=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,w,b;if(f!=null){let v=Jp(d,f),x=((this.visibleBottom-this.visibleTop)/2+y)/u.height;w=v-x,b=v+x}else w=(this.visibleTop-u.top-y)/u.height,b=(this.visibleBottom-u.top+y)/u.height;m=Qp(d,w),p=Qp(d,b)}else{let y=d.total*this.heightOracle.charWidth,w=s*this.heightOracle.charWidth,b=0;if(y>2e6)for(let E of t)E.from>=u.from&&E.from<u.to&&E.size!=E.displaySize&&E.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=E.size-E.displaySize);let v=this.pixelViewport.left+b,x=this.pixelViewport.right+b,S,C;if(f!=null){let E=Jp(d,f),M=((x-v)/2+w)/y;S=E-M,C=E+M}else S=(v-w)/y,C=(x+w)/y;m=Qp(d,S),p=Qp(d,C)}m>u.from&&l(u.from,m,u,d),p<u.to&&l(p,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(t,n,r,s){let i=Jp(s,r)-Jp(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){uv.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=gn.set(t.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];zn.spans(n,this.viewport.from,this.viewport.to,{span(i,o){r.push({from:i,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i<r.length&&!(s&8);i++){let o=this.visibleRanges[i],a=r[i];(o.from!=a.from||o.to!=a.to)&&(s|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||Wf(this.heightMap.lineAt(t,sr.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)||Wf(this.heightMap.lineAt(this.scaler.fromDOM(t),sr.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 Wf(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 Xp{constructor(t,n){this.from=t,this.to=n}}function T1e(e,t,n){let r=[],s=e,i=0;return zn.spans(n,e,t,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),i+=o-s),s=a}},20),s<t&&(r.push({from:s,to:t}),i+=t-s),{total:i,ranges:r}}function Qp({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let s=0;;s++){let{from:i,to:o}=t[s],a=o-i;if(r<=a)return i+r;r-=a}}function Jp(e,t){let n=0;for(let{from:r,to:s}of e.ranges){if(t<=s){n+=t-r;break}n+=s-r}return n/e.total}function C1e(e,t){for(let n of e)if(t(n))return n}const SC={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function TC(e){let t=e.facet(kb).filter(r=>typeof r!="function"),n=e.facet(Rk).filter(r=>typeof r!="function");return n.length&&t.push(zn.join(n)),t}class Ok{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,sr.ByPos,t,0,0).top,u=n.lineAt(l,sr.ByPos,t,0,0).bottom;return s+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);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,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return s+(t-r)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);r=i.bottom,s=i.domBottom}}fromDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return r+(t-s)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);r=i.bottom,s=i.domBottom}}eq(t){return t instanceof Ok?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,r)=>n.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}}function Wf(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Io(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>Wf(s,t)):e._content)}const Zp=Lt.define({combine:e=>e.join(" ")}),x3=Lt.define({combine:e=>e.indexOf(!0)>-1}),_3=Tc.newName(),UO=Tc.newName(),qO=Tc.newName(),HO={"&light":"."+UO,"&dark":"."+qO};function k3(e,t,n){return new Tc(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return e;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):e+" "+r}})}const A1e=k3("."+_3,{"&":{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"}},HO),E1e={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},dv=dt.ie&&dt.ie_version<=11;class M1e{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new ige,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(dt.ie&&dt.ie_version<=11||dt.ios&&t.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&dt.android&&t.constructor.EDIT_CONTEXT!==!1&&!(dt.chrome&&dt.chrome_version<126)&&(this.editContext=new N1e(t),t.state.facet(Ha)&&(t.contentDOM.editContext=this.editContext.editContext)),dv&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,r)=>n!=t[r]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Ha)?r.root.activeElement!=this.dom:!S0(this.dom,s))return;let i=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(dt.ie&&dt.ie_version<=11||dt.android&&dt.chrome)&&!r.state.selection.main.empty&&s.focusNode&&C0(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=im(t.root);if(!n)return!1;let r=dt.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&I1e(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=S0(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&age(this.dom,r)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(t,n){this.selectionRange.set(t.node,t.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==r?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,E1e),dv&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),dv&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&th(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&S0(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Kge(this.view,t,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=NO(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!cy(this.view.state.selection,n.newSel.main))&&this.view.update([]),s}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let r=CC(n,t.previousSibling||t.target.previousSibling,-1),s=CC(n,t.nextSibling||t.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Ha)!=t.state.facet(Ha)&&(t.view.contentDOM.editContext=t.state.facet(Ha)?this.editContext.editContext:null))}destroy(){var t,n,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function CC(e,t,n){for(;t;){let r=Er.get(t);if(r&&r.parent==e)return r;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function AC(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return C0(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function I1e(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return AC(e,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?AC(e,n):null}class N1e{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=r=>{let s=t.state.selection.main,{anchor:i,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let u=RO(t.state.sliceDoc(a,l),r.text,(c?s.from:s.to)-a,c?"end":null);if(!u){let f=Oe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));cy(f,s)||t.dispatch({selection:f,userEvent:"select"});return}let d={from:u.from+a,to:u.toA+a,insert:Cn.of(r.text.slice(u.from,u.toB).split(`
`))};if((dt.mac||dt.android)&&d.from==o-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:a,to:l,insert:Cn.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!t.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);jk(t,d,Oe.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),d.from<d.to&&!d.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.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,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.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 u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(gn.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:_O.of(gn.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(t.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=im(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,s=this.pendingContextChange;return t.changes.iterChanges((i,o,a,l,c)=>{if(r)return;let u=c.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),s&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let r=this.composing;return r&&r.drifted?r.editorBase+(t-r.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class St{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||oge(t.parent)||document,this.viewState=new kC(this,t.state||Bn.create(t)),t.scrollTo&&t.scrollTo.is(Gp)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Pd).map(s=>new iv(s));for(let s of this.plugins)s.update(this);this.observer=new M1e(this),this.inputState=new Jge(this),this.inputState.ensureHandlers(this.plugins),this.docView=new uC(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 ns?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let 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(PO))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=$O(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(Bn.phrases)!=this.state.facet(Bn.phrases))return this.setState(i);s=oy.create(this,i,t),s.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:m}=f.state.selection,{x:p,y}=this.state.facet(St.cursorScrollMargin);d=new nh(m.empty?m:Oe.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,p)}for(let m of f.effects)m.is(Gp)&&(d=m.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=dy.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Vf)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Zp)!=s.state.facet(Zp)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let f of this.state.facet(g3))try{f(s)}catch(m){Di(this.state,m,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!NO(this,u)&&c.force&&th(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 r of this.plugins)r.destroy(this);this.viewState=new kC(this,t),this.plugins=t.facet(Pd).map(r=>new iv(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new uC(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(Pd),r=t.state.facet(Pd);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new iv(i));else{let a=this.plugins[o];a.mustUpdate=t,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Di(this.state,r,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(iO(r||this.win))i=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(s);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 u=c.map(m=>{try{return m.read(this)}catch(p){return Di(this.state,p),EC}}),d=oy.create(this,this.state,[]),f=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),f=this.docView.update(d),f&&this.docViewUpdate());for(let m=0;m<c.length;m++)if(u[m]!=EC)try{let p=c[m];p.write&&p.write(u[m],this)}catch(p){Di(this.state,p)}if(f&&this.docView.updateSelection(!0),!d.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 p=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((p>1||p<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,r?r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(g3))a(n)}get themeClasses(){return _3+" "+(this.state.facet(x3)?qO:UO)+" "+this.state.facet(Zp)}updateAttrs(){let t=MC(this,kO,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ha)?"true":"false",class:"cm-content",style:`${dt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),MC(this,Nk,n);let r=this.observer.ignore(()=>{let s=sC(this.contentDOM,this.contentAttrs,n),i=sC(this.dom,this.editorAttrs,t);return s||i});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let s of r.effects)if(s.is(St.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Vf);let t=this.state.facet(St.cspNonce);Tc.mount(this.root,this.styleModules.concat(A1e).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(r=>r.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,r){return cv(this,t,dC(this,t,n,r))}moveByGroup(t,n){return cv(this,t,dC(this,t,n,r=>Uge(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),s=this.textDirectionAt(t.from),i=r[n?r.length-1:0];return Oe.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return Fge(this,t,n,r)}moveVertically(t,n,r){return cv(this,t,qge(this,t,n,r))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let r=v3(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),v3(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.docView.coordsAt(t,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(t),i=this.bidiSpans(s),o=i[ha.find(i,t-s.from,-1,n)];return om(r,o.dir==dr.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(vO)||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>R1e)return dO(t.length);let n=this.textDirectionAt(t.from),r;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||uO(i.isolates,r=aC(this,t))))return i.order;r||(r=aC(this,t));let s=mge(t.text,n,r);return this.bidiCache.push(new dy(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||dt.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{sO(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var r,s,i,o;return Gp.of(new nh(typeof t=="number"?Oe.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return Gp.of(new nh(Oe.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return wi.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return wi.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=Tc.newName(),s=[Zp.of(r),Vf.of(k3(`.${r}`,t))];return n&&n.dark&&s.push(x3.of(!0)),s}static baseTheme(t){return Zu.lowest(Vf.of(k3("."+_3,t,HO)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&Er.get(r)||Er.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}St.styleModule=Vf;St.inputHandler=yO;St.clipboardInputFilter=Mk;St.clipboardOutputFilter=Ik;St.scrollHandler=xO;St.focusChangeEffect=bO;St.perLineTextDirection=vO;St.exceptionSink=gO;St.updateListener=g3;St.editable=Ha;St.mouseSelectionStyle=pO;St.dragMovesSelection=mO;St.clickAddsSelectionRange=fO;St.decorations=kb;St.blockWrappers=SO;St.outerDecorations=Rk;St.atomicRanges=Hm;St.bidiIsolatedRanges=TO;St.cursorScrollMargin=Lt.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r=="number"?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}});St.scrollMargins=CO;St.darkTheme=x3;St.cspNonce=Lt.define({combine:e=>e.length?e[0]:""});St.contentAttributes=Nk;St.editorAttributes=kO;St.lineWrapping=St.contentAttributes.of({class:"cm-lineWrapping"});St.announce=Hn.define();const R1e=4096,EC={};class dy{constructor(t,n,r,s,i,o){this.from=t,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let r=[],s=t.length?t[t.length-1].dir:dr.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new dy(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function MC(e,t,n){for(let r=e.state.facet(t),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(e):i;o&&Ck(o,n)}return n}const L1e=dt.mac?"mac":dt.windows?"win":dt.linux?"linux":"key";function j1e(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,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))s=!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 s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function eg(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 D1e=Zu.default(St.domEventHandlers({keydown(e,t){return $1e(O1e(t.state),e,t,"editor")}})),lm=Lt.define({enables:D1e}),IC=new WeakMap;function O1e(e){let t=e.facet(lm),n=IC.get(t);return n||IC.set(t,n=P1e(t.reduce((r,s)=>r.concat(s),[]))),n}let Hl=null;const B1e=4e3;function P1e(e,t=L1e){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[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,u)=>{var d,f;let m=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(b=>j1e(b,t));for(let b=1;b<p.length;b++){let v=p.slice(0,b).join(" ");s(v,!0),m[v]||(m[v]={preventDefault:!0,stopPropagation:!1,run:[x=>{let S=Hl={view:x,prefix:v,scope:o};return setTimeout(()=>{Hl==S&&(Hl=null)},B1e),!0}]})}let y=p.join(" ");s(y,!1);let w=m[y]||(m[y]={preventDefault:!1,stopPropagation:!1,run:((f=(d=m._any)===null||d===void 0?void 0:d.run)===null||f===void 0?void 0:f.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let f in u)u[f].run.push(m=>d(m,S3))}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 S3=null;function $1e(e,t,n,r){S3=t;let s=Zpe(t),i=Dl(s,0),o=_d(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;Hl&&Hl.view==n&&Hl.scope==r&&(a=Hl.prefix+" ",jO.indexOf(t.keyCode)<0&&(c=!0,Hl=null));let d=new Set,f=w=>{if(w){for(let b of w.run)if(!d.has(b)&&(d.add(b),b(n)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},m=e[r],p,y;return m&&(f(m[a+eg(s,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(dt.windows&&t.ctrlKey&&t.altKey)&&!(dt.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Cc[t.keyCode])&&p!=s?(f(m[a+eg(p,t,!0)])||t.shiftKey&&(y=rm[t.keyCode])!=s&&y!=p&&f(m[a+eg(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(m[a+eg(s,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),S3=null,l}class Cu{constructor(t,n,r,s,i){this.className=t,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,r){if(r.empty){let s=t.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=VO(t);return[new Cu(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return z1e(t,n,r)}}function VO(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==dr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function NC(e,t,n,r){let s=e.coordsAtPos(t,n*2);if(!s)return r;let i=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),l=e.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function z1e(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),s=Math.min(n.to,e.viewport.to),i=e.textDirection==dr.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=VO(e),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=a.right-(u?parseInt(u.paddingRight):0),m=b3(e,r,1),p=b3(e,s,-1),y=m.type==Js.Text?m:null,w=p.type==Js.Text?p:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=NC(e,r,1,y)),w&&(e.lineWrapping||p.widgetLineBreaks)&&(w=NC(e,s,-1,w)),y&&w&&y.from==w.from&&y.to==w.to)return v(x(n.from,n.to,y));{let C=y?x(n.from,null,y):S(m,!1),E=w?x(null,n.to,w):S(p,!0),M=[];return(y||m).to<(w||p).from-(y&&w?1:0)||m.widgetLineBreaks>1&&C.bottom+e.defaultLineHeight/2<E.top?M.push(b(d,C.bottom,f,E.top)):C.bottom<E.top&&e.elementAtHeight((C.bottom+E.top)/2).type==Js.Text&&(C.bottom=E.top=(C.bottom+E.top)/2),v(C).concat(M).concat(v(E))}function b(C,E,M,D){return new Cu(t,C-l.left,E-l.top,Math.max(0,M-C),D-E)}function v({top:C,bottom:E,horizontal:M}){let D=[];for(let O=0;O<M.length;O+=2)D.push(b(M[O],C,M[O+1],E));return D}function x(C,E,M){let D=1e9,O=-1e9,A=[];function j(F,q,R,V,J){let ee=e.coordsAtPos(F,F==M.to?-2:2),N=e.coordsAtPos(R,R==M.from?2:-2);!ee||!N||(D=Math.min(ee.top,N.top,D),O=Math.max(ee.bottom,N.bottom,O),J==dr.LTR?A.push(i&&q?d:ee.left,i&&V?f:N.right):A.push(!i&&V?d:N.left,!i&&q?f:ee.right))}let I=C??M.from,P=E??M.to;for(let F of e.visibleRanges)if(F.to>I&&F.from<P)for(let q=Math.max(F.from,I),R=Math.min(F.to,P);;){let V=e.state.doc.lineAt(q);for(let J of e.bidiSpans(V)){let ee=J.from+V.from,N=J.to+V.from;if(ee>=R)break;N>q&&j(Math.max(ee,q),C==null&&ee<=I,Math.min(N,R),E==null&&N>=P,J.dir)}if(q=V.to+1,q>=R)break}return A.length==0&&j(I,C==null,P,E==null,e.textDirection),{top:D,bottom:O,horizontal:A}}function S(C,E){let M=a.top+(E?C.top:C.bottom);return{top:M,bottom:M,horizontal:[]}}}function F1e(e,t){return e.constructor==t.constructor&&e.eq(t)}class U1e{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(qg)!=t.state.facet(qg)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,r=t.facet(qg);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:n}=this.view;(t!=this.scaleX||n!=this.scaleY)&&(this.scaleX=t,this.scaleY=n,this.dom.style.transform=`scale(${1/t}, ${1/n})`)}draw(t){if(t.length!=this.drawn.length||t.some((n,r)=>!F1e(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of t)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=t,dt.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const qg=Lt.define();function WO(e){return[wi.define(t=>new U1e(t,e)),qg.of(e)]}const Ah=Lt.define({combine(e){return xb(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function q1e(e={}){return[Ah.of(e),H1e,V1e,W1e,wO.of(!0)]}function GO(e){return e.startState.facet(Ah)!=e.state.facet(Ah)}const H1e=WO({above:!0,markers(e){let{state:t}=e,n=t.facet(Ah),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&dt.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Oe.cursor(s.head,s.assoc);for(let l of Cu.forRange(e,o,a))r.push(l)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=GO(e);return n&&RC(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){RC(t.state,e)},class:"cm-cursorLayer"});function RC(e,t){t.style.animationDuration=e.facet(Ah).cursorBlinkRate+"ms"}const V1e=WO({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let s of r)if(!s.empty)for(let i of Cu.forRange(e,"cm-selectionBackground",s))t.push(i);if(dt.ios&&!n.empty&&e.state.facet(Ah).iosSelectionHandles){for(let s of Cu.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Oe.cursor(n.from,1)))t.push(s);for(let s of Cu.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Oe.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||GO(e)},class:"cm-selectionLayer"}),W1e=Zu.highest(St.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 LC(e,t,n,r,s){t.lastIndex=0;for(let i=e.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)s(o+a.index,a)}function G1e(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(e.state.doc.lineAt(s).from,s-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class K1e{constructor(t){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(a,l,c,u)=>s(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let d=r(a,l,c);d&&u(c,c+a[0].length,d)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new Pu,r=n.add.bind(n);for(let{from:s,to:i}of G1e(t,this.maxLength))LC(t.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,t,o,r));return n.finish()}updateDeco(t,n){let r=1e9,s=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),t.viewportMoved||s-r>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,n.map(t.changes),r,s):n}updateRange(t,n,r,s){for(let i of t.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=t.state.doc.lineAt(o),c=l.to<a?t.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),d=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){d=a;break}}let f=[],m,p=(y,w,b)=>f.push(b.range(y,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(m=this.regexp.exec(l.text))&&m.index<d-l.from;)this.addMatch(m,t,m.index+l.from,p);else LC(t.state.doc,this.regexp,u,d,(y,w)=>this.addMatch(w,t,y,p));n=n.update({filterFrom:u,filterTo:d,filter:(y,w)=>y<u||w>d,add:f})}}return n}}const T3=/x/.unicode!=null?"gu":"g",Y1e=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,T3),X1e={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 hv=null;function Q1e(){var e;if(hv==null&&typeof document<"u"&&document.body){let t=document.body.style;hv=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return hv||!1}const Hg=Lt.define({combine(e){let t=xb(e,{render:null,specialChars:Y1e,addSpecialChars:null});return(t.replaceTabs=!Q1e())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,T3)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,T3)),t}});function J1e(e={}){return[Hg.of(e),Z1e()]}let jC=null;function Z1e(){return jC||(jC=wi.fromClass(class{constructor(e){this.view=e,this.decorations=gn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Hg)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new K1e({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=Dl(t[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=Fm(o.text,a,r-o.from);return gn.replace({widget:new rye((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=gn.replace({widget:new nye(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Hg);e.startState.facet(Hg)!=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 eye="•";function tye(e){return e>=32?eye:e==10?"␤":String.fromCharCode(9216+e)}class nye extends Ca{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=tye(this.code),r=t.state.phrase("Control character")+" "+(X1e[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class rye extends Ca{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 sye extends Ca{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?T0(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=om(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function DC(e){let t=wi.fromClass(class{constructor(n){this.view=n,this.placeholder=e?gn.set([gn.widget({widget:new sye(e),side:1}).range(0)]):gn.none}get decorations(){return this.view.state.doc.length?gn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,St.contentAttributes.of({"aria-placeholder":e})]:t}const tg="-10000px";class iye{constructor(t,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(t,n){var r;let s=t.state.facet(this.facet),i=s.filter(l=>l);if(s===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],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let f=this.tooltips[d];f&&f.create==c.create&&(u=d)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let d=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),d.update&&d.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function oye(e={}){return Vg.of(e)}function aye(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Vg=Lt.define({combine:e=>{var t,n,r;return{position:dt.ios?"absolute":((t=e.find(s=>s.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=e.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||aye}}}),OC=new WeakMap,KO=wi.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(Vg);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 iye(e,YO,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Vg);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=tg,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(e=r.destroy)===null||e===void 0||e.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(dt.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=Lk(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let 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(Vg).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:r,scaleX:s,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:u}=c,d=e.pos[a],f=e.size[a];if(!d||l.clip!==!1&&(d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1)){u.style.top=tg;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,y=f.right-f.left,w=(t=OC.get(c))!==null&&t!==void 0?t:f.bottom-f.top,b=c.offset||cye,v=this.view.textDirection==dr.LTR,x=f.width>r.right-r.left?v?r.left:r.right-f.width:v?Math.max(r.left,Math.min(d.left-(m?14:0)+b.x,r.right-y)):Math.min(Math.max(r.left,d.left-y+(m?14:0)-b.x),r.right-y),S=this.above[a];!l.strictSide&&(S?d.top-w-p-b.y<r.top:d.bottom+w+p+b.y>r.bottom)&&S==r.bottom-d.bottom>d.top-r.top&&(S=this.above[a]=!S);let C=(S?d.top-r.top:r.bottom-d.bottom)-p;if(C<w&&c.resize!==!1){if(C<this.view.defaultLineHeight){u.style.top=tg;continue}OC.set(c,w),u.style.height=(w=C)/i+"px"}else u.style.height&&(u.style.height="");let E=S?d.top-w-p-b.y:d.bottom+p+b.y,M=x+y;if(c.overlap!==!0)for(let D of o)D.left<M&&D.right>x&&D.top<E+w&&D.bottom>E&&(E=S?D.top-w-2-p:D.bottom+p+2);if(this.position=="absolute"?(u.style.top=(E-e.parent.top)/i+"px",BC(u,(x-e.parent.left)/s)):(u.style.top=E/i+"px",BC(u,x/s)),m){let D=d.left+(v?b.x:-b.x)-(x+14-7);m.style.left=D/s+"px"}c.overlap!==!0&&o.push({left:x,top:E,right:M,bottom:E+w}),u.classList.toggle("cm-tooltip-above",S),u.classList.toggle("cm-tooltip-below",!S),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=tg}},{eventObservers:{scroll(){this.maybeMeasure()}}});function BC(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const lye=St.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"}}}),cye={x:0,y:0},YO=Lt.define({enables:[KO,lye]});function XO(e,t){let n=e.plugin(KO);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}class Eh extends Sc{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Eh.prototype.elementClass="";Eh.prototype.toDOM=void 0;Eh.prototype.mapMode=Li.TrackBefore;Eh.prototype.startSide=Eh.prototype.endSide=-1;Eh.prototype.point=!0;const uye=1024;let dye=0;class fv{constructor(t,n){this.from=t,this.to=n}}class kn{constructor(t={}){this.id=dye++,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=_o.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}kn.closedBy=new kn({deserialize:e=>e.split(" ")});kn.openedBy=new kn({deserialize:e=>e.split(" ")});kn.group=new kn({deserialize:e=>e.split(" ")});kn.isolate=new kn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});kn.contextHash=new kn({perNode:!0});kn.lookAhead=new kn({perNode:!0});kn.mounted=new kn({perNode:!0});class E0{constructor(t,n,r,s=!1){this.tree=t,this.overlay=n,this.parser=r,this.bracketed=s}static get(t){return t&&t.props&&t.props[kn.mounted.id]}}const hye=Object.create(null);class _o{constructor(t,n,r,s=0){this.name=t,this.props=n,this.id=r,this.flags=s}static define(t){let n=t.props&&t.props.length?Object.create(null):hye,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new _o(t.name||"",n,t.id,r);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(kn.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let s of r.split(" "))n[s]=t[r];return r=>{for(let s=r.prop(kn.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}_o.none=new _o("",Object.create(null),0,8);const ng=new WeakMap,PC=new WeakMap;var Nr;(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"})(Nr||(Nr={}));class Ss{constructor(t,n,r,s,i){if(this.type=t,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=E0.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new A3(this.topNode,t)}cursorAt(t,n=0,r=0){let s=ng.get(this)||this.topNode,i=new A3(s);return i.moveTo(t,n),ng.set(this,i._tree),i}get topNode(){return new bo(this,0,0,null)}resolve(t,n=0){let r=cm(ng.get(this)||this.topNode,t,n,!1);return ng.set(this,r),r}resolveInner(t,n=0){let r=cm(PC.get(this)||this.topNode,t,n,!0);return PC.set(this,r),r}resolveStack(t,n=0){return pye(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,a=(o&Nr.IncludeAnonymous)>0;for(let l=this.cursor(o|Nr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(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:$k(_o.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Ss(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new Ss(_o.none,n,r,s)))}static build(t){return gye(t)}}Ss.empty=new Ss(_o.none,[],[],0);class Bk{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 Bk(this.buffer,this.index)}}class Ec{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return _o.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],r=this.buffer[t+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),t+=4,r==t)return i;let o=[];for(;t<r;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=t;l!=n&&!(QO(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(t,n,r){let s=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let c=i[l++]=s[a++]-r;i[l++]=s[a++]-t,o=Math.max(o,c)}return new Ec(i,o,this.set)}}function QO(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function cm(e,t,n,r){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!r&&e instanceof bo&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:Nr.IgnoreOverlays;if(r)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof bo&&o.index<0&&((s=a.enter(t,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class JO{cursor(t=0){return new A3(this,t)}getChild(t,n=null,r=null){let s=$C(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return $C(this,t,n,r)}resolve(t,n=0){return cm(this,t,n,!1)}resolveInner(t,n=0){return cm(this,t,n,!0)}matchContext(t){return C3(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class bo extends JO{constructor(t,n,r,s){super(),this._tree=t,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,s,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;t!=c;t+=n){let u=a[t],d=l[t]+o.from,f;if(!(!(i&Nr.EnterBracketed&&u instanceof Ss&&(f=E0.get(u))&&!f.overlay&&f.bracketed&&r>=d&&r<=d+u.length)&&!QO(s,r,d,d+u.length))){if(u instanceof Ec){if(i&Nr.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,n,r-d,s);if(m>-1)return new ec(new fye(o,u,t,d),null,m)}else if(i&Nr.IncludeAnonymous||!u.type.isAnonymous||Pk(u)){let m;if(!(i&Nr.IgnoreMounts)&&(m=E0.get(u))&&!m.overlay)return new bo(m.tree,d,t,o);let p=new bo(u,d,t,o);return i&Nr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&Nr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,r=0){let s;if(!(r&Nr.IgnoreOverlays)&&(s=E0.get(this._tree))&&s.overlay){let i=t-this.from,o=r&Nr.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new bo(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function $C(e,t,n,r){let s=e.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(t)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function C3(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class fye{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class ec extends JO{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.context.start,r);return i<0?null:new ec(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,r=0){if(r&Nr.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new ec(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 ec(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 ec(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];t.push(r.slice(s,i,o)),n.push(0)}return new Ss(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ZO(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let r=n instanceof bo&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new mye(s,n)}class mye{constructor(t,n){this.heads=t,this.node=n}get next(){return ZO(this.heads)}}function pye(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof bo?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(t,n)),i=o}else{let o=E0.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new bo(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(cm(a,t,n,!1))}}return s?ZO(s):r}class A3{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&~Nr.EnterBracketed,t instanceof bo)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[t]],this.from=r+s.buffer[t+1],this.to=r+s.buffer[t+2],!0}yield(t){return t?t instanceof bo?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,r=this.mode){return this.buffer?r&Nr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Nr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Nr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:s}=this;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+t,o=t<0?-1:r._tree.children.length;i!=o;i+=t){let a=r._tree.children[i];if(this.mode&Nr.IncludeAnonymous||a instanceof Ec||!a.type.isAnonymous||Pk(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,r=0;if(t&&t.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new ec(this.buffer,n,this.stack[s]);return this.bufferNode=new ec(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(t){if(!this.buffer)return C3(this.node.parent,t);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=t.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return C3(this._tree,t,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[s]&&t[s]!=o.name)return!1;s--}}return!0}}function Pk(e){return e.children.some(t=>t instanceof Ec||!t.type.isAnonymous||Pk(t))}function gye(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=uye,reused:i=[],minRepeatType:o=r.types.length}=e,a=Array.isArray(n)?new Bk(n,n.length):n,l=r.types,c=0,u=0;function d(C,E,M,D,O,A){let{id:j,start:I,end:P,size:F}=a,q=u,R=c;if(F<0)if(a.next(),F==-1){let G=i[j];M.push(G),D.push(I-C);return}else if(F==-3){c=j;return}else if(F==-4){u=j;return}else throw new RangeError(`Unrecognized record size: ${F}`);let V=l[j],J,ee,N=I-C;if(P-I<=s&&(ee=w(a.pos-E,O))){let G=new Uint16Array(ee.size-ee.skip),B=a.pos-ee.size,k=G.length;for(;a.pos>B;)k=b(ee.start,G,k);J=new Ec(G,P-ee.start,r),N=ee.start-C}else{let G=a.pos-F;a.next();let B=[],k=[],Q=j>=o?j:-1,ce=0,pe=P;for(;a.pos>G;)Q>=0&&a.id==Q&&a.size>=0?(a.end<=pe-s&&(p(B,k,I,ce,a.end,pe,Q,q,R),ce=B.length,pe=a.end),a.next()):A>2500?f(I,G,B,k):d(I,G,B,k,Q,A+1);if(Q>=0&&ce>0&&ce<B.length&&p(B,k,I,ce,I,pe,Q,q,R),B.reverse(),k.reverse(),Q>-1&&ce>0){let be=m(V,R);J=$k(V,B,k,0,B.length,0,P-I,be,be)}else J=y(V,B,k,P-I,q-P,R)}M.push(J),D.push(N)}function f(C,E,M,D){let O=[],A=0,j=-1;for(;a.pos>E;){let{id:I,start:P,end:F,size:q}=a;if(q>4)a.next();else{if(j>-1&&P<j)break;j<0&&(j=F-s),O.push(I,P,F),A++,a.next()}}if(A){let I=new Uint16Array(A*4),P=O[O.length-2];for(let F=O.length-3,q=0;F>=0;F-=3)I[q++]=O[F],I[q++]=O[F+1]-P,I[q++]=O[F+2]-P,I[q++]=q;M.push(new Ec(I,O[2]-P,r)),D.push(P-C)}}function m(C,E){return(M,D,O)=>{let A=0,j=M.length-1,I,P;if(j>=0&&(I=M[j])instanceof Ss){if(!j&&I.type==C&&I.length==O)return I;(P=I.prop(kn.lookAhead))&&(A=D[j]+I.length+P)}return y(C,M,D,O,A,E)}}function p(C,E,M,D,O,A,j,I,P){let F=[],q=[];for(;C.length>D;)F.push(C.pop()),q.push(E.pop()+M-O);C.push(y(r.types[j],F,q,A-O,I-A,P)),E.push(O-M)}function y(C,E,M,D,O,A,j){if(A){let I=[kn.contextHash,A];j=j?[I].concat(j):[I]}if(O>25){let I=[kn.lookAhead,O];j=j?[I].concat(j):[I]}return new Ss(C,E,M,D,j)}function w(C,E){let M=a.fork(),D=0,O=0,A=0,j=M.end-s,I={size:0,start:0,skip:0};e:for(let P=M.pos-C;M.pos>P;){let F=M.size;if(M.id==E&&F>=0){I.size=D,I.start=O,I.skip=A,A+=4,D+=4,M.next();continue}let q=M.pos-F;if(F<0||q<P||M.start<j)break;let R=M.id>=o?4:0,V=M.start;for(M.next();M.pos>q;){if(M.size<0)if(M.size==-3||M.size==-4)R+=4;else break e;else M.id>=o&&(R+=4);M.next()}O=V,D+=F,A+=R}return(E<0||D==C)&&(I.size=D,I.start=O,I.skip=A),I.size>4?I:void 0}function b(C,E,M){let{id:D,start:O,end:A,size:j}=a;if(a.next(),j>=0&&D<o){let I=M;if(j>4){let P=a.pos-(j-4);for(;a.pos>P;)M=b(C,E,M)}E[--M]=I,E[--M]=A-C,E[--M]=O-C,E[--M]=D}else j==-3?c=D:j==-4&&(u=D);return M}let v=[],x=[];for(;a.pos>0;)d(e.start||0,e.bufferStart||0,v,x,-1,0);let S=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new Ss(l[e.topID],v.reverse(),x.reverse(),S)}const zC=new WeakMap;function Wg(e,t){if(!e.isAnonymous||t instanceof Ec||t.type!=e)return 1;let n=zC.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Ss)){n=1;break}n+=Wg(e,r)}zC.set(t,n)}return n}function $k(e,t,n,r,s,i,o,a,l){let c=0;for(let p=r;p<s;p++)c+=Wg(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],f=[];function m(p,y,w,b,v){for(let x=w;x<b;){let S=x,C=y[x],E=Wg(e,p[x]);for(x++;x<b;x++){let M=Wg(e,p[x]);if(E+M>=u)break;E+=M}if(x==S+1){if(E>u){let M=p[S];m(M.children,M.positions,0,M.children.length,y[S]+v);continue}d.push(p[S])}else{let M=y[x-1]+p[x-1].length-C;d.push($k(e,p,y,S,x,C,M,null,l))}f.push(C+v-i)}}return m(t,n,r,s,0),(a||l)(d,f,o)}class Au{constructor(t,n,r,s,i=!1,o=!1){this.from=t,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let s=[new Au(0,t.length,t,0,!1,r)];for(let i of n)i.to>t.length&&s.push(i);return s}static applyChanges(t,n,r=128){if(!n.length)return t;let s=[],i=1,o=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;o&&o.from<d;){let f=o;if(l>=f.from||d<=f.to||c){let m=Math.max(f.from,l)-c,p=Math.min(f.to,d)-c;f=m>=p?null:new Au(m,p,f.tree,f.offset+c,a>0,!!u)}if(f&&s.push(f),o.to>d)break;o=i<t.length?t[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class yye{startParse(t,n,r){return typeof t=="string"&&(t=new bye(t)),r=r?r.length?r.map(s=>new fv(s.from,s.to)):[new fv(0,0)]:[new fv(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let s=this.startParse(t,n,r);for(;;){let i=s.advance();if(i)return i}}}class bye{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 kn({perNode:!0});let vye=0;class oo{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=vye++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof oo&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new oo(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(t){let n=new hy(t);return r=>r.modified.indexOf(n)>-1?r:hy.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let wye=0;class hy{constructor(t){this.name=t,this.instances=[],this.id=wye++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(a=>a.base==t&&xye(n,a.modified));if(r)return r;let s=[],i=new oo(t.name,s,t,n);for(let a of n)a.instances.push(i);let o=_ye(n);for(let a of t.set)if(!a.modified.length)for(let l of o)s.push(hy.get(a,l));return i}}function xye(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function _ye(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,s=t.length;r<s;r++)t.push(t[r].concat(e[n]));return t.sort((n,r)=>r.length-n.length)}function kye(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let d=0;;){if(a=="..."&&d>0&&d+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==s.length)break;let m=s[d++];if(d==s.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+s);a=s.slice(d)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new um(r,o,l>0?i.slice(0,l):null);t[c]=u.sort(t[c])}}return eB.add(t)}const eB=new kn({combine(e,t){let n,r,s;for(;e||t;){if(!e||t&&e.depth>=t.depth?(s=t,t=t.next):(s=e,e=e.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new um(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class um{constructor(t,n,r,s){this.tags=t,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}um.empty=new um([],2,null);function tB(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=t||{};return{style:i=>{let o=s;for(let 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:r}}function Sye(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function Tye(e,t,n,r=0,s=e.length){let i=new Cye(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class Cye{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,r,s,i){let{type:o,from:a,to:l}=t;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(m=>!m.scope||m.scope(o)));let c=s,u=Aye(t)||um.empty,d=Sye(i,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(n,a),c),u.opaque)return;let f=t.tree&&t.tree.prop(kn.mounted);if(f&&f.overlay){let m=t.node.enter(f.overlay[0].from+a,1),p=this.highlighters.filter(w=>!w.scope||w.scope(f.tree.type)),y=t.firstChild();for(let w=0,b=a;;w++){let v=w<f.overlay.length?f.overlay[w]:null,x=v?v.from+a:l,S=Math.max(n,b),C=Math.min(r,x);if(S<C&&y)for(;t.from<C&&(this.highlightRange(t,S,C,s,i),this.startSpan(Math.min(C,t.to),c),!(t.to>=x||!t.nextSibling())););if(!v||x>r)break;b=v.to+a,b>n&&(this.highlightRange(m.cursor(),Math.max(n,v.from+a),Math.min(r,b),"",p),this.startSpan(Math.min(r,b),c))}y&&t.parent()}else if(t.firstChild()){f&&(s="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,s,i),this.startSpan(Math.min(r,t.to),c)}while(t.nextSibling());t.parent()}}}function Aye(e){let t=e.type.prop(eB);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ye=oo.define,rg=Ye(),Ol=Ye(),FC=Ye(Ol),UC=Ye(Ol),Bl=Ye(),sg=Ye(Bl),mv=Ye(Bl),ta=Ye(),Jc=Ye(ta),Qo=Ye(),Jo=Ye(),E3=Ye(),Mf=Ye(E3),ig=Ye(),it={comment:rg,lineComment:Ye(rg),blockComment:Ye(rg),docComment:Ye(rg),name:Ol,variableName:Ye(Ol),typeName:FC,tagName:Ye(FC),propertyName:UC,attributeName:Ye(UC),className:Ye(Ol),labelName:Ye(Ol),namespace:Ye(Ol),macroName:Ye(Ol),literal:Bl,string:sg,docString:Ye(sg),character:Ye(sg),attributeValue:Ye(sg),number:mv,integer:Ye(mv),float:Ye(mv),bool:Ye(Bl),regexp:Ye(Bl),escape:Ye(Bl),color:Ye(Bl),url:Ye(Bl),keyword:Qo,self:Ye(Qo),null:Ye(Qo),atom:Ye(Qo),unit:Ye(Qo),modifier:Ye(Qo),operatorKeyword:Ye(Qo),controlKeyword:Ye(Qo),definitionKeyword:Ye(Qo),moduleKeyword:Ye(Qo),operator:Jo,derefOperator:Ye(Jo),arithmeticOperator:Ye(Jo),logicOperator:Ye(Jo),bitwiseOperator:Ye(Jo),compareOperator:Ye(Jo),updateOperator:Ye(Jo),definitionOperator:Ye(Jo),typeOperator:Ye(Jo),controlOperator:Ye(Jo),punctuation:E3,separator:Ye(E3),bracket:Mf,angleBracket:Ye(Mf),squareBracket:Ye(Mf),paren:Ye(Mf),brace:Ye(Mf),content:ta,heading:Jc,heading1:Ye(Jc),heading2:Ye(Jc),heading3:Ye(Jc),heading4:Ye(Jc),heading5:Ye(Jc),heading6:Ye(Jc),contentSeparator:Ye(ta),list:Ye(ta),quote:Ye(ta),emphasis:Ye(ta),strong:Ye(ta),link:Ye(ta),monospace:Ye(ta),strikethrough:Ye(ta),inserted:Ye(),deleted:Ye(),changed:Ye(),invalid:Ye(),meta:ig,documentMeta:Ye(ig),annotation:Ye(ig),processingInstruction:Ye(ig),definition:oo.defineModifier("definition"),constant:oo.defineModifier("constant"),function:oo.defineModifier("function"),standard:oo.defineModifier("standard"),local:oo.defineModifier("local"),special:oo.defineModifier("special")};for(let e in it){let t=it[e];t instanceof oo&&(t.name=e)}tB([{tag:it.link,class:"tok-link"},{tag:it.heading,class:"tok-heading"},{tag:it.emphasis,class:"tok-emphasis"},{tag:it.strong,class:"tok-strong"},{tag:it.keyword,class:"tok-keyword"},{tag:it.atom,class:"tok-atom"},{tag:it.bool,class:"tok-bool"},{tag:it.url,class:"tok-url"},{tag:it.labelName,class:"tok-labelName"},{tag:it.inserted,class:"tok-inserted"},{tag:it.deleted,class:"tok-deleted"},{tag:it.literal,class:"tok-literal"},{tag:it.string,class:"tok-string"},{tag:it.number,class:"tok-number"},{tag:[it.regexp,it.escape,it.special(it.string)],class:"tok-string2"},{tag:it.variableName,class:"tok-variableName"},{tag:it.local(it.variableName),class:"tok-variableName tok-local"},{tag:it.definition(it.variableName),class:"tok-variableName tok-definition"},{tag:it.special(it.variableName),class:"tok-variableName2"},{tag:it.definition(it.propertyName),class:"tok-propertyName tok-definition"},{tag:it.typeName,class:"tok-typeName"},{tag:it.namespace,class:"tok-namespace"},{tag:it.className,class:"tok-className"},{tag:it.macroName,class:"tok-macroName"},{tag:it.propertyName,class:"tok-propertyName"},{tag:it.operator,class:"tok-operator"},{tag:it.comment,class:"tok-comment"},{tag:it.meta,class:"tok-meta"},{tag:it.invalid,class:"tok-invalid"},{tag:it.punctuation,class:"tok-punctuation"}]);var pv;const Gf=new kn,Eye=new kn;class fa{constructor(t,n,r=[],s=""){this.data=t,this.name=s,Bn.prototype.hasOwnProperty("tree")||Object.defineProperty(Bn.prototype,"tree",{get(){return jo(this)}}),this.parser=n,this.extension=[Ih.of(this),Bn.languageData.of((i,o,a)=>{let l=qC(i,o,a),c=l.type.prop(Gf);if(!c)return[];let u=i.facet(c),d=l.type.prop(Eye);if(d){let f=l.resolve(o-l.from,a);for(let m of d)if(m.test(f,i)){let p=i.facet(m.facet);return m.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(t,n,r=-1){return qC(t,n,r).type.prop(Gf)==this.data}findRegions(t){let n=t.facet(Ih);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(Gf)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(kn.mounted);if(a){if(a.tree.prop(Gf)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof Ss&&s(c,i.positions[l]+o)}};return s(jo(t),0),r}get allowsNesting(){return!0}}fa.setState=Hn.define();function qC(e,t,n){let r=e.facet(Ih),s=jo(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,Nr.ExcludeBuffers|Nr.EnterBracketed))i.type.isTop&&(s=i);return s}function jo(e){let t=e.field(fa.state,!1);return t?t.tree:Ss.empty}class Mye{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let r=this.cursorPos-this.string.length;return t<r||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-r,n-r)}}let If=null;class fy{constructor(t,n,r=[],s,i,o,a,l){this.parser=t,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new fy(t,n,[],Ss.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Mye(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Ss.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Au.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Au.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=If;If=this;try{return t()}finally{If=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=HC(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,u,d,f)=>l.push({fromA:c,toA:u,fromB:d,toB:f})),r=Au.applyChanges(r,l),s=Ss.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 u=t.mapPos(c.from,1),d=t.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new fy(this.parser,n,r,s,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 r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<t.to&&i>t.from&&(this.fragments=HC(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends yye{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=If;if(l){for(let c of s)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new Ss(_o.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 If}}function HC(e,t,n){return Au.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Mh{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Mh(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=fy.create(t.facet(Ih).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Mh(r)}}fa.state=Ta.define({create:Mh.init,update(e,t){for(let n of t.effects)if(n.is(fa.setState))return n.value;return t.startState.facet(Ih)!=t.state.facet(Ih)?Mh.init(t.state):e.apply(t)}});let nB=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(nB=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const gv=typeof navigator<"u"&&(!((pv=navigator.scheduling)===null||pv===void 0)&&pv.isInputPending)?()=>navigator.scheduling.isInputPending():null,Iye=wi.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(fa.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(fa.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=nB(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,i=r.field(fa.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!gv?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>gv&&gv()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:fa.setState.of(new Mh(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=>Di(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()}}}),Ih=Lt.define({combine(e){return e.length?e[0]:null},enables:e=>[fa.state,Iye,St.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),Nye=Lt.define(),zk=Lt.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 my(e){let t=e.facet(zk);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function py(e,t){let n="",r=e.tabSize,s=e.facet(zk)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function rB(e,t){e instanceof Bn&&(e=new Ab(e));for(let r of e.state.facet(Nye)){let s=r(e,t);if(s!==void 0)return s}let n=jo(e.state);return n.length>=t?Lye(e,n,t):null}class Ab{constructor(t,n={}){this.state=t,this.options=n,this.unit=my(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==t?{text:"",from:t}:(n<0?s<t:s<=t)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(t,n);return r.slice(t-s,Math.min(r.length,t+100-s))}column(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.countColumn(r,t-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(t,n=t.length){return Fm(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Rye=new kn;function Lye(e,t,n){let r=t.resolveStack(n),s=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return sB(r,e,n)}function sB(e,t,n){for(let r=e;r;r=r.next){let s=Dye(r.node);if(s)return s(Fk.create(t,n,r))}return 0}function jye(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Dye(e){let t=e.type.prop(Rye);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(kn.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>$ye(o,!0,1,void 0,i&&!jye(o)?s.from:void 0)}return e.parent==null?Oye:null}function Oye(){return 0}class Fk extends Ab{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new Fk(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Bye(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return sB(this.context.next,this.base,this.pos)}}function Bye(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Pye(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=t.childAfter(a);if(!l||l==r)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 $ye(e,t,n,r,s){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==e.pos+o,l=Pye(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}class Eb{constructor(t,n){this.specs=t;let r;function s(a){let l=Tc.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof fa?a=>a.prop(Gf)==o.data:o?a=>a==o:void 0,this.style=tB(t.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new Tc(r):null,this.themeType=n.themeType}static define(t,n){return new Eb(t,n||{})}}const M3=Lt.define(),iB=Lt.define({combine(e){return e.length?[e[0]]:null}});function yv(e){let t=e.facet(M3);return t.length?t:e.facet(iB)}function zye(e,t){let n=[Uye],r;return e instanceof Eb&&(e.module&&n.push(St.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(iB.of(e)):r?n.push(M3.computeN([St.darkTheme],s=>s.facet(St.darkTheme)==(r=="dark")?[e]:[])):n.push(M3.of(e)),n}class Fye{constructor(t){this.markCache=Object.create(null),this.tree=jo(t.state),this.decorations=this.buildDeco(t,yv(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=jo(t.state),r=yv(t.state),s=r!=yv(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return gn.none;let r=new Pu;for(let{from:s,to:i}of t.visibleRanges)Tye(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=gn.mark({class:l})))},s,i);return r.finish()}}const Uye=Zu.high(wi.fromClass(Fye,{decorations:e=>e.decorations})),qye=Eb.define([{tag:it.meta,color:"#404740"},{tag:it.link,textDecoration:"underline"},{tag:it.heading,textDecoration:"underline",fontWeight:"bold"},{tag:it.emphasis,fontStyle:"italic"},{tag:it.strong,fontWeight:"bold"},{tag:it.strikethrough,textDecoration:"line-through"},{tag:it.keyword,color:"#708"},{tag:[it.atom,it.bool,it.url,it.contentSeparator,it.labelName],color:"#219"},{tag:[it.literal,it.inserted],color:"#164"},{tag:[it.string,it.deleted],color:"#a11"},{tag:[it.regexp,it.escape,it.special(it.string)],color:"#e40"},{tag:it.definition(it.variableName),color:"#00f"},{tag:it.local(it.variableName),color:"#30a"},{tag:[it.typeName,it.namespace],color:"#085"},{tag:it.className,color:"#167"},{tag:[it.special(it.variableName),it.macroName],color:"#256"},{tag:it.definition(it.propertyName),color:"#00c"},{tag:it.comment,color:"#940"},{tag:it.invalid,color:"#f00"}]),Hye=1e4,Vye="()[]{}",Wye=new kn;function I3(e,t,n){let r=e.prop(t<0?kn.openedBy:kn.closedBy);if(r)return r;if(e.name.length==1){let s=n.indexOf(e.name);if(s>-1&&s%2==(t<0?1:0))return[n[s+t]]}return null}function N3(e){let t=e.type.prop(Wye);return t?t(e.node):e}function $d(e,t,n,r={}){let s=r.maxScanDistance||Hye,i=r.brackets||Vye,o=jo(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=I3(l.type,n,i);if(c&&l.from<l.to){let u=N3(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return Gye(e,t,n,l,u,c,i)}}return Kye(e,t,n,o,a.type,s,i)}function Gye(e,t,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let d=N3(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(I3(u.type,n,o))c++;else if(I3(u.type,-n,o)){if(c==0){let d=N3(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function Kye(e,t,n,r,s,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},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let f=0;!u.next().done&&f<=i;){let m=u.value;n<0&&(f+=m.length);let p=t+f*n;for(let y=n>0?0:m.length-1,w=n>0?m.length:-1;y!=w;y+=n){let b=o.indexOf(m[y]);if(!(b<0||r.resolveInner(p+y,1).type!=s))if(b%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+y,to:p+y+1},matched:b>>1==l>>1};d--}}n>0&&(f+=m.length)}return u.done?{start:c,matched:!1}:null}const Yye=Object.create(null),VC=[_o.none],WC=[],GC=Object.create(null),Xye=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"]])Xye[e]=Qye(Yye,t);function bv(e,t){WC.indexOf(e)>-1||(WC.push(e),console.warn(t))}function Qye(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let u=e[c]||it[c];u?typeof u=="function"?l.length?l=l.map(u):bv(c,`Modifier ${c} used at start of tag`):l.length?bv(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:bv(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=GC[s];if(i)return i.id;let o=GC[s]=_o.define({id:VC.length,name:r,props:[kye({[r]:n})]});return VC.push(o),o.id}dr.RTL,dr.LTR;const Jye=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=qk(e.state,n.from);return r.line?Zye(e):r.block?tbe(e):!1};function Uk(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const Zye=Uk(sbe,0),ebe=Uk(oB,0),tbe=Uk((e,t)=>oB(e,t,rbe(t)),0);function qk(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Nf=50;function nbe(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-Nf,r),o=e.sliceDoc(s,s+Nf),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:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,d;s-r<=2*Nf?u=d=e.sliceDoc(r,s):(u=e.sliceDoc(r,r+Nf),d=e.sliceDoc(s-Nf,s));let f=/^\s*/.exec(u)[0].length,m=/\s*$/.exec(d)[0].length,p=d.length-m-n.length;return u.slice(f,f+t.length)==t&&d.slice(p,p+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(u.charAt(f+t.length))?1:0},close:{pos:s-m-n.length,margin:/\s/.test(d.charAt(p-1))?1:0}}:null}function rbe(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function oB(e,t,n=t.selection.ranges){let r=n.map(i=>qk(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>nbe(t,r[o],i.from,i.to));if(e!=2&&!s.every(i=>i))return{changes:t.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function sbe(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let d=t.doc.lineAt(u);if(c==null&&(c=qk(t,d.from).line,!c))continue e;if(d.from>s&&(i==o||o>d.from)){s=d.from;let f=/^\s*/.exec(d.text)[0].length,m=f==d.length,p=d.text.slice(f,f+c.length)==c?f:-1;f<d.text.length&&f<l&&(l=f),r.push({line:d,comment:p,token:c,indent:f,empty:m,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(e!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&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&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const R3=wl.define(),ibe=wl.define(),obe=Lt.define(),aB=Lt.define({combine(e){return xb(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),lB=Ta.define({create(){return ma.empty},update(e,t){let n=t.state.facet(aB),r=t.annotation(R3);if(r){let l=gi.fromTransaction(t,r.selection),c=r.side,u=c==0?e.undone:e.done;return l?u=gy(u,u.length,n.minDepth,l):u=hB(u,t.startState.selection),new ma(c==0?r.rest:u,c==0?u:r.rest)}let s=t.annotation(ibe);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(ns.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=gi.fromTransaction(t),o=t.annotation(ns.time),a=t.annotation(ns.userEvent);return i?e=e.addChanges(i,o,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new ma(e.done.map(gi.fromJSON),e.undone.map(gi.fromJSON))}});function cB(e={}){return[lB,aB.of(e),St.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?uB:t.inputType=="historyRedo"?L3:null;return r?(t.preventDefault(),r(n)):!1}})]}function Mb(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(lB,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const uB=Mb(0,!1),L3=Mb(1,!1),abe=Mb(0,!0),lbe=Mb(1,!0);class gi{constructor(t,n,r,s,i){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(t){return new gi(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new gi(t.changes&&es.fromJSON(t.changes),[],t.mapped&&ya.fromJSON(t.mapped),t.startSelection&&Oe.fromJSON(t.startSelection),t.selectionsAfter.map(Oe.fromJSON))}static fromTransaction(t,n){let r=mo;for(let s of t.startState.facet(obe)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new gi(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,mo)}static selection(t){return new gi(void 0,mo,void 0,void 0,t)}}function gy(e,t,n,r){let s=t+1>n+20?t-n-1:0,i=e.slice(s,t);return i.push(r),i}function cbe(e,t){let n=[],r=!1;return e.iterChangedRanges((s,i)=>n.push(s,i)),t.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function ube(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function dB(e,t){return e.length?t.length?e.concat(t):e:t}const mo=[],dbe=200;function hB(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-dbe));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),gy(e,e.length-1,1e9,n.setSelAfter(r)))}else return[gi.selection([t])]}function hbe(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 vv(e,t){if(!e.length)return e;let n=e.length,r=mo;for(;n;){let s=fbe(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=e.slice(0,n);return i[n-1]=s,i}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[gi.selection(r)]:mo}function fbe(e,t,n){let r=dB(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):mo,n);if(!e.changes)return gi.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new gi(s,Hn.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}const mbe=/^(input\.type|delete)($|\.)/;class ma{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new ma(this.done,this.undone):this}addChanges(t,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!r||mbe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,cbe(a.changes,t.changes))||r=="input.type.compose")?o=gy(o,o.length-1,s.minDepth,new gi(t.changes.compose(a.changes),dB(Hn.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,mo)):o=gy(o,o.length,s.minDepth,t),new ma(o,mo,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:mo;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&ube(i[i.length-1],t)?this:new ma(hB(this.done,t),this.undone,n,r)}addMapping(t){return new ma(vv(this.done,t),vv(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:R3.of({side:t,rest:hbe(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?mo:s.slice(0,s.length-1);return i.mapped&&(a=vv(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:R3.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}ma.empty=new ma(mo,mo);const fB=[{key:"Mod-z",run:uB,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:L3,preventDefault:!0},{linux:"Ctrl-Shift-z",run:L3,preventDefault:!0},{key:"Mod-u",run:abe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:lbe,preventDefault:!0}];function Jh(e,t){return Oe.create(e.ranges.map(t),e.mainIndex)}function Oo(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Bo({state:e,dispatch:t},n){let r=Jh(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Oo(e,r)),!0)}function Ib(e,t){return Oe.cursor(t?e.to:e.from)}function mB(e,t){return Bo(e,n=>n.empty?e.moveByChar(n,t):Ib(n,t))}function Ps(e){return e.textDirectionAt(e.state.selection.main.head)==dr.LTR}const pB=e=>mB(e,!Ps(e)),gB=e=>mB(e,Ps(e));function yB(e,t){return Bo(e,n=>n.empty?e.moveByGroup(n,t):Ib(n,t))}const pbe=e=>yB(e,!Ps(e)),gbe=e=>yB(e,Ps(e));function ybe(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Nb(e,t,n){let r=jo(e).resolveInner(t.head),s=n?kn.closedBy:kn.openedBy;for(let l=t.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;ybe(e,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?$d(e,r.from,1):$d(e,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Oe.cursor(a,n?-1:1)}const bbe=e=>Bo(e,t=>Nb(e.state,t,!Ps(e))),vbe=e=>Bo(e,t=>Nb(e.state,t,Ps(e)));function bB(e,t){return Bo(e,n=>{if(!n.empty)return Ib(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const vB=e=>bB(e,!1),wB=e=>bB(e,!0);function xB(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(St.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function _B(e,t){let n=xB(e),{state:r}=e,s=Jh(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):Ib(o,t));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(r.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=St.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(Oo(r,s),{effects:i}),!0}const KC=e=>_B(e,!1),j3=e=>_B(e,!0);function Oc(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&t.head!=r.from+i&&(s=Oe.cursor(r.from+i))}return s}const wbe=e=>Bo(e,t=>Oc(e,t,!0)),xbe=e=>Bo(e,t=>Oc(e,t,!1)),_be=e=>Bo(e,t=>Oc(e,t,!Ps(e))),kbe=e=>Bo(e,t=>Oc(e,t,Ps(e))),Sbe=e=>Bo(e,t=>Oe.cursor(e.lineBlockAt(t.head).from,1)),Tbe=e=>Bo(e,t=>Oe.cursor(e.lineBlockAt(t.head).to,-1));function Cbe(e,t,n){let r=!1,s=Jh(e.selection,i=>{let o=$d(e,i.head,-1)||$d(e,i.head,1)||i.head>0&&$d(e,i.head-1,1)||i.head<e.doc.length&&$d(e,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Oe.cursor(a)});return r?(t(Oo(e,s)),!0):!1}const Abe=({state:e,dispatch:t})=>Cbe(e,t);function ko(e,t){let n=Jh(e.state.selection,r=>{let s=t(r);return Oe.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Oo(e.state,n)),!0)}function kB(e,t){return ko(e,n=>e.moveByChar(n,t))}const SB=e=>kB(e,!Ps(e)),TB=e=>kB(e,Ps(e));function CB(e,t){return ko(e,n=>e.moveByGroup(n,t))}const Ebe=e=>CB(e,!Ps(e)),Mbe=e=>CB(e,Ps(e)),Ibe=e=>ko(e,t=>Nb(e.state,t,!Ps(e))),Nbe=e=>ko(e,t=>Nb(e.state,t,Ps(e)));function AB(e,t){return ko(e,n=>e.moveVertically(n,t))}const EB=e=>AB(e,!1),MB=e=>AB(e,!0);function IB(e,t){return ko(e,n=>e.moveVertically(n,t,xB(e).height))}const YC=e=>IB(e,!1),XC=e=>IB(e,!0),Rbe=e=>ko(e,t=>Oc(e,t,!0)),Lbe=e=>ko(e,t=>Oc(e,t,!1)),jbe=e=>ko(e,t=>Oc(e,t,!Ps(e))),Dbe=e=>ko(e,t=>Oc(e,t,Ps(e))),Obe=e=>ko(e,t=>Oe.cursor(e.lineBlockAt(t.head).from)),Bbe=e=>ko(e,t=>Oe.cursor(e.lineBlockAt(t.head).to)),QC=({state:e,dispatch:t})=>(t(Oo(e,{anchor:0})),!0),JC=({state:e,dispatch:t})=>(t(Oo(e,{anchor:e.doc.length})),!0),ZC=({state:e,dispatch:t})=>(t(Oo(e,{anchor:e.selection.main.anchor,head:0})),!0),eA=({state:e,dispatch:t})=>(t(Oo(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Pbe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),$be=({state:e,dispatch:t})=>{let n=Rb(e).map(({from:r,to:s})=>Oe.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Oe.create(n),userEvent:"select"})),!0},zbe=({state:e,dispatch:t})=>{let n=Jh(e.selection,r=>{let s=jo(e),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Oe.range(a.to,a.from)}return r});return n.eq(e.selection)?!1:(t(Oo(e,n)),!0)};function NB(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let a=i;;){let l=e.moveVertically(a,t);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(e.dispatch(Oo(n,Oe.create(s,s.length-1))),!0)}const Fbe=e=>NB(e,!1),Ube=e=>NB(e,!0),qbe=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Oe.create([n.main]):n.main.empty||(r=Oe.create([Oe.cursor(n.main.head)])),r?(t(Oo(e,r)),!0):!1};function Vm(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=t(i);l<o?(n="delete.backward",l=og(e,l,!1)):l>o&&(n="delete.forward",l=og(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=og(e,o,!1),a=og(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Oe.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?St.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function og(e,t,n){if(e instanceof St)for(let r of e.state.facet(St.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const RB=(e,t,n)=>Vm(e,r=>{let s=r.from,{state:i}=e,o=i.doc.lineAt(s),a,l;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]=="	")return s-1;let c=Fm(a,i.tabSize),u=c%my(i)||my(i);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)s--;l=s}else l=Ds(o.text,s-o.from,t,t)+o.from,l==s&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=Ds(o.text,l-o.from,!1,!1)+o.from);return l}),D3=e=>RB(e,!1,!0),LB=e=>RB(e,!0,!1),jB=(e,t)=>Vm(e,n=>{let r=n.head,{state:s}=e,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let l=Ds(i.text,r-i.from,t)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),DB=e=>jB(e,!1),Hbe=e=>jB(e,!0),Vbe=e=>Vm(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Wbe=e=>Vm(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Gbe=e=>Vm(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Kbe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Cn.of(["",""])},range:Oe.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Ybe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,i=e.doc.lineAt(s),o=s==i.from?s-1:Ds(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:Ds(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(s,a).append(e.doc.slice(o,s))},range:Oe.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Rb(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(r)}else t.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return t}function OB(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of Rb(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){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let l of i.ranges)s.push(Oe.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)s.push(Oe.range(l.anchor-a,l.head-a))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Oe.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Xbe=({state:e,dispatch:t})=>OB(e,t,!1),Qbe=({state:e,dispatch:t})=>OB(e,t,!0);function BB(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of Rb(e))n?r.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):r.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Jbe=({state:e,dispatch:t})=>BB(e,t,!1),Zbe=({state:e,dispatch:t})=>BB(e,t,!0),e2e=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Rb(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=Jh(t.selection,s=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(s.head),a=e.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,i)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function t2e(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=jo(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),i;return r&&s&&r.to<=t&&s.from>=t&&(i=r.type.prop(kn.closedBy))&&i.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const tA=PB(!1),n2e=PB(!0);function PB(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:i,to:o}=s,a=t.doc.lineAt(i),l=!e&&i==o&&t2e(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new Ab(t,{simulateBreak:i,simulateDoubleBreak:!!l}),u=rB(c,i);for(u==null&&(u=Fm(/^\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 d=["",py(t,u)];return l&&d.push(py(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Cn.of(d)},range:Oe.cursor(i+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Hk(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=e.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(t(a,s,r),n=a.number),o=a.to+1}let i=e.changes(s);return{changes:s,range:Oe.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const r2e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ab(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=Hk(e,(i,o,a)=>{let l=rB(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=py(e,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},s2e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Hk(e,(n,r)=>{r.push({from:n.from,insert:e.facet(zk)})}),{userEvent:"input.indent"})),!0),i2e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Hk(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Fm(s,e.tabSize),o=0,a=py(e,Math.max(0,i-my(e)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),o2e=e=>(e.setTabFocusMode(),!0),a2e=[{key:"Ctrl-b",run:pB,shift:SB,preventDefault:!0},{key:"Ctrl-f",run:gB,shift:TB},{key:"Ctrl-p",run:vB,shift:EB},{key:"Ctrl-n",run:wB,shift:MB},{key:"Ctrl-a",run:Sbe,shift:Obe},{key:"Ctrl-e",run:Tbe,shift:Bbe},{key:"Ctrl-d",run:LB},{key:"Ctrl-h",run:D3},{key:"Ctrl-k",run:Vbe},{key:"Ctrl-Alt-h",run:DB},{key:"Ctrl-o",run:Kbe},{key:"Ctrl-t",run:Ybe},{key:"Ctrl-v",run:j3}],l2e=[{key:"ArrowLeft",run:pB,shift:SB,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:pbe,shift:Ebe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:_be,shift:jbe,preventDefault:!0},{key:"ArrowRight",run:gB,shift:TB,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:gbe,shift:Mbe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:kbe,shift:Dbe,preventDefault:!0},{key:"ArrowUp",run:vB,shift:EB,preventDefault:!0},{mac:"Cmd-ArrowUp",run:QC,shift:ZC},{mac:"Ctrl-ArrowUp",run:KC,shift:YC},{key:"ArrowDown",run:wB,shift:MB,preventDefault:!0},{mac:"Cmd-ArrowDown",run:JC,shift:eA},{mac:"Ctrl-ArrowDown",run:j3,shift:XC},{key:"PageUp",run:KC,shift:YC},{key:"PageDown",run:j3,shift:XC},{key:"Home",run:xbe,shift:Lbe,preventDefault:!0},{key:"Mod-Home",run:QC,shift:ZC},{key:"End",run:wbe,shift:Rbe,preventDefault:!0},{key:"Mod-End",run:JC,shift:eA},{key:"Enter",run:tA,shift:tA},{key:"Mod-a",run:Pbe},{key:"Backspace",run:D3,shift:D3,preventDefault:!0},{key:"Delete",run:LB,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:DB,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Hbe,preventDefault:!0},{mac:"Mod-Backspace",run:Wbe,preventDefault:!0},{mac:"Mod-Delete",run:Gbe,preventDefault:!0}].concat(a2e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),$B=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:bbe,shift:Ibe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vbe,shift:Nbe},{key:"Alt-ArrowUp",run:Xbe},{key:"Shift-Alt-ArrowUp",run:Jbe},{key:"Alt-ArrowDown",run:Qbe},{key:"Shift-Alt-ArrowDown",run:Zbe},{key:"Mod-Alt-ArrowUp",run:Fbe},{key:"Mod-Alt-ArrowDown",run:Ube},{key:"Escape",run:qbe},{key:"Mod-Enter",run:n2e},{key:"Alt-l",mac:"Ctrl-l",run:$be},{key:"Mod-i",run:zbe,preventDefault:!0},{key:"Mod-[",run:i2e},{key:"Mod-]",run:s2e},{key:"Mod-Alt-\\",run:r2e},{key:"Shift-Mod-k",run:e2e},{key:"Shift-Mod-\\",run:Abe},{key:"Mod-/",run:Jye},{key:"Alt-A",run:ebe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:o2e}].concat(l2e);class zB{constructor(t,n,r,s){this.state=t,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=jo(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(FB(t,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function nA(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 c2e(e){let t=Object.create(null),n=Object.create(null);for(let{label:s}of e){t[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=nA(t)+nA(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function u2e(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:c2e(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class rA{constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function Eu(e){return e.selection.main.from}function FB(e,t){var n;let{source:r}=e,s=t&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?e:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const UB=wl.define();function d2e(e,t,n,r){let{main:s}=e.selection,i=n-s.from,o=r-s.from;return{...e.changeByRange(a=>{if(a!=s&&n!=r&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Oe.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const sA=new WeakMap;function h2e(e){if(!Array.isArray(e))return e;let t=sA.get(e);return t||sA.set(e,t=u2e(e)),t}const yy=Hn.define(),dm=Hn.define();class f2e{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let r=Dl(t,n),s=_d(r);this.chars.push(r);let i=t.slice(n,n+s),o=i.toUpperCase();this.folded.push(Dl(o==i?i.toLowerCase():o,0)),n+=s}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let v=Dl(t,0),x=_d(v),S=x==t.length?0:-100;if(v!=n[0])if(v==r[0])S+=-200;else return null;return this.ret(S,[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 S=Dl(t,v);(S==n[c]||S==r[c])&&(s[c++]=v),v+=_d(S)}if(c<l)return null}let u=0,d=0,f=!1,m=0,p=-1,y=-1,w=/[a-z]/.test(t),b=!0;for(let v=0,x=Math.min(t.length,200),S=0;v<x&&d<l;){let C=Dl(t,v);a<0&&(u<l&&C==n[u]&&(i[u++]=v),m<l&&(C==n[m]||C==r[m]?(m==0&&(p=v),y=v+1,m++):m=0));let E,M=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(E=Ope(C))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!v||M==1&&w||S==0&&M!=0)&&(n[d]==C||r[d]==C&&(f=!0)?o[d++]=v:o.length&&(b=!1)),S=M,v+=_d(C)}return d==l&&o[0]==0&&b?this.result(-100+(f?-200:0),o,t):m==l&&p==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,[p,y]):d==l?this.result(-100+(f?-200:0)+-700+(b?0:-1100),o,t):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,t)}result(t,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?_d(Dl(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(t-r.length,s)}}class m2e{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(t.length==this.pattern.length?0:-100),this)}}const ms=Lt.define({combine(e){return xb(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:p2e,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>r=>iA(t(r),n(r)),optionClass:(t,n)=>r=>iA(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function iA(e,t){return e?t?e+" "+t:e:t}function p2e(e,t,n,r,s,i){let o=e.textDirection==dr.RTL,a=o,l=!1,c="top",u,d,f=t.left-s.left,m=s.right-t.right,p=r.right-r.left,y=r.bottom-r.top;if(a&&f<Math.min(p,m)?a=!1:!a&&m<Math.min(p,f)&&(a=!0),p<=(a?f:m))u=Math.max(s.top,Math.min(n.top,s.bottom-y))-t.top,d=Math.min(400,a?f:m);else{l=!0,d=Math.min(400,(o?t.right:s.right-t.left)-30);let v=s.bottom-t.bottom;v>=y||v>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let w=(t.bottom-t.top)/i.offsetHeight,b=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${d/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const Vk=Hn.define();function g2e(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],d=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(u,d))),f.className="cm-completionMatchedText",l=d}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),t.sort((n,r)=>n.position-r.position).map(n=>n.render)}function wv(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let s=Math.floor(t/n);return{from:s*n,to:(s+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}class y2e{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=t.state.field(n),{options:i,selected:o}=s.open,a=t.state.facet(ms);this.optionContent=g2e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=wv(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 u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(t,c[+d[1]]),l.preventDefault();return}if(l.target==this.list){let u=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;u!=null&&(t.dispatch({effects:Vk.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(ms).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:dm.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=wv(i.length,o,t.state.facet(ms).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.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 r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=wv(n.options.length,n.selected,this.view.state.facet(ms).maxRenderedOptions),this.showOptions(n.options,t.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,s)}).catch(a=>Di(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:s,destroy:i}=t;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&v2e(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=t.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(ms).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=t[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(o>r.from||r.from==0))if(i=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let m=s.appendChild(document.createElement("completion-section"));m.textContent=f}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let d=this.optionClass(a);d&&(u.className=d);for(let f of this.optionContent){let m=f(a,this.view.state,this.view,l);m&&u.appendChild(m)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function b2e(e,t){return n=>new y2e(n,e,t)}function v2e(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/s)}function oA(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function w2e(e,t){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:d}=u.completion;if(d){r||(r=[]);let f=typeof d=="string"?d:d.name;r.some(m=>m.name==f)||r.push(typeof d=="string"?{name:f}:d)}},o=t.facet(ms);for(let u of e)if(u.hasResult()){let d=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)i(new rA(f,u.source,d?d(f):[],1e9-n.length));else{let f=t.sliceDoc(u.from,u.to),m,p=o.filterStrict?new m2e(f):new f2e(f);for(let y of u.result.options)if(m=p.match(y.label)){let w=y.displayLabel?d?d(y,m.matched):[]:m.matched,b=m.score+(y.boost||0);if(i(new rA(y,u.source,w,b)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:v}=y.section;s||(s=Object.create(null)),s[v]=Math.max(b,s[v]||-1e9)}}}}if(r){let u=Object.create(null),d=0,f=(m,p)=>(m.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(m.name<p.name?-1:1);for(let m of r.sort(f))d-=1e5,u[m.name]=d;for(let m of n){let{section:p}=m.completion;p&&(m.score+=u[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((d,f)=>f.score-d.score||c(d.completion,f.completion))){let d=u.completion;!l||l.label!=d.label||l.detail!=d.detail||l.type!=null&&d.type!=null&&l.type!=d.type||l.apply!=d.apply||l.boost!=d.boost?a.push(u):oA(u.completion)>oA(l)&&(a[a.length-1]=u),l=u.completion}return a}class zd{constructor(t,n,r,s,i,o){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new zd(this.options,aA(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,s,i,o){if(s&&!o&&t.some(c=>c.isPending))return s.setDisabled();let a=w2e(t,n);if(!a.length)return s&&t.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(ms).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new zd(a,aA(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:C2e,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(t){return new zd(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new zd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class by{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new by(S2e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(ms),i=(r.override||n.languageDataAt("autocomplete",Eu(n)).map(h2e)).map(l=>(this.active.find(u=>u.source==l)||new po(l,this.active.some(u=>u.state!=0)?1:0)).update(t,r));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(Wk));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!x2e(i,this.active)||a?o=zd.build(i,n,this.id,o,r,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 po(l.source,0):l));for(let l of t.effects)l.is(Vk)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new by(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?_2e:k2e}}function x2e(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let s=n==e.length,i=r==t.length;if(s||i)return s==i;if(e[n++].result!=t[r++].result)return!1}}const _2e={"aria-autocomplete":"list"},k2e={};function aA(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const S2e=[];function qB(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(UB);if(r&&t.activateOnCompletion(r))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class po{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=qB(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new po(s.source,0)),r&4&&s.state==0&&(s=new po(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(yy))s=new po(s.source,1,i.value);else if(i.is(dm))s=new po(s.source,0);else if(i.is(Wk))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Eu(t.state))}}class rh extends po{constructor(t,n,r,s,i,o){super(t,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let s=this.result;s.map&&!t.changes.empty&&(s=s.map(s,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=Eu(t.state);if(a>o||!s||n&2&&(Eu(t.startState)==this.from||a<this.limit))return new po(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return T2e(s.validFor,t.state,i,o)?new rh(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new zB(t.state,a,!1)))?new rh(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:Eu(t.state)):new po(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 rh(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new po(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function T2e(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):FB(e,!0).test(s)}const Wk=Hn.define({map(e,t){return e.map(n=>n.map(t))}}),Ks=Ta.define({create(){return by.start()},update(e,t){return e.update(t)},provide:e=>[YO.from(e,t=>t.tooltip),St.contentAttributes.from(e,t=>t.attrs)]});function Gk(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Ks).active.find(s=>s.source==t.source);return r instanceof rh?(typeof n=="string"?e.dispatch({...d2e(e.state,n,r.from,r.to),annotations:UB.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const C2e=b2e(Ks,Gk);function tc(e,t="option"){return n=>{let r=n.state.field(Ks,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(ms).interactionDelay)return!1;let s=1,i;t=="page"&&(i=XO(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(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:Vk.of(a)}),!0}}const HB=e=>{let t=e.state.field(Ks,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(ms).interactionDelay?!1:Gk(e,t.open.options[t.open.selected])},sh=e=>e.state.field(Ks,!1)?(e.dispatch({effects:yy.of(!0)}),!0):!1,Gg=e=>{let t=e.state.field(Ks,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:dm.of(null)}),!0)};class A2e{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const E2e=50,M2e=1e3,I2e=wi.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(Ks).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ks),n=e.state.facet(ms);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ks)==t)return;let r=e.transactions.some(i=>{let o=qB(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>E2e&&Date.now()-o.time>M2e){for(let a of o.context.abortListeners)try{a()}catch(l){Di(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(yy)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of e.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Ks);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ms).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Eu(t),r=new zB(t,n,e.explicit,this.view),s=new A2e(e,r);this.running.push(s),Promise.resolve(e.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:dm.of(null)}),Di(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(ms).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ms),r=this.view.state.field(Ks);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=Eu(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new rh(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){t.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new po(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||r.open&&r.open.disabled)&&this.view.dispatch({effects:Wk.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ks,!1);if(t&&t.tooltip&&this.view.state.facet(ms).closeOnBlur){let n=t.open&&XO(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:dm.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:yy.of(!1)}),20),this.composing=0}}}),N2e=typeof navigator=="object"&&/Win/.test(navigator.platform),R2e=Zu.highest(St.domEventHandlers({keydown(e,t){let n=t.state.field(Ks,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(N2e&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&Gk(t,r),!1}})),L2e=St.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"}}}),VB=new class extends Sc{};VB.startSide=1;VB.endSide=-1;function j2e(e={}){return[R2e,Ks,ms.of(e),I2e,O2e,L2e]}const D2e=[{key:"Ctrl-Space",run:sh},{mac:"Alt-`",run:sh},{mac:"Alt-i",run:sh},{key:"Escape",run:Gg},{key:"ArrowDown",run:tc(!0)},{key:"ArrowUp",run:tc(!1)},{key:"PageDown",run:tc(!0,"page")},{key:"PageUp",run:tc(!1,"page")},{key:"Enter",run:HB}],O2e=Zu.highest(lm.computeN([ms],e=>e.facet(ms).defaultKeymap?[D2e]:[]));function Ti(e){let t=e.field(Ks,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const B2e=[J1e(),cB(),q1e(),zye(qye,{fallback:!0}),lm.of([...$B,...fB])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const Kk={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let e="̀".codePointAt(0);e<="ͯ".codePointAt(0);++e){const t=String.fromCodePoint(e);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const s=(n+t).normalize().codePointAt(0);s>126&&(Kk[s]=n)}}const xv={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(xv)){const t=e.toUpperCase();for(let n=xv[e][0];n<=xv[e][1];++n)Kk[n]=n%2===0?t:e}function Wm(e){if(e<192||e>8580)return e;const t=Kk[e];return t!==void 0?t.codePointAt(0):e}function Pl(e,t){return e>t?e:t}const WB=e=>e.split("").map(t=>t.codePointAt(0)),P2e=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)P2e.add(e);const Nh="".codePointAt(0),hm="A".codePointAt(0),fm="Z".codePointAt(0),GB="a".codePointAt(0),KB="z".codePointAt(0),$2e="0".codePointAt(0),z2e="9".codePointAt(0);function Fd(e,t,n){return n?e:t-e-1}const mm=16,O3=-3,vy=-1,Uu=mm/2,F2e=mm/2,U2e=Uu+vy,YB=4,XB=2;function B3(e){return e?new Set:null}function Rf(e,t,n){if(t!==null&&t.i16.length>e+n){const r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function lA(e,t,n){if(t!==null&&t.i32.length>e+n){const r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function QB(e){return e>=GB&&e<=KB?1:e>=hm&&e<=fm?2:e>=$2e&&e<=z2e?4:0}function JB(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 wy(e){return e<=Nh?QB(e):JB(e)}function Yk(e,t){return e===0&&t!==0?Uu:e===1&&t===2||e!==4&&t===4?U2e:t===0?F2e:0}function q2e(e,t){return t===0?Uu:Yk(wy(e[t-1]),wy(e[t]))}function H2e(e,t,n,r){let s=e.slice(r),i=s.indexOf(n);if(i===0)return r;if(!t&&n>=GB&&n<=KB){i>0&&(s=s.slice(0,i));const o=s.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:r+i}function cA(e){for(const t of e)if(t>=128)return!1;return!0}function Xk(e,t,n){if(!cA(e))return 0;if(!cA(t))return-1;let r=0,s=0;for(let i=0;i<t.length;i++){if(s=H2e(e,n,t[i],s),s<0)return-1;i===0&&s>0&&(r=s-1),s++}return r}const V2e=(e,t,n,r,s,i,o)=>{const a=s.length;if(a===0)return[{start:0,end:0,score:0},B3(i)];const l=r.length;if(o!==null&&l*a>o.i16.length)return eP(e,t,n,r,s,i);const c=Xk(r,s,e);if(c<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,m=null,p=null,y=null;[u,f]=Rf(u,o,l),[u,m]=Rf(u,o,l),[u,p]=Rf(u,o,l),[d,y]=lA(d,o,a);const[,w]=lA(d,o,l);for(let B=0;B<w.length;B++)w[B]=r[B];let b=0,v=0,x=0,S=0;const C=s[0];let E=s[0],M=0,D=0,O=!1,A=w.subarray(c),j=f.subarray(c).subarray(0,A.length),I=m.subarray(c).subarray(0,A.length),P=p.subarray(c).subarray(0,A.length);for(let[B,k]of A.entries()){let Q=null;k<=Nh?(Q=QB(k),!e&&Q===2&&(k+=32)):(Q=JB(k),!e&&Q===2&&(k=String.fromCodePoint(k).toLowerCase().codePointAt(0)),t&&(k=Wm(k))),A[B]=k;const ce=Yk(D,Q);if(P[B]=ce,D=Q,k===E&&(x<a&&(y[x]=c+B,x++,E=s[Math.min(x,a-1)]),S=c+B),k===C){const pe=mm+ce*XB;if(j[B]=pe,I[B]=1,a===1&&(n&&pe>b||!n&&pe>=b)&&(b=pe,v=c+B,n&&ce===Uu))break;O=!1}else O?j[B]=Pl(M+vy,0):j[B]=Pl(M+O3,0),I[B]=0,O=!0;M=j[B]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const B={start:v,end:v+1,score:b};if(!i)return[B,null];const k=new Set;return k.add(v),[B,k]}const F=y[0],q=S-F+1;let R=null;[u,R]=Rf(u,o,q*a);{const B=f.subarray(F,S+1);for(const[k,Q]of B.entries())R[k]=Q}let[,V]=Rf(u,o,q*a);{const B=m.subarray(F,S+1);for(const[k,Q]of B.entries())V[k]=Q}const J=y.subarray(1),ee=s.slice(1).slice(0,J.length);for(const[B,k]of J.entries()){let Q=!1;const ce=ee[B],pe=B+1,be=pe*q,ye=w.subarray(k,S+1),ie=p.subarray(k).subarray(0,ye.length),re=V.subarray(be+k-F).subarray(0,ye.length),oe=V.subarray(be+k-F-1-q).subarray(0,ye.length),ve=R.subarray(be+k-F).subarray(0,ye.length),qe=R.subarray(be+k-F-1-q).subarray(0,ye.length),We=R.subarray(be+k-F-1).subarray(0,ye.length);We[0]=0;for(const[te,we]of ye.entries()){const Se=te+k;let Ne=0,Pt=0,at=0;if(Q?Pt=We[te]+vy:Pt=We[te]+O3,ce===we){Ne=qe[te]+mm;let Tt=ie[te];at=oe[te]+1,Tt===Uu?at=1:at>1&&(Tt=Pl(Tt,Pl(YB,p[Se-at+1]))),Ne+Tt<Pt?(Ne+=ie[te],at=0):Ne+=Tt}re[te]=at,Q=Ne<Pt;const vt=Pl(Pl(Ne,Pt),0);pe===a-1&&(n&&vt>b||!n&&vt>=b)&&(b=vt,v=Se),ve[te]=vt}}const N=B3(i);let G=F;if(i&&N!==null){let B=a-1;G=v;let k=!0;for(;;){const Q=B*q,ce=G-F,pe=R[Q+ce];let be=0,ye=0;if(B>0&&G>=y[B]&&(be=R[Q-q+ce-1]),G>y[B]&&(ye=R[Q+ce-1]),pe>be&&(pe>ye||pe===ye&&k)){if(N.add(G),B===0)break;B--}k=V[Q+ce]>1||Q+q+ce+1<V.length&&V[Q+q+ce+1]>0,G--}}return[{start:G,end:v+1,score:b},N]};function ZB(e,t,n,r,s,i,o){let a=0,l=0,c=!1,u=0,d=0;const f=B3(o);let m=0;s>0&&(m=wy(n[s-1]));for(let p=s;p<i;p++){let y=n[p];const w=wy(y);if(e||(y>=hm&&y<=fm?y+=32:y>Nh&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=Wm(y)),y===r[a]){o&&f!==null&&f.add(p),l+=mm;let b=Yk(m,w);u===0?d=b:(b===Uu&&(d=b),b=Pl(Pl(b,d),YB)),a===0?l+=b*XB:l+=b,c=!1,u++,a++}else c?l+=vy:l+=O3,c=!0,u=0,d=0;m=w}return[l,f]}const eP=(e,t,n,r,s,i,o)=>{if(s.length===0)return[{start:0,end:0,score:0},null];if(Xk(r,s,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,l=-1,c=-1;const u=r.length,d=s.length;for(let f=0;f<u;f++){let m=r[Fd(f,u,n)];e||(m>=hm&&m<=fm?m+=32:m>Nh&&(m=String.fromCodePoint(m).toLowerCase().codePointAt(0))),t&&(m=Wm(m));const p=s[Fd(a,d,n)];if(m===p&&(l<0&&(l=f),a++,a===d)){c=f+1;break}}if(l>=0&&c>=0){a--;for(let p=c-1;p>=l;p--){const y=Fd(p,u,n);let w=r[y];e||(w>=hm&&w<=fm?w+=32:w>Nh&&(w=String.fromCodePoint(w).toLowerCase().codePointAt(0)));const b=Fd(a,d,n),v=s[b];if(w===v&&(a--,a<0)){l=p;break}}if(!n){const p=l;l=u-c,c=u-p}const[f,m]=ZB(e,t,r,s,l,c,i);return[{start:l,end:c,score:f},m]}return[{start:-1,end:-1,score:0},null]},W2e=(e,t,n,r,s,i,o)=>{if(s.length===0)return[{start:0,end:0,score:0},null];const a=r.length,l=s.length;if(a<l)return[{start:-1,end:-1,score:0},null];if(Xk(r,s,e)<0)return[{start:-1,end:-1,score:0},null];let c=0,u=-1,d=0,f=-1;for(let m=0;m<a;m++){const p=Fd(m,a,n);let y=r[p];e||(y>=hm&&y<=fm?y+=32:y>Nh&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=Wm(y));const w=Fd(c,l,n);if(s[w]===y){if(w===0&&(d=q2e(r,p)),c++,c===l){if(d>f&&(u=m,f=d),d===Uu)break;m-=c-1,c=0,d=0}}else m-=c,c=0,d=0}if(u>=0){let m=0,p=0;n?(m=u-l+1,p=u+1):(m=a-(u+1),p=a-(u-l+1));const[y]=ZB(e,t,r,s,m,p,!1);return[{start:m,end:p,score:y},null]}return[{start:-1,end:-1,score:0},null]},G2e=100*1024,K2e=2048;function Y2e(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const X2e=Y2e(G2e,K2e),Q2e=(e,t,n)=>{let r=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(r=!0);break;case"case-sensitive":r=!0;break;case"case-insensitive":e=e.toLowerCase(),r=!1;break}let s=WB(e);return n&&(s=s.map(Wm)),{queryRunes:s,caseSensitive:r}};function J2e(e,t){const n=Object.keys(e).map(s=>parseInt(s,10)).sort((s,i)=>i-s);let r=[];for(const s of n)if(r=r.concat(e[s]),r.length>=t)break;return r}function Z2e(e,t,n){return r=>{const s=this.runesList[r];if(t.length>s.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,s,t,!0,X2e);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[r],...i,positions:o??new Set})}}function e4e(e){const{queryRunes:t,caseSensitive:n}=Q2e(e,this.opts.casing,this.opts.normalize),r={},s=Z2e.bind(this)(r,t,n);for(let i=0,o=this.runesList.length;i<o;++i)s(i);return J2e(r,this.opts.limit)}const tP={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class t4e{constructor(t,...n){switch(this.opts={...tP,...n[0]},this.items=t,this.runesList=t.map(r=>WB(this.opts.selector(r).normalize())),this.algoFn=W2e,this.opts.fuzzy){case"v2":this.algoFn=V2e;break;case"v1":this.algoFn=eP;break}}}const n4e={...tP,match:e4e};class r4e extends t4e{constructor(t,...n){super(t,...n),this.opts={...n4e,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(s4e);t=t.normalize();let n=this.opts.match.bind(this)(t);return i4e(n,this.opts)}}const s4e=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function i4e(e,t){if(t.sort){const{selector:n}=t;e.sort((r,s)=>{if(r.score===s.score)for(const i of t.tiebreakers){const o=i(r,s,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class o4e{constructor(t,...n){this.finder=new r4e(t,...n),this.find=this.finder.find.bind(this.finder)}}const pm=["custom","skill","system"];function P3(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function a4e(e,t,n=pm){return uA(P3(e),n)-uA(P3(t),n)}function uA(e,t=pm){const n=t.indexOf(e);return n>=0?n:t.length+pm.indexOf(e)}const Qk=String.raw`([^\s/]+)`,Lb={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:"安装扩展"}]},jb={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"}]},Db={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 文件列表"}]},Ob={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 l4e(e,t,n,r,s){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(r==="zh-CN"?Lb:jb)[e];if(o||(o=(r==="zh-CN"?Db:Ob)[e]),!o&&t.length===0&&(s!=null&&s.length)&&(o=s.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 c4e(e,t,n){const r=e.toLowerCase(),s=t.toLowerCase(),i=r.startsWith(n),o=s.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function u4e(e,t,n,r){const s=a4e(e,t,r);return s!==0?s:0}const d4e={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function h4e(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),r=t.find(s=>s.name.toLowerCase().startsWith(n));return r?`/${r.name} `:null}function f4e(e,t,n){var c;const r=e.match(new RegExp(`^/${Qk}\\s+$`));if(!r)return null;const s=r[1],i=t.find(u=>u.name===s),o=n==="zh-CN"?Lb:jb;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[s]||s==="skills")return null;const l=(n==="zh-CN"?Db:Ob)[s];return!l||l.length===0?null:`/${s} ${l[0].name} `}function m4e(e,t,n){var u,d;const r=e.match(new RegExp(`^/${Qk}(\\s*)$`));if(!r)return null;const s=r[1],i=t.find(f=>f.name===s);if(!i)return null;const o=(u=i.argumentHint)==null?void 0:u.trim();if(o)return o;const a=n==="zh-CN"?Lb:jb;if((d=i.subcommands)!=null&&d.length||a[s]||s==="skills")return null;const c=(n==="zh-CN"?Db:Ob)[s];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function p4e(e,t){const n=Math.max(0,Math.min(t,e.length)),r=e.lastIndexOf(`
`,Math.max(0,n-1))+1,s=e.indexOf(`
`,n),i=s===-1?e.length:s;return{lineStart:r,lineEnd:i,lineText:e.slice(r,i),textBefore:e.slice(r,n),cursor:n}}const dA=new WeakMap;function g4e(e){let t=dA.get(e);if(!t){const n=[],r=new Map;for(const s of e)r.has(s.name)||(n.push(s.name),r.set(s.name,s));t={fzf:new o4e(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:r},dA.set(e,t)}return t}function y4e(e,t){try{const{fzf:n,byName:r}=g4e(e),s=[];for(const i of n.find(t)){const o=r.get(i.item);o&&s.push(o)}return s}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const r=t.toLowerCase();return e.filter(s=>s.name.toLowerCase().includes(r))}}function b4e(e,t,n,r=[],s="en",i=a=>a,o=pm){var v,x;const{lineStart:a,lineEnd:l,lineText:c,textBefore:u,cursor:d}=p4e(e,t),f=u.match(new RegExp(`^/${Qk}\\s+(.*)$`));if(f){const[,S,C]=f,E=n.find(N=>N.name===S),M=s==="zh-CN"?Lb:jb,D=s==="zh-CN"?Db:Ob,O=!!M[S]||S==="skills",A=!!D[S];if(!((v=E==null?void 0:E.subcommands)!=null&&v.length)&&!O&&!A)return null;const j=C.split(/\s+/),I=j.pop()||"",P=j;if(!((x=E==null?void 0:E.subcommands)!=null&&x.length)&&!O&&A&&!I)return null;const F=l4e(S,P,r,s,E==null?void 0:E.subcommands);if(!F)return null;const q=I.toLowerCase(),R=`/${S} ${P.length>0?P.join(" ")+" ":""}`,V=F.filter(N=>!I||N.name.toLowerCase().includes(q)).sort((N,G)=>I?c4e(N.name,G.name,q):0),J=S==="skills"&&P.length===0,ee=V.map(N=>{const G=`${R}${N.name}`;return{id:G,label:N.name,detail:N.description||void 0,apply:`${G} `,...J?{type:"skill"}:{}}});return ee.length===0?null:{kind:"subcommand",from:a,to:d,query:I,items:ee}}const m=c.match(/^\/([^\s/]*)$/);if(!m)return null;const p=m[1],y=p.length===0,b=(y?[...n].sort((S,C)=>u4e(S,C,"",o)):y4e(n,p)).map(S=>{const C=`/${S.name} `,E=P3(S),M=E==="custom"||E==="skill";return{id:S.name,label:`/${S.name}`,detail:S.description||void 0,apply:C,category:E,...y?{section:i(d4e[E])}:{},...M&&S.description?{type:"command-info"}:{}}});return b.length===0?null:{kind:"command",from:a,to:l,query:p,items:b}}function v4e(e,t=()=>{}){return n=>w4e(n,e,t)}function w4e(e,t,n=()=>{}){const r=e.state.doc.lineAt(e.pos),i=r.text.slice(0,e.pos-r.from).match(/@([\w./:-]*)$/);if(!i)return null;const o=i[1],a=e.pos-i[0].length,l=o.startsWith("ext:"),c=l?o.slice(4):o,u=l?void 0:t(),d=n();return Promise.all([_4e(c,d),u?x4e(o,u):Promise.resolve([])]).then(([f,m])=>f.length===0&&m.length===0?null:{from:a,options:[...f.map(p=>({label:`@ext:${p.name}`,apply:`@ext:${p.name} `,detail:k4e(p),type:"keyword",section:"Extensions",boost:20})),...m.map(p=>({label:`@${p}`,apply:`@${p} `,type:"file",section:"Files"}))],filter:!1})}async function x4e(e,t){try{const n=e?`${e}*`:"**/*";return(await t(n,{maxResults:50})).matches.filter(s=>s!==".")}catch{return[]}}async function _4e(e,t){if(!t)return[];try{const n=await t(),r=e.toLowerCase();return n.extensions.filter(s=>s.isActive).map(s=>({...s,displayName:hA(s.displayName??"")??void 0,description:hA(s.description??"")??void 0})).filter(s=>{var a;const i=s.name.toLowerCase(),o=((a=s.displayName)==null?void 0:a.toLowerCase())??"";return i.includes(r)||o.includes(r)}).sort((s,i)=>{const o=(s.displayName||s.name).toLowerCase(),a=(i.displayName||i.name).toLowerCase(),l=o.startsWith(r)?0:1,c=a.startsWith(r)?0:1;return l!==c?l-c:o.localeCompare(a)}).slice(0,50)}catch{return[]}}function k4e(e){const t=e.displayName&&e.displayName!==e.name?e.displayName:void 0;return t&&e.description?`${t} - ${e.description}`:t??e.description}const S4e="\x1B",T4e=new RegExp(`${S4e}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),C4e=/[‎‏؜⁦⁧⁨⁩‪‫‬‭‮]/g;function hA(e){const t=e.replace(T4e,"").replace(C4e,"").replace(/\s+/g," ").trim();return t.length>0?t:null}const A4e="qwen-web-shell-history",nP=100;function E4e(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch{return[]}}function M4e(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-nP)))}catch{}}function fA(e=A4e){const t=g.useRef(e);t.current=e;const n=g.useRef(E4e(e)),r=g.useRef(-1),s=g.useRef(""),i=g.useRef(-1),[o,a]=g.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=g.useCallback(()=>{const v=n.current,x=r.current;a({canUp:v.length>0&&(x===-1||x>0),canDown:x!==-1})},[]),c=g.useCallback(v=>{const x=n.current;x[x.length-1]!==v&&(x.push(v),x.length>nP&&x.shift(),M4e(t.current,x),r.current=-1,l())},[l]),u=g.useCallback(v=>{const x=n.current;if(x.length===0)return null;if(r.current===-1)s.current=v,r.current=x.length-1;else if(r.current>0)r.current--;else return null;return l(),x[r.current]},[l]),d=g.useCallback(()=>{const v=n.current;return r.current===-1?null:r.current<v.length-1?(r.current++,l(),v[r.current]):(r.current=-1,l(),s.current)},[l]),f=g.useCallback(()=>r.current!==-1,[]),m=g.useCallback(()=>{r.current=-1,i.current=-1,l()},[l]),p=g.useCallback(v=>{const x=n.current;if(x.length===0||!v)return null;const S=i.current===-1?x.length-1:i.current-1;if(S<0)return i.current=-1,null;const C=v.toLowerCase();for(let E=S;E>=0;E--)if(x[E].toLowerCase().includes(C))return i.current=E,x[E];return i.current=-1,null},[]),y=g.useCallback(v=>{const x=v.trim().toLowerCase();return n.current.slice().reverse().filter(S=>!x||S.toLowerCase().includes(x))},[]),w=g.useCallback(v=>{const x=n.current;if(!v)return x.length>0?x[x.length-1]:null;for(let S=x.length-1;S>=0;S--)if(v(x[S]))return x[S];return null},[]),b=g.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:u,navigateDown:d,isNavigating:f,reset:m,searchReverse:p,getReverseMatches:y,getLastEntry:w,resetSearch:b,nav:o}}const I4e=gn.mark({class:"cm-input-slash"}),N4e=gn.mark({class:"cm-input-at"}),R4e=gn.mark({class:"cm-input-code"});class L4e extends Ca{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 mA(e,t,n){const r=new Pu,s=e.state.doc,i=[];for(let o=1;o<=s.lines;o++){const a=s.line(o),l=a.text,c=a.from;if(l.startsWith("/")){const p=l.indexOf(" "),y=p===-1?l.length:p;i.push({from:c,to:c+y,deco:I4e})}const u=m4e(l,t(),n());if(u){const p=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:gn.widget({widget:new L4e(`${p}${u}`),side:1})})}const d=/@[^\s]+/g;let f;for(;(f=d.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:N4e});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:R4e})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:l}of i)r.add(o,a,l);return r.finish()}function j4e(e=()=>[],t=()=>"en"){return wi.fromClass(class{constructor(n){ue(this,"decorations");this.decorations=mA(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=mA(n.view,e,t))}},{decorations:n=>n.decorations})}const D4e=St.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"}}),O4e=1e3,B4e=10,pA="web-shell-tooltip-styles",P4e=`
[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: baseline;
  min-width: 0;
  padding: 4px 8px !important;
  color: var(--foreground, #e4e4e4) !important;
  overflow: hidden;
}

[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: 0;
  margin: 6px 10px 3px;
  padding: 0 !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section:first-of-type {
  display: none !important;
}

[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 .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 $4e(){if(document.getElementById(pA))return;const e=document.createElement("style");e.id=pA,e.textContent=P4e,document.head.appendChild(e)}function z4e(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function F4e(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function Jk(e){return F4e(e)}function U4e(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function q4e(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function H4e(e,t,n){if(!t.detail||!Jk(t))return;const r=e.closest("[data-web-shell-tooltip-portal]");if(!r)return;let s=r.querySelector(".cm-completionInfo-hover");s||(s=document.createElement("div"),s.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",r.appendChild(s)),s.textContent=`${U4e(t)}

${t.detail}`;const i=s.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete s.dataset.hideTimerId);const o=s.getBoundingClientRect(),a=18,l=12,c=12,u=window.innerWidth,d=window.innerHeight,f=n.clientX+a,m=f+o.width+c>u?Math.max(c,n.clientX-o.width-a):f,p=Math.min(Math.max(c,n.clientY+l),Math.max(c,d-o.height-c));s.style.position="fixed",s.style.left=`${m}px`,s.style.top=`${p}px`,s.style.right="auto",s.style.bottom="auto"}function V4e(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 W4e(e){if(!e.detail||!Jk(e))return null;const t=document.createElement("span");return t.className="cm-command-hover-info-anchor",t.setAttribute("aria-hidden","true"),queueMicrotask(()=>{const n=t.closest("li");!n||n.hasAttribute("data-web-shell-hover-info")||(n.setAttribute("data-web-shell-hover-info","true"),n.addEventListener("mouseenter",r=>{H4e(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&V4e(r)}))}),t}function G4e(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function K4e(e){return[...e].length>O4e||e.split(`
`).length>B4e}function Y4e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X4e(e,t,n){const s=`[Pasted Content ${[...n].length} chars]`,i=t===1?s:`${s} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function Q4e(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function J4e(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(Y4e).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function Kg(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function Z4e(e){return e.map(Kg).join(`
`)}function Zk(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function e6(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function rP(e){return e6(e)||Zk(e)||e.id}function _v(e,t){const n=Z4e(t);return n?e?`${n}

${e}`:n:e}const $3=Hn.define({map:e=>e}),t6=Hn.define(),su=Hn.define();class eve extends Ca{constructor(t){super(),this.tag=t}eq(t){return this.tag.id===t.tag.id&&this.tag.label===t.tag.label&&this.tag.value===t.tag.value&&this.tag.removable===t.tag.removable}toDOM(t){const n=document.createElement("span");n.style.cssText="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;";const r=Zk(this.tag),s=e6(this.tag);if(r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=r,n.appendChild(i)}if(s){const i=document.createElement("span");i.style.cssText="max-width:32ch;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 0.5ch;color:var(--muted-foreground);",i.textContent=s,n.appendChild(i)}else if(!r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=this.tag.id,n.appendChild(i)}if(this.tag.removable!==!1){const i=document.createElement("button");i.type="button",i.setAttribute("aria-label",`Remove ${rP(this.tag)}`),i.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;",i.textContent="×",i.addEventListener("mousedown",o=>o.preventDefault()),i.addEventListener("click",o=>{o.stopPropagation();const a=[];t.state.field(Ud).between(0,t.state.doc.length,(l,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&a.push({from:l,to:c,insert:""})}),a.length!==0&&(t.dispatch({changes:a,effects:t6.of({predicate:l=>l.id===this.tag.id}),scrollIntoView:!0}),t.focus())}),i.addEventListener("mouseenter",()=>{i.style.color="var(--error-color)"}),i.addEventListener("mouseleave",()=>{i.style.color="var(--muted-foreground)"}),n.appendChild(i)}return n}ignoreEvent(){return!1}}function tve(e){const t={widget:new eve(e.tag),inclusive:!1,tag:e.tag};return gn.replace(t).range(e.from,e.to)}const Ud=Ta.define({create(){return gn.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is($3)?n=n.update({add:[tve(r.value)]}):r.is(t6)?n=n.update({filter:(s,i,o)=>{const a=o.spec.tag;return a&&r.value.predicate?!r.value.predicate(a):!0}}):r.is(su)&&(n=gn.none);return n},provide:e=>[St.decorations.from(e),St.atomicRanges.of(t=>t.state.field(e))]});function nve(e){const t=[];return e.state.field(Ud).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push(i)}),t}const gA=new ed,yA=new ed,bA=new ed;function iu(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function rve(e,t){const n=iu(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class sve extends Ca{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 vA(e){return wi.fromClass(class{constructor(t){ue(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return gn.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=rve(r,e);return!s||!n.empty||n.head!==r.length?gn.none:gn.set([gn.widget({widget:new sve(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}function wA(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const r=e.state.selection.main;if(!r.empty)return"editor";const s=r.head,i=n.lineAt(s);return t==="up"?i.number>1?"editor":s>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":s<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function ive(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:r,disabled:s=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:u,currentMode:d="default",onFocusFooter:f,dialogOpen:m=!1,followupState:p,onAcceptFollowup:y,onDismissFollowup:w,sessionName:b,composerInput:v,composerInputVersion:x,editorTheme:S}=e,C=EN(),{language:E,t:M}=ht(),D=g.useRef(null),O=g.useRef(null),A=g.useRef(t);A.current=t;const j=g.useRef(n);j.current=n;const I=g.useRef(r);I.current=r;const P=g.useRef(s);P.current=s;const F=g.useRef(o);F.current=o;const q=g.useRef(a);q.current=a;const R=g.useRef(l);R.current=l;const V=g.useRef(M);V.current=M;const J=g.useRef(c);J.current=c;const ee=g.useRef(u);ee.current=u;const N=g.useRef(p);N.current=p;const G=g.useRef(y);G.current=y;const B=g.useRef(w);B.current=w;const k=g.useRef(f);k.current=f;const Q=g.useRef(E);Q.current=E;const ce=g.useRef(C==null?void 0:C.actions);ce.current=C==null?void 0:C.actions;const[pe,be]=g.useState(!1),ye=g.useRef(pe);ye.current=pe;const ie=g.useCallback(()=>{var X,de,Re;(X=N.current)!=null&&X.isVisible&&((de=B.current)==null||de.call(B)),be(st=>!st),(Re=O.current)==null||Re.focus()},[]),[re,oe]=g.useState(!1),[ve,qe]=g.useState(""),[We,te]=g.useState([]),[we,Se]=g.useState(0),Ne=g.useRef(null),Pt=g.useRef(null),at=g.useRef(""),[vt,Tt]=g.useState([]),rt=g.useRef([]),tt=g.useRef(new Map),Qe=g.useRef(1),[ne,se]=g.useState([]),De=g.useRef([]);De.current=ne;const lt=g.useRef(v);lt.current=v;const ae=g.useRef(()=>!0),ze=g.useRef(null),[Je,Nt]=g.useState(null),Ut=g.useRef(null),he=g.useRef(!1),Y=g.useCallback(X=>{Ut.current=X,Nt(X)},[]),me=g.useCallback((X,de)=>{var mn;if(!X||P.current||ye.current){Y(null);return}if(he.current){Y(null);return}const Re=X.state.selection.main;if(!Re.empty){Y(null);return}const st=b4e(X.state.doc.toString(),Re.head,F.current,q.current,Q.current,En=>V.current(En),R.current??pm);if(!st){Y(null);return}const en=de??((mn=Ut.current)==null?void 0:mn.selectedIndex)??0,jt=Math.max(0,Math.min(en,st.items.length-1));Y({...st,selectedIndex:jt})},[Y]),le=g.useCallback(()=>{Y(null)},[Y]),Ke=g.useCallback(X=>{const de=Ut.current;return!de||X<0||X>=de.items.length?!1:(de.selectedIndex===X||Y({...de,selectedIndex:X}),!0)},[Y]),_t=g.useCallback(X=>{const de=Ut.current;if(!de)return!1;const Re=z4e(de.selectedIndex,de.items.length,X);return Re===null?!1:(Y({...de,selectedIndex:Re}),!0)},[Y]),Et=g.useCallback(X=>{const de=O.current,Re=Ut.current;if(!de||!Re)return!1;const st=Re.items[X??Re.selectedIndex];return st?(de.dispatch({changes:{from:Re.from,to:Re.to,insert:st.apply},selection:{anchor:Re.from+st.apply.length},scrollIntoView:!0}),de.focus(),!0):!1},[]),[Ze,Kt]=g.useState(!1);g.useEffect(()=>{const X=O.current,de=(X==null?void 0:X.state.doc.toString())??"",Re=iu(de,p!=null&&p.isVisible?p.suggestion:null);Kt(de.trim().length>0||!!Re||ne.length>0||vt.length>0)},[ne,vt,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]);const Wn=fA(),yn=fA("qwen-web-shell-command-history"),{push:Sn,navigateUp:Ie,navigateDown:bt,isNavigating:Qt,reset:Wr,getReverseMatches:ni,getLastEntry:Gi,resetSearch:Po}=Wn,Gn=g.useRef({push:Sn,navigateUp:Ie,navigateDown:bt,isNavigating:Qt,reset:Wr,getReverseMatches:ni,getLastEntry:Gi,resetSearch:Po});Gn.current={push:Sn,navigateUp:Ie,navigateDown:bt,isNavigating:Qt,reset:Wr,getReverseMatches:ni,getLastEntry:Gi,resetSearch:Po};const kr=g.useRef(yn);kr.current=yn,rt.current=vt;const Gr=g.useCallback(X=>{const de=ye.current,st=(de?kr.current:Gn.current).getReverseMatches(X);return de?st:st.filter(en=>!en.trimStart().startsWith("/"))},[]),An=g.useCallback(()=>{if(P.current)return;const X=O.current;if(!X)return;le();const de=X.state.doc.toString();at.current=de,oe(!0),qe("");const Re=ye.current?kr.current:Gn.current;te(Gr("")),Se(0),Re.resetSearch(),setTimeout(()=>{var st;return(st=Ne.current)==null?void 0:st.focus()},0)},[le,Gr]),$o=g.useRef(An);$o.current=An;const Cs=g.useCallback(()=>{if(P.current)return;const X=O.current;if(!X)return;if(Ti(X.state)==="active"){tc(!1)(X),X.focus();return}if(X.state.doc.lines>1){X.focus();return}const de=ye.current?kr.current:Gn.current,Re=X.state.doc.toString(),st=de.navigateUp(Re);st!==null&&X.dispatch({changes:{from:0,to:X.state.doc.length,insert:st},selection:{anchor:st.length}}),X.focus()},[]),So=g.useCallback(()=>{if(P.current)return;const X=O.current;if(!X)return;if(Ti(X.state)==="active"){tc(!0)(X),X.focus();return}if(X.state.doc.lines>1){X.focus();return}const Re=(ye.current?kr.current:Gn.current).navigateDown();Re!==null&&X.dispatch({changes:{from:0,to:X.state.doc.length,insert:Re},selection:{anchor:Re.length}}),X.focus()},[]);g.useEffect(()=>{var Uo,Yi;if(!D.current)return;$4e();const X=document.createElement("div");X.setAttribute("data-web-shell-tooltip-portal",""),X.style.position="fixed",X.style.inset="0",X.style.zIndex="var(--web-shell-tooltip-z-index)",X.style.pointerEvents="none";const de=/\b\S*theme(?:Dark|Light)\S*/gi,Re=()=>{var et,pt;let Te=D.current,fe=null;if(D.current){const Rt=getComputedStyle(D.current);for(let Mt=0;Mt<Rt.length;Mt+=1){const cn=Rt[Mt];cn.startsWith("--")&&X.style.setProperty(cn,Rt.getPropertyValue(cn))}Rt.getPropertyValue("--web-shell-tooltip-z-index").trim()||X.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;Te;){const Rt=(pt=(et=Te.className)==null?void 0:et.match)==null?void 0:pt.call(et,de);if(Rt){fe=Rt[0];break}Te=Te.parentElement}fe&&(X.className=fe)};Re(),document.body.appendChild(X);const st=new MutationObserver(Re);let en=D.current;for(;en&&(st.observe(en,{attributes:!0,attributeFilter:["class","style"]}),!((Yi=(Uo=en.className)==null?void 0:Uo.match)!=null&&Yi.call(Uo,de)));)en=en.parentElement;const jt=(Te,fe,et)=>{var Xi,Qi;const pt=Te.state.doc.toString(),Rt=N.current,Mt=fe===void 0&&(Rt!=null&&Rt.isVisible)?iu(pt,Rt.suggestion):null,cn=(fe??Mt??pt).trim(),tn=et??De.current;if(!cn&&tn.length===0)return!0;const vr=J4e(tt.current,cn),$s=_v(vr,tn),ar=rt.current,xn=ye.current;return A.current(xn?`!${$s}`:$s,ar.length>0?[...ar]:void 0)===!1||(Y(null),Mt&&((Xi=G.current)==null||Xi.call(G,"enter",{skipOnAccept:!0})),(Qi=B.current)==null||Qi.call(B),tt.current.clear(),Qe.current=1,xn?(kr.current.push(vr),kr.current.reset()):(Gn.current.push(vr),Gn.current.reset()),he.current=!1,se([]),Tt([]),Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:""},effects:su.of()})),!0};ae.current=jt;const mn=[v4e(()=>{var Te;return(Te=ce.current)==null?void 0:Te.globWorkspace},()=>{var Te;return(Te=ce.current)==null?void 0:Te.loadExtensionsStatus})],En=Te=>(Te.dispatch(Te.state.replaceSelection(`
`)),!0),Pn=(Te,fe)=>{var Mt;const et=N.current,pt=et==null?void 0:et.suggestion,Rt=iu(Te.state.doc.toString(),pt);return!(et!=null&&et.isVisible)||!Rt?!1:(Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:Rt},selection:{anchor:Rt.length},scrollIntoView:!0}),Te.focus(),(Mt=G.current)==null||Mt.call(G,fe,{skipOnAccept:!0}),!0)},Tn=lm.of([{key:"Backspace",run:Te=>{var Rt;const fe=Te.state.selection.main;if(!fe.empty||fe.from!==0)return!1;let et=!1;if(Te.state.field(Ud).between(0,1,Mt=>{Mt===0&&(et=!0)}),et)return!1;let pt=-1;for(let Mt=De.current.length-1;Mt>=0;Mt-=1)if(((Rt=De.current[Mt])==null?void 0:Rt.removable)!==!1){pt=Mt;break}return pt<0?!1:(se(Mt=>Mt.filter((cn,tn)=>tn!==pt)),!0)}},{key:"Delete",run:Te=>{const fe=Te.state.selection.main;if(!fe.empty||fe.from!==0)return!1;let et=!1;if(Te.state.field(Ud).between(0,1,Rt=>{Rt===0&&(et=!0)}),et)return!1;const pt=De.current.findIndex(Rt=>Rt.removable!==!1);return pt<0?!1:(se(Rt=>Rt.filter((Mt,cn)=>cn!==pt)),!0)}},{key:"Enter",run:Te=>{var pt;if(Ut.current)return Et();if(Ti(Te.state)==="active")return!1;const fe=N.current,et=iu(Te.state.doc.toString(),fe==null?void 0:fe.suggestion);return fe!=null&&fe.isVisible&&et?((pt=G.current)==null||pt.call(G,"enter",{skipOnAccept:!0}),jt(Te,et)):jt(Te)}},{key:"Shift-Enter",run:En},{key:"Ctrl-j",run:En},{key:"Mod-Enter",run:En},{key:"Alt-Enter",run:En},{key:"Escape",run:()=>Ut.current?(le(),!0):ye.current?(be(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:Te=>{var cn;const fe=ye.current?kr.current:Gn.current;if(he.current)Gg(Te),le();else{if(_t("up"))return!0;if(Ti(Te.state)==="active")return tc(!1)(Te)}const pt=wA(Te,"up");if(pt==="handled")return!0;if(pt==="editor")return!1;if(ye.current){const tn=Te.state.doc.toString(),vr=fe.navigateUp(tn);return vr===null||(he.current=!0,Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:vr},selection:{anchor:vr.length}})),!0}if(J.current.length>0&&(cn=ee.current)!=null&&cn.call(ee))return!0;const Rt=Te.state.doc.toString(),Mt=fe.navigateUp(Rt);return Mt===null?!1:(he.current=!0,Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:Mt},selection:{anchor:Mt.length}}),!0)}},{key:"ArrowDown",run:Te=>{var Mt;const fe=ye.current?kr.current:Gn.current;if(he.current)Gg(Te),le();else{if(_t("down"))return!0;if(Ti(Te.state)==="active")return tc(!0)(Te)}const pt=wA(Te,"down");if(pt==="handled")return!0;if(pt==="editor")return!1;if(ye.current){const cn=fe.navigateDown();return cn===null||(he.current=fe.isNavigating(),Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:cn},selection:{anchor:cn.length}})),!0}const Rt=fe.navigateDown();return Rt===null?((Mt=k.current)==null?void 0:Mt.call(k))??!1:(he.current=fe.isNavigating(),Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:Rt},selection:{anchor:Rt.length}}),!0)}},{key:"Ctrl-r",run:()=>($o.current(),!0)},{key:"Tab",run:Te=>{if(Pn(Te,"tab"))return!0;if(Ut.current)return Et();if(Ti(Te.state)==="active")return HB(Te);const fe=Te.state.doc.toString(),et=f4e(fe,F.current,Q.current);if(et)return Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:et},selection:{anchor:et.length}}),!0;const pt=h4e(fe,F.current);return pt&&Te.dispatch({changes:{from:0,to:Te.state.doc.length,insert:pt},selection:{anchor:pt.length}}),!0}},{key:"ArrowRight",run:Te=>!!(Ti(Te.state)!=="active"&&Pn(Te,"right"))},{key:"Shift-Tab",run:()=>{var Te;return(Te=j.current)==null||Te.call(j),!0}}]),As=St.updateListener.of(Te=>{if(Te.docChanged&&tt.current.size>0){const et=Q4e(tt.current,Te.state.doc.toString());et!==null&&(Qe.current=et)}Te.transactions.some(et=>et.isUserEvent("input")||et.isUserEvent("delete"))&&(he.current=!1),(Te.docChanged||Te.selectionSet)&&me(Te.view)});let Fo=!1;const as=St.updateListener.of(Te=>{const fe=ze.current,et=Ti(Te.state)==="active";if(fe){const pt=Te.state.doc;if(!(pt.length===fe.from+fe.text.length&&pt.sliceString(fe.from)===fe.text))ze.current=null;else if(Fo&&!et){ze.current=null;const{view:Mt}=Te,{from:cn}=fe;window.setTimeout(()=>{if(O.current!==Mt)return;const tn=Mt.state.doc;tn.length===cn+fe.text.length&&tn.sliceString(cn)===fe.text&&Mt.dispatch({changes:{from:cn,to:tn.length,insert:""}})},0)}}Fo=et,et||q4e(X)}),si=Bn.create({doc:"",extensions:[Zu.highest(Tn),B2e,cB(),lm.of([...$B,...fB]),j2e({override:mn,activateOnTyping:!0,icons:!1,optionClass:Te=>Te.type==="file"?"cm-file-completion":Jk(Te)?"cm-command-info-completion":"",addToOptions:[{render:W4e,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(Te,fe,et,pt,Rt)=>{const Mt=pt.bottom-pt.top,cn=Rt.bottom-fe.bottom,tn=cn>=Mt||cn>fe.top,vr=tn?"top":"bottom",$s=tn?et.bottom-fe.top:fe.bottom-et.top;return{style:`${vr}: ${$s}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:Te=>typeof Te.apply=="string"&&Te.apply.endsWith(" ")}),oye({parent:X}),yA.of(DC("")),bA.of(vA(null)),St.lineWrapping,gA.of(St.editable.of(!0)),j4e(()=>F.current,()=>Q.current),D4e,Ud,As,as,St.updateListener.of(Te=>{if(Te.docChanged){const fe=Te.state.doc.toString(),et=N.current,pt=iu(fe,et!=null&&et.isVisible?et.suggestion:null);Kt(fe.trim().length>0||!!pt||De.current.length>0||rt.current.length>0)}}),St.inputHandler.of((Te,fe,et,pt)=>{var Rt;return pt==="!"&&Te.state.doc.toString()===""&&Ti(Te.state)!=="active"?(ie(),!0):pt==="?"&&Te.state.doc.toString()===""&&Ti(Te.state)!=="active"?((Rt=I.current)==null||Rt.call(I),!0):!1}),St.domEventHandlers({blur(){return le(),!1},paste(Te){var tn,vr,$s,ar;const fe=(tn=Te.clipboardData)==null?void 0:tn.items;if(!fe)return!1;let et=!1;for(const xn of fe)if(xn.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(xn.type)){et=!0;const Yn=xn.getAsFile();if(!Yn)continue;const Xi=xn.type,Qi=new FileReader;Qi.onload=()=>{const $c=Qi.result.split(",")[1];Tt(zc=>[...zc,{data:$c,media_type:Xi}])},Qi.readAsDataURL(Yn)}if(et)return Te.preventDefault(),!0;const pt=G4e(((vr=Te.clipboardData)==null?void 0:vr.getData("text/plain"))??"");if(!pt||!K4e(pt))return!1;Te.preventDefault(),Ki.state.doc.toString()===""&&(($s=N.current)!=null&&$s.isVisible)&&((ar=B.current)==null||ar.call(B));const{placeholderText:Rt,nextPasteId:Mt}=X4e(tt.current,Qe.current,pt);Qe.current=Mt;const cn=Ki.state.selection.main;return Ki.dispatch({changes:{from:cn.from,to:cn.to,insert:Rt},selection:{anchor:cn.from+Rt.length},scrollIntoView:!0}),!0}}),St.theme(S)]}),Ki=new St({state:si,parent:D.current});O.current=Ki,Ki.focus();const tf=Ki.state.doc.toString().trim();return Kt(tf.length>0||De.current.length>0||rt.current.length>0),()=>{Ki.destroy(),O.current=null,st.disconnect(),X.remove()}},[]),g.useEffect(()=>{const X=O.current;X&&(X.dispatch({effects:gA.reconfigure(St.editable.of(!s))}),s||X.focus())},[s]),g.useEffect(()=>{const X=O.current;if(!X)return;const de=!s&&(p!=null&&p.isVisible)&&p.suggestion?p.suggestion:null,Re=de??(pe?M("editor.shellPlaceholder"):i);X.dispatch({effects:[yA.reconfigure(DC(Re)),bA.reconfigure(vA(de))]})},[s,i,pe,M,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]),g.useEffect(()=>{const X=O.current;!X||Ti(X.state)!=="active"||(Gg(X),window.setTimeout(()=>{O.current===X&&sh(X)},0))},[E]);const xe=[o.map(X=>{var de;return[X.name,X.description??"",X.source??"",X.displayCategory??"",X.argumentHint??"",((de=X.subcommands)==null?void 0:de.join(","))??""].join("\0")}).join(""),a.map(X=>[X.name,X.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");g.useEffect(()=>{Ut.current&&me(O.current)},[xe,E,me]),g.useEffect(()=>{const X=O.current;X&&(m?(le(),X.contentDOM.blur()):X.focus())},[m,le]),g.useEffect(()=>{const X=de=>{var Tn,As,Fo;if(P.current||re||m||de.defaultPrevented)return;const Re=de.target,st=(Tn=D.current)==null?void 0:Tn.contains(Re),en=document.activeElement===document.body;if(!st&&!en)return;const jt=O.current,mn=N.current,En=iu((jt==null?void 0:jt.state.doc.toString())??"",mn==null?void 0:mn.suggestion);if(jt&&!jt.hasFocus&&(mn!=null&&mn.isVisible)&&En&&!Z0(de.target)){if(de.key==="Tab"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&Ti(jt.state)!=="active"){de.preventDefault(),jt.dispatch({changes:{from:0,to:jt.state.doc.length,insert:En},selection:{anchor:En.length},scrollIntoView:!0}),jt.focus(),(As=G.current)==null||As.call(G,"tab",{skipOnAccept:!0});return}if(de.key==="ArrowRight"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&Ti(jt.state)!=="active"){de.preventDefault(),jt.dispatch({changes:{from:0,to:jt.state.doc.length,insert:En},selection:{anchor:En.length},scrollIntoView:!0}),jt.focus(),(Fo=G.current)==null||Fo.call(G,"right",{skipOnAccept:!0});return}}if(de.metaKey||de.ctrlKey||de.altKey||de.key.length!==1||Z0(de.target)||!jt||jt.hasFocus)return;if(de.preventDefault(),de.key==="!"&&jt.state.doc.toString()===""){ie();return}const Pn=jt.state.selection.main;jt.dispatch({changes:{from:Pn.from,to:Pn.to,insert:de.key},selection:{anchor:Pn.from+de.key.length},scrollIntoView:!0}),jt.focus(),de.key==="/"?window.setTimeout(()=>{me(O.current)},0):de.key==="@"&&window.setTimeout(()=>{const as=O.current;as&&as.hasFocus&&sh(as)},0)};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[re,m,me,ie]);const Be=g.useCallback(()=>{var X;(X=O.current)==null||X.focus()},[]),Dt=g.useCallback((X,de)=>{const Re=O.current;if(!Re||!X){Re==null||Re.focus();return}if((de==null?void 0:de.mode)==="replace"){Re.dispatch({changes:{from:0,to:Re.state.doc.length,insert:X},effects:su.of(),selection:{anchor:X.length},scrollIntoView:!0}),Re.focus();return}const st=Re.state.selection.main;let en=X,jt=!1,mn=null;const En=X==="@";let Pn=X==="/";if(X==="/")Re.state.doc.lineAt(st.head).text.startsWith("/")?jt=!0:Re.state.doc.length>0&&(jt=!0,Pn=!1);else if(X==="@"){const Tn=st.from>0?Re.state.doc.sliceString(st.from-1,st.from):"";Re.state.doc.sliceString(st.from,st.from+1)==="@"?(jt=!0,mn=st.from+1):Tn==="@"?jt=!0:Tn&&!/\s/.test(Tn)&&(en=" @")}jt?mn!==null&&Re.dispatch({selection:{anchor:mn},scrollIntoView:!0}):(Re.dispatch({changes:{from:st.from,to:st.to,insert:en},selection:{anchor:st.from+en.length},scrollIntoView:!0}),En&&(ze.current={text:en,from:st.from})),Re.focus(),Pn?window.setTimeout(()=>{me(O.current)},0):En&&window.setTimeout(()=>{const Tn=O.current;Tn&&Tn.hasFocus&&sh(Tn)},0)},[me]),rn=g.useCallback(()=>{var X;return((X=O.current)==null?void 0:X.state.doc.toString())??""},[]),qt=g.useCallback(X=>{const de=O.current;de&&(de.dispatch({changes:{from:0,to:de.state.doc.length,insert:X},effects:su.of(),selection:{anchor:X.length},scrollIntoView:!0}),de.focus())},[]),on=g.useCallback(X=>{const de=O.current;if(!de)return;const Re=[];de.state.field(Ud).between(0,de.state.doc.length,(st,en,jt)=>{const mn=jt.spec.tag;mn&&(!X||X(mn))&&Re.push({from:st,to:en,insert:""})}),de.dispatch({...Re.length>0?{changes:Re}:{},effects:t6.of({predicate:X}),scrollIntoView:!0})},[]),nr=g.useCallback(X=>{const de=(X==null?void 0:X.text)??!0,Re=(X==null?void 0:X.tags)??!0,st=O.current;de&&st&&st.state.doc.length>0&&st.dispatch({changes:{from:0,to:st.state.doc.length,insert:""},effects:su.of()}),de&&(Tt([]),tt.current.clear(),Qe.current=1),Re&&(se([]),de||on())},[on]),Kr=g.useCallback(()=>{nr({text:!0,tags:!1})},[nr]),Yr=g.useCallback((X,de)=>{if(X.length!==0){if((de==null?void 0:de.placement)==="inline"){const Re=O.current;if(!Re)return;const st=Re.state.selection.main;let en=st.from;const jt=[],mn=X.map(Pn=>{const Tn=Kg(Pn);return jt.push({from:en,to:en+Tn.length,tag:Pn}),en+=Tn.length+1,Tn}).join(" "),En=mn?`${mn} `:"";Re.dispatch({changes:{from:st.from,to:st.to,insert:En},effects:jt.length>0?jt.map(Pn=>$3.of(Pn)):void 0,selection:{anchor:st.from+En.length},scrollIntoView:!0}),Re.focus();return}se(Re=>{const st=[...Re];for(const en of X){const jt=st.findIndex(mn=>mn.id===en.id);jt>=0?st[jt]=en:st.push(en)}return st})}},[]),fn=g.useCallback(X=>{se(de=>de.filter(Re=>Re.id!==X||Re.removable===!1)),on(de=>de.id===X&&de.removable!==!1)},[on]),sn=g.useCallback(()=>{var X;return(((X=O.current)==null?void 0:X.state.doc.toString().trim().length)??0)>0||De.current.length>0||rt.current.length>0},[]),mt=g.useCallback(X=>{const de=O.current;if(!de)return;const Re=nve(de);if((X==null?void 0:X.tagPlacement)==="inline"){ae.current(de,_v(X.text??"",X.tags??Re),[]);return}if((X==null?void 0:X.text)!==void 0&&X.tags===void 0&&Re.length>0){ae.current(de,_v(X.text,Re),[]);return}ae.current(de,X==null?void 0:X.text,X?X.tags??[]:void 0)},[]),Aa=g.useCallback(()=>{const X=Gn.current.getLastEntry(Re=>!Re.startsWith("/")&&!Re.startsWith("!"));!X||A.current(X)===!1||Tt([])},[]),br=g.useCallback(X=>{const de=O.current;de&&de.dispatch({changes:{from:0,to:de.state.doc.length,insert:X},selection:{anchor:X.length},scrollIntoView:!0})},[]);g.useEffect(()=>{const X=lt.current;if(!X)return;const de=O.current;if(!de)return;const Re=X.tagPlacement??"top";if(X.tags!==void 0&&Re==="top"&&se([...X.tags]),X.text!==void 0||Re==="inline"){const en=Re==="inline"?[...X.tags??[]]:[],jt=en.map(Kg).join(" "),mn=Re==="inline"?jt&&X.text?`${jt} ${X.text}`:jt||(X.text??""):X.text??"",En=[su.of()];if(en.length>0){let Pn=0;for(const Tn of en){const As=Kg(Tn);En.push($3.of({from:Pn,to:Pn+As.length,tag:Tn})),Pn+=As.length+1}}de.dispatch({changes:{from:0,to:de.state.doc.length,insert:mn},effects:En,selection:{anchor:mn.length},scrollIntoView:!0})}else de.dispatch({effects:su.of()});(X.text!==void 0||X.submit)&&de.focus();let st=null;return X.submit&&(st=window.setTimeout(()=>{O.current&&mt(X)},0)),()=>{st!==null&&window.clearTimeout(st)}},[x,mt]);const or=g.useCallback((X,de=!0)=>{var st;X&&br(at.current),oe(!1),qe(""),te([]),Se(0),(ye.current?kr.current:Gn.current).resetSearch(),de&&((st=O.current)==null||st.focus())},[br]);g.useEffect(()=>{if(!re)return;const X=de=>{if(de instanceof MouseEvent&&de.button!==0||de.defaultPrevented)return;const Re=Pt.current,st=de.target;Re&&st instanceof Node&&!Re.contains(st)&&or(!0,!1)};return window.addEventListener("mousedown",X),window.addEventListener("touchstart",X),()=>{window.removeEventListener("mousedown",X),window.removeEventListener("touchstart",X)}},[re,or]);const os=g.useCallback(X=>{var mn;if(!O.current)return;or(!1);const Re=X.trim();if(!Re)return;const st=rt.current,en=ye.current;if(A.current(en?`!${Re}`:Re,st.length>0?[...st]:void 0)===!1){br(X);return}(mn=B.current)==null||mn.call(B),en?(kr.current.push(Re),kr.current.reset()):(Gn.current.push(Re),Gn.current.reset()),Tt([]),br("")},[or,br]),zo=X=>{if(!X.nativeEvent.isComposing)if(X.key==="Escape")X.preventDefault(),or(!0);else if(X.key==="Tab"){X.preventDefault();const de=We[we];de&&br(de),or(!1)}else if(X.key==="Enter"){X.preventDefault();const de=We[we];de?os(de):or(!1)}else X.key==="r"&&X.ctrlKey&&(X.preventDefault(),We.length>0&&Se(de=>(de+1)%We.length))},xl=X=>{const de=ye.current?kr.current:Gn.current;te(Gr(X)),Se(0),de.resetSearch()},ef=X=>{const de=X.target.value;qe(de),!X.nativeEvent.isComposing&&xl(de)},td=X=>{const de=X.currentTarget.value;qe(de),xl(de)},Kn=g.useCallback(X=>{Tt(de=>de.filter((Re,st)=>st!==X))},[]),ri=!pe&&!re&&!(p!=null&&p.isVisible)&&!s&&!m,Pc={clearText:Kr,clear:nr,focus:Be,getText:rn,hasInput:sn,setText:qt,addTags:Yr,removeTag:fn,insertText:Dt,retryLast:Aa,restoreImages:X=>{Tt(de=>[...de,...X])},submit:mt};return{containerRef:D,viewRef:O,focus:Be,submitText:g.useCallback(()=>{const X=O.current;X&&ae.current(X)},[]),clearText:Kr,getText:rn,hasInput:sn,hasContent:Ze,handle:Pc,pastedImages:vt,removeImage:Kn,composerTags:ne,removeTopTag:fn,addTags:Yr,removeInlineTags:on,insertText:Dt,setText:qt,submit:mt,clear:nr,retryLast:Aa,replaceEditorText:br,shellMode:pe,setShellMode:be,toggleShellMode:ie,currentMode:d,sessionName:b,searchState:{searchMode:re,searchQuery:ve,searchMatches:We,searchActiveIndex:we,searchInputRef:Ne,searchUiRef:Pt,openHistorySearch:An,closeSearch:or,submitSearchMatch:os,handleSearchKeyDown:zo,handleSearchInput:ef,handleSearchCompositionEnd:td},navigatePrevHistory:Cs,navigateNextHistory:So,showShortcutHints:ri,followupState:p,disabled:s,onAcceptFollowup:y,onDismissFollowup:w,slashMenu:Je,closeSlashMenu:le,selectSlashCompletion:Ke,acceptSlashCompletion:Et}}const ove="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",ave="/assets/default-aEtf0G7-.svg",sP="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",lve="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",cve="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";function Kf(e,t){return{[e]:`url("${t}")`}}const uve="_icon_i7y0u_1",dve={icon:uve},hve={auto:ove,"auto-edit":sP,default:ave,plan:lve,yolo:cve};function z3({mode:e}){const t=hve[e];return t?h.jsx("span",{className:dve.icon,style:Kf("--mode-icon-url",t),"aria-hidden":"true"}):h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.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 fve(e,t){const n=new Map;if(t==="command")for(const s of e)s.section&&n.set(s.section,(n.get(s.section)??0)+1);let r;return e.map((s,i)=>{const o=s.section,a=t==="command"&&o!==void 0&&o!==r,l=a&&i>0;return r=o??r,{showHeader:a,showDivider:l,count:a&&o?n.get(o)??0:0}})}function xy(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const kv=16e3,mve=4096,xA=6e4;function pve(e){const t=new URL(e),n=t.pathname.replace(/\/?$/,"/"),r=new URL("voice/stream",`${t.origin}${n}`);return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}const gve="qwen-bearer.",yve="qwen-ws";function bve(e){const t=new TextEncoder().encode(e);let n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);const r=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${gve}${r}`}function vve(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 wve(e){const t=new Int16Array(e.length);let n=0;for(let r=0;r<e.length;r++){let s=e[r];s>1?s=1:s<-1&&(s=-1),t[r]=s<0?s*32768:s*32767,n+=s*s}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function xve(e){const{baseUrl:t,token:n,onFinal:r,onError:s}=e,[i,o]=g.useState("idle"),[a,l]=g.useState(""),[c,u]=g.useState(0),[d,f]=g.useState(void 0),m=g.useRef({}),p=g.useRef(!0),y=g.useRef(0),w=g.useRef("idle"),b=g.useRef(r);b.current=r;const v=g.useRef(s);v.current=s;const x=g.useCallback(I=>{w.current=I,o(I)},[]),S=g.useCallback(()=>{const I=m.current;I.transcribeTimeout&&(clearTimeout(I.transcribeTimeout),I.transcribeTimeout=void 0)},[]),C=g.useCallback(()=>{var P;const I=m.current;I.processor&&(I.processor.onaudioprocess=null);for(const F of[I.processor,I.source,I.sink])try{F==null||F.disconnect()}catch{}(P=I.stream)==null||P.getTracks().forEach(F=>F.stop()),I.context&&I.context.state!=="closed"&&I.context.close().catch(()=>{}),I.processor=void 0,I.sink=void 0,I.source=void 0,I.stream=void 0,I.context=void 0},[]),E=g.useCallback(()=>{y.current++,C();const I=m.current;if(S(),I.ws){try{I.ws.onmessage=null,I.ws.onerror=null,I.ws.onclose=null,I.ws.close()}catch{}I.ws=void 0}},[C,S]),M=g.useCallback((I,P)=>{var F;!p.current||P!==void 0&&y.current!==P||(E(),x("error"),l(""),u(0),f(I),(F=v.current)==null||F.call(v,I))},[E,x]),D=g.useCallback((I,P)=>{P!==void 0&&y.current!==P||(E(),p.current&&(x("idle"),l(""),u(0),b.current(I)))},[E,x]),O=g.useCallback(()=>{if(w.current!=="idle"&&w.current!=="error")return;f(void 0),l(""),x("connecting");const I=++y.current,P=()=>!p.current||y.current!==I;(async()=>{var F;try{if(!((F=navigator.mediaDevices)!=null&&F.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 q;try{q=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(G){throw new Error(vve(G))}if(P()){q.getTracks().forEach(G=>G.stop());return}m.current.stream=q;const R=new AudioContext({sampleRate:kv});if(R.sampleRate!==kv)throw q.getTracks().forEach(G=>G.stop()),R.close().catch(()=>{}),new Error(`Browser audio rate ${R.sampleRate} Hz is not the required ${kv} Hz.`);if(m.current.context=R,R.state==="suspended"&&await R.resume(),P()){q.getTracks().forEach(G=>G.stop()),R.close().catch(()=>{});return}const V=R.createMediaStreamSource(q),J=R.createScriptProcessor(mve,1,1),ee=R.createGain();ee.gain.value=0,m.current.source=V,m.current.processor=J,m.current.sink=ee;const N=new WebSocket(pve(t),n?[yve,bve(n)]:void 0);N.binaryType="arraybuffer",m.current.ws=N,J.onaudioprocess=G=>{const{pcm:B,level:k}=wve(G.inputBuffer.getChannelData(0));p.current&&u(k),N.readyState===WebSocket.OPEN&&N.send(B)},N.onopen=()=>{if(P()){J.onaudioprocess=null;for(const B of[J,V,ee])try{B.disconnect()}catch{}q.getTracks().forEach(B=>B.stop()),R.state!=="closed"&&R.close().catch(()=>{});const G=m.current;G.ws===N&&(G.ws=void 0),G.processor===J&&(G.processor=void 0),G.source===V&&(G.source=void 0),G.sink===ee&&(G.sink=void 0),G.stream===q&&(G.stream=void 0),G.context===R&&(G.context=void 0);try{N.close()}catch{}return}N.send(JSON.stringify({type:"start"})),V.connect(J),J.connect(ee),ee.connect(R.destination),S(),m.current.transcribeTimeout=setTimeout(()=>{w.current==="recording"&&M("No response from server. Check that the voice model is running.",I)},xA),p.current&&x("recording")},N.onmessage=G=>{(w.current==="connecting"||w.current==="recording")&&S();let B;try{B=JSON.parse(String(G.data))}catch{return}B.type==="interim"?p.current&&l(B.text??""):B.type==="final"?D(B.text??"",I):B.type==="error"&&M(B.message??B.text??"Voice transcription failed.",I)},N.onerror=()=>{},N.onclose=G=>{if(p.current&&(w.current==="recording"||w.current==="connecting"||w.current==="transcribing")){const B=G.code||1006,k=G.reason||"none";M(`Voice connection closed (code=${B}, reason=${k}).`,I)}}}catch(q){M(q instanceof Error?q.message:String(q),I)}})()},[t,n,M,D,x,S]),A=g.useCallback(()=>{const I=m.current.ws;if(!I||I.readyState!==WebSocket.OPEN){E(),x("idle");return}C(),u(0),x("transcribing");const P=y.current;try{I.send(JSON.stringify({type:"stop"})),S(),m.current.transcribeTimeout=setTimeout(()=>{w.current==="transcribing"&&M("Transcription timed out.",P)},xA)}catch{M("Failed to finalize voice transcription.",P)}},[E,C,M,x,S]),j=g.useCallback(()=>{const I=m.current.ws;if(I&&I.readyState===WebSocket.OPEN)try{I.send(JSON.stringify({type:"abort"}))}catch{}E(),x("idle"),l(""),u(0)},[E,x]);return g.useEffect(()=>(p.current=!0,()=>{p.current=!1,E()}),[E]),{status:i,interimText:a,audioLevel:c,errorMessage:d,start:O,stop:A,abort:j}}const _ve="_root_9hwm9_7",kve="_iconBtn_9hwm9_14",Sve="_error_9hwm9_47",Tve="_connecting_9hwm9_51",Cve="_pill_9hwm9_56",Ave="_transcribing_9hwm9_75",Eve="_recDot_9hwm9_79",Mve="_wave_9hwm9_88",Ive="_bar_9hwm9_95",Nve="_time_9hwm9_103",Rve="_stop_9hwm9_111",Lve="_spinner_9hwm9_118",jve="_interim_9hwm9_128",Es={root:_ve,iconBtn:kve,error:Sve,connecting:Tve,pill:Cve,transcribing:Ave,recDot:Eve,wave:Mve,bar:Ive,time:Nve,stop:Rve,spinner:Lve,interim:jve},Dve="voice_transcribe",_A=16,Ove=()=>h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[h.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),h.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"})]}),Bve=()=>h.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:h.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Pve(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function $ve({onInsert:e,disabled:t}){var A;const n=a5(),r=((A=n.capabilities)==null?void 0:A.features)??[],[s,i]=g.useState(void 0),{status:o,interimText:a,audioLevel:l,errorMessage:c,start:u,stop:d,abort:f}=xve({baseUrl:n.baseUrl,token:n.token,onFinal:j=>{const I=j.trim();I?(i(void 0),e(I)):i("No speech detected.")}}),m=o==="recording",[p,y]=g.useState(()=>new Array(_A).fill(0));g.useEffect(()=>{if(!m){y(new Array(_A).fill(0));return}y(j=>[...j.slice(1),Math.min(1,l*8)])},[l,m]);const[w,b]=g.useState(0);if(g.useEffect(()=>{if(!m){b(0);return}const j=performance.now(),I=setInterval(()=>b(performance.now()-j),200);return()=>clearInterval(I)},[m]),!r.includes(Dve))return null;const v=o==="connecting",x=o==="transcribing",S=o==="error",C=!!s&&!S,E=m||v,M=m?"Stop dictation":x?"Transcribing…":v?"Starting…":S?`Voice error — click to retry${c?`: ${c}`:""}`:C?"No speech detected — click to retry":"Start voice dictation";let D;if(m)D=h.jsxs("button",{type:"button",className:Es.pill,onClick:()=>d(),"aria-label":M,title:M,children:[h.jsx("span",{className:Es.recDot,"aria-hidden":"true"}),h.jsx("span",{className:Es.wave,"aria-hidden":"true",children:p.map((j,I)=>h.jsx("span",{className:Es.bar,style:{height:`${2+Math.round(j*14)}px`}},I))}),h.jsx("span",{className:Es.time,children:Pve(w)}),h.jsx("span",{className:Es.stop,"aria-hidden":"true",children:h.jsx(Bve,{})})]});else if(x)D=h.jsxs("span",{className:`${Es.pill} ${Es.transcribing}`,role:"status","aria-label":M,children:[h.jsx("span",{className:Es.spinner,"aria-hidden":"true"}),h.jsx("span",{className:Es.time,children:"…"})]});else{const j=[Es.iconBtn,S?Es.error:"",v?Es.connecting:""].filter(Boolean).join(" ");D=h.jsx("button",{type:"button",className:j,onClick:()=>{if(v)f();else{if(t)return;i(void 0),u()}},disabled:!!t&&!E,"aria-label":M,title:c??s??M,children:h.jsx(Ove,{})})}const O=m&&a||S||C;return h.jsxs("span",{className:Es.root,children:[D,O&&h.jsx("span",{role:"status","aria-live":"polite",className:`${Es.interim}${S?` ${Es.error}`:""}`,children:S?c||"Voice error":C?s:a})]})}const zve="_editorShell_1tdi5_1",Fve="_container_1tdi5_7",Uve="_content_1tdi5_22",qve="_dacAura_1tdi5_35",Hve="_dacHalo_1tdi5_36",Vve="_slashPortalLayer_1tdi5_177",Wve="_slashPanel_1tdi5_181",Gve="_slashPanelBody_1tdi5_216",Kve="_slashList_1tdi5_222",Yve="_slashEntry_1tdi5_250",Xve="_slashSection_1tdi5_256",Qve="_slashSectionHeader_1tdi5_262",Jve="_slashSectionCount_1tdi5_275",Zve="_slashItem_1tdi5_283",ewe="_slashItemActive_1tdi5_304",twe="_slashCommand_1tdi5_308",nwe="_slashDetail_1tdi5_313",rwe="_slashDetailCommand_1tdi5_332",swe="_slashDetailText_1tdi5_342",iwe="_slashDescription_1tdi5_362",owe="_tags_1tdi5_391",awe="_tag_1tdi5_391",lwe="_tagLabel_1tdi5_412",cwe="_tagValue_1tdi5_413",uwe="_tagRemove_1tdi5_431",dwe="_editorArea_1tdi5_451",hwe="_shellPrefix_1tdi5_466",fwe="_toolbar_1tdi5_503",mwe="_toolbarLeading_1tdi5_512",pwe="_toolbarStart_1tdi5_513",gwe="_toolbarEnd_1tdi5_514",ywe="_toolbarLeft_1tdi5_515",bwe="_toolbarRight_1tdi5_516",vwe="_toolbarRightCustom_1tdi5_544",wwe="_toolBtn_1tdi5_551",xwe="_toolBtnText_1tdi5_557",_we="_dropdownWrapper_1tdi5_562",kwe="_dropdown_1tdi5_562",Swe="_dropdownRich_1tdi5_584",Twe="_dropdownCheck_1tdi5_590",Cwe="_dropdownItem_1tdi5_596",Awe="_dropdownItemActive_1tdi5_634",Ewe="_dropdownItemIcon_1tdi5_639",Mwe="_dropdownItemCheck_1tdi5_640",Iwe="_dropdownItemContent_1tdi5_657",Nwe="_dropdownItemLabel_1tdi5_664",Rwe="_dropdownItemDesc_1tdi5_674",Lwe="_toolBtnIcon_1tdi5_732",jwe="_widthModeBtn_1tdi5_748",Dwe="_quickActionsBtn_1tdi5_757",Owe="_toolBtnModeIcon_1tdi5_766",Bwe="_toolBtnModelIcon_1tdi5_767",Pwe="_toolBtnArrow_1tdi5_794",$we="_chevronDown_1tdi5_807",zwe="_quickActionsPanel_1tdi5_816",Fwe="_quickActionsHeader_1tdi5_829",Uwe="_quickActionsLayout_1tdi5_836",qwe="_quickActionsGrid_1tdi5_843",Hwe="_quickAction_1tdi5_757",Vwe="_quickActionLabel_1tdi5_874",Wwe="_quickKeysGrid_1tdi5_889",Gwe="_quickKey_1tdi5_889",Kwe="_quickKeyLabel_1tdi5_918",Ywe="_sendBtn_1tdi5_931",Xwe="_sendBtnRunning_1tdi5_969",Qwe="_sendIcon_1tdi5_982",Jwe="_stopIcon_1tdi5_988",Zwe="_loadingIcon_1tdi5_995",exe="_sendBtnArmed_1tdi5_1007",txe="_escLabel_1tdi5_1075",nxe="_srOnly_1tdi5_1083",rxe="_images_1tdi5_1105",sxe="_imageThumb_1tdi5_1112",ixe="_imageRemove_1tdi5_1127",oxe="_searchPanel_1tdi5_1148",axe="_searchBar_1tdi5_1165",lxe="_searchLabel_1tdi5_1173",cxe="_searchInput_1tdi5_1178",uxe="_searchResults_1tdi5_1192",dxe="_searchResult_1tdi5_1192",hxe="_searchResultActive_1tdi5_1225",fxe="_searchResultMarker_1tdi5_1230",mxe="_searchResultText_1tdi5_1235",pxe="_searchEmpty_1tdi5_1242",Pe={editorShell:zve,container:Fve,content:Uve,dacAura:qve,dacHalo:Hve,slashPortalLayer:Vve,slashPanel:Wve,slashPanelBody:Gve,slashList:Kve,slashEntry:Yve,slashSection:Xve,slashSectionHeader:Qve,slashSectionCount:Jve,slashItem:Zve,slashItemActive:ewe,slashCommand:twe,slashDetail:nwe,slashDetailCommand:rwe,slashDetailText:swe,slashDescription:iwe,tags:owe,tag:awe,tagLabel:lwe,tagValue:cwe,tagRemove:uwe,editorArea:dwe,shellPrefix:hwe,toolbar:fwe,toolbarLeading:mwe,toolbarStart:pwe,toolbarEnd:gwe,toolbarLeft:ywe,toolbarRight:bwe,toolbarRightCustom:vwe,toolBtn:wwe,toolBtnText:xwe,dropdownWrapper:_we,dropdown:kwe,dropdownRich:Swe,dropdownCheck:Twe,dropdownItem:Cwe,dropdownItemActive:Awe,dropdownItemIcon:Ewe,dropdownItemCheck:Mwe,dropdownItemContent:Iwe,dropdownItemLabel:Nwe,dropdownItemDesc:Rwe,toolBtnIcon:Lwe,widthModeBtn:jwe,quickActionsBtn:Dwe,toolBtnModeIcon:Owe,toolBtnModelIcon:Bwe,toolBtnArrow:Pwe,chevronDown:$we,quickActionsPanel:zwe,quickActionsHeader:Fwe,quickActionsLayout:Uwe,quickActionsGrid:qwe,quickAction:Hwe,quickActionLabel:Vwe,quickKeysGrid:Wwe,quickKey:Gwe,quickKeyLabel:Kwe,sendBtn:Ywe,sendBtnRunning:Xwe,sendIcon:Qwe,stopIcon:Jwe,loadingIcon:Zwe,sendBtnArmed:exe,escLabel:txe,srOnly:nxe,images:rxe,imageThumb:sxe,imageRemove:ixe,searchPanel:oxe,searchBar:axe,searchLabel:lxe,searchInput:cxe,searchResults:uxe,searchResult:dxe,searchResultActive:hxe,searchResultMarker:fxe,searchResultText:mxe,searchEmpty:pxe},gxe=["approvalMode","model","widthMode","voice"],yxe=new Set(gxe),bxe={"&":{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 kA(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}const vxe=["--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 wxe(){return h.jsx("svg",{className:Pe.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:h.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function xxe(){return h.jsx("span",{className:Pe.stopIcon,"aria-hidden":"true"})}function _xe(){return h.jsx("span",{className:Pe.loadingIcon,"aria-hidden":"true"})}function kxe(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>h.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function Sxe(e,t){let n,r,s,i,o=0,a=0;const l=(y,w)=>{e.style.setProperty("--dac-glow-on",y.toFixed(4)),e.style.setProperty("--dac-glow-pulse",w.toFixed(4))},c=y=>{n!==void 0&&window.cancelAnimationFrame(n);const w=o,b=y-w;if(Math.abs(b)<.001){o=y,l(y,a);return}const v=performance.now(),x=S=>{const C=Math.min((S-v)/220,1);o=w+b*(1-(1-C)**2),l(o,a),n=C<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},u=()=>{r!==void 0&&window.cancelAnimationFrame(r);const y=a,w=performance.now(),b=v=>{const x=Math.min((v-w)/300,1);a=y*(1-x),l(o,a),r=x<1?window.requestAnimationFrame(b):void 0};r=window.requestAnimationFrame(b)},d=y=>{y?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},f=()=>c(1),m=()=>{c(0),d(!1),i!==void 0&&window.clearTimeout(i)},p=()=>{r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),a=1,l(o,1),s=window.setTimeout(u,100),d(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>d(!1),650)};return t.addEventListener("focus",f),t.addEventListener("blur",m),t.addEventListener("keydown",p),document.activeElement===t&&c(1),()=>{n!==void 0&&window.cancelAnimationFrame(n),r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",f),t.removeEventListener("blur",m),t.removeEventListener("keydown",p),l(0,0),d(!1)}}function Txe({mode:e}){return e==="wide"?h.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[h.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)"}),h.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)"})]}):h.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:h.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 SA(){return h.jsx("span",{className:Pe.chevronDown,"aria-hidden":"true"})}function Cxe(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.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"}),h.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 Axe(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 Exe=[{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 Mxe(){return h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function iP(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 Ixe(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]??iP(e,t)}function TA({open:e,items:t,activeId:n,onClose:r,onSelect:s,anchorRef:i,showCheck:o=!1,maxHeight:a}){const l=g.useRef(null);if(g.useEffect(()=>{if(!e)return;const d=f=>{if(f instanceof MouseEvent&&f.button!==0||f.defaultPrevented)return;const m=l.current,p=i.current,y=f.target;m&&y instanceof Node&&!m.contains(y)&&p&&!p.contains(y)&&r()};return window.addEventListener("mousedown",d),()=>window.removeEventListener("mousedown",d)},[e,r,i]),g.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),r())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,r]),!e)return null;const c=t.some(d=>d.description||d.icon),u=c||o;return h.jsx("div",{ref:l,className:`${Pe.dropdown} ${c?Pe.dropdownRich:o?Pe.dropdownCheck:""}`,style:a?{maxHeight:a,overflowY:"auto"}:void 0,children:t.map(d=>h.jsx("button",{type:"button",className:`${Pe.dropdownItem} ${d.id===n?Pe.dropdownItemActive:""}`,onMouseDown:f=>{f.preventDefault(),s(d.id)},children:u?h.jsxs(h.Fragment,{children:[c&&h.jsx("span",{className:Pe.dropdownItemIcon,children:d.icon}),h.jsxs("span",{className:Pe.dropdownItemContent,children:[h.jsx("span",{className:Pe.dropdownItemLabel,children:d.label}),d.description&&h.jsx("span",{className:Pe.dropdownItemDesc,children:d.description})]}),h.jsx("span",{className:Pe.dropdownItemCheck,children:d.id===n?h.jsx(Mxe,{}):null})]}):d.label},d.id))})}function Nxe({menu:e,anchorRef:t,panelRef:n,onSelect:r,onAccept:s}){const i=g.useRef([]),[o,a]=g.useState(null),[l,c]=g.useState({}),[u,d]=g.useState(null),f=g.useRef(null);g.useEffect(()=>{var S;(S=i.current[e.selectedIndex])==null||S.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),g.useLayoutEffect(()=>{const S=t.current;if(!S)return;const C=()=>{const M=S.getBoundingClientRect(),D=getComputedStyle(S),O=Object.fromEntries(vxe.map(A=>[A,D.getPropertyValue(A)]));a({left:Math.max(12,Math.min(M.left+16,window.innerWidth-252)),bottom:window.innerHeight-M.top+8,width:M.width}),c(O)};C();const E=new ResizeObserver(C);return E.observe(S),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{E.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[t,e.items]),g.useEffect(()=>{d(null)},[e.items]);const m=S=>Array.from(S).length,p=Math.max(...e.items.map(S=>m(S.label)),0),y=Math.max(...e.items.map(S=>m(S.detail??"")),0),w=y>0,b={"--slash-command-col":`${Math.min(Math.max(p+1,10),24)}ch`,"--slash-desc-col":w?`${Math.min(Math.max(y+1,18),36)}ch`:"0px","--slash-column-gap":w?"2ch":"0px"};if(!o)return null;const v=fve(e.items,e.kind),x={...b,...l,left:o.left,bottom:o.bottom,"--slash-anchor-width":`${o.width}px`};return Ay.createPortal(h.jsxs("div",{ref:n,className:Pe.slashPortalLayer,style:l,children:[h.jsx("div",{className:Pe.slashPanel,style:x,role:"listbox",onMouseDown:S=>S.preventDefault(),onMouseLeave:S=>{var E;const C=S.relatedTarget;C instanceof Node&&((E=f.current)!=null&&E.contains(C))||d(null)},children:h.jsx("div",{className:Pe.slashPanelBody,children:h.jsx("div",{className:Pe.slashList,onScroll:()=>d(null),children:e.items.map((S,C)=>{const E=v[C];return h.jsxs("div",{className:Pe.slashEntry,children:[E.showHeader&&h.jsxs(h.Fragment,{children:[E.showDivider&&h.jsx("div",{className:Pe.slashSection}),h.jsxs("div",{className:Pe.slashSectionHeader,children:[h.jsx("span",{children:S.section}),E.count>0?h.jsx("span",{className:Pe.slashSectionCount,children:E.count}):null]})]}),h.jsxs("button",{ref:M=>{i.current[C]=M},type:"button",role:"option","aria-selected":C===e.selectedIndex,className:`${Pe.slashItem} ${C===e.selectedIndex?Pe.slashItemActive:""}`,onMouseEnter:M=>{if(r(C),!S.detail){d(null);return}const D=M.currentTarget,O=8,A=180,j=D.getBoundingClientRect(),P=Math.min(j.left+Math.min(220,j.width*.34),window.innerWidth-320-12),F=window.innerHeight-j.bottom-O-12,q=j.top-O-12,R=F>=96||F>=q,V=Math.max(72,Math.min(A,R?F:q));d({label:S.label,detail:S.detail,left:Math.max(12,P),...R?{top:j.bottom+O}:{bottom:window.innerHeight-j.top+O},maxHeight:V})},onMouseDown:M=>{M.preventDefault(),M.stopPropagation(),s(C)},children:[h.jsx("span",{className:Pe.slashCommand,children:S.label}),S.detail&&h.jsx("span",{className:Pe.slashDescription,children:S.detail})]})]},`${S.id}:${C}`)})})})}),u&&h.jsxs("div",{ref:f,className:Pe.slashDetail,style:{...l,left:u.left,top:u.top,bottom:u.bottom,maxHeight:u.maxHeight},children:[h.jsx("div",{className:Pe.slashDetailCommand,children:u.label}),h.jsx("div",{className:Pe.slashDetailText,children:u.detail})]})]}),document.body)}function Rxe({actions:e,onRun:t,onPressKey:n}){const{t:r}=ht();return h.jsxs("div",{className:Pe.quickActionsPanel,onMouseDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[h.jsx("div",{className:Pe.quickActionsHeader,children:r("quickActions.title")}),h.jsxs("div",{className:Pe.quickActionsLayout,children:[h.jsx("div",{className:Pe.quickActionsGrid,children:e.map(s=>h.jsx("button",{type:"button",className:Pe.quickAction,onClick:()=>t(s),children:h.jsx("span",{className:Pe.quickActionLabel,children:s.label})},s.id))}),h.jsx("div",{className:Pe.quickKeysGrid,children:Exe.map(s=>h.jsx("button",{type:"button",className:Pe.quickKey,title:r(s.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(s),children:h.jsx("span",{className:Pe.quickKeyLabel,children:s.label})},s.id))})]})]})}const Lxe=g.memo(g.forwardRef(function(t,n){const{onSubmit:r,onCycleMode:s,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,isPreparing:l=!1,cancelArmed:c=!1,disabled:u=!1,placeholderText:d="Type a message...",commands:f,skills:m=[],slashCommandCategoryOrder:p,queuedMessages:y=[],onPopQueuedMessages:w,currentMode:b="default",currentModel:v="",chatWidthMode:x="1000",showChatWidthToggle:S=!0,chatWidthToggleMin:C,visibleToolbarActions:E,availableModels:M=[],onSelectMode:D,onSelectModel:O,onChatWidthModeChange:A,onFocusFooter:j,dialogOpen:I=!1,followupState:P,onAcceptFollowup:F,onDismissFollowup:q,sessionName:R,composerInput:V,composerInputVersion:J}=t,ee=ive({onSubmit:r,onCycleMode:s,onToggleShortcuts:i,disabled:u,placeholderText:d,commands:f,skills:m,slashCommandCategoryOrder:p,queuedMessages:y,onPopQueuedMessages:w,currentMode:b,onFocusFooter:j,dialogOpen:I,followupState:P,onAcceptFollowup:F,onDismissFollowup:q,sessionName:R,composerInput:V,composerInputVersion:J,editorTheme:bxe}),{t:N}=ht(),{renderComposerToolbarStart:G,renderComposerToolbarEnd:B,renderComposerToolbarRight:k}=Lc();g.useImperativeHandle(n,()=>ee.handle,[ee.handle]);const[Q,ce]=g.useState(!1),[pe,be]=g.useState(!1),[ye,ie]=g.useState(!1),[re,oe]=g.useState(kA),ve=g.useRef(null),qe=g.useRef(null),We=g.useRef(null),te=g.useRef(null),[we,Se]=g.useState(!1),Ne=ee.slashMenu,Pt=ee.closeSlashMenu,at=ee.viewRef;g.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Ie=window.matchMedia("(hover: none), (pointer: coarse)"),bt=()=>oe(kA());return bt(),Ie.addEventListener("change",bt),()=>Ie.removeEventListener("change",bt)},[]),g.useEffect(()=>{re||ie(!1)},[re]),g.useEffect(()=>{if(!Ne)return;const Ie=bt=>{var ni;const Qt=bt.target,Wr=ve.current;Qt instanceof Node&&Wr&&!Wr.contains(Qt)&&!((ni=qe.current)!=null&&ni.contains(Qt))&&Pt()};return window.addEventListener("mousedown",Ie),window.addEventListener("touchstart",Ie),()=>{window.removeEventListener("mousedown",Ie),window.removeEventListener("touchstart",Ie)}},[Ne,Pt]),g.useEffect(()=>{var Qt;const Ie=ve.current,bt=(Qt=at.current)==null?void 0:Qt.contentDOM;if(!(!Ie||!bt))return Sxe(Ie,bt)},[at]),g.useEffect(()=>{const Ie=ve.current,bt=C;if(!Ie||bt===void 0){Se(!1);return}const Qt=()=>{Se(Ie.getBoundingClientRect().width>=bt-50)};Qt();const Wr=new ResizeObserver(Qt);return Wr.observe(Ie),()=>Wr.disconnect()},[C]);const vt=g.useMemo(()=>Hy.map(Ie=>({id:Ie,label:Ixe(Ie,N),description:N(`mode.desc.${Ie}`),icon:h.jsx(z3,{mode:Ie})})),[N]),Tt=g.useMemo(()=>{if(!E)return null;const Ie=E.filter(bt=>yxe.has(bt));return new Set(Ie)},[E]),rt=Ie=>Tt?Tt.has(Ie):!0,tt=g.useMemo(()=>new Set(f.map(Ie=>Ie.name.replace(/^\/+/,""))),[f]),Qe=g.useCallback(Ie=>tt.has(Ie),[tt]),ne=g.useMemo(()=>[{id:"new",label:N("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:N("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:N("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:N("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:N("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:N("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:N("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:N("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:N("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:N("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:N("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:N("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:N("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:N("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:N("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:N("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:ee.shellMode?N("quickActions.exitShellMode"):N("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:N("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Ie=>{const bt=Axe(Ie);return!bt||Qe(bt)}),[ee.shellMode,Qe,N]),se=g.useMemo(()=>M.map(Ie=>({id:Ie.id,label:xy(Ie.label||Ie.id)})),[M]),De=g.useCallback(Ie=>{D==null||D(Ie),ce(!1),ee.focus()},[D,ee]),lt=g.useCallback(Ie=>{O==null||O(Ie),be(!1),ee.focus()},[O,ee]),ae=g.useCallback(Ie=>{const bt=ee.viewRef.current;bt&&(bt.focus(),bt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Ie,bubbles:!0,cancelable:!0})))},[ee]),ze=g.useCallback(Ie=>{if(ie(!1),ce(!1),be(!1),ee.closeSlashMenu(),Ie.action.type==="insert"){ee.insertText(Ie.action.text,{mode:"replace"});return}if(Ie.action.type==="shell"){ee.toggleShellMode();return}if(Ie.action.type==="key"){ae(Ie.action.item.event);return}r(Ie.action.command)},[ee,ae,r]),Je=g.useCallback(Ie=>{ae(Ie.event),Ie.id==="ctrl-r"&&ie(!1)},[ae]),{searchMode:Nt,searchQuery:Ut,searchMatches:he,searchActiveIndex:Y,searchInputRef:me,searchUiRef:le,closeSearch:Ke,handleSearchKeyDown:_t,handleSearchInput:Et,handleSearchCompositionEnd:Ze}=ee.searchState,Kt=Ie=>{const bt=Zk(Ie),Qt=e6(Ie);return!bt&&!Qt?h.jsx("span",{className:Pe.tagLabel,children:Ie.id}):h.jsxs(h.Fragment,{children:[bt&&h.jsx("span",{className:Pe.tagLabel,children:bt}),Qt&&h.jsx("span",{className:Pe.tagValue,children:Qt})]})},Wn=iP(b,N),yn=xy(v),Sn=a&&!ee.hasContent;return h.jsxs("div",{className:Pe.editorShell,"data-composer":!0,children:[h.jsxs("div",{ref:ve,className:Pe.container,"data-dac-glow":!0,onClick:()=>{ce(!1),be(!1),ie(!1),ee.focus()},children:[h.jsx("div",{className:Pe.dacAura,"aria-hidden":"true"}),h.jsx("div",{className:Pe.dacHalo,"aria-hidden":"true"}),Nt&&h.jsxs("div",{ref:le,className:Pe.searchPanel,onMouseDown:Ie=>Ie.stopPropagation(),onClick:Ie=>Ie.stopPropagation(),children:[h.jsxs("div",{className:Pe.searchBar,children:[h.jsx("span",{className:Pe.searchLabel,children:N("editor.searchLabel")}),h.jsx("input",{ref:me,className:Pe.searchInput,value:Ut,onChange:Et,onCompositionEnd:Ze,onKeyDown:_t,placeholder:N("editor.searchPlaceholder")})]}),he.length>0&&h.jsx("div",{className:Pe.searchResults,children:he.map((Ie,bt)=>h.jsxs("button",{type:"button",className:`${Pe.searchResult} ${bt===Y?Pe.searchResultActive:""}`,onMouseDown:Qt=>{Qt.preventDefault(),ee.replaceEditorText(Ie),Ke(!1)},children:[h.jsx("span",{className:Pe.searchResultMarker,children:bt===Y?"›":""}),h.jsx("span",{className:Pe.searchResultText,children:Ie})]},`${Ie}-${bt}`))}),he.length===0&&h.jsx("div",{className:Pe.searchEmpty,children:N("editor.noHistory")})]}),h.jsxs("div",{className:Pe.content,children:[ee.composerTags.length>0&&h.jsx("div",{className:Pe.tags,children:ee.composerTags.map(Ie=>h.jsxs("span",{className:Pe.tag,children:[Kt(Ie),Ie.removable!==!1&&h.jsx("button",{type:"button",className:Pe.tagRemove,"aria-label":`Remove ${rP(Ie)}`,onMouseDown:bt=>bt.preventDefault(),onClick:bt=>{var Qt;bt.stopPropagation(),ee.removeTopTag(Ie.id),(Qt=ee.viewRef.current)==null||Qt.focus()},onKeyDown:bt=>{var Qt;bt.key!=="Backspace"&&bt.key!=="Delete"||(bt.preventDefault(),ee.removeTopTag(Ie.id),(Qt=ee.viewRef.current)==null||Qt.focus())},children:"×"})]},Ie.id))}),ee.pastedImages.length>0&&h.jsx("div",{className:Pe.images,children:ee.pastedImages.map((Ie,bt)=>h.jsxs("div",{className:Pe.imageThumb,children:[h.jsx("img",{src:`data:${Ie.media_type};base64,${Ie.data}`,alt:""}),h.jsx("button",{className:Pe.imageRemove,onClick:Qt=>{Qt.stopPropagation(),ee.removeImage(bt)},children:"×"})]},bt))}),ee.slashMenu&&h.jsx(Nxe,{menu:ee.slashMenu,anchorRef:ve,panelRef:qe,onSelect:ee.selectSlashCompletion,onAccept:ee.acceptSlashCompletion}),h.jsxs("div",{className:Pe.editorArea,children:[ee.shellMode&&h.jsx("span",{className:Pe.shellPrefix,"aria-hidden":"true",children:"!"}),h.jsx("div",{ref:ee.containerRef})]}),h.jsxs("div",{className:Pe.toolbar,children:[h.jsxs("div",{className:Pe.toolbarLeading,children:[G&&h.jsx("div",{className:Pe.toolbarStart,children:h.jsx(G,{disabled:u,isRunning:a,currentMode:b,currentModel:v,sessionName:R})}),h.jsxs("div",{className:Pe.toolbarLeft,children:[rt("approvalMode")&&h.jsxs("div",{className:Pe.dropdownWrapper,children:[h.jsx(TA,{open:Q,items:vt,activeId:b,onClose:()=>ce(!1),onSelect:De,anchorRef:We}),h.jsxs("button",{ref:We,className:Pe.toolBtn,onClick:Ie=>{Ie.stopPropagation(),ee.closeSlashMenu(),ie(!1),ce(bt=>!bt),be(!1)},"aria-label":N("status.mode"),children:[h.jsx("span",{className:Pe.toolBtnModeIcon,children:h.jsx(z3,{mode:b})}),h.jsx("span",{className:Pe.toolBtnText,children:Wn}),h.jsx("span",{className:Pe.toolBtnArrow,children:h.jsx(SA,{})})]})]}),rt("model")&&h.jsxs("div",{className:Pe.dropdownWrapper,children:[h.jsx(TA,{open:pe,items:se,activeId:v,onClose:()=>be(!1),onSelect:lt,anchorRef:te,showCheck:!0,maxHeight:300}),h.jsxs("button",{ref:te,className:Pe.toolBtn,onClick:Ie=>{Ie.stopPropagation(),ee.closeSlashMenu(),ie(!1),be(bt=>!bt),ce(!1)},"aria-label":N("model.select"),children:[h.jsx("span",{className:Pe.toolBtnModelIcon,children:h.jsx(Cxe,{})}),h.jsx("span",{className:Pe.toolBtnText,children:yn}),h.jsx("span",{className:Pe.toolBtnArrow,children:h.jsx(SA,{})})]})]}),B&&h.jsx("div",{className:Pe.toolbarEnd,children:h.jsx(B,{disabled:u,isRunning:a,currentMode:b,currentModel:v,sessionName:R})})]})]}),h.jsxs("div",{className:Pe.toolbarRight,children:[re&&ne.length>0&&h.jsx("button",{className:`${Pe.toolBtn} ${Pe.quickActionsBtn}`,onClick:Ie=>{Ie.stopPropagation(),ee.closeSlashMenu(),ce(!1),be(!1),ie(bt=>!bt)},"aria-expanded":ye,"aria-label":N("quickActions.open"),title:N("quickActions.open"),"data-tooltip":N("quickActions.open"),children:h.jsx("span",{className:Pe.toolBtnIcon,children:h.jsx(kxe,{})})}),k&&h.jsx("div",{className:Pe.toolbarRightCustom,children:h.jsx(k,{disabled:u,isRunning:a,currentMode:b,currentModel:v,sessionName:R})}),S&&we&&rt("widthMode")&&h.jsx("button",{className:`${Pe.toolBtn} ${Pe.widthModeBtn}`,onClick:Ie=>{Ie.stopPropagation(),A==null||A(x==="wide"?"1000":"wide")},disabled:!A,"aria-label":N(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:N(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":N(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:h.jsx("span",{className:Pe.toolBtnIcon,children:h.jsx(Txe,{mode:x})})}),rt("voice")&&h.jsx($ve,{disabled:u,onInsert:Ie=>{const bt=ee.getText(),Qt=bt&&!/\s$/.test(bt)?" ":"";ee.insertText(`${Qt}${Ie} `),ee.focus()}}),h.jsx("button",{className:l||Sn?`${Pe.sendBtn} ${Pe.sendBtnRunning}${c?` ${Pe.sendBtnArmed}`:""}`:Pe.sendBtn,disabled:l?!0:Sn?!o:ee.disabled||!ee.hasContent,onClick:Ie=>{if(Ie.stopPropagation(),!l){if(Sn){o==null||o();return}ee.submitText()}},"aria-label":N(l?"common.loading":Sn?c?"stream.cancelArmed":"stream.cancel":"editor.send"),title:a&&c?N("stream.cancelArmed"):void 0,children:l?h.jsx(_xe,{}):Sn?c?h.jsx("span",{className:Pe.escLabel,"aria-hidden":"true",children:"Esc"}):h.jsx(xxe,{}):h.jsx(wxe,{})}),h.jsx("span",{role:"status","aria-live":"polite",className:Pe.srOnly,children:a&&c?N("stream.cancelArmed"):""})]})]})]})]}),re&&ye&&ne.length>0&&h.jsx(Rxe,{actions:ne,onRun:ze,onPressKey:Je})]})})),jxe="_bar_agzxl_1",Dxe="_left_agzxl_12",Oxe="_right_agzxl_13",Bxe="_settingsButton_agzxl_23",Pxe="_modeButton_agzxl_49",$xe="_modeHint_agzxl_62",zxe="_modeLabel_agzxl_67",Fxe="_modeDefault_agzxl_71",Uxe="_modePlan_agzxl_75",qxe="_modeAutoEdit_agzxl_79",Hxe="_modeAuto_agzxl_79",Vxe="_modeYolo_agzxl_87",Wxe="_shortcutsButton_agzxl_96",Gxe="_modelButton_agzxl_114",Kxe="_model_agzxl_114",Yxe="_contextButton_agzxl_138",Xxe="_context_agzxl_138",Qxe="_goal_agzxl_161",Jxe="_separator_agzxl_167",Zxe="_taskPill_agzxl_171",Dr={bar:jxe,left:Dxe,right:Oxe,settingsButton:Bxe,modeButton:Pxe,modeHint:$xe,modeLabel:zxe,modeDefault:Fxe,modePlan:Uxe,modeAutoEdit:qxe,modeAuto:Hxe,modeYolo:Vxe,shortcutsButton:Wxe,modelButton:Gxe,model:Kxe,contextButton:Yxe,context:Xxe,goal:Qxe,separator:Jxe,taskPill:Zxe},e3e=1e3;function t3e(e,t){switch(e){case"default":return{label:t("mode.default"),className:Dr.modeDefault};case"plan":return{label:t("mode.plan"),className:Dr.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:Dr.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:Dr.modeAuto};case"yolo":return{label:t("mode.yolo"),className:Dr.modeYolo};default:return null}}function n3e(){return h.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:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.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 Sv(e,t,n,r){return r(e===1?t:n,{count:e})}function r3e(e,t){if(e.length===0)return"";const n=e.filter(s=>s.status==="running");if(n.length>0){const s={agent:0,shell:0,monitor:0};for(const o of n)s[o.kind]++;const i=[];return s.shell>0&&i.push(Sv(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.agent>0&&i.push(Sv(s.agent,"tasks.pill.agent","tasks.pill.agents",t)),s.monitor>0&&i.push(Sv(s.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}const r=e.filter(s=>s.kind==="agent"&&s.status==="paused");return r.length>0?t(r.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:r.length}):t(e.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:e.length})}function s3e(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 i3e=g.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:r,onOpenSettings:s,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:c,onToggleShortcuts:u,compact:d=!1},f){const m=ml(),p=m.status==="connected",y=m.currentModel??"",w=m.currentMode??"",b=m.tokenCount??0,v=m.contextWindow??0,{t:x}=ht(),C=(v>0?b/v*100:0).toFixed(1),E=t3e(w,x),[,M]=g.useState(0),D=g.useRef(null);g.useEffect(()=>{if(!l)return;const R=setInterval(()=>M(V=>(V+1)%1e6),e3e);return()=>clearInterval(R)},[l]);const O=g.useMemo(()=>r3e(a,x),[a,x]),A=!d&&(p||!!E),j=l?s3e(Date.now()-l.setAt):"",I=l?`◎ ${x("goal.statusActive")}${j?` (${j})`:""}`:"",P=!!O||!d,F=!d&&!!y||!d&&v>0&&b>0||!!I;if(g.useImperativeHandle(f,()=>({focusTaskPill(){var R;return O?((R=D.current)==null||R.focus({preventScroll:!0}),!0):!1}}),[O]),!P&&!F)return null;const q=R=>{if(R.key==="Enter"||R.key==="ArrowDown"||R.key==="n"&&R.ctrlKey){R.preventDefault(),R.stopPropagation(),i==null||i();return}if(R.key==="ArrowUp"||R.key==="Escape"||R.key==="p"&&R.ctrlKey){R.preventDefault(),R.stopPropagation(),o==null||o();return}R.key.length===1&&!R.metaKey&&!R.ctrlKey&&!R.altKey&&(R.preventDefault(),R.stopPropagation(),o==null||o(R.key))};return h.jsxs("div",{className:Dr.bar,children:[h.jsxs("div",{className:Dr.left,children:[p&&!c&&!d&&h.jsx("button",{type:"button",className:Dr.settingsButton,onClick:s,onMouseDown:R=>R.stopPropagation(),onTouchStart:R=>R.stopPropagation(),title:x("settings.title"),"aria-label":x("settings.title"),"aria-haspopup":"dialog",children:h.jsx(n3e,{})}),E&&!d&&h.jsxs("button",{type:"button",className:Dr.modeButton,onClick:t,onMouseDown:R=>R.stopPropagation(),onTouchStart:R=>R.stopPropagation(),title:x("mode.select"),"aria-haspopup":"listbox",children:[h.jsx("span",{className:`${Dr.modeLabel} ${E.className}`,children:E.label}),!d&&h.jsx("span",{className:Dr.modeHint,children:x("status.modeHint")})]}),!d&&h.jsx(h.Fragment,{children:u?h.jsx("button",{type:"button",className:Dr.shortcutsButton,onClick:u,onMouseDown:R=>R.stopPropagation(),onTouchStart:R=>R.stopPropagation(),"aria-haspopup":"dialog","aria-label":x("status.shortcuts"),children:x("status.shortcuts")}):h.jsx("span",{children:x("status.shortcuts")})}),O&&h.jsxs(h.Fragment,{children:[A&&h.jsx("span",{className:Dr.separator,children:"·"}),h.jsx("button",{ref:D,type:"button",className:Dr.taskPill,onClick:i,onKeyDown:q,disabled:!i,children:O})]})]}),h.jsxs("div",{className:Dr.right,children:[!d&&y&&h.jsx("button",{type:"button",className:Dr.modelButton,onClick:n,onMouseDown:R=>R.stopPropagation(),onTouchStart:R=>R.stopPropagation(),title:x("model.select"),"aria-haspopup":"listbox",children:h.jsx("span",{className:Dr.model,children:y})}),!d&&v>0&&b>0&&h.jsx("button",{type:"button",className:Dr.contextButton,onClick:r,title:x("contextUsage.title"),children:h.jsx("span",{className:Dr.context,children:x("status.contextUsed",{pct:C})})}),I&&h.jsx("span",{className:Dr.goal,title:l==null?void 0:l.condition,children:I})]})]})}),o3e=15e3,a3e=["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."],l3e=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function CA(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?l3e:a3e}function c3e(){const e=u5(),t=Gy(),n=e!=="idle",r=g.useRef(0),s=g.useRef(0),[i,o]=g.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=g.useMemo(()=>{let c=0,u=0,d=!1;const f=new Set;let m=-1;for(let p=t.length-1;p>=0;p--)if(t[p].kind==="user"){m=p;break}for(let p=m+1;p<t.length;p++){const y=t[p];if(y.kind==="assistant"&&!y.parentToolCallId&&(c+=y.text.length,y.streaming&&(d=!0)),y.kind==="tool"&&!y.parentToolCallId){if(y.rawInput!==void 0)try{c+=JSON.stringify(y.rawInput).length}catch{}const w=u3e(y.rawOutput);w!==void 0&&!f.has(y.toolCallId)&&(u+=w,f.add(y.toolCallId))}}return{chars:c,agentTokens:u,isReceiving:d}},[t]),l=g.useRef(a);return l.current=a,a.chars<s.current&&(r.current=a.chars),s.current=a.chars,g.useEffect(()=>{if(!n){r.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:u,agentTokens:d,isReceiving:f}=l.current;if(u<r.current){r.current=u,o({estimatedOutputTokens:d+Math.round(u/4),isReceivingContent:f});return}const m=u-r.current;if(m<=0){o(w=>{const b={estimatedOutputTokens:d+Math.round(r.current/4),isReceivingContent:f};return w.estimatedOutputTokens===b.estimatedOutputTokens&&w.isReceivingContent===b.isReceivingContent?w:b});return}let p;m<70?p=3:m<=200?p=Math.max(3,Math.round(m*.2)):p=50;const y=Math.min(r.current+p,u);r.current=y,o({estimatedOutputTokens:d+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function u3e(e){if(typeof e!="object"||e===null||!("type"in e)||e.type!=="task_execution")return;const t=e,n=t.tokenCount;if(typeof n=="number"&&n>0)return n;const r=t.executionSummary;if(typeof r=="object"&&r!==null){const s=r.outputTokens;if(typeof s=="number"&&s>0)return s}}function d3e(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}const h3e="_status_zld2v_1",f3e="_spinner_zld2v_11",m3e="_label_zld2v_15",p3e="_meta_zld2v_19",ag={status:h3e,spinner:f3e,label:m3e,meta:p3e},Tv=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function g3e({startedAt:e}){const t=u5(),{estimatedOutputTokens:n,isReceivingContent:r}=c3e(),{language:s,t:i}=ht(),{loadingPhrases:o}=Lc(),a=g.useRef(o);a.current=o;const l=g.useCallback(C=>{var E;try{return((E=a.current)==null?void 0:E.call(a,C))??CA(C)}catch(M){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",M),CA(C)}},[]),[c,u]=g.useState(0),d=g.useRef(Date.now()),[f,m]=g.useState(0),[p,y]=g.useState(()=>l(s)[0]??""),w=t!=="idle";if(g.useEffect(()=>{if(!w){u(0);return}d.current=e??Date.now(),u(AA(d.current));const C=setInterval(()=>{u(AA(d.current))},1e3);return()=>clearInterval(C)},[w,e]),g.useEffect(()=>{if(t==="idle"){y(l(s)[0]??"");return}const C=()=>{const M=l(s),D=Math.floor(Math.random()*M.length);y(M[D]??"")};C();const E=setInterval(C,o3e);return()=>clearInterval(E)},[s,t,l]),g.useEffect(()=>{if(t==="idle")return;const C=setInterval(()=>{m(E=>(E+1)%Tv.length)},250);return()=>clearInterval(C)},[t]),t==="idle")return null;const b=Tv[f%Tv.length],v=r?"↓":"↑",x=c<60?`${c}s`:y3e(c*1e3),S=n>0?` · ${v} ${i("stream.tokens",{count:d3e(n)})}`:"";return h.jsxs("div",{className:ag.status,children:[h.jsx("span",{className:ag.spinner,children:b}),p&&h.jsx("span",{className:ag.label,children:p}),h.jsxs("span",{className:ag.meta,children:["(",x,S," · ",i("stream.cancel"),")"]})]})}function y3e(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,i=[];return n>0&&i.push(`${n}h`),r>0&&i.push(`${r}m`),s>0&&i.push(`${s}s`),i.length>0?i.join(" "):"0s"}function AA(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const b3e="_host_1scjy_1",v3e="_toast_1scjy_13",w3e="_message_1scjy_31",x3e="_close_1scjy_39",_3e="_info_1scjy_58",k3e="_success_1scjy_62",S3e="_warning_1scjy_66",T3e="_error_1scjy_70",Yf={host:b3e,toast:v3e,message:w3e,close:x3e,info:_3e,success:k3e,warning:S3e,error:T3e};function C3e({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:h.jsx("div",{className:Yf.host,role:"status","aria-live":"polite",children:e.map(r=>h.jsx(A3e,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function A3e({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=ht();return g.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),h.jsxs("div",{className:`${Yf.toast} ${Yf[e.tone]}`,children:[h.jsx("div",{className:Yf.message,children:e.message}),h.jsx("button",{type:"button",className:Yf.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const E3e="_panel_k9l9d_1",M3e="_summary_k9l9d_10",I3e="_progressRing_k9l9d_27",N3e="_stepText_k9l9d_41",R3e="_fullText_k9l9d_48",L3e="_compactText_k9l9d_52",j3e="_detail_k9l9d_71",D3e="_item_k9l9d_103",O3e="_icon_k9l9d_113",B3e="_content_k9l9d_121",P3e="_completed_k9l9d_129",$3e="_inProgress_k9l9d_134",z3e="_pending_k9l9d_140",Ei={panel:E3e,summary:M3e,progressRing:I3e,stepText:N3e,fullText:R3e,compactText:L3e,detail:j3e,item:D3e,icon:O3e,content:B3e,completed:P3e,inProgress:$3e,pending:z3e};function F3e(e){switch(e){case"completed":return Ei.completed;case"in_progress":return Ei.inProgress;case"pending":return Ei.pending}}const U3e=g.memo(function({todos:t,title:n}){const{t:r}=ht();if(t.length===0)return null;const s=t.length,i=t.findIndex(c=>c.status==="in_progress"),o=i>=0?i:t.findIndex(c=>c.status==="pending"),a=o>=0?o+1:s,l=s>0?a/s:0;return h.jsxs("section",{className:Ei.panel,"aria-label":n??r("todo.title"),tabIndex:0,children:[h.jsxs("div",{className:Ei.summary,"aria-label":r("todo.stepProgress",{current:a,total:s}),children:[h.jsx("span",{className:Ei.progressRing,style:{"--todo-progress":String(l)},"aria-hidden":"true"}),h.jsxs("span",{className:Ei.stepText,children:[h.jsx("span",{className:Ei.fullText,children:r("todo.stepProgress",{current:a,total:s})}),h.jsx("span",{className:Ei.compactText,children:r("todo.stepFraction",{current:a,total:s})})]})]}),h.jsx("div",{className:Ei.detail,role:"tooltip",children:t.map((c,u)=>h.jsxs("div",{className:`${Ei.item} ${F3e(c.status)}`,children:[h.jsx("span",{className:Ei.icon,"aria-hidden":"true",children:ey(c.status)}),h.jsx("span",{className:Ei.content,title:c.content,children:c.content})]},`${c.id||u}:${c.content}`))})]})}),q3e="_header_leiy3_1",H3e="_titleRow_leiy3_11",V3e="_title_leiy3_11",W3e="_subtitle_leiy3_31",lg={header:q3e,titleRow:H3e,title:V3e,subtitle:W3e};function G3e(e){const{t}=ht();return h.jsxs("div",{className:lg.header,children:[h.jsxs("div",{className:lg.titleRow,children:[h.jsx("span",{children:t("welcome.titlePrefix")}),h.jsx("span",{className:lg.title,children:"Qwen Code"})]}),h.jsx("div",{className:lg.subtitle,children:t("welcome.prompt")})]})}const K3e="_themeDark_e0gve_1",Y3e="_themeLight_e0gve_20",X3e="_backdrop_e0gve_39",Q3e="_panel_e0gve_59",J3e="_sizeSm_e0gve_77",Z3e="_sizeMd_e0gve_81",e_e="_sizeLg_e0gve_85",t_e="_sizeXl_e0gve_89",n_e="_header_e0gve_93",r_e="_titleWrap_e0gve_102",s_e="_title_e0gve_102",i_e="_subtitle_e0gve_114",o_e="_close_e0gve_121",a_e="_body_e0gve_160",ui={themeDark:K3e,themeLight:Y3e,backdrop:X3e,panel:Q3e,sizeSm:J3e,sizeMd:Z3e,sizeLg:e_e,sizeXl:t_e,header:n_e,titleWrap:r_e,title:s_e,subtitle:i_e,close:o_e,body:a_e},l_e={sm:ui.sizeSm,md:ui.sizeMd,lg:ui.sizeLg,xl:ui.sizeXl},c_e=["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 Cv(e){return e?Array.from(e.querySelectorAll(c_e)):[]}const $l=[],oP=g.createContext(null);function u_e(e){return e===null?!0:$l[$l.length-1]===e}function ys({title:e,subtitle:t,size:n="md",onClose:r,children:s}){const{t:i}=ht(),a=m5()===Rs.Light?ui.themeLight:ui.themeDark,l=g.useRef(null),c=g.useRef(r);c.current=r;const[u]=g.useState(()=>typeof document<"u"?document.activeElement:null),d=g.useRef(!1),f=g.useRef(!1),m=g.useRef(null);m.current===null&&(m.current={}),g.useEffect(()=>{const v=l.current,x=m.current;$l.push(x),v&&!v.contains(document.activeElement)&&(Cv(v).find(M=>!M.hasAttribute("data-dialog-close"))??v).focus();const S=C=>{var E;if($l[$l.length-1]===x&&!C.defaultPrevented&&!(C.isComposing||C.keyCode===229)){if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),c.current();return}if(C.key==="Tab"){const M=Cv(l.current);if(M.length===0){C.preventDefault(),(E=l.current)==null||E.focus();return}const D=M[0],O=M[M.length-1],A=document.activeElement;M.includes(A)?C.shiftKey&&A===D?(C.preventDefault(),O.focus()):!C.shiftKey&&A===O&&(C.preventDefault(),D.focus()):(C.preventDefault(),(C.shiftKey?O:D).focus())}}};return document.addEventListener("keydown",S),()=>{var A,j,I;document.removeEventListener("keydown",S);const C=$l.indexOf(x);if(C>=0&&$l.splice(C,1),$l.length===0){(A=u==null?void 0:u.focus)==null||A.call(u);return}const E=Array.from(document.querySelectorAll("[data-keyboard-scope]")),M=(j=E[E.length-1])==null?void 0:j.querySelector('[role="dialog"]');(I=Cv(M).find(P=>!P.hasAttribute("data-dialog-close"))??M)==null||I.focus()}},[u]);const p=v=>{d.current=v.target===v.currentTarget,f.current=!1},y=v=>{f.current=v.target===v.currentTarget},w=v=>{const x=d.current&&f.current&&v.target===v.currentTarget;d.current=!1,f.current=!1,x&&r()},b=h.jsx("div",{className:`${ui.backdrop} ${a}`,"data-keyboard-scope":!0,onMouseDown:p,onMouseUp:y,onClick:w,children:h.jsx(oP.Provider,{value:m.current,children:h.jsxs("section",{ref:l,className:`${ui.panel} ${l_e[n]}`,role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,children:[h.jsxs("header",{className:ui.header,children:[h.jsxs("div",{className:ui.titleWrap,children:[h.jsx("div",{className:ui.title,children:e}),t&&h.jsx("div",{className:ui.subtitle,children:t})]}),h.jsx("button",{type:"button",className:ui.close,onClick:r,"aria-label":i("common.close"),title:i("common.close"),"data-dialog-close":!0})]}),h.jsx("div",{className:ui.body,children:s})]})})});return typeof document>"u"?b:Ay.createPortal(b,document.body)}function cg(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const d_e=new Set(["button","submit","reset"]),h_e=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function EA(){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 d_e.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function Av(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!h_e.has(e.type):e.isContentEditable===!0}function Bc({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r,enabled:s=!0}){const i=g.useContext(oP),o=g.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r};const[a,l]=g.useState(!1);return g.useEffect(()=>{if(!s)return;const c=()=>l(!0),u=()=>l(!1),d=f=>{if(!u_e(i)||f.defaultPrevented||f.isComposing||f.keyCode===229||f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;const{itemCount:m,activeIndex:p}=o.current;if(!(m<=0))switch(f.key){case"ArrowDown":f.preventDefault(),c(),o.current.onActiveIndexChange(cg(p+1,m));break;case"ArrowUp":f.preventDefault(),c(),o.current.onActiveIndexChange(cg(p-1,m));break;case"Home":if(Av())return;f.preventDefault(),c(),o.current.onActiveIndexChange(0);break;case"End":if(Av())return;f.preventDefault(),c(),o.current.onActiveIndexChange(m-1);break;case"Enter":{if(EA()||p<0)return;f.preventDefault(),o.current.onConfirm(cg(p,m));break}case" ":{if(EA()||Av()||p<0)return;f.preventDefault(),o.current.onConfirm(cg(p,m));break}}};return window.addEventListener("keydown",d),window.addEventListener("mousemove",u),()=>{window.removeEventListener("keydown",d),window.removeEventListener("mousemove",u)}},[i,s]),{keyboardMode:a}}const f_e="_picker_5cmbf_4",m_e="_selected_5cmbf_98",p_e="_disabled_5cmbf_114",g_e={picker:f_e,"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:m_e,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:p_e,"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 Me(...e){return e.filter(t=>!!t).map(t=>g_e[t]).filter(Boolean).join(" ")}const y_e="_list_jbgdx_1",b_e="_row_jbgdx_16",v_e="_selected_jbgdx_32",w_e="_keyboardOnly_jbgdx_39",x_e="_modeName_jbgdx_47",__e="_modeIcon_jbgdx_51",k_e="_modeText_jbgdx_67",S_e="_modeDesc_jbgdx_83",Il={list:y_e,row:b_e,selected:v_e,keyboardOnly:w_e,modeName:x_e,modeIcon:__e,modeText:k_e,modeDesc:S_e};function T_e({currentMode:e,onSelect:t}){const{t:n}=ht(),r=g.useRef(null),s=Hy.map(f=>({id:f,name:n(`mode.listLabel.${f}`),description:n(`mode.desc.${f}`)})),i=s.findIndex(f=>f.id===e),[o,a]=g.useState(i>=0?i:0),l=g.useRef(!1);g.useEffect(()=>{l.current||i<0||a(i)},[i]);const c=f=>{l.current=!0,a(f)},u=f=>{const m=s[f];m&&t(m.id)},{keyboardMode:d}=Bc({itemCount:s.length,activeIndex:o,onActiveIndexChange:c,onConfirm:u});return g.useEffect(()=>{var m;const f=(m=r.current)==null?void 0:m.children[o];f==null||f.scrollIntoView({block:"nearest"})},[o]),h.jsx("div",{className:`${Il.list} ${d?Il.keyboardOnly:""}`,ref:r,role:"listbox",tabIndex:0,"aria-activedescendant":s.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),children:s.map((f,m)=>{const p=m===o,y=f.id===e;return h.jsxs("div",{id:`mode-opt-${m}`,role:"option","aria-selected":y,className:`${Il.row} ${p?Il.selected:""} ${y?Me("dialog-current"):""}`,onClick:()=>u(m),onMouseMove:()=>c(m),children:[h.jsx("span",{className:Il.modeIcon,children:h.jsx(z3,{mode:f.id})}),h.jsxs("span",{className:Il.modeText,children:[h.jsx("span",{className:Il.modeName,children:f.name}),h.jsx("span",{className:Il.modeDesc,children:f.description})]})]},f.id)})})}function Bb(e){const[t,n]=g.useState(""),[r,s]=g.useState(""),i=g.useRef(!1),o=g.useRef(""),a=g.useRef(e);a.current=e;const l=g.useCallback(f=>{var m;f!==o.current&&(o.current=f,s(f),(m=a.current)==null||m.call(a,f))},[]),c=g.useCallback(f=>{const m=f.target.value;n(m),i.current||l(m)},[l]),u=g.useCallback(()=>{i.current=!0},[]),d=g.useCallback(f=>{i.current=!1;const m=f.currentTarget.value;n(m),l(m)},[l]);return{filterValue:r,inputProps:{value:t,onChange:c,onCompositionStart:u,onCompositionEnd:d}}}function aP(e,t){const n=Date.now()-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return t("time.justNow");if(r<60)return t("time.minutesAgo",{count:r});const s=Math.floor(r/60);if(s<24)return t("time.hoursAgo",{count:s});const i=Math.floor(s/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function n6({session:e,active:t,current:n,confirmed:r,disabled:s,currentLabel:i,optionId:o,ariaSelected:a,leading:l,trailing:c,onClick:u,onActivate:d}){const{t:f}=ht(),m=e.updatedAt||e.createdAt;return h.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":s||void 0,className:Me("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,r?"picker-item-confirmed":void 0,s?"disabled":void 0),title:n?i:void 0,onClick:u,onMouseMove:d,children:[h.jsxs("div",{className:Me("picker-item-row"),children:[l,h.jsx("span",{className:Me("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),c]}),h.jsxs("div",{className:Me("picker-item-meta"),children:[h.jsx("span",{children:m&&aP(m,f)}),h.jsx("span",{className:Me("picker-item-detail"),children:f("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&h.jsx("span",{className:Me("picker-item-detail"),children:f("resume.activePrompt")})]})]})}const F3="resume-session-list",MA=e=>`${F3}-opt-${e}`;function C_e({onSelect:e,onClose:t}){const{t:n}=ht(),r=ml(),{sessions:s,loading:i,error:o}=Yy({autoLoad:!0}),a=r.sessionId,[l,c]=g.useState(-1),{filterValue:u,inputProps:d}=Bb(()=>c(-1)),f=g.useRef(null),m=g.useRef(null),p=u?s.filter(b=>{const v=u.toLowerCase();return(b.displayName||"").toLowerCase().includes(v)||b.sessionId.toLowerCase().includes(v)}):s;g.useEffect(()=>{l>=p.length&&p.length>0&&c(p.length-1)},[p.length,l]),g.useEffect(()=>{var v;const b=(v=f.current)==null?void 0:v.children[l];b==null||b.scrollIntoView({block:"nearest"})},[l]);const y=b=>{const v=p[b];v&&(e(v.sessionId),t())},{keyboardMode:w}=Bc({itemCount:p.length,activeIndex:l,onActiveIndexChange:c,onConfirm:y});return g.useEffect(()=>{var b;(b=m.current)==null||b.focus()},[]),h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search"),children:[h.jsxs("span",{className:Me("picker-search-label"),children:[n("resume.search"),":"," "]}),h.jsx("input",{ref:m,className:Me("picker-search-input"),"aria-label":n("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":F3,"aria-activedescendant":l>=0&&l<p.length?MA(l):void 0,...d,placeholder:""})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:F3,role:"listbox",className:Me("picker-list",w?"picker-keyboard-only":void 0),ref:f,children:[i&&h.jsx("div",{className:Me("picker-empty"),children:n("common.loading")}),!i&&o&&h.jsx("div",{className:Me("picker-empty"),children:o.message||"Failed to load sessions"}),!i&&!o&&p.length===0&&h.jsx("div",{className:Me("picker-empty"),children:u?n("resume.noMatch",{query:u}):n("resume.none")}),!i&&p.map((b,v)=>h.jsx(n6,{session:b,optionId:MA(v),active:v===l,current:b.sessionId===a,currentLabel:n("resume.current"),onClick:()=>y(v),onActivate:()=>c(v)},b.sessionId))]})]})}const A_e="_layout_1sigx_1",E_e="_list_1sigx_9",M_e="_row_1sigx_23",I_e="_selected_1sigx_39",N_e="_keyboardOnly_1sigx_46",R_e="_label_1sigx_54",L_e="_divider_1sigx_58",j_e="_number_1sigx_65",D_e="_provider_1sigx_71",O_e="_badge_1sigx_86",B_e="_detail_1sigx_92",P_e="_detailRow_1sigx_104",$_e="_detailLabel_1sigx_111",z_e="_detailValue_1sigx_117",F_e="_empty_1sigx_122",qs={layout:A_e,list:E_e,row:M_e,selected:I_e,keyboardOnly:N_e,label:R_e,divider:L_e,number:j_e,provider:D_e,badge:O_e,detail:B_e,detailRow:P_e,detailLabel:$_e,detailValue:z_e,empty:F_e};function U_e(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function q_e(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 IA(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function H_e(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function V_e(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function W_e(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function ug({label:e,value:t}){return h.jsxs("div",{className:qs.detailRow,children:[h.jsx("span",{className:qs.detailLabel,children:e}),h.jsx("span",{className:qs.detailValue,children:t})]})}function G_e({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=ml(),i=r??s.currentModel??"",o=g.useMemo(()=>n??s.models??[],[n,s.models]),{t:a}=ht(),l=g.useRef(null),c=e==="fast",u=e==="voice",d=e==="vision",f=o.findIndex(S=>S.id===i),[m,p]=g.useState(f>=0?f:0),y=g.useRef(!1);g.useEffect(()=>{y.current||o.length===0||p(f>=0?f:0)},[o.length,f]);const w=S=>{y.current=!0,p(S)};g.useEffect(()=>{m>=o.length&&o.length>0&&p(o.length-1)},[o.length,m]);const b=o[m]??o[0],v=S=>{const C=o[S];C&&t(W_e(C,c))},{keyboardMode:x}=Bc({itemCount:o.length,activeIndex:m,onActiveIndexChange:w,onConfirm:v});return g.useEffect(()=>{var C;const S=(C=l.current)==null?void 0:C.children[m];S==null||S.scrollIntoView({block:"nearest"})},[m]),h.jsxs("div",{className:qs.layout,children:[h.jsxs("div",{className:`${qs.list} ${x?qs.keyboardOnly:""}`,ref:l,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${m}`:void 0,"aria-label":a(c?"model.setFast":u?"model.setVoice":d?"model.setVision":"model.select"),children:[o.length===0?h.jsx("div",{className:qs.empty,children:a("model.none")}):null,o.map((S,C)=>{const E=C===m,M=C===f,D=IA(S);return h.jsxs("div",{id:`model-opt-${C}`,role:"option","aria-selected":M,className:`${qs.row} ${E?qs.selected:""} ${M?Me("dialog-current"):""}`,onClick:()=>v(C),onMouseMove:()=>w(C),children:[h.jsxs("span",{className:qs.number,children:[C+1,"."]}),D?h.jsxs("span",{className:qs.provider,children:["[",D,"]"]}):null,h.jsx("span",{className:qs.label,children:H_e(S)}),S.isRuntime?h.jsx("span",{className:qs.badge,children:"Runtime"}):null]},V_e(S))})]}),b?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:qs.divider}),h.jsxs("div",{className:qs.detail,children:[h.jsx(ug,{label:a("model.modality"),value:q_e(b.modalities,a)}),h.jsx(ug,{label:a("model.contextWindow"),value:U_e(b.contextWindow,a)}),IA(b)!=="qwen-oauth"?h.jsxs(h.Fragment,{children:[h.jsx(ug,{label:a("model.baseUrl"),value:b.baseUrl??a("model.default")}),h.jsx(ug,{label:a("model.apiKey"),value:b.envKey??a("model.notSet")})]}):null]})]}):null]})}function r6(e){return e.replace(/[：:\s]+$/u,"")}const K_e="_panel_irhhk_1",Y_e="_embedded_irhhk_13",X_e="_footer_irhhk_21",Q_e="_titleLine_irhhk_25",J_e="_icon_irhhk_32",Z_e="_title_irhhk_25",e5e="_subtitle_irhhk_44",t5e="_text_irhhk_49",n5e="_options_irhhk_55",r5e="_option_irhhk_55",s5e="_optionActive_irhhk_77",i5e="_optionLabel_irhhk_81",o5e="_optionIcon_irhhk_86",a5e="_optionContent_irhhk_119",l5e="_optionDesc_irhhk_129",c5e="_badge_irhhk_135",u5e="_toolDetail_irhhk_170",d5e="_toolDetailTitle_irhhk_175",h5e="_toolDetailBody_irhhk_180",f5e="_toolList_irhhk_181",m5e="_textInput_irhhk_193",p5e="_textArea_irhhk_211",g5e="_summary_irhhk_231",y5e="_summaryRow_irhhk_238",b5e="_summaryLabel_irhhk_244",v5e="_summaryValue_irhhk_250",w5e="_summaryBlockTitle_irhhk_255",x5e="_summaryBlock_irhhk_255",_5e="_manageList_irhhk_295",k5e="_manageItem_irhhk_301",S5e="_manageItemExpanded_irhhk_307",T5e="_manageRow_irhhk_312",C5e="_manageRowActive_irhhk_329",A5e="_manageIcon_irhhk_333",E5e="_manageName_irhhk_362",M5e="_levelTag_irhhk_370",I5e="_manageChevron_irhhk_380",N5e="_manageChevronExpanded_irhhk_398",R5e="_manageDetail_irhhk_402",L5e="_manageDetailInner_irhhk_409",j5e="_manageDetailHeader_irhhk_419",D5e="_manageActions_irhhk_426",O5e="_manageButton_irhhk_433",B5e="_dangerButton_irhhk_453",P5e="_deleteText_irhhk_457",$5e="_viewerRow_irhhk_487",z5e="_viewerLabel_irhhk_500",F5e="_viewerField_irhhk_507",U5e="_viewerSectionTitle_irhhk_512",q5e="_viewerBlock_irhhk_518",H5e="_closed_irhhk_524",V5e="_closedText_irhhk_528",W5e="_loading_irhhk_534",G5e="_error_irhhk_539",K5e="_createWizard_irhhk_545",Y5e="_createSteps_irhhk_551",X5e="_createStepPill_irhhk_559",Q5e="_createStepPillActive_irhhk_571",J5e="_createStepPillDone_irhhk_576",Z5e="_createStepNumber_irhhk_580",eke="_createStepLabel_irhhk_591",tke="_createBody_irhhk_597",nke="_createActions_irhhk_601",ke={panel:K_e,embedded:Y_e,footer:X_e,titleLine:Q_e,icon:J_e,title:Z_e,subtitle:e5e,text:t5e,options:n5e,option:r5e,optionActive:s5e,optionLabel:i5e,optionIcon:o5e,optionContent:a5e,optionDesc:l5e,badge:c5e,toolDetail:u5e,toolDetailTitle:d5e,toolDetailBody:h5e,toolList:f5e,textInput:m5e,textArea:p5e,summary:g5e,summaryRow:y5e,summaryLabel:b5e,summaryValue:v5e,summaryBlockTitle:w5e,summaryBlock:x5e,manageList:_5e,manageItem:k5e,manageItemExpanded:S5e,manageRow:T5e,manageRowActive:C5e,manageIcon:A5e,manageName:E5e,levelTag:M5e,manageChevron:I5e,manageChevronExpanded:N5e,manageDetail:R5e,manageDetailInner:L5e,manageDetailHeader:j5e,manageActions:D5e,manageButton:O5e,dangerButton:B5e,deleteText:P5e,viewerRow:$5e,viewerLabel:z5e,viewerField:F5e,viewerSectionTitle:U5e,viewerBlock:q5e,closed:H5e,closedText:V5e,loading:W5e,error:G5e,createWizard:K5e,createSteps:Y5e,createStepPill:X5e,createStepPillActive:Q5e,createStepPillDone:J5e,createStepNumber:Z5e,createStepLabel:eke,createBody:tke,createActions:nke};function lP(e){if(e==="project")return"workspace";if(e==="user")return"global"}function cP(e){return lP(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function rke(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 aa=r6;function ske(e){return e.displayName||e.name}function uP(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 dP(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function hP(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function ike(e,t){if(!t||t.length===0)return 0;const n=new Set(t),r=e.findIndex(s=>s.id==="all"||s.tools.length!==n.size?!1:s.tools.every(i=>n.has(i)));return r>=0?r:0}function oke({mode:e,embedded:t=!1,onMessage:n,onClose:r}){const{t:s}=ht(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:u,deleteAgent:d}=AV({autoLoad:!0}),{tools:f}=UN({autoLoad:!0}),[m,p]=g.useState(!1),[y,w]=g.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[b,v]=g.useState(0),[x,S]=g.useState(0),[C,E]=g.useState(null),[M,D]=g.useState(null),[O,A]=g.useState(!1),[j,I]=g.useState(null),[P,F]=g.useState(1),[q,R]=g.useState(()=>e==="create-user"?"global":"workspace"),[V,J]=g.useState("manual"),[ee,N]=g.useState(""),[G,B]=g.useState(""),[k,Q]=g.useState(""),[ce,pe]=g.useState([]),[be,ye]=g.useState(0),[ie,re]=g.useState(!1),[oe,ve]=g.useState(!1),qe=g.useRef(0),We=g.useCallback(()=>{p(!0),r()},[r]),te=g.useMemo(()=>{const rt=i.filter(se=>se.level==="project"),tt=i.filter(se=>se.level==="user"),Qe=i.filter(se=>se.level==="builtin"),ne=i.filter(se=>se.level==="extension");return{project:rt,user:tt,builtin:Qe,extension:ne}},[i]),we=g.useMemo(()=>[...te.project,...te.user,...te.builtin,...te.extension],[te]),Se=g.useMemo(()=>{const rt=f.filter(se=>se.enabled).map(ske).sort((se,De)=>se.localeCompare(De)),tt=rt.filter(uP),Qe=rt.filter(dP),ne=rt.filter(hP);return[{id:"all",label:s("agent.create.tools.all"),tools:[]},{id:"read",label:s("agent.create.tools.readOnly"),tools:tt},{id:"edit",label:s("agent.create.tools.readEdit"),tools:[...new Set([...tt,...Qe])]},{id:"execute",label:s("agent.create.tools.readEditExecute"),tools:[...new Set([...tt,...Qe,...ne])]}]},[s,f]);g.useEffect(()=>{if(y!=="manage")return;const rt=M!==null?we[M]:void 0;rt&&l(rt.name).then(E).catch(tt=>I(tt instanceof Error?tt.message:String(tt)))},[y,we,M,l]),g.useEffect(()=>{x>=we.length&&we.length>0&&S(we.length-1),M!==null&&M>=we.length&&D(null)},[M,we.length,x]);const Ne=g.useCallback((rt=x)=>{const tt=we[rt];if(!tt||!cP(tt))return;const Qe=lP(tt.level);Qe&&(A(!0),d(tt.name,Qe).then(()=>{n(s("agent.deleted",{name:tt.name})),E(null),D(null),S(0),a()}).catch(ne=>I(ne instanceof Error?ne.message:String(ne))).finally(()=>A(!1)))},[we,x,d,n,a,s]),Pt=g.useCallback(()=>{if(!ee.trim()||!G.trim()||!k.trim()){I(s("agent.create.required"));return}A(!0),c({name:ee.trim(),description:G.trim(),systemPrompt:k.trim(),scope:q,tools:ce}).then(rt=>{n(s("agent.created",{name:rt.agent.name})),We()}).catch(rt=>I(rt instanceof Error?rt.message:String(rt))).finally(()=>A(!1))},[ee,G,k,q,ce,c,n,We,s]),at=g.useCallback(async()=>{const rt=G.trim();if(!rt||ie)return;const tt=qe.current+1;qe.current=tt,re(!0),ve(!1),I(null);try{const Qe=await u(rt);if(qe.current!==tt)return;N(Qe.name),B(Qe.description),Q(Qe.systemPrompt),F(V==="manual"?6:4),ye(0)}catch(Qe){if(qe.current!==tt)return;I(s("agent.create.generateFailed",{error:Qe instanceof Error?Qe.message:String(Qe)})),ve(!0)}finally{qe.current===tt&&re(!1)}},[G,ie,V,u,s]),vt=g.useCallback(rt=>{if(rt==="name"&&ee.trim())F(4),ve(!0);else if(rt==="prompt"&&k.trim())F(5),ve(!0);else if(rt==="desc"&&G.trim()){if(V==="qwen"){at();return}F(V==="manual"?6:4),ye(0),ve(!1)}},[ee,G,k,V,at]);if(m)return h.jsx("div",{className:`${ke.panel} ${t?ke.embedded:""} ${ke.closed}`,children:h.jsx("div",{className:ke.closedText,children:s("agents.closed")})});if(o&&i.length===0)return h.jsxs("div",{className:`${ke.panel} ${t?ke.embedded:""}`,children:[h.jsxs("div",{className:ke.titleLine,children:[h.jsx("span",{className:ke.icon,children:"?"}),h.jsx("span",{className:ke.title,children:s("agents.title")})]}),h.jsx("div",{className:ke.loading,children:s("common.loading")})]});const Tt=s("agents.title");return h.jsxs("div",{className:`${ke.panel} ${t?ke.embedded:""}`,children:[!t&&y!=="create"&&h.jsxs("div",{className:ke.titleLine,children:[h.jsx("span",{className:ke.icon,children:"?"}),h.jsx("span",{className:ke.title,children:Tt}),h.jsx("span",{className:ke.subtitle,children:s("agent.count",{count:i.length})})]}),j&&h.jsx("div",{className:ke.error,children:j}),y==="menu"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:s("agent.selectAction")}),h.jsxs("div",{className:ke.options,children:[h.jsx(du,{idx:0,active:b===0,label:s("agent.manage"),desc:s("agent.manage.desc"),onClick:()=>{v(0),w("manage")},onHover:()=>v(0)}),h.jsx(du,{idx:1,active:b===1,label:s("agent.create"),desc:s("agent.create.desc"),onClick:()=>{v(1),w("create")},onHover:()=>v(1)})]}),h.jsx("div",{className:ke.footer,children:s("agent.footer.nav")})]}),y==="manage"&&h.jsx(ake,{agents:we,expandedAgentIdx:M,selectedAgent:C,busy:O,onToggleAgent:rt=>{S(rt),D(tt=>tt===rt?null:rt),E(null)},onDelete:rt=>{O||Ne(rt)},t:s}),y==="create"&&h.jsx(lke,{step:P,method:V,scope:q,name:ee,desc:G,prompt:k,tools:ce,toolCategories:Se,selIdx:be,busy:O,generating:ie,inputFocused:oe,onSetName:N,onSetDesc:B,onSetPrompt:Q,onInputNext:vt,onInputFocus:()=>ve(!0),onInputBlur:()=>ve(!1),onSetStep:F,onSetSelectedIndex:ye,onSelectLocation:rt=>{ye(rt),R(rt===0?"workspace":"global")},onSelectMethod:rt=>{ye(rt),J(rt===0?"qwen":"manual")},onSelectTools:rt=>{var tt;ye(rt),pe(((tt=Se[rt])==null?void 0:tt.tools)??[])},onSave:()=>{O||Pt()},t:s})]})}function du({idx:e,active:t,label:n,desc:r,badge:s,numbered:i=!1,onClick:o,onHover:a}){return h.jsxs("div",{className:`${ke.option} ${t?ke.optionActive:""}`,onClick:o,onMouseEnter:a,children:[h.jsx("span",{className:ke.optionIcon,"aria-hidden":"true"}),h.jsxs("span",{className:ke.optionContent,children:[h.jsxs("span",{className:ke.optionLabel,children:[i?`${e+1}. `:"",n,s&&h.jsx("span",{className:ke.badge,children:s})]}),r&&h.jsx("span",{className:ke.optionDesc,children:r})]})]})}function ake({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:r,onToggleAgent:s,onDelete:i,t:o}){const[a,l]=g.useState(null),c=g.useMemo(()=>new Set(e.filter(u=>u.level==="project").map(u=>u.name)),[e]);return e.length===0?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:o("agent.empty")}),h.jsx("div",{className:ke.text,children:o("agent.createFirstHint")})]}):h.jsx("div",{className:ke.manageList,children:e.map((u,d)=>{const f=t===d,m=f&&(n==null?void 0:n.name)===u.name?n:null,p=cP(u),y=(m==null?void 0:m.tools)??[],w=y.length===0||y.includes("*")?o("agent.create.tools.all"):y.join(", ");return h.jsxs("div",{className:`${ke.manageItem} ${f?ke.manageItemExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${ke.manageRow} ${f?ke.manageRowActive:""}`,onClick:()=>{l(null),s(d)},children:[h.jsx("span",{className:ke.manageIcon,"aria-hidden":"true"}),h.jsx("span",{className:ke.manageName,children:u.name}),h.jsx("span",{className:ke.levelTag,children:rke(u.level,o)}),u.level==="user"&&c.has(u.name)?h.jsx("span",{className:ke.levelTag,children:o("agent.overriddenBadge")}):null,h.jsx("span",{className:`${ke.manageChevron} ${f?ke.manageChevronExpanded:""}`})]}),f?h.jsx("div",{className:ke.manageDetail,children:m?h.jsxs("div",{className:ke.manageDetailInner,children:[h.jsx("div",{className:ke.manageDetailHeader,children:p?h.jsx("div",{className:ke.manageActions,children:a===d?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ke.deleteText,children:r?o("agent.delete.loading"):o("agent.delete.confirm",{name:u.name})}),h.jsx("button",{type:"button",className:ke.manageButton,onClick:()=>l(null),disabled:r,children:o("common.cancel")}),h.jsx("button",{type:"button",className:`${ke.manageButton} ${ke.dangerButton}`,onClick:()=>i(d),disabled:r,children:o("agent.action.delete")})]}):h.jsx("button",{type:"button",className:`${ke.manageButton} ${ke.dangerButton}`,onClick:()=>l(d),disabled:r,children:o("agent.action.delete")})}):null}),h.jsxs("div",{className:ke.viewerField,children:[h.jsx("div",{className:ke.viewerSectionTitle,children:aa(o("agent.toolsLabel"))}),h.jsx("div",{className:ke.viewerBlock,children:w})]}),h.jsxs("div",{className:ke.viewerField,children:[h.jsx("div",{className:ke.viewerSectionTitle,children:aa(o("agent.filePathLabel"))}),h.jsx("div",{className:ke.viewerBlock,children:m.filePath||"—"})]}),m.model?h.jsxs("div",{className:ke.viewerRow,children:[h.jsx("span",{className:ke.viewerLabel,children:aa(o("agent.modelLabel"))}),h.jsx("span",{children:m.model})]}):null,h.jsxs("div",{className:ke.viewerField,children:[h.jsx("div",{className:ke.viewerSectionTitle,children:aa(o("agent.descriptionLabel"))}),h.jsx("div",{className:ke.viewerBlock,children:m.description||"—"})]}),h.jsxs("div",{className:ke.viewerField,children:[h.jsx("div",{className:ke.viewerSectionTitle,children:aa(o("agent.systemPromptLabel"))}),h.jsx("div",{className:ke.viewerBlock,children:m.systemPrompt||"—"})]})]}):h.jsx("div",{className:ke.loading,children:o("common.loading")})}):null]},`${u.level}:${u.name}`)})})}function lke({step:e,method:t,scope:n,name:r,desc:s,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:c,generating:u,inputFocused:d,onSetName:f,onSetDesc:m,onSetPrompt:p,onInputNext:y,onInputFocus:w,onInputBlur:b,onSetStep:v,onSetSelectedIndex:x,onSelectLocation:S,onSelectMethod:C,onSelectTools:E,onSave:M,t:D}){const O=g.useRef(null),A=g.useRef(null),j=g.useRef(null);g.useEffect(()=>{var G,B,k,Q;d&&(t==="manual"?e===3?(G=O.current)==null||G.focus():e===4?(B=j.current)==null||B.focus():e===5&&((k=A.current)==null||k.focus()):e===3&&((Q=A.current)==null||Q.focus()))},[e,t,d]);const I=t==="manual"?6:4,P=I+1,F=t==="manual"?[D("agent.create.location"),D("agent.create.method"),D("agent.create.name"),D("agent.create.prompt"),D("agent.create.description"),D("agent.create.toolsSelection")]:[D("agent.create.location"),D("agent.create.method"),D("agent.create.describeAgent"),D("agent.create.toolsSelection")],q=G=>G===1?n==="workspace"?0:1:G===2?t==="qwen"?0:1:G===I?ike(a,o):0,R=G=>{v(G),x(q(G)),t==="manual"&&(G===3||G===4||G===5)||t==="qwen"&&G===3?w():b()},V=()=>{e<=1||u||R(e-1)},J=()=>{if(!u){if(e===1){R(2);return}if(e===2){R(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===I&&(E(l),R(P))}},ee=u||t==="manual"&&e===3&&!r.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!s.trim()||t==="qwen"&&e===3&&!s.trim();let N=null;if(e===1&&(N=h.jsx(h.Fragment,{children:h.jsxs("div",{className:ke.options,children:[h.jsx(du,{idx:0,active:l===0,label:D("agent.create.project.cli"),numbered:!0,onClick:()=>S(0)}),h.jsx(du,{idx:1,active:l===1,label:D("agent.create.user.cli"),numbered:!0,onClick:()=>S(1)})]})})),e===2&&(N=h.jsx(h.Fragment,{children:h.jsxs("div",{className:ke.options,children:[h.jsx(du,{idx:0,active:l===0,label:D("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>C(0)}),h.jsx(du,{idx:1,active:l===1,label:D("agent.create.method.manual"),numbered:!0,onClick:()=>C(1)})]})})),t==="manual"&&e===3&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:D("agent.create.nameHelp")}),h.jsx("input",{ref:O,className:ke.textInput,value:r,onChange:G=>f(G.target.value),onFocus:w,onBlur:b,placeholder:D("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:D("agent.create.promptHelp")}),h.jsx("textarea",{ref:j,className:ke.textArea,value:i,onChange:G=>p(G.target.value),onFocus:w,onBlur:b,placeholder:D("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:D("agent.create.manualDescHelp")}),h.jsx("textarea",{ref:A,className:ke.textArea,value:s,onChange:G=>m(G.target.value),onFocus:w,onBlur:b,placeholder:D("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:D("agent.create.qwenHint")}),u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.text,children:D("agent.create.generatingConfig")}),h.jsx("div",{className:ke.footer,children:D("agent.footer.generating")})]}):h.jsx(h.Fragment,{children:h.jsx("textarea",{ref:A,className:ke.textArea,value:s,onChange:G=>m(G.target.value),onFocus:w,onBlur:b,placeholder:D("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===I){const G=a[l]??a[0],B=(G==null?void 0:G.tools)??[],k=(G==null?void 0:G.id)==="all"?D("agent.create.tools.allInfo"):B.length>0?B.join(", "):D("agent.create.tools.none"),Q=B.filter(uP),ce=B.filter(dP),pe=B.filter(hP);N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.options,children:a.map((be,ye)=>h.jsx(du,{idx:ye,active:l===ye,label:be.label,numbered:!0,onClick:()=>E(ye)},be.id))}),h.jsx("div",{className:ke.toolDetail,children:(G==null?void 0:G.id)==="all"?h.jsx("div",{className:ke.toolDetailBody,children:k}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:ke.toolDetailTitle,children:D("agent.create.tools.selected")}),h.jsx("div",{className:ke.toolList,children:B.length===0?k:h.jsxs(h.Fragment,{children:[Q.length>0&&h.jsxs("div",{children:[D("agent.create.tools.readOnlyLabel")," ",Q.join(", ")]}),ce.length>0&&h.jsxs("div",{children:[D("agent.create.tools.editLabel")," ",ce.join(", ")]}),pe.length>0&&h.jsxs("div",{children:[D("agent.create.tools.executionLabel")," ",pe.join(", ")]})]})})]})})]})}if(e===P){const G=o.length===0?"*":o.join(", ");N=h.jsx(h.Fragment,{children:h.jsxs("div",{className:ke.summary,children:[h.jsxs("div",{className:ke.summaryRow,children:[h.jsx("span",{className:ke.summaryLabel,children:aa(D("agent.create.name"))}),h.jsx("span",{className:ke.summaryValue,children:r||"—"})]}),h.jsxs("div",{className:ke.summaryRow,children:[h.jsx("span",{className:ke.summaryLabel,children:aa(D("agent.location"))}),h.jsx("span",{className:ke.summaryValue,children:D(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),h.jsxs("div",{className:ke.summaryRow,children:[h.jsx("span",{className:ke.summaryLabel,children:aa(D("agent.toolsLabel"))}),h.jsx("span",{className:ke.summaryValue,children:G})]}),h.jsx("div",{className:ke.summaryBlockTitle,children:aa(D("agent.descriptionLabel"))}),h.jsx("div",{className:ke.summaryBlock,children:s||"—"}),h.jsx("div",{className:ke.summaryBlockTitle,children:aa(D("agent.systemPromptLabel"))}),h.jsx("div",{className:ke.summaryBlock,children:i||"—"})]})})}return h.jsxs("div",{className:ke.createWizard,children:[h.jsx("div",{className:ke.createSteps,children:F.map((G,B)=>{const k=B+1;return h.jsxs("div",{className:`${ke.createStepPill} ${k===Math.min(e,I)?ke.createStepPillActive:""} ${k<Math.min(e,I)?ke.createStepPillDone:""}`,children:[h.jsx("span",{className:ke.createStepNumber,children:k}),h.jsx("span",{className:ke.createStepLabel,children:G})]},`${k}:${G}`)})}),h.jsx("div",{className:ke.createBody,children:N}),h.jsxs("div",{className:ke.createActions,children:[h.jsx("button",{type:"button",className:ke.manageButton,onClick:V,disabled:e<=1||u||c,children:D("common.previous")}),e===P?h.jsx("button",{type:"button",className:ke.manageButton,onClick:M,disabled:c,children:D(c?"agent.create.loading":"agent.create.save")}):h.jsx("button",{type:"button",className:ke.manageButton,onClick:J,disabled:ee,children:D("common.next")})]})]})}const cke="_page_1np31_1",uke="_tabs_1np31_11",dke="_memoryCard_1np31_19",hke="_memoryCardActive_1np31_35",fke="_memoryTitle_1np31_44",mke="_detailPath_1np31_48",pke="_status_1np31_49",gke="_actionButton_1np31_54",yke="_primaryButton_1np31_55",bke="_secondaryButton_1np31_56",vke="_detail_1np31_48",wke="_detailHeader_1np31_79",xke="_detailTitleWrap_1np31_87",_ke="_actions_1np31_91",kke="_content_1np31_105",Ske="_editor_1np31_106",Tke="_editorFooter_1np31_127",gs={page:cke,tabs:uke,memoryCard:dke,memoryCardActive:hke,memoryTitle:fke,detailPath:mke,status:pke,actionButton:gke,primaryButton:yke,secondaryButton:bke,detail:vke,detailHeader:wke,detailTitleWrap:xke,actions:_ke,content:kke,editor:Ske,editorFooter:Tke};function NA(e,t){return e.find(n=>n.scope===t)}function RA(e,t){return t(e==="global"?"memory.global":"memory.project")}function Cke({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var N,G;const{t:s}=ht(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:u}=EV({autoLoad:!0}),d=g.useRef(null),f=g.useRef(0),[m,p]=g.useState("workspace"),[y,w]=g.useState("view"),[b,v]=g.useState(""),[x,S]=g.useState(""),[C,E]=g.useState(!1),[M,D]=g.useState(!1),[O,A]=g.useState(null),j=g.useRef(0),I=g.useMemo(()=>{const B=NA(i,"global"),k=NA(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:k},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:B}]},[i,s]),P=I.find(B=>B.scope===m)??I[0],F=g.useCallback((B,k)=>{const Q=++f.current;if(w(k),A(null),v(""),S(""),!(B!=null&&B.file)){k==="edit"&&requestAnimationFrame(()=>{var ce;return(ce=d.current)==null?void 0:ce.focus()});return}E(!0),l(B.file.path).then(ce=>{Q===f.current&&(v(ce.content),S(ce.content),ce.truncated&&A(s("memory.fileTruncated")),requestAnimationFrame(()=>{var pe;return(pe=d.current)==null?void 0:pe.focus()}))}).catch(ce=>{if(Q!==f.current)return;const pe=ce instanceof Error?ce.message:String(ce);A(pe),B.scope!=="global"&&(r==null||r(pe,"error"))}).finally(()=>{Q===f.current&&E(!1)})},[r,l,s]);g.useEffect(()=>{P&&F(P,y)},[(N=P==null?void 0:P.file)==null?void 0:N.path,P==null?void 0:P.scope]),g.useEffect(()=>{a&&A(a.message)},[a]),g.useEffect(()=>{e<=0||c().then(()=>A(s("memory.refreshed"))).catch(B=>{const k=B instanceof Error?B.message:String(B);A(k),r==null||r(k,"error")})},[r,e,c,s]),g.useEffect(()=>{if(t<=0||j.current===t)return;j.current=t;const B=n==="global"?"global":"workspace";p(B);const k=I.find(Q=>Q.scope===B);F(k,"edit")},[n,t,I,F]);const q=B=>{p(B.scope),F(B,"view")},R=()=>{P&&F(P,"edit")},V=()=>{if(P){if(!x.trim()){A(s("memory.contentEmpty"));return}D(!0),A(null),u({scope:P.scope,mode:"replace",content:x}).then(B=>{const k=s("memory.saved",{scope:RA(P.scope,s),bytes:B.bytesWritten,path:B.filePath});v(x),w("view"),A(k),r==null||r(k,"status"),c().catch(()=>{})}).catch(B=>{const k=B instanceof Error?B.message:String(B);A(k),r==null||r(k,"error")}).finally(()=>D(!1))}},J=((G=P==null?void 0:P.file)==null?void 0:G.path)??(P==null?void 0:P.fallbackPath)??"",ee=O??(o?s("memory.loading"):null);return h.jsxs("div",{className:gs.page,children:[h.jsx("nav",{className:gs.tabs,"aria-label":s("memory.menu"),children:I.map(B=>{const k=B.scope===m;return h.jsx("button",{type:"button",className:`${gs.memoryCard} ${k?gs.memoryCardActive:""}`,onClick:()=>q(B),children:h.jsx("span",{className:gs.memoryTitle,children:B.title})},B.scope)})}),h.jsxs("section",{className:gs.detail,children:[h.jsxs("header",{className:gs.detailHeader,children:[h.jsx("div",{className:gs.detailTitleWrap,children:h.jsx("div",{className:gs.detailPath,children:J})}),h.jsx("div",{className:gs.actions,children:h.jsx("button",{type:"button",className:gs.actionButton,onClick:R,children:s("settings.action.edit")})})]}),ee&&h.jsx("div",{className:gs.status,children:ee}),y==="edit"?h.jsxs(h.Fragment,{children:[h.jsx("textarea",{ref:d,className:gs.editor,value:x,disabled:M||C,onChange:B=>S(B.target.value),placeholder:s("memory.placeholder",{scope:P?RA(P.scope,s):""})}),h.jsxs("div",{className:gs.editorFooter,children:[h.jsx("button",{type:"button",className:gs.secondaryButton,disabled:M,onClick:()=>{S(b),w("view")},children:s("common.cancel")}),h.jsx("button",{type:"button",className:gs.primaryButton,disabled:M||C,onClick:V,children:s(M?"memory.saving":"memory.save")})]})]}):h.jsx("pre",{className:gs.content,children:C?s("memory.loadingFile"):b||s("memory.noFiles")})]})]})}const Ake="_panel_cxp6w_1",Eke="_steps_cxp6w_10",Mke="_stepPill_cxp6w_18",Ike="_stepPillActive_cxp6w_29",Nke="_stepPillDone_cxp6w_34",Rke="_stepNumber_cxp6w_38",Lke="_stepLabel_cxp6w_49",jke="_body_cxp6w_55",Dke="_text_cxp6w_59",Oke="_muted_cxp6w_64",Bke="_options_cxp6w_68",Pke="_option_cxp6w_68",$ke="_optionActive_cxp6w_90",zke="_label_cxp6w_94",Fke="_optionText_cxp6w_98",Uke="_description_cxp6w_112",qke="_input_cxp6w_119",Hke="_preview_cxp6w_135",Vke="_error_cxp6w_146",Wke="_link_cxp6w_150",Gke="_terms_cxp6w_161",Kke="_actions_cxp6w_169",Yke="_actionButton_cxp6w_177",Mn={panel:Ake,steps:Eke,stepPill:Mke,stepPillActive:Ike,stepPillDone:Nke,stepNumber:Rke,stepLabel:Lke,body:jke,text:Dke,muted:Oke,options:Bke,option:Pke,optionActive:$ke,label:zke,optionText:Fke,description:Uke,input:qke,preview:Hke,error:Vke,link:Wke,terms:Gke,actions:Kke,actionButton:Yke},Xke=[{value:"openai",label:"OpenAI-compatible",description:"Standard OpenAI API format (most common)"},{value:"anthropic",label:"Anthropic-compatible",description:"Anthropic Messages API format"},{value:"gemini",label:"Gemini-compatible",description:"Google Gemini API format"}];function Lf(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function LA(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function Qke(e,t,n){var r;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((r=t.uiLabels)==null?void 0:r.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function Jke(e){const t=e.trim();return t?t.length<=6?"***":`${t.slice(0,3)}...${t.slice(-4)}`:"(not set)"}function Ev(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Zke({onMessage:e,onClose:t}){const{t:n}=ht(),r=Rc(),[s,i]=g.useState("groups"),[o,a]=g.useState(0),[l,c]=g.useState(0),[u,d]=g.useState("providers"),[f,m]=g.useState(0),[p,y]=g.useState(),[w,b]=g.useState("alibaba"),[v,x]=g.useState(null),[S,C]=g.useState("openai"),[E,M]=g.useState(""),[D,O]=g.useState(""),[A,j]=g.useState(""),[I,P]=g.useState(!1),[F,q]=g.useState(!1),[R,V]=g.useState(!0),[J,ee]=g.useState(!0),[N,G]=g.useState(!1),[B,k]=g.useState(!1),[Q,ce]=g.useState(""),[pe,be]=g.useState(!0),[ye,ie]=g.useState(!1),[re,oe]=g.useState(null);g.useEffect(()=>{r.getAuthProviders().then(Y=>{y(Y),be(!1)}).catch(Y=>{oe(Y instanceof Error?Y.message:String(Y)),be(!1)})},[r]);const ve=g.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),qe=g.useMemo(()=>{var me;return(((me=ve.find(le=>le.id===w))==null?void 0:me.providerIds)??[]).map(le=>p==null?void 0:p.providers.find(Ke=>Ke.id===le)).filter(le=>!!le)},[p,w,ve]),We=g.useMemo(()=>(v==null?void 0:v.steps)??[],[v==null?void 0:v.steps]),te=We[f],we=(v==null?void 0:v.showAdvancedConfig)===!0,Se=g.useMemo(()=>F?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[F]),Ne=Se.indexOf("context"),Pt=te==="apiKey"||te==="models"||te==="baseUrl"&&!Array.isArray(v==null?void 0:v.baseUrl),[at,vt]=g.useState(0),Tt=g.useCallback((Y,me="providers")=>{var Ke,_t;x(Y),d(me);const le=((Ke=Y.protocolOptions)==null?void 0:Ke[0])??Y.protocol;C(le),typeof Y.baseUrl=="string"?M(Y.baseUrl):Array.isArray(Y.baseUrl)?M(((_t=Y.baseUrl[0])==null?void 0:_t.url)??""):M(Lf(le)),O(""),j(LA(Y)),P(!1),q(!1),V(!0),ee(!0),G(!1),k(!1),ce(""),m(0),vt(0),oe(null),i(Y.steps.length>0?"step":"review")},[]),rt=g.useCallback(()=>{if(oe(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(We.length===0){i(u);return}i("step"),m(Math.max(0,We.length-1));return}if(f>0){m(Y=>Y-1),vt(0);return}i(u)},[t,u,f,We.length,s]),tt=g.useCallback(()=>{if(!v||ye)return;ie(!0),oe(null);const Y=Number(Q);r.installAuthProvider({providerId:v.id,protocol:S,baseUrl:E,apiKey:D,modelIds:Ev(A),advancedConfig:I||F||Number.isFinite(Y)&&Y>0?{...I?{enableThinking:!0}:{},...F?{multimodal:{...R?{image:!0}:{},...J?{video:!0}:{},...N?{audio:!0}:{},...B?{pdf:!0}:{}}}:{},...Number.isFinite(Y)&&Y>0?{contextWindowSize:Y}:{}}:void 0}).then(me=>{e(me.message),t()}).catch(me=>{const le=me instanceof Error?me.message:String(me);oe(le),e(le,"error")}).finally(()=>ie(!1))},[D,E,Q,F,N,R,B,J,A,t,e,S,v,ye,I,r]),Qe=g.useCallback(()=>{if(v){if(te==="baseUrl"){const Y=E.trim()||Lf(S);if(!Y){oe(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Y)){oe(n("auth.baseUrlInvalid"));return}E.trim()||M(Y)}if(te==="apiKey"&&D.trim().length===0){oe(n("auth.apiKeyRequired"));return}if(te==="models"&&Ev(A).length===0){oe(n("auth.modelsRequired"));return}oe(null),f>=We.length-1?we?i("review"):tt():(m(Y=>Y+1),vt(0))}},[D,E,te,A,S,v,tt,we,f,We.length,n]),ne=g.useCallback(Y=>{switch(Y){case"thinking":P(me=>!me);return;case"modality":q(me=>!me);return;case"image":V(me=>!me);return;case"video":ee(me=>!me);return;case"audio":G(me=>!me);return;case"pdf":k(me=>!me);return;case"context":Qe();return;default:return}},[Qe]),se=g.useCallback(()=>{if(s==="groups"){const Y=ve[o];if(!Y)return;if(Y.id==="custom"){const me=Y.providerIds.map(le=>p==null?void 0:p.providers.find(Ke=>Ke.id===le)).find(le=>!!le);me&&Tt(me,"groups");return}b(Y.id),c(0),i("providers");return}if(s==="providers"){const Y=qe[l];Y&&Tt(Y,"providers");return}if(s==="review"){tt();return}if(!(!v||!te)){if(te==="protocol"){const Y=(v.protocolOptions??[v.protocol])[at];Y&&(C(Y),v.baseUrl||M(Lf(Y))),Qe();return}if(te==="baseUrl"&&Array.isArray(v.baseUrl)){const Y=v.baseUrl[at];Y&&M(Y.url),Qe();return}if(te==="advancedConfig"){ne(Se[at]);return}Qe()}},[te,p,Qe,o,ve,at,v,l,qe,tt,Tt,s,ne,Se]),De=g.useCallback(Y=>{if(s==="groups"){const me=ve[Y];if(!me)return;if(me.id==="custom"){const le=me.providerIds.map(Ke=>p==null?void 0:p.providers.find(_t=>_t.id===Ke)).find(Ke=>!!Ke);le&&Tt(le,"groups");return}b(me.id),c(0),i("providers");return}if(s==="providers"){const me=qe[Y];me&&Tt(me,"providers");return}if(!v||!te){s==="review"&&tt();return}if(te==="protocol"){const me=(v.protocolOptions??[v.protocol])[Y];me&&(C(me),v.baseUrl||M(Lf(me))),Qe();return}if(te==="baseUrl"&&Array.isArray(v.baseUrl)){const me=v.baseUrl[Y];me&&M(me.url),Qe();return}te==="advancedConfig"&&ne(Se[Y])},[te,p,Qe,ve,ne,Se,v,qe,tt,Tt,s]),lt=(Y,me,le)=>h.jsx("div",{className:Mn.options,children:Y.map((Ke,_t)=>h.jsx("button",{type:"button",className:`${Mn.option} ${me===_t?Mn.optionActive:""}`,onClick:()=>{le(_t),De(_t)},children:h.jsxs("div",{className:Mn.optionText,children:[h.jsx("div",{className:Mn.label,children:Ke.label}),Ke.description&&h.jsx("div",{className:Mn.description,children:Ke.description})]})},Ke.value))}),ae=()=>{if(!v||!te)return null;if(te==="protocol"){const le=v.protocolOptions??[v.protocol];return lt(Xke.filter(Ke=>le.includes(Ke.value)),at,vt)}if(te==="baseUrl")return Array.isArray(v.baseUrl)?lt(v.baseUrl.map(le=>({value:le.url,label:le.label,description:le.url})),at,vt):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Mn.text,children:n("auth.baseUrlPrompt")}),h.jsx("input",{className:Mn.input,value:E,placeholder:Lf(S),onChange:le=>{M(le.target.value),oe(null)},onKeyDown:le=>{le.key==="Enter"&&(le.preventDefault(),le.stopPropagation(),Qe())},autoFocus:!0}),v.documentationUrl&&h.jsx("a",{className:Mn.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(te==="apiKey")return h.jsxs(h.Fragment,{children:[v.documentationUrl&&h.jsxs("a",{className:Mn.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",v.documentationUrl]}),h.jsx("input",{className:Mn.input,type:"password",value:D,placeholder:v.apiKeyPlaceholder??"sk-...",onChange:le=>{O(le.target.value),oe(null)},onKeyDown:le=>{le.key==="Enter"&&(le.preventDefault(),le.stopPropagation(),Qe())},autoFocus:!0})]});if(te==="models"){const le=LA(v);return h.jsxs(h.Fragment,{children:[le&&h.jsx("div",{className:Mn.muted,children:n("auth.modelsPrompt",{modelIds:le})}),h.jsx("input",{className:Mn.input,value:A,placeholder:le||"model-id-1, model-id-2",onChange:Ke=>{j(Ke.target.value),oe(null)},onKeyDown:Ke=>{Ke.key==="Enter"&&(Ke.preventDefault(),Ke.stopPropagation(),Qe())},autoFocus:!0})]})}const Y=le=>le?"◉":"○",me=[{value:"thinking",label:`${Y(I)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Y(F)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return F&&me.push({value:"image",label:`${Y(R)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Y(J)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Y(N)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Y(B)} ${n("auth.advanced.modalityPdf")}`}),me.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${Q||"auto"}`,description:n("auth.advanced.contextDesc")}),h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Mn.text,children:n("auth.advanced.prompt")}),lt(me,at,vt),h.jsx("input",{className:Mn.input,value:Q,placeholder:"auto",onChange:le=>ce(le.target.value.replace(/[^0-9]/g,"")),onFocus:()=>vt(Ne),onKeyDown:le=>{le.key==="Enter"&&(le.preventDefault(),le.stopPropagation(),Qe())}})]})},ze=g.useMemo(()=>{if(!v)return"";const Y=v.envKey??`${S.toUpperCase()}_API_KEY`,me=Ev(A),le={};if(I&&(le.extra_body={enable_thinking:!0}),F){const Et={};R&&(Et.image=!0),J&&(Et.video=!0),N&&(Et.audio=!0),B&&(Et.pdf=!0),Object.keys(Et).length>0&&(le.modalities=Et)}const Ke=Number(Q);Number.isFinite(Ke)&&Ke>0&&(le.contextWindowSize=Ke);const _t=Object.keys(le).length>0;return JSON.stringify({env:{[Y]:Jke(D)},modelProviders:{[S]:me.map(Et=>({id:Et,name:Et,baseUrl:E.trim(),envKey:Y,..._t?{generationConfig:le}:{}}))},security:{auth:{selectedType:S}},model:{name:me[0]}},null,2)},[D,E,Q,F,N,R,B,J,A,S,v,I]),Je=g.useMemo(()=>{const Y=[n("auth.step.group"),n("auth.step.provider")];return v&&(Y.push(...We.map(me=>Qke(me,v,n))),we&&Y.push(n("auth.review"))),Y},[v,we,We,n]),Nt=g.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+f,Je.length):Je.length,[f,Je.length,s]),Ut=pe?h.jsx("div",{className:Mn.muted,children:n("common.loading")}):s==="groups"?h.jsxs(h.Fragment,{children:[lt(ve.map(Y=>({value:Y.id,label:n(Y.label),description:n(Y.description)})),o,a),h.jsxs("div",{className:Mn.terms,children:[h.jsxs("div",{children:[n("auth.termsTitle"),":"]}),h.jsx("a",{className:Mn.link,href:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/",target:"_blank",rel:"noreferrer",children:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/"})]})]}):s==="providers"?lt(qe.map(Y=>({value:Y.id,label:n(Y.label),description:n(Y.description)})),l,c):s==="step"?ae():h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Mn.text,children:n("auth.reviewText")}),h.jsx("div",{className:Mn.preview,children:ze})]}),he=()=>{if(s==="review"){tt();return}if(Pt||te==="advancedConfig"){Qe();return}se()};return h.jsxs("div",{className:Mn.panel,children:[h.jsx("div",{className:Mn.steps,children:Je.map((Y,me)=>{const le=me+1;return h.jsxs("div",{className:`${Mn.stepPill} ${le===Nt?Mn.stepPillActive:""} ${le<Nt?Mn.stepPillDone:""}`,children:[h.jsx("span",{className:Mn.stepNumber,children:le}),h.jsx("span",{className:Mn.stepLabel,children:Y})]},`${le}:${Y}`)})}),h.jsx("div",{className:Mn.body,children:Ut}),re&&h.jsx("div",{className:Mn.error,children:re}),h.jsxs("div",{className:Mn.actions,children:[h.jsx("button",{type:"button",className:Mn.actionButton,onClick:rt,disabled:s==="groups"||pe||ye,children:n("common.previous")}),h.jsx("button",{type:"button",className:Mn.actionButton,onClick:he,disabled:pe||ye,children:n(s==="review"?ye?"auth.saving":"auth.save":"common.next")})]})]})}function e6e(e){return e.displayName||e.name}const fP="tools-list",jA=e=>`${fP}-opt-${e}`;function t6e(){const{t:e}=ht(),{status:t,tools:n,loading:r,error:s}=UN({autoLoad:!0}),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState(()=>new Set),d=g.useRef(null);g.useEffect(()=>{var y,w;s?l(s.message):(w=(y=t==null?void 0:t.errors)==null?void 0:y[0])!=null&&w.error?l(t.errors[0].error):t&&l(null)},[t,s]);const f=g.useCallback(y=>{u(w=>w.has(y.name)?new Set:new Set([y.name]))},[]);g.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),g.useEffect(()=>{var w;const y=(w=d.current)==null?void 0:w.children[i];y==null||y.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:m}=Bc({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:y=>{const w=n[y];w!=null&&w.description&&f(w)}}),p=g.useMemo(()=>{if(!t)return"";const y=n.filter(w=>w.enabled).length;return e("tools.summary",{enabled:y,total:n.length})},[t,n,e]);return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[p&&h.jsx("div",{className:Me("picker-search"),children:h.jsx("span",{className:Me("picker-search-hint"),children:p})}),(a||r)&&h.jsx("div",{className:Me("picker-search"),children:h.jsx("span",{className:Me("picker-search-hint"),children:a||e("tools.loading")})}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:fP,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?jA(i):void 0,className:Me("picker-list",m?"picker-keyboard-only":void 0),ref:d,children:[!r&&n.length===0&&h.jsx("div",{className:Me("picker-empty"),children:e("tools.empty")}),n.map((y,w)=>{const b=c.has(y.name),v=y.description??"";return h.jsxs("div",{id:jA(w),role:"option","aria-selected":!1,"aria-expanded":v?b:void 0,className:Me("picker-item","picker-session-item","tools-picker-item",w===i?"selected":void 0,b?"tools-picker-item-expanded":void 0),onClick:()=>{o(w),y.description&&f(y)},onMouseMove:()=>o(w),children:[h.jsxs("div",{className:Me("picker-item-row"),children:[h.jsx("span",{className:Me("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:Me("picker-item-title"),children:e6e(y)}),h.jsx("span",{className:Me("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?h.jsx("svg",{className:Me("tools-item-chevron",b?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),b&&v&&h.jsx("div",{className:Me("tools-desc-expanded"),children:h.jsx("div",{className:Me("tools-desc-body"),children:v})})]},y.name)})]})]})}const mP="update available";function n6e(e){return e.displayName||e.name}function pP(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function r6e(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 pd(e){return e&&e.length>0?e.join(", "):"-"}const s6e=r6;function i6e(){const{t:e}=ht(),t=ml(),n=Rc(),r=Yu(),[s,i]=g.useState([]),[o,a]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState({}),[f,m]=g.useState(!1),[p,y]=g.useState(!1),[w,b]=g.useState(null),[v,x]=g.useState(null),S=g.useCallback(()=>(m(!0),n.loadExtensionsStatus().then(O=>{var j,I;const A=O.extensions??[];i(A),x(((I=(j=O.errors)==null?void 0:j[0])==null?void 0:I.error)??null),a(P=>P&&A.some(F=>F.name===P)?P:null)}).catch(O=>{x(O instanceof Error?O.message:String(O))}).finally(()=>m(!1))),[n]),C=g.useCallback(()=>{const O=t.clientId;return O?(y(!0),n.checkExtensionUpdates(O).then(A=>d(A.states)).catch(A=>{x(A instanceof Error?A.message:String(A))}).finally(()=>y(!1))):(x(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),E=g.useCallback(()=>{const O=t.clientId;if(!O){x(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(O).then(async A=>{x(e("extensions.manage.refreshed",{refreshed:A.refreshed,failed:A.failed})),await S(),await C()}).catch(A=>{x(A instanceof Error?A.message:String(A))}).finally(()=>y(!1))},[n,C,t.clientId,S,e]);g.useEffect(()=>{S()},[S]),g.useEffect(()=>{s.length>0&&C()},[C,s.length]),g.useEffect(()=>{((r==null?void 0:r.extensionsVersion)??0)>0&&(d({}),S())},[S,r==null?void 0:r.extensionsVersion]);const M=g.useCallback((O,A)=>{const j=t.clientId;if(!j){x(e("extensions.install.waitForSession"));return}b(O),x(null),A(j).then(()=>x(e("extensions.manage.queued",{name:O}))).catch(I=>{x(I instanceof Error?I.message:String(I))}).finally(()=>b(null))},[t.clientId,e]),D=g.useMemo(()=>f?e("extensions.manage.loading"):p?e("extensions.manage.checkingUpdates"):e("extensions.manage.count",{count:s.length}),[p,s.length,f,e]);return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search","extensions-toolbar"),children:[h.jsx("span",{className:Me("picker-search-hint"),children:v||D}),h.jsx("button",{type:"button",className:Me("dialog-inline-button"),disabled:f||p,onClick:E,children:e("common.refresh")})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{className:Me("picker-list"),children:[!f&&s.length===0&&h.jsx("div",{className:Me("picker-empty"),children:e("extensions.manage.empty")}),s.map(O=>{const A=u[O.name]??O.updateState,j=o===O.name,I=w===O.name;return h.jsxs("div",{className:Me("picker-item","picker-session-item","tools-picker-item",j?"selected":void 0,j?"tools-picker-item-expanded":void 0),children:[h.jsxs("button",{type:"button",className:Me("extensions-row-button"),onClick:()=>{a(j?null:O.name),c(null)},children:[h.jsx("span",{className:Me("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:Me("picker-item-title"),children:n6e(O)}),h.jsxs("span",{className:Me("picker-item-badge"),children:["v",O.version]}),h.jsx("span",{className:Me("tools-status-badge",O.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:pP(O,e)}),h.jsx("span",{className:Me("tools-status-badge",A===mP?"tools-status-badge-busy":void 0),children:r6e(A,e)}),h.jsx("svg",{className:Me("tools-item-chevron",j?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),j&&h.jsx(o6e,{extension:O,updateState:A,busy:I,confirmingUninstall:l===O.name,onUpdate:()=>M(O.name,P=>n.updateExtension(O.name,P)),onToggleScope:(P,F)=>M(O.name,q=>P==="enable"?n.enableExtension(O.name,{scope:F},q):n.disableExtension(O.name,{scope:F},q)),onRequestUninstall:()=>c(O.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{M(O.name,P=>n.uninstallExtension(O.name,P)),c(null),a(null)}})]},O.id||O.name)})]})]})}function o6e({extension:e,updateState:t,busy:n,confirmingUninstall:r,onUpdate:s,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=ht(),u=e.details,d=e.isActive?"disable":"enable";return h.jsxs("div",{className:Me("extensions-detail"),children:[h.jsxs("div",{className:Me("extensions-detail-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-inline-button"),disabled:n||t!==mP,onClick:s,children:c("extensions.manage.update")}),h.jsxs("button",{type:"button",className:Me("dialog-inline-button"),disabled:n,onClick:()=>i(d,"user"),children:[c(d==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.user")]}),h.jsxs("button",{type:"button",className:Me("dialog-inline-button"),disabled:n,onClick:()=>i(d,"workspace"),children:[c(d==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.workspace")]}),h.jsx("button",{type:"button",className:Me("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),r&&h.jsxs("div",{className:Me("extensions-confirm"),children:[h.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),h.jsxs("div",{className:Me("dialog-inline-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),h.jsxs("div",{className:Me("extensions-detail-grid"),children:[h.jsx(Eo,{label:c("extensions.manage.name"),value:e.name}),h.jsx(Eo,{label:c("extensions.manage.version"),value:e.version}),h.jsx(Eo,{label:c("extensions.manage.status"),value:pP(e,c)}),h.jsx(Eo,{label:c("extensions.manage.path"),value:e.path}),h.jsx(Eo,{label:c("extensions.manage.source"),value:e.source??"-"}),h.jsx(Eo,{label:c("extensions.manage.commands"),value:pd(u==null?void 0:u.commands)}),h.jsx(Eo,{label:c("extensions.manage.skills"),value:pd(u==null?void 0:u.skills)}),h.jsx(Eo,{label:c("extensions.manage.agents"),value:pd(u==null?void 0:u.agents)}),h.jsx(Eo,{label:c("extensions.manage.mcpServers"),value:pd(u==null?void 0:u.mcpServers)}),h.jsx(Eo,{label:c("extensions.manage.contextFiles"),value:pd(u==null?void 0:u.contextFiles)}),h.jsx(Eo,{label:c("extensions.manage.settings"),value:pd(u==null?void 0:u.settings)})]})]})}function Eo({label:e,value:t}){return h.jsxs("div",{className:Me("extensions-detail-field"),children:[h.jsx("span",{className:Me("extensions-detail-label"),children:s6e(e)}),h.jsx("span",{className:Me("extensions-detail-value"),children:t})]})}const a6e="_panel_1nmt9_1",l6e="_embeddedPanel_1nmt9_16",c6e="_header_1nmt9_26",u6e="_title_1nmt9_32",d6e="_secondary_1nmt9_36",h6e="_hint_1nmt9_37",f6e="_empty_1nmt9_38",m6e="_busy_1nmt9_39",p6e="_scopeTabs_1nmt9_49",g6e="_scopeTab_1nmt9_49",y6e="_scopeTabActive_1nmt9_71",b6e="_settingsPage_1nmt9_76",v6e="_sidebar_1nmt9_83",w6e="_categoryButton_1nmt9_92",x6e="_categoryButtonActive_1nmt9_110",_6e="_categoryCount_1nmt9_115",k6e="_content_1nmt9_121",S6e="_card_1nmt9_128",T6e="_cardBody_1nmt9_142",C6e="_cardTitle_1nmt9_146",A6e="_cardDescription_1nmt9_155",E6e="_scopeHint_1nmt9_156",M6e="_scopeBadge_1nmt9_164",I6e="_cardControl_1nmt9_174",N6e="_select_1nmt9_180",R6e="_actionButton_1nmt9_181",L6e="_editInput_1nmt9_182",j6e="_editor_1nmt9_219",D6e="_switchOn_1nmt9_241",O6e="_switchKnob_1nmt9_246",B6e="_footer_1nmt9_261",Jt={panel:a6e,embeddedPanel:l6e,header:c6e,title:u6e,secondary:d6e,hint:h6e,empty:f6e,busy:m6e,scopeTabs:p6e,scopeTab:g6e,scopeTabActive:y6e,settingsPage:b6e,sidebar:v6e,categoryButton:w6e,categoryButtonActive:x6e,categoryCount:_6e,content:k6e,card:S6e,cardBody:T6e,cardTitle:C6e,cardDescription:A6e,scopeHint:E6e,scopeBadge:M6e,cardControl:I6e,select:N6e,actionButton:R6e,editInput:L6e,editor:j6e,switch:"_switch_1nmt9_231",switchOn:D6e,switchKnob:O6e,footer:B6e},P6e=new Set(["fastModel","visionModel"]),$6e=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function Pb(e,t,n){const r=e(t);return r===t?n:r}function z6e(e,t){return Pb(t,`settings.category.${e}`,e)}function F6e(e,t){return Pb(t,`settings.label.${e.key}`,e.label)}function U6e(e,t){if(e.description)return Pb(t,`settings.description.${e.key}`,e.description)}function gP(e,t,n,r){return Pb(r,`settings.option.${e.key}.${String(t)}`,n)}function Mv(e,t,n){const r=bP(e,t);if(r==null)return"";if(e.key===ou){const i=p5(r,Rs.Dark);return n(`theme.${i}`)}if(e.key===m0){const i=h5(r);return i?f5(i):String(r)}if(e.type==="boolean")return n(r===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===r);return i?gP(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?s.slice(0,21)+"...":s}function yP(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function q6e(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return yP(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function bP(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function H6e(e,t){const n=new Map;for(const r of e){let s=n.get(r.category);s||(s=[],n.set(r.category,s)),s.push(r)}return Array.from(n.entries()).map(([r,s])=>({category:z6e(r,t),items:s}))}function V6e({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,embedded:o=!1}){const{t:a}=ht(),{status:l,settings:c,loading:u,error:d,reload:f,setValue:m}=e,[p,y]=g.useState("workspace"),[w,b]=g.useState(""),[v,x]=g.useState(null),[S,C]=g.useState(null),[E,M]=g.useState(null),D=g.useRef(null),[O,A]=g.useState(!1),j=u&&!l,I=c.find(B=>B.key===ou),P=p5(I==null?void 0:I.values.effective),F=c.find(B=>B.key===m0),q=h5(F==null?void 0:F.values.effective),R=g.useMemo(()=>{const B=c.filter(pe=>!$6e.has(pe.key)),k=H6e(B,a).map(pe=>({id:pe.category,label:pe.category,items:pe.items.map(be=>({type:"setting",setting:be}))})),Q={type:"local",localKey:"chatWidth"},ce=k.find(pe=>pe.items.some(be=>be.type==="setting"&&be.setting.key===ou));if(ce){const pe=ce.items.findIndex(be=>be.type==="setting"&&be.setting.key===ou);ce.items.splice(pe+1,0,Q)}else k.push({id:a("settings.category.UI"),label:a("settings.category.UI"),items:[Q]});return k},[c,a]);g.useEffect(()=>{R.length!==0&&(R.some(B=>B.id===w)||b(R[0].id))},[w,R]),g.useEffect(()=>{var B;d?C(d.message):(B=l==null?void 0:l.warnings)!=null&&B.length?C(l.warnings.map(k=>a("settings.corrupted",{recovered:k.recovered?"true":"false"})).join("; ")):c.length>0&&!O&&C(null)},[d,c,l,a,O]),g.useEffect(()=>{E&&setTimeout(()=>{var B;return(B=D.current)==null?void 0:B.focus()},0)},[E]);const V=g.useCallback((B,k)=>{O||C(null),x(B),m("workspace",B,k).then(async Q=>{try{await f()}catch{}Q!=null&&Q.requiresRestart&&B!==m0&&(A(!0),C(a("settings.requiresRestart")))}).catch(Q=>{C(Q instanceof Error?Q.message:String(Q))}).finally(()=>x(null))},[f,O,m,a]),J=g.useCallback(()=>{if(!E)return;const B=c.find(Q=>Q.key===E.key);if(!B){M(null);return}let k=E.draft;if(B.type==="number"){const Q=E.draft.trim();if(Q===""||!Number.isFinite(Number(Q))){C(a("settings.invalidNumber"));return}k=Number(Q)}M(null),V(B.key,k)},[E,c,V,a]),ee=R.find(B=>B.id===w)??R[0],N=(B,k,Q,ce=!1)=>h.jsx("select",{className:Jt.select,value:B,disabled:ce,onChange:pe=>k(pe.target.value),children:Q.map(pe=>h.jsx("option",{value:pe.value,children:pe.label},pe.value))}),G=B=>{var be;const k=bP(B,p),Q=v===B.key,ce=(E==null?void 0:E.key)===B.key;if(p!=="workspace")return h.jsx("button",{type:"button",className:Jt.actionButton,disabled:!0,title:a("settings.readOnly"),children:Mv(B,p,a)||a("settings.readOnly")});if(B.key===ou)return N(P??Rs.Dark,ye=>{const ie=ye;r(ie),V(ou,wW(ie))},XN.map(ye=>({value:ye,label:a(`theme.${ye}`)})),Q);if(B.key===m0)return N(q??"zh-CN",ye=>t(ye),rW.map(ye=>({value:ye,label:f5(ye)})),Q);if(P6e.has(B.key))return h.jsx("button",{type:"button",className:Jt.actionButton,onClick:()=>n(B.key),children:Mv(B,p,a)||a("settings.action.edit")});if(B.type==="boolean"){const ye=k===!0;return h.jsx("button",{type:"button",className:`${Jt.switch} ${ye?Jt.switchOn:""}`,disabled:Q,onClick:()=>V(B.key,!ye),"aria-pressed":ye,children:h.jsx("span",{className:Jt.switchKnob})})}if(B.type==="enum"&&((be=B.options)!=null&&be.length)){const ye=B.options.findIndex(ie=>ie.value===k);return N(ye>=0?String(ye):"",ie=>{var oe;const re=(oe=B.options)==null?void 0:oe[Number(ie)];re&&V(B.key,re.value)},B.options.map((ie,re)=>({value:String(re),label:gP(B,ie.value,ie.label,a)})),Q)}return ce?h.jsxs("div",{className:Jt.editor,children:[h.jsx("input",{ref:D,className:Jt.editInput,type:B.type==="number"?"number":"text",value:E.draft,onChange:ye=>M({key:E.key,draft:ye.target.value}),onKeyDown:ye=>{ye.key==="Enter"&&(ye.preventDefault(),J()),ye.key==="Escape"&&(ye.preventDefault(),M(null))}}),h.jsx("button",{type:"button",className:Jt.actionButton,onClick:J,children:a("settings.action.save")})]}):h.jsx("button",{type:"button",className:Jt.actionButton,disabled:Q,onClick:()=>M({key:B.key,draft:String(k??"")}),children:Mv(B,p,a)||a("settings.action.edit")})};return h.jsxs("div",{className:`${Jt.panel} ${o?Jt.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!o&&h.jsxs("div",{className:Jt.header,children:[h.jsx("span",{className:Jt.title,children:a("settings.title")}),h.jsx("span",{className:Jt.secondary,children:a("settings.scope.workspace")})]}),(S||j)&&h.jsx("div",{className:Jt.hint,children:S||a("settings.loading")}),h.jsxs("div",{className:Jt.scopeTabs,role:"tablist",children:[h.jsx("button",{type:"button",role:"tab","aria-selected":p==="workspace",className:`${Jt.scopeTab} ${p==="workspace"?Jt.scopeTabActive:""}`,onClick:()=>y("workspace"),children:a("settings.scope.workspace")}),h.jsx("button",{type:"button",role:"tab","aria-selected":p==="user",className:`${Jt.scopeTab} ${p==="user"?Jt.scopeTabActive:""}`,onClick:()=>{M(null),y("user")},children:a("settings.scope.user")})]}),h.jsxs("div",{className:Jt.settingsPage,children:[h.jsx("nav",{className:Jt.sidebar,"aria-label":a("settings.title"),children:R.map(B=>h.jsxs("button",{type:"button",className:`${Jt.categoryButton} ${B.id===w?Jt.categoryButtonActive:""}`,onClick:()=>b(B.id),children:[h.jsx("span",{children:B.label}),h.jsx("span",{className:Jt.categoryCount,children:B.items.length})]},B.id))}),h.jsxs("section",{className:Jt.content,children:[!u&&!ee&&h.jsx("div",{className:Jt.empty,children:a("settings.empty")}),ee==null?void 0:ee.items.map(B=>{if(B.type==="local")return h.jsxs("div",{className:Jt.card,children:[h.jsxs("div",{className:Jt.cardBody,children:[h.jsx("div",{className:Jt.cardTitle,children:a("settings.label.ui.chatWidth")}),h.jsx("div",{className:Jt.cardDescription,children:a("settings.description.ui.chatWidth")})]}),h.jsx("div",{className:Jt.cardControl,children:N(s,be=>i(be),[{value:"1000",label:a("settings.option.ui.chatWidth.1000")},{value:"wide",label:a("settings.option.ui.chatWidth.wide")}])})]},B.localKey);const k=B.setting,Q=U6e(k,a),ce=q6e(k,p),pe=yP(k,p);return h.jsxs("div",{className:Jt.card,children:[h.jsxs("div",{className:Jt.cardBody,children:[h.jsxs("div",{className:Jt.cardTitle,children:[F6e(k,a),pe&&h.jsx("span",{className:Jt.scopeBadge,children:a(p==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),Q&&h.jsx("div",{className:Jt.cardDescription,children:Q}),ce&&h.jsx("div",{className:Jt.scopeHint,children:a(ce,{scope:a(p==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),h.jsx("div",{className:Jt.cardControl,children:v===k.key?h.jsx("span",{className:Jt.busy,children:"..."}):G(k)})]},k.key)})]})]}),!o&&h.jsx("div",{className:Jt.footer,children:a(E?"settings.footer.edit":"settings.footer")})]})}const W6e="_approval_j86la_1",G6e="_floating_j86la_18",K6e="_header_j86la_31",Y6e="_icon_j86la_41",X6e="_name_j86la_56",Q6e="_desc_j86la_67",J6e="_content_j86la_87",Z6e="_code_j86la_105",e8e="_codeBlock_j86la_113",t8e="_question_j86la_133",n8e="_options_j86la_139",r8e="_option_j86la_139",s8e="_optionPlain_j86la_167",i8e="_optionSecondary_j86la_177",o8e="_optionPrimary_j86la_184",a8e="_optionActive_j86la_195",l8e="_pointer_j86la_199",c8e="_num_j86la_203",u8e="_label_j86la_207",Mr={approval:W6e,floating:G6e,header:K6e,icon:Y6e,name:X6e,desc:Q6e,content:J6e,code:Z6e,codeBlock:e8e,question:t8e,options:n8e,option:r8e,optionPlain:s8e,optionSecondary:i8e,optionPrimary:o8e,optionActive:a8e,pointer:l8e,num:c8e,label:u8e};function d8e(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 h8e(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function f8e(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 m8e(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 p8e(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function DA(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 OA(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 dg(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=OA(t.option)-OA(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function g8e(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 y8e(e){return e.kind==="allow_once"?Mr.optionPrimary:e.kind==="allow_always"?Mr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?Mr.optionPlain:Mr.optionSecondary}function b8e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=ht(),s=g.useMemo(()=>dg(e.options),[e.options]),[i,o]=g.useState(()=>DA(dg(e.options))),a=g.useRef(e);a.current=e;const l=g.useRef(i),c=g.useRef(!1),u=g.useRef(!1);g.useEffect(()=>{const C=DA(dg(a.current.options));c.current=!1,u.current=!1,l.current=C,o(C)},[e.id]);const d=d8e(e.title),f=e.toolName||d.toolName||e.kind||"Tool",m=vl(f,r),p=p8e(e),y=h8e(e),w=g.useCallback(C=>{c.current||(c.current=!0,t(a.current.id,C))},[t]),b=g.useCallback(C=>{if(C.defaultPrevented||Z0(C.target))return;const E=a.current,M=dg(E.options),D=M.length;if(C.key==="ArrowUp"||C.key==="k")C.preventDefault(),u.current=!0,o(O=>{const A=(O-1+D)%D;return l.current=A,A});else if(C.key==="ArrowDown"||C.key==="j")C.preventDefault(),u.current=!0,o(O=>{const A=(O+1)%D;return l.current=A,A});else if(C.key==="Enter"){if(C.preventDefault(),!u.current){u.current=!0;return}const O=M[l.current];O&&w(O.id)}else if(C.key==="Escape"){C.preventDefault();const O=E.options.find(A=>A.kind==="reject_once"||A.kind==="reject_always");O&&w(O.id)}else if(C.key>="1"&&C.key<="9"){const O=parseInt(C.key)-1;O<D&&(C.preventDefault(),u.current=!0,w(M[O].id))}},[w]);g.useEffect(()=>{const C=setTimeout(()=>{window.addEventListener("keydown",b)},250);return()=>{clearTimeout(C),window.removeEventListener("keydown",b)}},[b]);const v=f8e(e),x=TU(e.toolName),S=m8e(e);return h.jsxs("div",{className:n==="floating"?`${Mr.approval} ${Mr.floating}`:Mr.approval,children:[h.jsxs("div",{className:Mr.header,children:[h.jsx("span",{className:Mr.icon,children:"?"}),h.jsx("span",{className:Mr.name,children:m})]}),p&&h.jsx("div",{className:Mr.desc,title:p,children:p}),v&&S?h.jsx("div",{className:Mr.code,children:h.jsx("pre",{className:Mr.codeBlock,title:S,children:S})}):y&&y!==e.title?h.jsx("pre",{className:Mr.content,title:y,children:y}):null,h.jsx("div",{className:Mr.question,children:x?r("approval.launchAgentQuestion"):v?r("approval.execQuestion",{tool:m}):r("approval.changeQuestion")}),h.jsx("div",{className:Mr.options,children:s.map((C,E)=>{const M=E===i,D=g8e(C),O=D?r(D):C.label;return h.jsxs("div",{className:`${Mr.option} ${y8e(C)} ${M?Mr.optionActive:""}`,onClick:()=>w(C.id),children:[h.jsx("span",{className:Mr.pointer,children:M?"›":" "}),h.jsxs("span",{className:Mr.num,children:[E+1,"."]}),h.jsx("span",{className:Mr.label,children:O})]},C.id)})})]})}const v8e="_question_1e2wi_1",w8e="_floating_1e2wi_18",x8e="_titleLine_1e2wi_30",_8e="_icon_1e2wi_39",k8e="_toolName_1e2wi_43",S8e="_toolDesc_1e2wi_47",T8e="_tabs_1e2wi_54",C8e="_tab_1e2wi_54",A8e="_tabActive_1e2wi_78",E8e="_text_1e2wi_95",M8e="_description_1e2wi_104",I8e="_multiHint_1e2wi_112",N8e="_options_1e2wi_118",R8e="_option_1e2wi_118",L8e="_optionActive_1e2wi_140",j8e="_optionSelected_1e2wi_141",D8e="_optionLabel_1e2wi_146",O8e="_pointer_1e2wi_151",B8e="_optionNum_1e2wi_155",P8e="_editIcon_1e2wi_172",$8e="_optionContent_1e2wi_204",z8e="_optionPlaceholder_1e2wi_220",F8e="_optionDesc_1e2wi_225",U8e="_customInput_1e2wi_232",q8e="_actions_1e2wi_249",H8e="_button_1e2wi_257",V8e="_submitButton_1e2wi_283",W8e="_ignoreButton_1e2wi_289",bn={question:v8e,floating:w8e,titleLine:x8e,icon:_8e,toolName:k8e,toolDesc:S8e,tabs:T8e,tab:C8e,tabActive:A8e,text:E8e,description:M8e,multiHint:I8e,options:N8e,option:R8e,optionActive:L8e,optionSelected:j8e,optionLabel:D8e,pointer:O8e,optionNum:B8e,editIcon:P8e,optionContent:$8e,optionPlaceholder:z8e,optionDesc:F8e,customInput:U8e,actions:q8e,button:H8e,submitButton:V8e,ignoreButton:W8e};function G8e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=ht(),s=g.useMemo(()=>{var R;return Array.isArray((R=e.rawInput)==null?void 0:R.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState({}),[d,f]=g.useState({}),[m,p]=g.useState({}),[y,w]=g.useState(!1),b=g.useRef(!1);g.useEffect(()=>{const R=s[0];b.current=!1,o(0),l(R!=null&&R.options.length?0:null),u(R&&!R.multiSelect&&R.options[0]?{0:R.options[0].label}:{}),f({}),p(R!=null&&R.multiSelect&&R.options[0]?{0:[R.options[0].label]}:{}),w(!1)},[s,e.id]);const v=s[i],x=(v==null?void 0:v.multiSelect)??!1,S=g.useCallback(()=>{const R={};for(let V=0;V<s.length;V++){const J=s[V];if(J)if(J.multiSelect){const ee=m[V]||[],N=d[V],G=N?[...ee,N]:ee;R[String(V)]=G.join(", ")}else R[String(V)]=c[V]||d[V]||""}return R},[s,m,d,c]),C=g.useCallback(()=>{if(b.current)return;const R=e.options.find(V=>V.kind==="allow_once");R&&(b.current=!0,t(e.id,R.id,S()))},[S,e,t]),E=g.useCallback(()=>{if(b.current)return;const R=e.options.find(V=>V.kind==="reject_once"||V.kind==="reject_always");R&&(b.current=!0,t(e.id,R.id,void 0))},[e,t]),M=g.useCallback(R=>{R!==void 0&&f(V=>({...V,[i]:R})),x||u(V=>{if(!(i in V))return V;const J={...V};return delete J[i],J}),w(!0)},[i,x]),D=g.useCallback(R=>{if(!v)return;if(R===v.options.length){M();return}const J=v.options[R].label;if(x){const ee=m[i]||[],N=ee.includes(J)?ee.filter(G=>G!==J):[...ee,J];p({...m,[i]:N})}else{const ee={...c,[i]:J};u(ee),f(N=>{if(!(i in N))return N;const G={...N};return delete G[i],G})}},[v,i,x,m,c,M]),O=g.useCallback(R=>{if(!v||!x)return;if(R===v.options.length){M();return}const V=v.options[R].label,J=m[i]||[],ee=J.includes(V)?J.filter(N=>N!==V):[...J,V];p({...m,[i]:ee})},[v,x,m,i,M]);if(s.length===0)return null;const A=R=>{const V=s[R];return V?V.multiSelect?(m[R]||[]).length>0||!!d[R]:!!c[R]||!!d[R]:!1},j=s.every((R,V)=>A(V)),I=Math.min(i,s.length-1),P=R=>{const V=s[R];if(o(R),w(!1),!(V!=null&&V.options.length)){l(null);return}if(l(0),V.multiSelect){p(J=>(J[R]||[]).length>0||d[R]?J:{...J,[R]:[V.options[0].label]});return}u(J=>J[R]||d[R]?J:{...J,[R]:V.options[0].label})},F=()=>{i<=0||P(i-1)},q=()=>{i>=s.length-1||P(i+1)};return h.jsxs("div",{className:`${bn.question} ${n==="floating"?bn.floating:""}`,children:[h.jsxs("div",{className:bn.titleLine,children:[h.jsx("span",{className:bn.icon,children:"?"}),h.jsx("span",{className:bn.toolName,children:vl("ask_user_question",r)}),h.jsx("span",{className:bn.toolDesc,children:r("askUser.progress",{current:I+1,total:s.length})})]}),h.jsx("div",{className:bn.tabs,children:s.map((R,V)=>h.jsx("span",{className:`${bn.tab} ${V===i?bn.tabActive:""}`,"aria-hidden":"true"},V))}),v?h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:bn.text,children:[v.question,x&&h.jsxs("span",{className:bn.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),h.jsx("p",{className:bn.description,children:r("askUser.selectAnswer")}),h.jsxs("div",{className:bn.options,onMouseLeave:()=>l(null),children:[v.options.map((R,V)=>{const J=V===a,ee=x?(m[i]||[]).includes(R.label):c[i]===R.label;return h.jsxs("div",{className:`${bn.option} ${J?bn.optionActive:""} ${ee?bn.optionSelected:""}`,onClick:()=>{l(V),x?O(V):D(V)},onMouseEnter:()=>l(V),children:[h.jsx("span",{className:bn.pointer,children:J?"›":" "}),h.jsx("span",{className:bn.optionNum,children:V+1}),h.jsxs("span",{className:bn.optionContent,children:[h.jsx("span",{className:bn.optionLabel,children:R.label}),R.description&&h.jsx("span",{className:bn.optionDesc,children:R.description})]})]},R.label)}),(()=>{const R=a===v.options.length,V=!!d[i];return h.jsxs("div",{className:`${bn.option} ${R?bn.optionActive:""} ${V?bn.optionSelected:""}`,onClick:()=>{l(v.options.length),M()},onMouseEnter:()=>l(v.options.length),children:[h.jsx("span",{className:bn.pointer,children:R?"›":" "}),h.jsx("span",{className:bn.editIcon,"aria-hidden":"true",children:h.jsx("svg",{viewBox:"0 0 16 16",children:h.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?h.jsx("input",{type:"text",className:bn.customInput,placeholder:r("askUser.typePlaceholder"),value:d[i]||"",onChange:J=>f({...d,[i]:J.target.value}),onBlur:()=>w(!1),autoFocus:!0}):h.jsx("span",{className:`${bn.optionLabel} ${d[i]?"":bn.optionPlaceholder}`,children:d[i]||r("askUser.typePlaceholder")})]})})()]})]}):null,h.jsxs("div",{className:bn.actions,children:[h.jsx("button",{type:"button",className:bn.ignoreButton,onClick:E,children:r("askUser.ignore")}),s.length>1&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:bn.button,disabled:i<=0,onClick:F,children:r("common.previous")}),h.jsx("button",{type:"button",className:bn.button,disabled:i>=s.length-1,onClick:q,children:r("common.next")})]}),h.jsx("button",{type:"button",className:`${bn.button} ${bn.submitButton}`,disabled:!j,onClick:C,children:r("askUser.submit")})]})]})}const K8e="_dialog_1ymqd_1",Y8e="_toolbar_1ymqd_12",X8e="_tabs_1ymqd_21",Q8e="_tab_1ymqd_21",J8e="_tabActive_1ymqd_39",Z8e="_search_1ymqd_48",eSe="_general_1ymqd_60",tSe="_shortcuts_1ymqd_67",nSe="_shortcut_1ymqd_67",rSe="_shortcutKey_1ymqd_87",sSe="_shortcutDesc_1ymqd_95",iSe="_commandList_1ymqd_101",oSe="_commandCard_1ymqd_108",aSe="_commandCardExpanded_1ymqd_115",lSe="_commandRow_1ymqd_119",cSe="_commandName_1ymqd_135",uSe="_commandTag_1ymqd_142",dSe="_chevron_1ymqd_152",hSe="_chevronExpanded_1ymqd_160",fSe="_commandDetail_1ymqd_164",mSe="_commandDescription_1ymqd_174",pSe="_commandSubcommands_1ymqd_175",gSe="_empty_1ymqd_182",xr={dialog:K8e,toolbar:Y8e,tabs:X8e,tab:Q8e,tabActive:J8e,search:Z8e,general:eSe,shortcuts:tSe,shortcut:nSe,shortcutKey:rSe,shortcutDesc:sSe,commandList:iSe,commandCard:oSe,commandCardExpanded:aSe,commandRow:lSe,commandName:cSe,commandTag:uSe,chevron:dSe,chevronExpanded:hSe,commandDetail:fSe,commandDescription:mSe,commandSubcommands:pSe,empty:gSe},ySe=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],bSe=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"]),vSe=[["@","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 wSe(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function U3(e){return!bSe.has(e.name)}function xSe(e,t){return U3(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function _Se(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!U3(s):t==="custom-commands"?U3(s):!0).filter(s=>r?s.name.toLowerCase().includes(r)||(s.description??"").toLowerCase().includes(r)||(s.argumentHint??"").toLowerCase().includes(r):!0).sort((s,i)=>s.name.localeCompare(i.name))}function kSe(){const{t:e}=ht();return h.jsx("div",{className:xr.general,children:h.jsx("div",{className:xr.shortcuts,children:vSe.map(([t,n])=>h.jsxs("div",{className:xr.shortcut,children:[h.jsx("span",{className:xr.shortcutDesc,children:e(n)}),h.jsx("span",{className:xr.shortcutKey,children:t})]},t))})})}function SSe({commands:e,tab:t,query:n}){const{t:r}=ht(),[s,i]=g.useState(null),o=g.useMemo(()=>_Se(e,t,n),[e,n,t]);return o.length===0?h.jsx("div",{className:xr.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):h.jsx("div",{className:xr.commandList,children:o.map(a=>{var c;const l=s===a.name;return h.jsxs("article",{className:`${xr.commandCard} ${l?xr.commandCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:xr.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[h.jsx("span",{className:xr.commandName,children:wSe(a)}),h.jsx("span",{className:xr.commandTag,children:xSe(a,r)}),h.jsx("svg",{className:`${xr.chevron} ${l?xr.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l&&h.jsxs("div",{className:xr.commandDetail,children:[a.description&&h.jsx("div",{className:xr.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&h.jsxs("div",{className:xr.commandSubcommands,children:[r("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function TSe({commands:e}){const{t}=ht(),[n,r]=g.useState("general"),{filterValue:s,inputProps:i}=Bb(),o=n!=="general";return h.jsxs("div",{className:xr.dialog,children:[h.jsxs("div",{className:xr.toolbar,children:[h.jsx("div",{className:xr.tabs,children:ySe.map(a=>h.jsx("button",{type:"button",className:`${xr.tab} ${a.id===n?xr.tabActive:""}`,onClick:()=>r(a.id),children:t(a.labelKey)},a.id))}),o&&h.jsx("input",{className:xr.search,...i,placeholder:t("help.search")})]}),n==="general"?h.jsx(kSe,{}):h.jsx(SSe,{commands:e,tab:n,query:s})]})}function CSe({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=ht(),s=XN.map(u=>({id:u,label:r(`theme.${u}`),description:r(`theme.${u}.desc`)})),[i,o]=g.useState(()=>{const u=s.findIndex(d=>d.id===e);return u>=0?u:0}),a=g.useRef(null),l=u=>{const d=s[u];d&&(t(d.id),n())},{keyboardMode:c}=Bc({itemCount:s.length,activeIndex:i,onActiveIndexChange:o,onConfirm:l});return g.useEffect(()=>{var d;const u=(d=a.current)==null?void 0:d.children[i];u==null||u.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:Me("picker-list","picker-list-compact",c?"picker-keyboard-only":void 0),ref:a,role:"listbox","aria-label":r("theme.title"),tabIndex:0,"aria-activedescendant":s.length>0?`theme-opt-${i}`:void 0,children:s.map((u,d)=>{const f=u.id===e;return h.jsxs("div",{id:`theme-opt-${d}`,role:"option","aria-selected":f,className:Me("picker-item","picker-session-item",d===i?"selected":void 0,f?"dialog-current":void 0),onClick:()=>l(d),onMouseMove:()=>o(d),children:[h.jsx("div",{className:Me("picker-item-row"),children:h.jsx("span",{className:Me("picker-item-title"),children:u.label})}),h.jsx("div",{className:Me("picker-item-meta"),children:u.description})]},u.id)})})}const q3="delete-session-list",BA=e=>`${q3}-opt-${e}`;function ASe({onDeleted:e,onError:t,onClose:n}){const{t:r}=ht(),s=ml(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=Yy({autoLoad:!0}),u=s.sessionId,[d,f]=g.useState(!1),[m,p]=g.useState(-1),[y,w]=g.useState(new Set),{filterValue:b,inputProps:v}=Bb(()=>{p(-1),w(new Set)}),[x,S]=g.useState(null),C=g.useRef(null),E=g.useRef(null);g.useEffect(()=>{a&&S(a.message)},[a]);const M=g.useMemo(()=>b?i.filter(P=>{const F=b.toLowerCase();return(P.displayName||"").toLowerCase().includes(F)||P.sessionId.toLowerCase().includes(F)}):i,[i,b]),D=g.useCallback(P=>{P!==u&&w(F=>{const q=new Set(F);return q.has(P)?q.delete(P):q.add(P),q})},[u]);g.useEffect(()=>{if(y.size===0)return;const P=new Set(M.map(F=>F.sessionId));w(F=>{const q=new Set([...F].filter(R=>P.has(R)));return q.size===F.size?F:q})},[M,y.size]),g.useEffect(()=>{m>=M.length&&M.length>0&&p(M.length-1)},[M.length,m]),g.useEffect(()=>{var F;const P=(F=C.current)==null?void 0:F.children[m];P==null||P.scrollIntoView({block:"nearest"})},[m]),g.useEffect(()=>{var P;(P=E.current)==null||P.focus()},[]);const{keyboardMode:O}=Bc({itemCount:M.length,activeIndex:m,onActiveIndexChange:p,onConfirm:P=>{const F=M[P];F&&D(F.sessionId)}}),A=g.useCallback(()=>{if(d)return;if(y.size>0){const F=new Set(M.map(R=>R.sessionId)),q=Array.from(y).filter(R=>F.has(R));if(q.length===0)return;f(!0),c(q).then(R=>{const V=R.removed.length+R.notFound.length,J=R.errors.length;if(J>0&&V>0){t(new Error(r("delete.partialFail",{removed:V,failed:J,detail:R.errors[0].error}))),n();return}if(J>0){S(r("delete.allFailed",{count:J,reason:R.errors[0].error})),f(!1),w(new Set);return}if(V===0){S(r("delete.nonRemoved")),f(!1),w(new Set);return}e([...R.removed,...R.notFound]),n()}).catch(R=>{t(R),f(!1)});return}const P=M[m];if(P){if(P.sessionId===u){S(r("delete.cannotCurrent"));return}f(!0),l(P.sessionId).then(F=>{if(!F){S(r("delete.notFound")),f(!1);return}e([P.sessionId]),n()}).catch(F=>{t(F),f(!1)})}},[u,l,c,d,M,n,e,t,m,y,r]),j=y.size>0,I=!d&&!o&&j;return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search"),children:[h.jsxs("span",{className:Me("picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:E,className:Me("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":q3,"aria-activedescendant":m>=0&&m<M.length?BA(m):void 0,...v,placeholder:""}),h.jsx("span",{className:Me("picker-search-hint"),children:x||(d?r("delete.deleting"):o?r("common.loading"):j?r("delete.selected",{count:y.size}):b?r("delete.matches",{count:M.length}):"")})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:q3,role:"listbox","aria-multiselectable":"true",className:Me("picker-list",O?"picker-keyboard-only":void 0),ref:C,children:[o&&h.jsx("div",{className:Me("picker-empty"),children:r("common.loading")}),!o&&a&&h.jsx("div",{className:Me("picker-empty"),children:a.message}),!o&&!a&&M.length===0&&h.jsx("div",{className:Me("picker-empty"),children:b?r("delete.noMatch",{query:b}):r("delete.none")}),!o&&M.map((P,F)=>{const q=P.sessionId===u,R=y.has(P.sessionId);return h.jsx(n6,{session:P,optionId:BA(F),active:F===m,ariaSelected:R,current:!1,disabled:q,leading:h.jsx("span",{className:Me("picker-item-checkbox",R?"picker-item-checkbox-checked":void 0),children:R?"[x] ":"[ ] "}),trailing:q?h.jsx("span",{className:Me("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{p(F),q||D(P.sessionId)},onActivate:()=>p(F)},P.sessionId)})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{className:Me("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:n,disabled:d,children:r("common.cancel")}),h.jsx("button",{type:"button",className:Me("dialog-danger-button"),onClick:A,disabled:!I,children:r(d?"delete.deleting":"delete.action")})]})]})}const H3="release-session-list",PA=e=>`${H3}-opt-${e}`;function ESe({onReleased:e,onError:t,onClose:n}){const{t:r}=ht(),s=ml(),{sessions:i,loading:o,error:a,releaseSession:l}=Yy({autoLoad:!0}),c=s.sessionId,[u,d]=g.useState(!1),[f,m]=g.useState(-1),[p,y]=g.useState(null),{filterValue:w,inputProps:b}=Bb(()=>{m(-1),y(null)}),[v,x]=g.useState(null),S=g.useRef(null),C=g.useRef(null);g.useEffect(()=>{a&&x(a.message)},[a]);const E=w?i.filter(P=>{const F=w.toLowerCase();return(P.displayName||"").toLowerCase().includes(F)||P.sessionId.toLowerCase().includes(F)}):i,M=P=>{const F=E[P];if(!F)return;const q=F.sessionId===c,R=(F.clientCount??0)>0||F.hasActivePrompt===!0;q||!R||(m(P),y(F.sessionId))};g.useEffect(()=>{f>=E.length&&E.length>0&&m(E.length-1)},[E.length,f]),g.useEffect(()=>{var F;const P=(F=S.current)==null?void 0:F.children[f];P==null||P.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var P;(P=C.current)==null||P.focus()},[]);const{keyboardMode:D}=Bc({itemCount:E.length,activeIndex:f,onActiveIndexChange:m,onConfirm:M}),O=g.useCallback(P=>{const F=P??E.find(R=>R.sessionId===p)??void 0;if(!F||u)return;if(!((F.clientCount??0)>0||F.hasActivePrompt===!0)){x(r("release.inactive"));return}if(F.sessionId===c){x(r("release.cannotCurrent"));return}l&&(d(!0),l(F.sessionId).then(()=>{e(F.sessionId),n()}).catch(R=>{t(R),d(!1)}))},[c,u,E,n,t,e,l,p,r]),A=E.find(P=>P.sessionId===p)??void 0,j=A&&((A.clientCount??0)>0||A.hasActivePrompt===!0),I=!u&&!o&&!!A&&A.sessionId!==c&&!!j;return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search"),children:[h.jsxs("span",{className:Me("picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:C,className:Me("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":H3,"aria-activedescendant":f>=0&&f<E.length?PA(f):void 0,...b,placeholder:""}),h.jsx("span",{className:Me("picker-search-hint"),children:v||(u?r("release.releasing"):o?r("common.loading"):w?r("release.matches",{count:E.length}):"")})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:H3,role:"listbox",className:Me("picker-list",D?"picker-keyboard-only":void 0),ref:S,children:[o&&h.jsx("div",{className:Me("picker-empty"),children:r("common.loading")}),!o&&E.length===0&&h.jsx("div",{className:Me("picker-empty"),children:w?r("release.noMatch",{query:w}):r("release.none")}),!o&&E.map((P,F)=>{const q=P.sessionId===c,R=(P.clientCount??0)>0||P.hasActivePrompt===!0,V=q||!R;return h.jsx(n6,{session:P,optionId:PA(F),active:F===f,confirmed:P.sessionId===p,ariaSelected:P.sessionId===p,current:!1,disabled:V,trailing:q?h.jsx("span",{className:Me("picker-item-badge"),children:r("resume.current")}):R?void 0:h.jsx("span",{className:Me("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>M(F),onActivate:()=>m(F)},P.sessionId)})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{className:Me("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:n,disabled:u,children:r("common.cancel")}),h.jsx("button",{type:"button",className:Me("dialog-danger-button"),onClick:()=>O(),disabled:!I,children:r(u?"release.releasing":"release.action")})]})]})}const MSe="_root_ieg2d_1",ISe="_list_ieg2d_8",NSe="_item_ieg2d_21",RSe="_itemCursor_ieg2d_42",LSe="_itemSelected_ieg2d_49",jSe="_prompt_ieg2d_61",DSe="_keyboardOnly_ieg2d_68",OSe="_itemDisabled_ieg2d_77",BSe="_turn_ieg2d_91",PSe="_time_ieg2d_96",$Se="_footer_ieg2d_102",zSe="_footerMessage_ieg2d_112",FSe="_dangerButton_ieg2d_118",Ci={root:MSe,list:ISe,item:NSe,itemCursor:RSe,itemSelected:LSe,prompt:jSe,keyboardOnly:DSe,itemDisabled:OSe,turn:BSe,time:PSe,footer:$Se,footerMessage:zSe,dangerButton:FSe},USe="rewind-snapshot-list",$A=e=>`${USe}-opt-${e}`;function qSe(e,t){let n=0;for(const r of e)if(r.kind==="user"){if(n===t)return r.text.trim();n+=1}return""}function HSe(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function VSe({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=ht(),[o,a]=g.useState([]),[l,c]=g.useState(!0),[u,d]=g.useState(null),[f,m]=g.useState(0),[p,y]=g.useState(null),[w,b]=g.useState(null);g.useEffect(()=>{let D=!0;return c(!0),t().then(O=>{D&&a(O.snapshots)}).catch(O=>{D&&r(O)}).finally(()=>{D&&c(!1)}),()=>{D=!1}},[t,r]);const v=g.useMemo(()=>o.map(D=>({snapshot:D,promptText:qSe(e,D.turnIndex)})).sort((D,O)=>D.snapshot.turnIndex-O.snapshot.turnIndex),[e,o]);g.useEffect(()=>{f>=v.length&&v.length>0&&m(v.length-1)},[v.length,f]);const x=g.useRef(null),S=u!==null,C=D=>{!D||u||(d(D),b(null),n(D).then(()=>{s()}).catch(O=>{r(O),b(i("rewind.failed",{reason:O instanceof Error?O.message:String(O)})),d(null)}))},E=D=>{const O=v[D];O&&(m(D),y(O.snapshot.promptId))},{keyboardMode:M}=Bc({itemCount:v.length,activeIndex:f,onActiveIndexChange:m,onConfirm:E,enabled:!S});return g.useEffect(()=>{var O;const D=(O=x.current)==null?void 0:O.children[f];D==null||D.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var O;if(l||v.length===0)return;const D=document.activeElement;(D==null?void 0:D.getAttribute("role"))==="dialog"&&((O=x.current)==null||O.focus())},[l,v.length]),l?h.jsx("div",{className:Me("picker-empty"),children:i("rewind.loading")}):v.length===0?h.jsx("div",{className:Me("picker-empty"),children:i("rewind.empty")}):h.jsxs("div",{className:Ci.root,children:[h.jsx("div",{className:`${Ci.list} ${M?Ci.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":v.length>0?$A(f):void 0,children:v.map(({snapshot:D,promptText:O},A)=>{const j=A===f,I=p===D.promptId,P=O||i("rewind.promptFallback",{id:D.promptId.slice(-8)});return h.jsxs("div",{id:$A(A),role:"option","aria-selected":I,"aria-disabled":S||void 0,className:`${Ci.item} ${j?Ci.itemCursor:""} ${I?Ci.itemSelected:""} ${S?Ci.itemDisabled:""}`,onClick:()=>{S||E(A)},onMouseMove:()=>m(A),children:[h.jsxs("div",{className:Ci.prompt,title:P,children:[h.jsxs("span",{className:Ci.turn,children:["#",D.turnIndex+1]})," ",P]}),h.jsx("div",{className:Ci.time,children:HSe(D.timestamp)})]},D.promptId)})}),h.jsxs("div",{className:Ci.footer,children:[w&&h.jsx("span",{className:Ci.footerMessage,role:"alert",children:w}),h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:s,disabled:u!==null,children:i("common.cancel")}),h.jsx("button",{type:"button",className:`${Me("dialog-danger-button")} ${Ci.dangerButton}`,onClick:()=>C(p),disabled:!p||u!==null,children:i(u?"rewind.rewinding":"rewind.confirm")})]})]})}const WSe="_sidebar_1eb9z_1",GSe="_resizing_1eb9z_21",KSe="_collapsed_1eb9z_25",YSe="_newChatButton_1eb9z_31",XSe="_footerButton_1eb9z_32",QSe="_collapseButton_1eb9z_33",JSe="_projectRow_1eb9z_34",ZSe="_sessionRow_1eb9z_35",e7e="_retry_1eb9z_36",t7e="_projectIconButton_1eb9z_38",n7e="_sessionActionButton_1eb9z_39",r7e="_secondaryButton_1eb9z_40",s7e="_dangerButton_1eb9z_41",i7e="_navIcon_1eb9z_96",o7e="_settingsIcon_1eb9z_119",a7e="_projectFolderIcon_1eb9z_125",l7e="_body_1eb9z_129",c7e="_sectionTitle_1eb9z_138",u7e="_projectName_1eb9z_176",d7e="_sessionText_1eb9z_177",h7e="_sessionList_1eb9z_192",f7e="_currentSession_1eb9z_214",m7e="_busySession_1eb9z_219",p7e="_floatingTooltip_1eb9z_224",g7e="_tooltipContent_1eb9z_254",y7e="_tooltipTitle_1eb9z_260",b7e="_tooltipTags_1eb9z_267",v7e="_tooltipTag_1eb9z_267",w7e="_tooltipTagRunning_1eb9z_287",x7e="_tooltipTagNew_1eb9z_292",_7e="_tooltipMeta_1eb9z_297",k7e="_sessionStatusSlot_1eb9z_312",S7e="_sessionStatusDot_1eb9z_322",T7e="_sessionMetaSlot_1eb9z_332",C7e="_sessionTime_1eb9z_343",A7e="_sessionLoading_1eb9z_350",E7e="_runningSession_1eb9z_360",M7e="_sessionActions_1eb9z_369",I7e="_searchInput_1eb9z_461",N7e="_renameInput_1eb9z_475",R7e="_renameForm_1eb9z_486",L7e="_notice_1eb9z_502",j7e="_confirmContent_1eb9z_517",D7e="_confirmDescription_1eb9z_523",O7e="_confirmActions_1eb9z_530",B7e="_footer_1eb9z_32",P7e="_version_1eb9z_581",$7e="_resizeHandle_1eb9z_613",z7e="_mobileOpen_1eb9z_646",xt={sidebar:WSe,resizing:GSe,collapsed:KSe,newChatButton:YSe,footerButton:XSe,collapseButton:QSe,projectRow:JSe,sessionRow:ZSe,retry:e7e,projectIconButton:t7e,sessionActionButton:n7e,secondaryButton:r7e,dangerButton:s7e,navIcon:i7e,settingsIcon:o7e,projectFolderIcon:a7e,body:l7e,sectionTitle:c7e,projectName:u7e,sessionText:d7e,sessionList:h7e,currentSession:f7e,busySession:m7e,floatingTooltip:p7e,tooltipContent:g7e,tooltipTitle:y7e,tooltipTags:b7e,tooltipTag:v7e,tooltipTagRunning:w7e,tooltipTagNew:x7e,tooltipMeta:_7e,sessionStatusSlot:k7e,sessionStatusDot:S7e,sessionMetaSlot:T7e,sessionTime:C7e,sessionLoading:A7e,runningSession:E7e,sessionActions:M7e,searchInput:I7e,renameInput:N7e,renameForm:R7e,notice:L7e,confirmContent:j7e,confirmDescription:D7e,confirmActions:O7e,footer:B7e,version:P7e,resizeHandle:$7e,mobileOpen:z7e},vP="qwen-code-web-shell-sidebar-width",hg=260,F7e=220,U7e=420,q7e=1e3,H7e=2e3,V7e=3e4;function fg(...e){return e.filter(Boolean).join(" ")}function zA(e){return e instanceof DOMException&&e.name==="AbortError"}function W7e(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function jf(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function G7e(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function _y(e){return Math.min(U7e,Math.max(F7e,e))}function K7e(){if(typeof window>"u")return hg;try{const e=window.localStorage.getItem(vP),t=e?Number(e):hg;return Number.isFinite(t)?_y(t):hg}catch{return hg}}function Y7e(e){try{window.localStorage.setItem(vP,String(_y(e)))}catch{}}function X7e(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v14M5 12h14"})})}function Q7e({expanded:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsxs(h.Fragment,{children:[h.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"}),h.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"})]}):h.jsxs(h.Fragment,{children:[h.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"}),h.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 J7e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"m16.5 16.5 4 4"})]})}function Z7e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.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 e9e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("path",{d:"M4 20h5l10-10a3 3 0 0 0-5-5L4 15v5Z"}),h.jsx("path",{d:"M13.5 5.5 18.5 10.5"})]})}function t9e(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"})})}function n9e({collapsed:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsx("path",{d:"M9 6l6 6-6 6"}):h.jsx("path",{d:"M15 6l-6 6 6 6"})})}function r9e({expanded:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsx("path",{d:"m6 9 6 6 6-6"}):h.jsx("path",{d:"m9 6 6 6-6 6"})})}function s9e({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onNewSession:r,onLoadSession:s,onError:i,mobileOpen:o}){var lt;const{t:a}=ht(),l=ml(),c=Ky(),{sessions:u,loading:d,error:f,reload:m,deleteSession:p}=Yy({autoLoad:!0,pageSize:q7e}),[y,w]=g.useState(null),[b,v]=g.useState(""),[x,S]=g.useState(null),C=g.useRef(null),E=g.useRef(!1),[M,D]=g.useState(null),[O,A]=g.useState(K7e),[j,I]=g.useState(!0),[P,F]=g.useState(!1),[q,R]=g.useState(""),[V,J]=g.useState(!1),[ee,N]=g.useState(null),[G,B]=g.useState(()=>new Set),k=g.useRef(null),Q=g.useRef(null),ce=g.useRef(!1),pe=g.useRef(null),be=l.sessionId,ye=W7e(l.workspaceCwd)||a("sidebar.projectFallback"),ie=((lt=l.capabilities)==null?void 0:lt.qwenCodeVersion)||"",re=ie?/^\d/.test(ie)?`v${ie}`:ie:"",oe={"--web-shell-sidebar-width":`${O}px`},ve=g.useCallback(()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)},[]),qe=g.useCallback(()=>{ve(),k.current=window.setTimeout(()=>{N(null),k.current=null},240)},[ve]);g.useEffect(()=>()=>{var ae;ve(),(ae=pe.current)==null||ae.call(pe,!1)},[ve]),g.useEffect(()=>{I(!e),e&&(F(!1),R(""),N(null))},[e]);const We=g.useMemo(()=>u.some(ae=>ae.hasActivePrompt),[u]);g.useEffect(()=>{if(!j&&!We)return;const ae=We&&!f?H7e:V7e,ze=window.setInterval(()=>{document.hidden||ce.current||(ce.current=!0,m().finally(()=>{ce.current=!1}))},ae);return()=>window.clearInterval(ze)},[f,We,j,m]),g.useEffect(()=>{const ae=new Map(u.map(Je=>[Je.sessionId,!!Je.hasActivePrompt])),ze=Q.current;Q.current=ae,ze!==null&&B(Je=>{const Nt=new Set(Je);let Ut=!1;for(const[he,Y]of ze){const me=ae.get(he);Y&&me===!1&&he!==be&&!Nt.has(he)&&(Nt.add(he),Ut=!0)}for(const he of Nt)(he===be||!ae.has(he)||ae.get(he))&&(Nt.delete(he),Ut=!0);return Ut?Nt:Je})},[be,u]);const te=g.useCallback((ae,ze)=>{ve();const Je=ae.currentTarget.getBoundingClientRect();N({content:ze,top:Je.top+Je.height/2,left:Je.right+8})},[ve]),we=g.useCallback(ae=>{const ze=jf(ae),Je=ae.sessionId!==be&&G.has(ae.sessionId);return h.jsxs("div",{className:xt.tooltipContent,children:[h.jsx("div",{className:xt.tooltipTitle,children:ze}),h.jsxs("div",{className:xt.tooltipTags,children:[ae.hasActivePrompt&&h.jsx("span",{className:fg(xt.tooltipTag,xt.tooltipTagRunning),children:a("sidebar.running")}),Je&&h.jsx("span",{className:fg(xt.tooltipTag,xt.tooltipTagNew),children:a("sidebar.completedUnread")}),h.jsx("span",{className:xt.tooltipTag,children:a("sidebar.clients",{count:ae.clientCount??0})})]}),h.jsx("div",{className:xt.tooltipMeta,children:ae.sessionId})]})},[G,be,a]),Se=g.useCallback(()=>{C.current!==null||E.current||(E.current=!0,(async()=>{try{await r()&&m()}catch(ae){zA(ae)||i(ae,a("sidebar.newSessionFailed"))}finally{E.current=!1}})())},[i,r,m,a]),Ne=g.useCallback(ae=>{ae===be||ae===C.current||(B(ze=>{if(!ze.has(ae))return ze;const Je=new Set(ze);return Je.delete(ae),Je}),C.current=ae,S(ae),(async()=>{try{await s(ae)}catch(ze){zA(ze)||i(ze,a("sidebar.switchFailed"))}finally{C.current===ae&&(C.current=null),S(ze=>ze===ae?null:ze)}})())},[be,i,s,a]),Pt=g.useCallback(ae=>{w(ae.sessionId),v(jf(ae))},[]),at=g.useCallback(()=>{w(null),v("")},[]),vt=g.useCallback(()=>{const ae=b.trim();if(!ae||y!==be){at();return}const ze=y;C.current=ze,S(ze),c.renameSession(ae).then(()=>{at(),m()}).catch(Je=>{i(Je,a("sidebar.renameFailed")),at()}).finally(()=>{C.current===ze&&(C.current=null),S(Je=>Je===ze?null:Je)})},[c,at,be,b,y,i,m,a]),Tt=g.useCallback(ae=>{ae.sessionId!==be&&D(ae)},[be]),rt=g.useCallback(()=>{if(!M)return;const ae=M.sessionId;if(ae===be){D(null);return}D(null),C.current=ae,S(ae),p(ae).then(ze=>{ze||m()}).catch(ze=>i(ze,a("sidebar.deleteFailed"))).finally(()=>{C.current===ae&&(C.current=null),S(ze=>ze===ae?null:ze)})},[be,M,p,i,m,a]),tt=g.useCallback(ae=>{ae.sessionId===be&&Pt(ae)},[be,Pt]),Qe=g.useMemo(()=>{const ae=q.trim().toLowerCase(),ze=ae?u.filter(Nt=>jf(Nt).toLowerCase().includes(ae)||Nt.sessionId.toLowerCase().includes(ae)):u.slice(),Je=new Map(ze.map(Nt=>[Nt.sessionId,G7e(Nt)]));return ze.sort((Nt,Ut)=>(Je.get(Ut.sessionId)??0)-(Je.get(Nt.sessionId)??0))},[q,u]),ne=g.useCallback(ae=>{var Ke;if(e)return;ae.preventDefault(),(Ke=pe.current)==null||Ke.call(pe,!0),J(!0);const ze=ae.clientX,Je=O,Nt=document.body.style.cursor,Ut=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{ae.currentTarget.setPointerCapture(ae.pointerId)}catch{}const he=_t=>{const Et=_y(Je+_t.clientX-ze);A(Et)},Y=_t=>{document.body.style.cursor=Nt,document.body.style.userSelect=Ut,window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",me),window.removeEventListener("pointercancel",le),pe.current=null,_t&&J(!1)},me=_t=>{const Et=_y(Je+_t.clientX-ze);A(Et),Y7e(Et),Y(!0)},le=()=>{Y(!0)};pe.current=Y,window.addEventListener("pointermove",he),window.addEventListener("pointerup",me,{once:!0}),window.addEventListener("pointercancel",le,{once:!0})},[e,O]),se=M?jf(M):"",De=g.useMemo(()=>j?d&&u.length===0?h.jsx("div",{className:xt.notice,children:a("sidebar.loadingSessions")}):f&&u.length===0?h.jsx("button",{className:xt.retry,type:"button",onClick:m,children:a("sidebar.loadFailed")}):Qe.length===0?h.jsx("div",{className:xt.notice,children:a("sidebar.searchEmpty")}):Qe.map(ae=>{const ze=ae.sessionId===be,Je=y===ae.sessionId,Nt=jf(ae),Ut=ae.updatedAt||ae.createdAt,he=Ut?aP(Ut,a):"",Y=x===ae.sessionId,me=!ze&&G.has(ae.sessionId);return h.jsx("div",{className:fg(xt.sessionRow,ze&&xt.currentSession,ae.hasActivePrompt&&xt.runningSession,Y&&xt.busySession),role:"button",tabIndex:0,"aria-current":ze?"page":void 0,onMouseEnter:le=>te(le,we(ae)),onMouseLeave:qe,onFocus:le=>te(le,we(ae)),onBlur:qe,onClick:()=>Ne(ae.sessionId),onDoubleClick:()=>{ze&&!e&&Pt(ae)},onKeyDown:le=>{le.key==="Enter"&&Ne(ae.sessionId)},children:!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:xt.sessionStatusSlot,"aria-hidden":"true",children:me&&h.jsx("span",{className:xt.sessionStatusDot})}),Je?h.jsx("form",{className:xt.renameForm,onClick:le=>le.stopPropagation(),onSubmit:le=>{le.preventDefault(),vt()},children:h.jsx("input",{autoFocus:!0,className:xt.renameInput,value:b,onChange:le=>v(le.target.value),onBlur:at,onKeyDown:le=>{le.key==="Escape"&&(le.preventDefault(),at())}})}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:xt.sessionText,children:Nt}),h.jsxs("div",{className:xt.sessionMetaSlot,children:[ae.hasActivePrompt?h.jsx("span",{className:xt.sessionLoading,"aria-label":a("sidebar.running")}):h.jsx("span",{className:xt.sessionTime,children:he}),h.jsxs("div",{className:xt.sessionActions,onClick:le=>le.stopPropagation(),onKeyDown:le=>le.stopPropagation(),onMouseEnter:le=>{le.stopPropagation(),N(null)},children:[h.jsx("button",{className:xt.sessionActionButton,type:"button",disabled:!ze,title:a(ze?"sidebar.rename":"sidebar.renameCurrentOnly"),"aria-label":a("sidebar.rename"),onClick:()=>tt(ae),children:h.jsx(e9e,{})}),h.jsx("button",{className:xt.sessionActionButton,type:"button",disabled:ze,title:a(ze?"sidebar.currentDeleteDisabled":"sidebar.delete"),"aria-label":a("sidebar.delete"),onClick:()=>Tt(ae),children:h.jsx(t9e,{})})]})]})]})]})},ae.sessionId)}):null,[x,at,e,G,be,b,y,f,Qe,Tt,Ne,tt,qe,d,j,m,vt,we,u.length,te,Pt,a]);return h.jsxs("aside",{className:fg(xt.sidebar,e&&xt.collapsed,V&&xt.resizing,o&&xt.mobileOpen),"aria-label":a("sidebar.label"),style:oe,children:[ee&&h.jsx("div",{className:xt.floatingTooltip,role:"tooltip",style:{top:ee.top,left:ee.left},onMouseEnter:ve,onMouseLeave:qe,children:ee.content}),M&&h.jsx(ys,{title:a("delete.title"),size:"sm",onClose:()=>D(null),children:h.jsxs("div",{className:xt.confirmContent,children:[h.jsx("p",{className:xt.confirmDescription,children:a("sidebar.deleteConfirmDescription",{name:se})}),h.jsxs("div",{className:xt.confirmActions,children:[h.jsx("button",{className:xt.secondaryButton,type:"button",onClick:()=>D(null),children:a("common.cancel")}),h.jsx("button",{className:xt.dangerButton,type:"button",onClick:rt,children:a("sidebar.delete")})]})]})}),h.jsxs("button",{className:xt.newChatButton,type:"button",title:a("sidebar.newChat"),"aria-label":a("sidebar.newChat"),onClick:Se,children:[h.jsx("span",{className:xt.navIcon,children:h.jsx(X7e,{})}),!e&&h.jsx("span",{children:a("sidebar.newChat")})]}),h.jsxs("div",{className:xt.body,children:[!e&&h.jsx("div",{className:xt.sectionTitle,children:a("sidebar.project")}),h.jsxs("div",{className:xt.projectRow,role:"button",tabIndex:0,"aria-expanded":j,onClick:()=>{e||I(ae=>!ae)},onKeyDown:ae=>{e||(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),I(ze=>!ze))},onMouseEnter:ae=>te(ae,h.jsxs("div",{className:xt.tooltipContent,children:[h.jsx("div",{className:xt.tooltipTitle,children:ye}),h.jsx("div",{className:xt.tooltipMeta,children:l.workspaceCwd||ye})]})),onMouseLeave:qe,onFocus:ae=>te(ae,h.jsxs("div",{className:xt.tooltipContent,children:[h.jsx("div",{className:xt.tooltipTitle,children:ye}),h.jsx("div",{className:xt.tooltipMeta,children:l.workspaceCwd||ye})]})),onBlur:qe,children:[h.jsx("span",{className:`${xt.navIcon} ${xt.projectFolderIcon}`,children:h.jsx(Q7e,{expanded:j})}),!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:xt.projectName,children:ye}),h.jsx("button",{className:xt.projectIconButton,type:"button","aria-label":a("sidebar.search"),onKeyDown:ae=>ae.stopPropagation(),onClick:ae=>{ae.stopPropagation(),F(ze=>(ze&&R(""),!ze)),I(!0)},children:h.jsx(J7e,{})}),h.jsx("button",{className:xt.projectIconButton,type:"button","aria-label":a(j?"sidebar.collapseProject":"sidebar.expandProject"),onKeyDown:ae=>ae.stopPropagation(),onClick:ae=>{ae.stopPropagation(),I(ze=>!ze)},children:h.jsx(r9e,{expanded:j})})]})]}),P&&!e&&j&&h.jsx("input",{className:xt.searchInput,value:q,placeholder:a("sidebar.searchPlaceholder"),"aria-label":a("sidebar.search"),autoFocus:!0,onChange:ae=>R(ae.target.value),onKeyDown:ae=>{ae.key==="Escape"&&(R(""),F(!1))}}),h.jsx("div",{className:xt.sessionList,children:De})]}),h.jsxs("div",{className:xt.footer,children:[h.jsxs("button",{className:xt.footerButton,type:"button",title:a("sidebar.settings"),"aria-label":a("sidebar.settings"),onClick:n,children:[h.jsx("span",{className:`${xt.navIcon} ${xt.settingsIcon}`,children:h.jsx(Z7e,{})}),!e&&h.jsx("span",{children:a("sidebar.settings")})]}),!e&&re&&h.jsx("span",{className:xt.version,title:`Qwen Code ${re}`,children:re}),!o&&h.jsx("button",{className:xt.collapseButton,type:"button",title:a(e?"sidebar.expand":"sidebar.collapse"),"aria-label":a(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:h.jsx(n9e,{collapsed:e})})]}),h.jsx("div",{className:xt.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:ne})]})}function i9e(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:"extensions",description:e("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(n=>({...n,source:"builtin-command"}))}function o9e(...e){const t=new Map;for(const n of e)for(const r of n){const s=t.get(r.name);s?t.set(r.name,{...s,...r,description:r.description||s.description,argumentHint:r.argumentHint??s.argumentHint}):t.set(r.name,r)}return[...t.values()]}function a9e(e){const[t,n]=g.useState(e);return g.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(r)},[e]),t}const l9e=3e3,c9e=2;function FA(e){return e.some(t=>t.status==="running"||t.status==="paused")}function u9e(e,t,n=0){const r=Ky(),[s,i]=g.useState([]),[o,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useRef(0),d=g.useRef(!1);g.useEffect(()=>{if(!t){i([]),a(!1),u.current=0;return}},[t]),g.useEffect(()=>{!t||!e||(u.current=0,a(!0))},[t,e]),g.useEffect(()=>{!t||n===0||(u.current=0,a(!0))},[t,n]),g.useEffect(()=>{if(l||!t||!o)return;let m=!1;const p=()=>{d.current||(d.current=!0,r.getTasks().then(w=>{if(!m){if(i(w.tasks),w.tasks.length===0){u.current+=1,u.current>=c9e&&a(!1);return}u.current=0,FA(w.tasks)||a(!1)}}).catch(w=>{m||console.warn("[web-shell] failed to refresh tasks:",w)}).finally(()=>{d.current=!1}))};p();const y=setInterval(p,l9e);return()=>{m=!0,clearInterval(y)}},[r,t,o,l]);const f=g.useRef(s);return f.current=s,g.useEffect(()=>{const m=p=>{const y=p.detail,w=(y==null?void 0:y.active)===!0;c(w),!w&&FA(f.current)&&a(!0)};return window.addEventListener(em,m),()=>window.removeEventListener(em,m)},[]),s}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function d9e(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function h9e(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 f9e(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(r=>typeof r=="string").join(`
`).trim()||null}function m9e(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function p9e(e){return m9e(e)||!e.text&&!e.usage?null:e}function UA(e){return e.text.length===0}function g9e(e){const t=e.flatMap((n,r)=>{const s=bi(n),i=mi(s,"content");return i?[{id:mi(s,"id")??`plan-${r}`,content:i,status:_9e(mi(s,"status")),...(()=>{const a=k9e(mi(s,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function qA(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 y9e(e,t={}){var c,u,d;const n=[],r=((c=t.labels)==null?void 0:c.promptCancelled)??"Request cancelled.",s=new Map,i=new Map;let o=null,a=null,l=!1;for(let f=0;f<e.length;f++){const m=e[f],p=m.serverTimestamp??m.clientReceivedAt;switch(m.kind){case"user":{o=null,a=null,l=!1;const y=m,w={id:m.id,role:"user",content:y.text,timestamp:p};y.images&&y.images.length>0&&(w.images=y.images.map(b=>({data:b.data,mimeType:b.mimeType||"image/*"}))),n.push(w);break}case"assistant":{const y=p9e(m);if(!y)break;const w=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(w){HA(w,y.text);break}const b=O9e(y.text);if(b){let x=null,S=!1,C=0,E=0;for(const M of b)M.kind==="insight"?M.data.type==="insight_progress"?x=M.data:M.data.type==="insight_ready"?(S=!0,n.push({id:`${m.id}-ir-${C++}`,role:"insight_ready",path:M.data.path,timestamp:p})):M.data.type==="insight_error"&&(S=!0,n.push({id:`${m.id}-ie-${E++}`,role:"insight_error",error:M.data.error,timestamp:p})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:M.text,timestamp:p}),o=n.length-1,a=null);x&&!S&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:p}),l=!0;break}const v=o!==null?n[o]:void 0;if(v&&v.role==="assistant"&&!l&&!UA(y)){const x=qA(v.usage,y.usage);n[o]={...v,content:v.content+y.text,isStreaming:y.streaming,...x?{usage:x}:{}},l=!1,a=null}else if(!UA(y))n.push({id:m.id,role:"assistant",content:y.text,isStreaming:y.streaming,timestamp:p,...y.usage?{usage:y.usage}:{}}),o=n.length-1,a=null,l=!1;else if(y.usage&&v&&v.role==="assistant"){const x=qA(v.usage,y.usage);n[o]={...v,...x?{usage:x}:{}}}break}case"thought":{const y=m,w=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(w){HA(w,y.text);break}const b=a!==null?n[a]:void 0;b&&b.role==="thinking"&&!l?(n[a]={...b,content:b.content+y.text,isStreaming:y.streaming},l=!1):(n.push({id:m.id,role:"thinking",content:y.text,isStreaming:y.streaming,timestamp:p}),a=n.length-1,l=!1),o=null;break}case"tool":{const w=S9e(m),b=i.get(w.callId);b!=null&&b.title&&(w.title=b.title),!w.args&&(b!=null&&b.args)&&(w.args=b.args);const v=w.parentToolCallId?s.get(w.parentToolCallId):void 0,x=s.get(w.callId);if(x){VA(x,w);break}if(v){b9e(v,w),s.set(w.callId,w);break}Iv(n,m.id,w,p),s.set(w.callId,w),o=null,a=null,l=!0;break}case"shell":{const y=m,w=n[n.length-1];if(w&&w.role==="tool_group"){const b=v9e(w.tools),v=w.tools[b];if(v){const x=typeof v.rawOutput=="string"?v.rawOutput:"",S={...v,rawOutput:x+y.text};n[n.length-1]={...w,tools:[...w.tools.slice(0,b),S,...w.tools.slice(b+1)]},s.get(v.callId)===v&&s.set(v.callId,S)}}else n.push({id:m.id,role:"tool_group",tools:[{callId:m.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:y.text}],timestamp:p}),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:p}),l=!0;break}case"permission":{const y=m;C9e(y,i);const w=T9e(y);if(!w)break;const b=wP(w);if(!y.resolved)break;const v=s.get(w.callId);if(v){const x=v.status;w.toolName=v.toolName,y.resolved&&(Nv(y.resolved)?w.status=b?w.status:"in_progress":(w.status="failed",w.endTime=y.updatedAt)),VA(v,w),y.resolved&&b&&Nv(y.resolved)&&(v.status=x);break}if(y.resolved){Nv(y.resolved)?(b||(w.status="in_progress"),Iv(n,m.id,w,p),s.set(w.callId,w),l=!0):(w.status="failed",w.endTime=y.updatedAt,Iv(n,m.id,w,p),s.set(w.callId,w),l=!0);break}break}case"status":case"debug":{const y=m,w=y.source==="session_branched"?h9e(y.data):null,b=y.source==="mid_turn_message_injected"?f9e(y.data):null,v=w&&((u=t.labels)!=null&&u.branchSuccess)?t.labels.branchSuccess(w):b&&((d=t.labels)!=null&&d.midTurnInserted)?t.labels.midTurnInserted(b):y.text;if(d9e(v))break;const x=x9e(v);if(x){n.push({id:m.id,role:"plan",todos:x,timestamp:p}),l=!0;break}n.push({id:m.id,role:"system",content:v,variant:"info",timestamp:p,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"error":{const y=m;n.push({id:m.id,role:"system",content:y.text,variant:"error",retryable:y.source==="turn_error",timestamp:p,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"prompt_cancelled":n.push({id:m.id,role:"system",content:r,variant:"info",source:"prompt_cancelled",timestamp:p}),l=!0;break}}return n}function b9e(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function HA(e,t){e.subContent=(e.subContent||"")+t}function Iv(e,t,n,r){const s=o=>wP(o)||Xh(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!s(n)&&!i.tools.some(s)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:r})}function v9e(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 VA(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 wP(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||w9e(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function w9e(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function x9e(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=bi(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:g9e(r.entries)}catch{return}}function bi(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function mi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function _9e(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function k9e(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function S9e(e){const t=E9e(e),n=A9e(e,t),r=M9e(e.content),s={running:"in_progress",pending:"pending",confirming:"pending",background:"pending",completed:"completed",failed:"failed",cancelled:"completed",canceled:"completed",in_progress:"in_progress"},i=e.status==="completed"||e.status==="failed"||e.status==="cancelled"||e.status==="canceled";return{callId:e.toolCallId,toolName:e.toolName||"unknown",title:e.title,status:(n?"pending":s[e.status])||e.status||"in_progress",kind:_P(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...r?{content:r}:{}}}function T9e(e){const t=bi(e.toolCall);if(!t)return;const n=xP(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=bi(t._meta),s=mi(t,"kind"),i=mi(r,"toolName")??mi(t,"toolName")??mi(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),o=mi(t,"toolCallId")??mi(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:mi(t,"title")??e.title,status:"pending",kind:_P(i,s),args:n,startTime:e.createdAt}}function C9e(e,t){const n=bi(e.toolCall),r=mi(n,"toolCallId")??mi(n,"id");if(!r)return;const s=mi(n,"title")??e.title,i=n?xP(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function Nv(e){const[t="",n=""]=e.toLowerCase().split(":",2);return WA(t)?!0:t!=="selected"?!1:WA(n.trim())}function WA(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 xP(e){return bi(e.rawInput)??bi(e.input)??bi(e.args)}function A9e(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=bi(t);return(r==null?void 0:r.status)==="background"}function E9e(e){return I9e(e)&&e.status==="failed"?N9e(e)??e.details??e.rawOutput:!R9e(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 M9e(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=bi(n);if(!r)return[];const s=r.type;if(s==="content"){const i=bi(r.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(s==="diff"){const i=r.newText;if(typeof i!="string")return[];const o=r.path,a=r.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(s==="terminal"){const i=r.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function I9e(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function N9e(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var r;return(r=n==null?void 0:n.content)==null?void 0:r.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function R9e(e){return e==="cancelled"||e==="canceled"}const L9e=['"insight_progress":','"insight_ready":','"insight_error":'];function j9e(e){try{const t=JSON.parse(e),n=bi(t.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const r=bi(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=bi(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function D9e(e,t){if(e[t]!=="{")return null;let n=0,r=!1,s=!1;for(let i=t;i<e.length;i++){const o=e[i];if(s){s=!1;continue}if(o==="\\"&&r){s=!0;continue}if(o==='"'){r=!r;continue}if(!r){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function O9e(e){const t=[];let n=0,r=0,s=!1;for(;r<e.length;){const o=e.indexOf("{",r);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!L9e.some(f=>a.startsWith(f))){r=o+1;continue}const c=D9e(e,o);if(!c){r=o+1;continue}const u=j9e(c);if(!u){r=o+1;continue}s=!0;const d=e.slice(n,o).trim();d&&t.push({kind:"text",text:d}),t.push({kind:"insight",data:u}),n=o+c.length,r=n}if(!s)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function _P(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 B9e(e){const t=Gy();return g.useMemo(()=>y9e(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n})}}),[t,e])}function P9e(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>i===t[o]);const n=Object.keys(e),r=t,s=e;return n.length!==Object.keys(r).length?!1:n.every(i=>{const o=s[i],a=r[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((l,c)=>l===a[c]):!1})}function $9e(e){const t=g.useRef(e);return P9e(t.current,e)||(t.current=e),t.current}function z9e(e,t){const n=g.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((s,i)=>t(s)!==t(n.current[i]))&&(n.current=e),n.current)}const Jr={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"},GA=1024,F9e=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${GA}}\S\$)([^$\n]{1,${GA}})\$(?![\w$])`,"g");function U9e(e){var c,u,d;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=new Map;let i=null,o=null,a=null,l=[];for(const f of n){const m=f.match(r);if(!i){if(m){if(i=m[1]??null,o=((u=(c=m[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:u.toLowerCase())||null,o){const p=(s.get(o)??0)+1;s.set(o,p),a=p}else a=null;l=[]}continue}if(m&&((d=m[1])!=null&&d.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 q9e(e){var l;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const c of n){const u=c.match(r);if(i){u&&((l=u[1])!=null&&l.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(!o){if(u){i=u[1]??null;continue}s.test(c)&&(o=!0,a=[]);continue}if(s.test(c)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(c)}return t}function H9e(e){var a;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1;for(const l of n){const c=l.match(r);if(i){c&&((a=c[1])!=null&&a.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(o){s.test(l)&&(o=!1);continue}if(c){i=c[1]??null;continue}if(s.test(l)){o=!0;continue}for(const u of l.matchAll(F9e)){const d=u[1];d&&t.push({content:d,index:t.length+1})}}return t}function KA(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function V9e(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),r=(u=n[0])==null?void 0:u.toLowerCase();if(!r)return;const s=U9e(e);if(s.length===0)return null;let i=null,o=null;const a=r==="code"?n.slice(1):n.map(d=>d);r!=="code"&&(i=r);for(const d of a)/^\d+$/.test(d)?o=Number(d):d.toLowerCase()!=="code"&&(i=d.toLowerCase());const l=i?s.filter(d=>d.lang===i):s;if(l.length===0)return null;if(o!==null){const d=i?l.find(f=>f.langIndex===o):s.find(f=>f.index===o);return d?{content:d.content,label:KA(d,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:KA(c,i)}:null}function YA(e,t){const n=H9e(e);if(n.length===0)return null;let r=null;for(const i of t)/^\d+$/.test(i)&&(r=Number(i));const s=r!==null?n.find(i=>i.index===r):n[n.length-1];return s?{content:s.content,label:`Inline LaTeX expression ${s.index}`}:null}function W9e(e,t){var c;const n=t.trim().split(/\s+/).filter(Boolean),r=(c=n[0])==null?void 0:c.toLowerCase();if(r!=="latex"&&r!=="math"&&r!=="inline-latex")return;if(r==="inline-latex")return YA(e,n.slice(1));const s=n.slice(1),i=s.findIndex(u=>u.toLowerCase()==="inline");if(i!==-1)return YA(e,s.filter((u,d)=>d!==i));const o=q9e(e);if(o.length===0)return null;let a=null;for(const u of s)/^\d+$/.test(u)&&(a=Number(u));const l=a!==null?o.find(u=>u.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function G9e(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 K9e(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 Y9e(e,t,n=K9e){const r=G9e(e);if(r===null)return{status:"info",message:Jr.NO_OUTPUT};if(!r)return{status:"info",message:Jr.NO_TEXT};try{const s=W9e(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Jr.INLINE_LATEX_MISSING:Jr.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${Jr.COPIED_SUFFIX}`};const i=V9e(r,t);if(i===null)return{status:"info",message:Jr.CODE_MISSING};const o=(i==null?void 0:i.content)??r;return await n(o),{status:"info",message:i?`${i.label}${Jr.COPIED_SUFFIX}`:Jr.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${Jr.CLIPBOARD_PREFIX}${i}`}}}function X9e(e){return typeof e=="object"&&e!==null}function kP(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function s6(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function Q9e(e){if(!s6(e)||!X9e(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function J9e(e){const t=new Set;for(const n of e){if(!s6(n))continue;const r=Q9e(n);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=kP(n.content);return!r||!t.has(r)})}function Z9e(e){return e.role!=="system"||e.variant!=="info"?!1:kP(e.content)!==null||s6(e)}function eTe(e){const t=e.findIndex(n=>!Z9e(n));return t<0?[]:e.slice(t)}function XA(e){return eTe(J9e(e))}function tTe(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 QA(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const r of e.cells){const s=r.detail;r.kind==="node_version"&&(s!=null&&s.version)?n.nodeVersion=s.version:r.kind==="npm"&&(s!=null&&s.version)?n.npmVersion=String(s.version).replace(/^npm\s*/i,""):r.kind==="auth"&&(s!=null&&s.source)&&(n.authSource=s.source)}if(t)for(const r of t.cells)r.kind==="platform"?(n.platform=r.name,r.value&&(n.arch=r.value)):r.kind==="sandbox"&&r.name==="SANDBOX"?n.sandbox=r.value||"":r.kind==="proxy"&&r.present&&r.value?n.proxy=`${r.name}: ${r.value}`:r.kind==="memory"&&r.value&&(n.memoryUsage=r.value);return n}function nTe(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function rTe(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function sTe(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,r=n.indexOf(":");return r>0?`${n.slice(r+1)}(${n.slice(0,r)})`:n}function iTe(e,t,n,r){return e?!0:(r.append(t),!1)}function SP(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}const oTe="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",aTe="/assets/insert-DmRbh9Rv.svg",lTe="/assets/queue-DWpnpFgW.svg",cTe="_app_rurlx_1",uTe="_appChat_rurlx_36",dTe="_appChatEmpty_rurlx_42",hTe="_appShell_rurlx_47",fTe="_chatPane_rurlx_55",mTe="_mobileDrawer_rurlx_64",pTe="_mobileBackdrop_rurlx_68",gTe="_hamburgerButton_rurlx_72",yTe="_mobileDrawerOpen_rurlx_111",bTe="_appWithSidebar_rurlx_147",vTe="_themeDark_rurlx_195",wTe="_themeLight_rurlx_263",xTe="_content_rurlx_331",_Te="_contentHasMessages_rurlx_339",kTe="_footer_rurlx_348",STe="_bottomPanels_rurlx_358",TTe="_approvalOverlay_rurlx_373",CTe="_scrollToBottomLayer_rurlx_382",ATe="_scrollToBottomLayerWithTodos_rurlx_393",ETe="_scrollToBottomButton_rurlx_397",MTe="_scrollToBottomIcon_rurlx_426",ITe="_btwPanel_rurlx_432",NTe="_composer_rurlx_439",RTe="_escClearStatus_rurlx_446",LTe="_emptyWelcomeFooter_rurlx_453",jTe="_queuedPrompts_rurlx_457",DTe="_queuedPrompt_rurlx_457",OTe="_queuedPromptIcon_rurlx_487",BTe="_queuedPromptMaskIcon_rurlx_497",PTe="_queuedPromptActionIcon_rurlx_498",$Te="_queuedPromptText_rurlx_511",zTe="_queuedPromptState_rurlx_519",FTe="_queuedPromptSpinner_rurlx_527",UTe="_queuedPromptActions_rurlx_542",qTe="_queuedPromptAction_rurlx_498",HTe="_queuedHint_rurlx_587",Yt={app:cTe,appChat:uTe,appChatEmpty:dTe,appShell:hTe,chatPane:fTe,mobileDrawer:mTe,mobileBackdrop:pTe,hamburgerButton:gTe,mobileDrawerOpen:yTe,appWithSidebar:bTe,themeDark:vTe,themeLight:wTe,content:xTe,contentHasMessages:_Te,footer:kTe,bottomPanels:STe,approvalOverlay:TTe,scrollToBottomLayer:CTe,scrollToBottomLayerWithTodos:ATe,scrollToBottomButton:ETe,scrollToBottomIcon:MTe,btwPanel:ITe,composer:NTe,escClearStatus:RTe,emptyWelcomeFooter:LTe,queuedPrompts:jTe,queuedPrompt:DTe,queuedPromptIcon:OTe,queuedPromptMaskIcon:BTe,queuedPromptActionIcon:PTe,queuedPromptText:$Te,queuedPromptState:zTe,queuedPromptSpinner:FTe,queuedPromptActions:UTe,queuedPromptAction:qTe,queuedHint:HTe},JA=240;function VTe({prompts:e,t,onDelete:n,onInsert:r,onEdit:s}){return e.length===0?null:h.jsxs("div",{className:Yt.queuedPrompts,children:[e.map(i=>{var b;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>JA?`${o.slice(0,JA)}...`:o,l=((b=i.images)==null?void 0:b.length)??0,c=SP(i.text),u=i.serverState==="submitting",d=i.serverState==="running",f=i.isRemoving===!0,m=u||d||i.isEditing===!0||f;let p=t("queue.insertTip");m?p=t("queue.submittingDisabled"):c&&(p=t("queue.insertCommandDisabled"));let y=t("queue.editTip");m&&(y=t("queue.submittingDisabled"));const w=t(m?"queue.submittingDisabled":"queue.deleteTip");return h.jsxs("div",{className:Yt.queuedPrompt,children:[h.jsx("span",{className:Yt.queuedPromptIcon,"aria-hidden":"true",children:h.jsx("span",{className:Yt.queuedPromptMaskIcon,style:Kf("--queued-icon-url",lTe)})}),h.jsxs("span",{className:Yt.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",u||i.isEditing||f?h.jsxs("span",{className:Yt.queuedPromptState,children:[h.jsx("span",{className:Yt.queuedPromptSpinner}),f?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),h.jsxs("span",{className:Yt.queuedPromptActions,children:[l===0&&h.jsxs("button",{type:"button",className:Yt.queuedPromptAction,onClick:()=>r(i.id),disabled:c||m,title:p,children:[h.jsx("span",{className:Yt.queuedPromptActionIcon,style:Kf("--queued-icon-url",aTe),"aria-hidden":"true"}),t("queue.insert")]}),h.jsx("button",{type:"button",className:Yt.queuedPromptAction,onClick:()=>n(i.id),disabled:m,"aria-label":t("queue.delete"),title:w,children:h.jsx("span",{className:Yt.queuedPromptActionIcon,style:Kf("--queued-icon-url",oTe),"aria-hidden":"true"})}),h.jsx("button",{type:"button",className:Yt.queuedPromptAction,onClick:()=>s(i.id),disabled:m,"aria-label":t("queue.edit"),title:y,children:h.jsx("span",{className:Yt.queuedPromptActionIcon,style:Kf("--queued-icon-url",sP),"aria-hidden":"true"})})]})]},i.id)}),h.jsx("div",{className:Yt.queuedHint,children:t("queue.footer")})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function WTe(e,t,n,r){const s=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==r))for(const a of o.messages){const l=s.findIndex(c=>c.text===a&&(!c.images||c.images.length===0));l>=0&&(s.splice(l,1),i=!0)}return i?s:null}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const GTe=100;function ZA(e,t){return e.length!==t.length?!1:e.every((n,r)=>{var i,o;const s=t[r];return s!==void 0&&n.id===s.id&&n.sessionId===s.sessionId&&n.text===s.text&&n.serverPromptId===s.serverPromptId&&n.serverState===s.serverState&&n.isEditing===s.isEditing&&n.isRemoving===s.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=s.images)==null?void 0:o.length)??0)})}function eE(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function KTe({connected:e,sessionId:t,clientId:n,streamingState:r,sessionActions:s,store:i,editorRef:o,reportError:a,notifySuccess:l,t:c}){const[u,d]=g.useState([]),f=g.useRef([]),m=g.useRef(1),p=g.useRef(t),y=g.useRef(null),w=g.useRef(new Set),b=g.useRef(new Set),v=g.useRef(new Set),x=g.useRef(new Map),S=g.useRef(new Set),C=g.useRef([]),E=g.useRef(r),M=g.useRef(0);p.current=t,E.current=r;const D=g.useMemo(()=>u.map(ie=>ie.text),[u]);g.useEffect(()=>{f.current=u},[u]),g.useEffect(()=>{var ie;f.current=[],d([]),x.current.clear(),S.current.clear(),C.current=[];for(const re of w.current)re.abort();w.current.clear(),b.current.clear(),v.current.clear(),q.current=void 0,(ie=y.current)==null||ie.abort(),y.current=null},[t]);const O=g.useCallback((ie,re)=>{const oe=f.current.filter(ve=>ve.serverPromptId?ie.some(qe=>qe.promptId===ve.serverPromptId):!0);for(const ve of ie){if(b.current.has(ve.promptId))continue;const qe=oe.findIndex(we=>we.serverPromptId===ve.promptId),We=v.current.has(ve.promptId);if(qe!==-1){if(We){oe.splice(qe,1);continue}oe[qe]={...oe[qe],text:ve.text,serverState:ve.state};continue}const te=oe.filter(we=>!we.serverPromptId&&we.serverState==="submitting"&&we.text===ve.text);if(te.length===1){const we=oe.indexOf(te[0]);if(We){oe.splice(we,1);continue}oe[we]={...te[0],serverPromptId:ve.promptId,serverState:ve.state};continue}ve.state==="running"||We||oe.push({id:m.current++,sessionId:re,text:ve.text,serverPromptId:ve.promptId,serverState:ve.state})}ZA(f.current,oe)||(f.current=oe,d(oe))},[]),A=g.useCallback(async(ie=t)=>{if(!e||!ie||p.current!==ie)return!1;const re=++M.current;try{const oe=await s.getPendingPrompts({sessionId:ie});return re!==M.current||p.current!==ie?!1:(O(oe.pendingPrompts.filter(ve=>ve.state==="queued"||ve.state==="running"),ie),!0)}catch(oe){return console.warn("Failed to refresh pending prompts",oe),!1}},[e,s,t,O]),j=g.useCallback(ie=>{const re=p.current,oe=ie.filter(te=>te.sessionId===void 0||te.sessionId===re);if(oe.length===0)return;const ve=new Set(f.current.map(te=>te.id)),qe=oe.filter(te=>!ve.has(te.id));if(qe.length===0)return;const We=[...f.current,...qe].sort((te,we)=>te.id-we.id);f.current=We,d(We)},[]),I=g.useCallback((ie,re,oe)=>{var We,te,we,Se;if(oe!==void 0&&p.current!==oe)return;const ve=((We=o.current)==null?void 0:We.getText())??"",qe=ve.trim()?`${ie}
${ve}`:ie;(te=o.current)==null||te.setText(qe),re&&re.length>0&&((we=o.current)==null||we.restoreImages(re)),(Se=o.current)==null||Se.focus()},[o]),P=g.useSyncExternalStore(iV,sV),F=g.useRef(P),q=g.useRef(void 0);g.useEffect(()=>{if(!e||!t)return;const ie=F.current!==P;if(F.current=P,!ie){if(f.current.length>0||r==="idle"||q.current===t)return;q.current=t}A()},[P,e,t,r,A]);const R=g.useSyncExternalStore(oV,zS,zS);g.useEffect(()=>{if(!t||R.length===0)return;const ie=[];for(const re of R){if(re.data.sessionId!==t)continue;ie.push(re);const oe=re.data.promptId;if(oe){if(re.type==="pending_prompt_started"){if(b.current.has(oe))continue;if((re.originatorClientId===void 0||re.originatorClientId===n)&&!v.current.has(oe)){const qe=typeof re.data.text=="string"?re.data.text:"",We=f.current.find(we=>we.serverPromptId===oe)??f.current.find(we=>!we.serverPromptId&&we.serverState==="submitting"&&we.text===qe),te=(We==null?void 0:We.text)??"";te&&(v.current.add(oe),i.appendLocalUserMessage(te,eE(We==null?void 0:We.images)))}A()}else if(re.type==="turn_complete"){v.current.delete(oe);const ve=x.current.get(oe);if(x.current.delete(oe),ve)ve();else if(!S.current.has(oe))for(S.current.add(oe),C.current.push(oe);C.current.length>GTe;){const qe=C.current.shift();qe&&S.current.delete(qe)}}else if(re.type==="turn_error"||re.type==="pending_prompt_completed"&&re.data.state==="removed"){v.current.delete(oe);const ve=x.current.get(oe);x.current.delete(oe),ve==null||ve(),S.current.delete(oe),C.current=C.current.filter(qe=>qe!==oe)}}}lV(ie)},[R,t,n,i,A]);const V=g.useCallback((ie,re)=>{if(S.current.delete(ie)){C.current=C.current.filter(oe=>oe!==ie),re();return}x.current.set(ie,re)},[]),J=g.useCallback((ie,re,oe)=>{const ve=ie.trim();if(!ve)return!0;const qe=m.current++,We=p.current,te=new AbortController;w.current.add(te);const we=re?[...re]:void 0,Se={id:qe,sessionId:We,text:ve,images:we,onComplete:oe,serverState:"submitting"};return f.current=[...f.current,Se],d(f.current),s.submitPrompt(ve,{images:re,optimisticUserMessage:!1,sessionId:We,signal:te.signal}).then(Ne=>{if(w.current.delete(te),p.current!==We){s.removePendingPrompt(Ne.promptId,{sessionId:We}).catch(Tt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:We,promptId:Ne.promptId,error:Tt})});return}if(E.current==="idle"){v.current.has(Ne.promptId)||(v.current.add(Ne.promptId),i.appendLocalUserMessage(ve,eE(we)));const Tt=f.current.filter(rt=>rt.id!==qe);f.current=Tt,d(Tt),oe&&V(Ne.promptId,oe);return}const Pt=f.current,at=Pt.findIndex(Tt=>Tt.id===qe);if(at===-1){s.removePendingPrompt(Ne.promptId,{sessionId:We}).then(Tt=>{Tt.removed||A(We)},()=>{A(We)});return}const vt=[...Pt];vt[at]={...vt[at],serverPromptId:Ne.promptId,serverState:"queued"},f.current=vt,d(vt),oe&&V(Ne.promptId,oe)}).catch(Ne=>{if(w.current.delete(te),p.current!==We||!f.current.some(at=>at.id===qe))return;const Pt=f.current.filter(at=>at.id!==qe);f.current=Pt,d(Pt),I(ve,we,We),a(Ne,c("queue.queueFailed"))}),!0},[A,a,I,s,V,i,c]);g.useEffect(()=>{if(r!=="idle")return;const ie=y.current;ie&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),ie.abort(),y.current=null)},[r]);const ee=g.useCallback(ie=>{const re=f.current;if(re.length===0)return null;const oe=ie===void 0?re.length-1:re.findIndex(We=>We.id===ie);if(oe<0)return null;const ve=re[oe],qe=re.filter((We,te)=>te!==oe);return f.current=qe,d(qe),(ve==null?void 0:ve.text)??null},[]),N=g.useCallback((ie,re)=>{const oe=f.current.map(ve=>ve.id===ie?{...ve,...re}:ve);ZA(oe,f.current)||(f.current=oe,d(oe))},[]),G=g.useCallback(async(ie,re,oe)=>{if(!ie.serverPromptId)return!0;if(ie.serverState!=="queued"||b.current.has(ie.serverPromptId))return!1;const ve=ie.sessionId;b.current.add(ie.serverPromptId),N(ie.id,re);try{const qe=await s.removePendingPrompt(ie.serverPromptId,{sessionId:ve});return b.current.delete(ie.serverPromptId),qe.removed?(x.current.delete(ie.serverPromptId),await A(ve)||(N(ie.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),oe)),!0):(N(ie.id,{isEditing:!1,isRemoving:!1}),await A(ve),a(new Error("Prompt could not be removed from queue"),oe),!1)}catch(qe){return b.current.delete(ie.serverPromptId),N(ie.id,{isEditing:!1,isRemoving:!1}),await A(ve)||j([ie]),a(qe,oe),!1}},[A,a,j,s,N]),B=g.useCallback(ie=>{const re=f.current.find(oe=>oe.id===ie);if((re==null?void 0:re.serverState)!=="submitting"&&re){if(!re.serverPromptId){const oe=f.current.filter(ve=>ve.id!==ie);f.current=oe,d(oe);return}G(re,{isRemoving:!0},c("queue.deleteFailed"))}},[G,c]),k=g.useCallback(async ie=>{var te;const re=f.current.find(we=>we.id===ie);if(!re||(((te=re.images)==null?void 0:te.length)??0)>0||re.serverState==="submitting"||re.isEditing||re.isRemoving||SP(re.text))return;const oe=re.serverPromptId?re.onComplete??x.current.get(re.serverPromptId):void 0,ve=()=>{re.serverPromptId&&x.current.delete(re.serverPromptId),oe==null||oe()};if(re.serverPromptId&&!await G(re,{isRemoving:!0},c("queue.insertFailed")))return;let qe=y.current;qe||(qe=new AbortController,y.current=qe);let We;try{We=await s.enqueueMidTurnMessage(re.text,{signal:qe.signal})}catch(we){re.serverPromptId&&(I(re.text,re.images,re.sessionId),ve()),a(we,c("queue.insertFailed"));return}if(!We.accepted){re.serverPromptId&&(I(re.text,re.images,re.sessionId),ve()),a(new Error("Queued message was not accepted for insertion"),c("queue.insertFailed"));return}if(ve(),!re.serverPromptId){const we=f.current.filter(Se=>Se.id!==ie);f.current=we,d(we)}l(c("queue.inserted"))},[G,l,a,I,s,c]),Q=g.useCallback(async ie=>{const re=f.current.find(ve=>ve.id===ie);if(!re||re.serverState==="submitting"||re.isEditing||re.isRemoving)return;if(re.serverPromptId){if(!await G(re,{isEditing:!0},c("queue.editFailed")))return;I(re.text,re.images,re.sessionId);return}const oe=ee(ie);oe&&I(oe,re.images,re.sessionId)},[ee,G,I,c]),ce=g.useCallback(()=>{const ie=f.current;if(ie.length===0)return!1;const re=ie[ie.length-1];if(!re)return!1;if(re.serverState==="submitting"||re.isEditing||re.isRemoving)return!0;if(!re.serverPromptId){const oe=ee(re.id);return oe?(I(oe,re.images,re.sessionId),!0):!1}return re.serverState!=="queued"?!1:((async()=>{await G(re,{isEditing:!0},c("queue.editFailed"))&&I(re.text,re.images,re.sessionId)})().catch(oe=>{a(oe,c("queue.editFailed"))}),!0)},[ee,G,a,I,c]),pe=g.useCallback(()=>{if(f.current.length===0)return!1;const ie=p.current,re=f.current.filter(we=>we.serverState==="submitting"),oe=f.current.filter(we=>we.serverState!=="submitting");for(const we of[...re].reverse())I(we.text,we.images,we.sessionId);for(const we of w.current)we.abort();const ve=oe.filter(we=>we.serverPromptId);if(ve.length===0)return f.current=[],d([]),i.dispatch([{type:"status",text:c("queue.cleared")}]),!0;const qe=new Set(f.current.map(we=>we.id)),We=new Set(ve.map(we=>we.serverPromptId).filter(we=>!!we));for(const we of We)b.current.add(we);const te=f.current.filter(we=>!qe.has(we.id)).concat(ve.map(we=>({...we,isRemoving:!0})));return f.current=te,d(te),(async()=>{var Pt;const we=[];if(await Promise.all(ve.map(async at=>{const vt=at.serverPromptId;try{if((await s.removePendingPrompt(vt,{sessionId:at.sessionId})).removed){x.current.delete(vt);return}we.push(at)}catch{we.push(at)}finally{b.current.delete(vt)}})),p.current!==ie)return;const Se=we.map(at=>({...at,isRemoving:!1})),Ne=f.current.filter(at=>at.serverPromptId?!We.has(at.serverPromptId):!qe.has(at.id)).concat(Se);if(f.current=Ne,d(Ne),we.length>0){a(new Error("Some prompts could not be removed from queue"),c("queue.deleteFailed")),A((Pt=we[0])==null?void 0:Pt.sessionId);return}i.dispatch([{type:"status",text:c("queue.cleared")}])})(),!0},[A,a,I,i,c,s]),{batches:be,consume:ye}=jV();return g.useEffect(()=>{if(!t||be.length===0)return;n===void 0&&be.some(re=>re.sessionId===t&&re.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const ie=WTe(f.current,be,t,n);ie&&(f.current=ie,d(ie)),ye(be.filter(re=>re.sessionId===t))},[be,t,n,ye]),{queuedPrompts:u,queuedTexts:D,enqueuePrompt:J,removeQueuedPrompt:B,insertQueuedPrompt:k,editQueuedPrompt:Q,editLastQueuedPrompt:ce,clearQueuedPrompts:pe}}const YTe="_layout_ghraz_1",XTe="_muted_ghraz_8",QTe="_notice_ghraz_13",JTe="_list_ghraz_20",ZTe="_group_ghraz_26",eCe="_groupTitle_ghraz_33",tCe="_server_ghraz_39",nCe="_serverCard_ghraz_44",rCe="_serverCardExpanded_ghraz_50",sCe="_row_ghraz_55",iCe="_expandedRow_ghraz_72",oCe="_serverRow_ghraz_76",aCe="_rowMain_ghraz_81",lCe="_rowIcon_ghraz_96",cCe="_chevronCell_ghraz_125",uCe="_toolRow_ghraz_135",dCe="_chevron_ghraz_125",hCe="_chevronExpanded_ghraz_150",fCe="_disabled_ghraz_154",mCe="_name_ghraz_158",pCe="_serverName_ghraz_166",gCe="_status_ghraz_170",yCe="_badge_ghraz_171",bCe="_toolCount_ghraz_185",vCe="_resourceCount_ghraz_190",wCe="_promptCount_ghraz_191",xCe="_success_ghraz_196",_Ce="_warning_ghraz_200",kCe="_error_ghraz_204",SCe="_serverDetail_ghraz_208",TCe="_serverDetailHeader_ghraz_218",CCe="_serverActions_ghraz_223",ACe="_field_ghraz_230",ECe="_label_ghraz_238",MCe="_value_ghraz_244",ICe="_button_ghraz_249",NCe="_message_ghraz_269",RCe="_schema_ghraz_270",LCe="_tools_ghraz_281",jCe="_tool_ghraz_135",DCe="_resources_ghraz_292",OCe="_sectionTitle_ghraz_301",BCe="_resourceUri_ghraz_306",PCe="_resourceLabel_ghraz_314",$Ce="_toolDetail_ghraz_324",zCe="_section_ghraz_301",FCe="_description_ghraz_347",UCe="_parameter_ghraz_353",qCe="_empty_ghraz_359",HCe="_emptyTools_ghraz_360",Xe={layout:YTe,muted:XTe,notice:QTe,list:JTe,group:ZTe,groupTitle:eCe,server:tCe,serverCard:nCe,serverCardExpanded:rCe,row:sCe,expandedRow:iCe,serverRow:oCe,rowMain:aCe,rowIcon:lCe,chevronCell:cCe,toolRow:uCe,chevron:dCe,chevronExpanded:hCe,disabled:fCe,name:mCe,serverName:pCe,status:gCe,badge:yCe,toolCount:bCe,resourceCount:vCe,promptCount:wCe,success:xCe,warning:_Ce,error:kCe,serverDetail:SCe,serverDetailHeader:TCe,serverActions:CCe,field:ACe,label:ECe,value:MCe,button:ICe,message:NCe,schema:RCe,tools:LCe,tool:jCe,resources:DCe,sectionTitle:OCe,resourceUri:BCe,resourceLabel:PCe,toolDetail:$Ce,section:zCe,description:FCe,parameter:UCe,empty:qCe,emptyTools:HCe};function tE(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const s=n.details;if(typeof s=="string"&&s)return s}const r=t.error;if(typeof r=="string"&&r)return r}if(e instanceof Error&&e.message)return e.message}return String(e)}function VCe(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:Xe.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:Xe.success};case"connecting":return{text:t("mcp.status.starting"),className:Xe.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:Xe.error}}}function WCe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Rv(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function GCe(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 KCe(e,t){const n=e.annotations??{},r=[];return n.destructiveHint&&r.push(t("mcp.annotation.destructive")),n.readOnlyHint&&r.push(t("mcp.annotation.readOnly")),n.openWorldHint&&r.push(t("mcp.annotation.openWorld")),n.idempotentHint&&r.push(t("mcp.annotation.idempotent")),r.join(", ")}function nE(e,t){return`${e}:${t}`}function rE(e,t){return`${e}\0${t}`}const Vl=r6;function Lv({expanded:e}){return h.jsx("svg",{className:`${Xe.chevron} ${e?Xe.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function YCe(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 XCe({tool:e,t}){const n=GCe(e);if(!n)return h.jsx("div",{className:Xe.muted,children:t("mcp.noSchema")});const r=n.properties,s=Array.isArray(n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object")return h.jsx("pre",{className:Xe.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:Xe.parameter,children:`- ${o}${s.has(o)?t("mcp.required"):""}: ${c}${u?` - ${u}`:""}`},o)})]})}function Xf({label:e,value:t}){return h.jsxs("div",{className:Xe.field,children:[h.jsx("span",{className:Xe.label,children:e}),h.jsx("span",{className:Xe.value,children:t})]})}function QCe({tool:e,t}){const n=KCe(e,t);return h.jsxs("div",{className:Xe.toolDetail,children:[e.isValid?null:h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:`${Xe.sectionTitle} ${Xe.error}`,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{className:Xe.muted,children:[Vl(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:Xe.muted,children:t("mcp.invalidToolHelp")})]}),e.description?h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:Xe.sectionTitle,children:Vl(t("mcp.description"))}),h.jsx("div",{className:Xe.description,children:e.description.trim()})]}):h.jsx("div",{className:Xe.muted,children:t("mcp.noDescription")}),n?h.jsx(Xf,{label:Vl(t("mcp.annotations")),value:n}):null,h.jsx(XCe,{tool:e,t})]})}function JCe({resource:e,t}){const n=e.title||e.name||"",r=n!==""&&n!==e.uri;return h.jsxs("div",{className:Xe.toolDetail,children:[h.jsx(Xf,{label:Vl(t("mcp.resource.uriLabel")),value:e.uri}),r?h.jsx(Xf,{label:Vl(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?h.jsx(Xf,{label:Vl(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?h.jsx(Xf,{label:Vl(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:Xe.sectionTitle,children:Vl(t("mcp.description"))}),h.jsx("div",{className:Xe.description,children:e.description.trim()})]}):null]})}function ZCe({message:e}){const{t}=ht(),n=FN({autoLoad:!1}),[r,s]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(e.resourcesByServer??{}),c=g.useMemo(()=>r.servers??[],[r.servers]),[u,d]=g.useState(new Set),[f,m]=g.useState(new Set),[p,y]=g.useState(new Set),[w,b]=g.useState(null),[v,x]=g.useState(null);g.useEffect(()=>{d(j=>{const I=new Set(c.map(P=>P.name));return new Set([...j].filter(P=>I.has(P)))})},[c]);const S=c.filter(j=>!j.disabled&&j.mcpStatus==="connecting").length,C=g.useMemo(()=>{var I,P;const j=[];for(const F of c){const q=WCe(F,t),R={server:F,tools:((I=i[F.name])==null?void 0:I.tools)??[],resources:((P=a[F.name])==null?void 0:P.resources)??[]},V=j.find(J=>J.label===q);V?V.items.push(R):j.push({label:q,items:[R]})}return j},[c,t,i,a]),E=g.useCallback(async j=>{var q;const I=await n.reload();if(!I)return;s(I);const P=(q=I.servers)==null?void 0:q.find(R=>R.name===j);if(!P)return;const F=await n.loadTools(P.name);if(o(R=>({...R,[P.name]:F})),P.resourceCount)try{const R=await n.loadResources(P.name);l(V=>({...V,[P.name]:R}))}catch{}else l(R=>{if(!(P.name in R))return R;const V={...R};return delete V[P.name],V})},[n]),M=g.useCallback(async(j,I)=>{if(!v){d(new Set([j.name])),x(j.name),b({serverName:j.name,text:I.id==="authenticate"?Rv(j.name,t):t("mcp.action.running",{action:I.label})});try{let P=null;if(I.id==="reconnect")await n.restartServer(j.name);else{const F=await n.manageServer(j.name,I.id),q=[...F.messages??[],...F.authUrl?[F.authUrl]:[]].join(`
`);q&&(P=I.id==="authenticate"?Rv(j.name,t,q):q)}await E(j.name),b({serverName:j.name,text:P??t("mcp.action.done",{action:I.label})})}catch(P){b({serverName:j.name,text:I.id==="authenticate"?Rv(j.name,t,tE(P)):t("mcp.action.failed",{error:tE(P)})})}finally{x(null)}}},[v,n,E,t]),D=g.useCallback(j=>{d(I=>I.has(j)?new Set:new Set([j])),m(new Set),y(new Set)},[]),O=g.useCallback((j,I)=>{const P=nE(j,I);m(F=>F.has(P)?new Set:new Set([P]))},[]),A=g.useCallback((j,I)=>{const P=rE(j,I);y(F=>F.has(P)?new Set:new Set([P]))},[]);return h.jsxs("div",{className:Xe.layout,"data-keyboard-scope":!0,children:[S>0?h.jsxs("div",{className:Xe.notice,children:[t("mcp.starting",{count:S}),h.jsx("div",{className:Xe.muted,children:t("mcp.startingNote")})]}):null,c.length===0?h.jsx("div",{className:Xe.empty,children:t("mcp.empty")}):h.jsx("div",{className:Xe.list,children:C.map(j=>h.jsxs("div",{className:Xe.group,children:[j.label!==t("mcp.extensionMcp")?h.jsx("div",{className:Xe.groupTitle,children:j.label}):null,j.items.map(({server:I,tools:P,resources:F})=>{var G;const q=VCe(I,t),R=u.has(I.name),V=YCe(I,t),J=((G=i[I.name])==null?void 0:G.tools.length)??0,ee=I.resourceCount??0,N=I.promptCount??0;return h.jsx("div",{className:Xe.server,children:h.jsxs("div",{className:`${Xe.serverCard} ${R?Xe.serverCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${Xe.row} ${Xe.serverRow} ${R?Xe.expandedRow:""}`,onClick:()=>D(I.name),"aria-label":t(R?"mcp.collapse":"mcp.expand"),children:[h.jsxs("span",{className:Xe.rowMain,children:[h.jsx("span",{className:Xe.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Xe.name} ${Xe.serverName}`,children:I.name})]}),h.jsx("span",{className:`${Xe.status} ${q.className}`,children:q.text}),h.jsx("span",{className:`${Xe.badge} ${Xe.toolCount}`,children:t(J===1?"mcp.toolCount":"mcp.toolsCount",{count:J})}),ee>0?h.jsx("span",{className:`${Xe.badge} ${Xe.resourceCount}`,children:t("mcp.resourceCount",{count:ee})}):null,N>0?h.jsx("span",{className:`${Xe.badge} ${Xe.promptCount}`,children:t("mcp.promptCount",{count:N})}):null,h.jsx("span",{className:Xe.chevronCell,"aria-hidden":"true",children:h.jsx(Lv,{expanded:R})})]}),R?h.jsxs("div",{className:Xe.serverDetail,children:[V.length>0?h.jsx("div",{className:Xe.serverDetailHeader,children:h.jsx("div",{className:Xe.serverActions,children:V.map(B=>h.jsx("button",{type:"button",className:Xe.button,onClick:()=>void M(I,B),disabled:v!==null,children:B.label},B.id))})}):null,(w==null?void 0:w.serverName)===I.name?h.jsx("pre",{className:Xe.message,children:w.text}):null,P.length===0?h.jsx("div",{className:Xe.emptyTools,children:t("mcp.emptyTools")}):h.jsx("div",{className:Xe.tools,children:P.map(B=>{const k=nE(I.name,B.name),Q=f.has(k);return h.jsxs("div",{className:Xe.tool,children:[h.jsxs("button",{type:"button",className:`${Xe.row} ${Xe.toolRow} ${Q?Xe.expandedRow:""} ${B.isValid?"":Xe.disabled}`,onClick:()=>O(I.name,B.name),children:[h.jsx("span",{className:Xe.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:Xe.name,children:B.name}),h.jsx(Lv,{expanded:Q})]}),Q?h.jsx(QCe,{tool:B,t}):null]},B.name)})}),ee>0?h.jsxs("div",{className:Xe.resources,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.resources")}),F.length===0?h.jsx("div",{className:Xe.emptyTools,children:t("mcp.resourcesUnavailable")}):null,F.map(B=>{const k=rE(I.name,B.uri),Q=p.has(k),ce=B.title||B.name||"";return h.jsxs("div",{className:Xe.tool,children:[h.jsxs("button",{type:"button",className:`${Xe.row} ${Xe.toolRow} ${Q?Xe.expandedRow:""}`,onClick:()=>A(I.name,B.uri),children:[h.jsx("span",{className:Xe.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Xe.name} ${Xe.resourceUri}`,children:B.uri}),ce&&ce!==B.uri?h.jsx("span",{className:Xe.resourceLabel,children:ce}):null,h.jsx(Lv,{expanded:Q})]}),Q?h.jsx(JCe,{resource:B,t}):null]},B.uri)})]}):null]}):null]})},I.name)})]},j.label))})]})}function V3(e){return Hy.includes(e)}async function eAe({sessionActions:e,modelId:t,modeId:n,warn:r=console.warn}){await e.createSession();try{await e.attachSession()}catch(s){throw r("[WebShell] failed to attach new session:",s),await e.closeSession().catch(i=>{r("[WebShell] failed to close unattached session:",i)}),await e.clearSession().catch(i=>{r("[WebShell] failed to clear unattached session:",i)}),s}await Promise.all([t?e.setModel(t).catch(s=>{r("[WebShell] failed to set model for new session:",s)}):Promise.resolve(),n&&V3(n)?e.setApprovalMode(n).catch(s=>{r("[WebShell] failed to set approval mode for new session:",s)}):Promise.resolve()])}function tAe({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function nAe({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"common.loading":t||n?"editor.processing":"editor.placeholder"}function rAe({connectionStatus:e}){return e==="disconnected"||e==="error"}const Zh=g.createContext(!1),i6=g.createContext(new Map),TP=g.createContext(new Map);function sAe({timeline:e,details:t,children:n}){return h.jsx(i6.Provider,{value:e,children:h.jsx(TP.Provider,{value:t,children:n})})}const mg=Hy,iAe="ui.compactMode",oAe="ui.hideTips",aAe=new Set(["coder-model(qwen-oauth)"]),lAe={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function sE(e){return!aAe.has(e.id)}function jv(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const CP=new Set(["clear","stop","off","reset","none","cancel"]);function cAe(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return CP.has(t)}function uAe(e){const t=e;return t.source!=="goal"?null:Z1(t.data)??Z1(t.text)}function dAe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=uAe(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const iE={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},AP=1e3,EP="qwen-code-web-shell-chat-width",hAe=40,MP="qwen-code-web-shell-sidebar-collapsed";function fAe(e){return e===!0?{enabled:!0,defaultCollapsed:!1}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1}:{enabled:!1,defaultCollapsed:!1}}function mAe(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(MP);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function pAe(e){try{window.localStorage.setItem(MP,String(e))}catch{}}function Yg(){return`${AP}`}function gAe(){if(typeof window>"u")return Yg();try{return window.localStorage.getItem(EP)==="wide"?"wide":Yg()}catch{return Yg()}}function yAe(e){try{window.localStorage.setItem(EP,e)}catch{}}function IP(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:AP}function bAe(e,t){const n=`${IP(t)}px`,r=`calc(${n} + ${hAe}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":r,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":r}}function oE(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function vAe(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return dc(e.get("language")??e.get("lang")??navigator.language)}function wAe(e,t){return e instanceof Error?e.message:t}function Dv(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function gd(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function xAe(e){e.length>0&&console.info("[web-shell] useSessionNotices()",{notices:e})}function _Ae(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function kAe(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function Ov(e){return typeof e=="object"&&e!==null}function SAe(e){if(!Ov(e))return null;const t=e._meta;if(!Ov(t))return null;const n=t.qwenModelSwitch;if(!Ov(n))return null;const r=n.authType,s=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof r!="string"||typeof s!="string"||typeof i!="string"||typeof o!="string"?null:{authType:r,modelId:s,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function TAe(e){return`Using ${e.isRuntime?"runtime ":""}model: ${e.modelId}`}function CAe(e){return e.toolKind==="edit"}function aE(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Yh(e.toolName):!0}function AAe(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 EAe(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 MAe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)(VN(r)||EAe(r))&&t.push(`${r.callId}:${r.status}`);return t.join("|")}function IAe(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 NAe(e,t){return e===Jr.NO_OUTPUT?t("copy.noOutput"):e===Jr.NO_TEXT?t("copy.noText"):e===Jr.CODE_MISSING?t("copy.codeMissing"):e===Jr.LATEX_MISSING?t("copy.latexMissing"):e===Jr.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Jr.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Jr.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Jr.CLIPBOARD_PREFIX.length)}`:e.endsWith(Jr.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Jr.COPIED_SUFFIX.length)}):e}function RAe({onSessionIdChange:e,theme:t,onThemeChange:n,language:r,onLanguageChange:s,className:i,style:o,onConnectionChange:a,onStreamingStateChange:l,onError:c,onBugReport:u,hiddenSlashCommands:d,slashCommandCategoryOrder:f,renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:w,renderComposerToolbarEnd:b,renderComposerToolbarRight:v,renderFooter:x,chatMaxWidth:S,sidebar:C,composerToolbarActions:E,compactThinking:M=!1,collapseCompletedTurns:D=!0,markdownTableMode:O="basic",virtualScrollThreshold:A,markdown:j,loadingPhrases:I,onTranscriptChange:P,onToast:F,composerRef:q,onComposerReady:R,composerInput:V,composerInputVersion:J}={}){var L6;const[ee,N]=g.useState(gAe),[G,B]=g.useState(()=>r===void 0?vAe():dc(r)),k=g.useMemo(()=>KN(G),[G]),Q=g.useMemo(()=>fAe(C),[C]),[ce,pe]=g.useState(()=>mAe(Q.defaultCollapsed)),[be,ye]=g.useState(null),[ie,re]=g.useState(!1),oe=g.useCallback(()=>re(!1),[]);g.useEffect(()=>{const $=window.matchMedia("(max-width: 760px)"),K=ge=>{ge.matches||re(!1)};return $.addEventListener("change",K),()=>$.removeEventListener("change",K)},[]),g.useEffect(()=>{if(!ie)return;const $=ct=>{if(ct.key!=="Escape"||Sn.current)return;const Ot=ct.target;Z0(Ot)&&!(Ot!=null&&Ot.closest("[data-mobile-drawer]"))||(ct.stopPropagation(),ct.preventDefault(),oe())},K=document.body.style.overflow;document.body.style.overflow="hidden";const ge=ct=>{const Ot=ct.target;Ot!=null&&Ot.closest("[data-mobile-drawer]")&&!Ot.closest(`.${Yt.mobileBackdrop}`)||ct.preventDefault()};return document.addEventListener("touchmove",ge,{passive:!1}),window.addEventListener("keydown",$,!0),()=>{document.body.style.overflow=K,document.removeEventListener("touchmove",ge),window.removeEventListener("keydown",$,!0)}},[ie,oe]);const ve=g.useCallback($=>{pe($),pAe($)},[]),qe=g.useMemo(()=>({renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:w,renderComposerToolbarEnd:b,renderComposerToolbarRight:v,renderFooter:x,compactThinking:M,collapseCompletedTurns:D,markdownTableMode:O,markdown:j,loadingPhrases:I}),[m,p,y,w,b,v,x,M,D,O,j,I]),We=x,te=c5(),we=Gy(),Se=ml(),Ne=Ky(),{notices:Pt,dismissNotice:at}=xV(),vt=Rc(),Tt=g.useRef(F);Tt.current=F;const rt=g.useRef(0),[tt,Qe]=g.useState([]),ne=g.useCallback($=>{Qe(K=>K.filter(ge=>ge.id!==$))},[]),se=g.useCallback(($,K)=>{if(Tt.current){Tt.current($,K);return}const ge={id:`web-shell-toast-${Date.now()}-${++rt.current}`,tone:$,message:K};Qe(ct=>[...ct.filter(yt=>yt.tone!==$||yt.message!==K),ge].slice(-4))},[]),De=B9e(k),lt=g.useRef(De);lt.current=De;const[ae,ze]=g.useState(null),[Je,Nt]=g.useState(null),Ut=g.useRef(1),he=g.useRef(1),Y=g.useRef(null),me=g.useRef(Se.sessionId),le=g.useRef(void 0),Ke=g.useMemo(()=>{const $=[ae].filter(ge=>ge!==null);if($.length===0)return XA(De);const K=[...De];for(const ge of $.sort((ct,Ot)=>ct.anchorIndex-Ot.anchorIndex)){const ct=ge.anchorAfterId?K.findIndex(yt=>yt.id===ge.anchorAfterId):-1,Ot=ct>=0?ct+1:Math.min(ge.anchorIndex,K.length);K.splice(Ot,0,ge.message)}return XA(K)},[De,ae]),_t=a9e(we),Et=g.useMemo(()=>DV(_t),[_t]),Ze=$9e(Et),Kt=!(Se.catchingUp&&be!==null),Wn=aE(Ze)&&Kt?Ze:null,yn=Ze&&!aE(Ze)&&Kt?Ze:null,Sn=g.useRef(Ze);Sn.current=Kt?Ze:null;const Ie=g.useMemo(()=>Fhe(De),[De]),bt=g.useRef(null),Qt=g.useMemo(()=>{const $=qhe(De),K=bt.current;if(K&&K.signature===$)return K.timeline;const ge=Uhe(De);return bt.current={signature:$,timeline:ge},ge},[De]),Wr=g.useRef(null),ni=g.useMemo(()=>{const $=Hhe(De),K=Wr.current;if(K&&K.signature===$)return K.details;const ge=Xhe(De);return Wr.current={signature:$,details:ge},ge},[De]),Gi=z9e(Ie.todos,$=>`${$.id}:${$.status}:${$.content}`),Po=Ie.allCompleted,[Gn,kr]=g.useState("hidden"),Gr=Se.catchingUp||Gi.length===0||Po?"hidden":"active";Gr!==Gn&&kr(Gr);const An=Gr!=="hidden",$o=g.useMemo(()=>MAe(De),[De]),[Cs,So]=g.useState(0),xe=u9e($o,Se.status==="connected",Cs),Be=g.useMemo(()=>x?xe.map(IAe):[],[xe,x]),Dt=g.useRef(null),rn=g.useRef(null),qt=g.useRef(null),on=g.useRef(null),nr=g.useRef(null),[Kr,Yr]=g.useState(!1),fn=g.useRef(null),sn=g.useRef(!1),mt=g.useCallback(($="smooth")=>{requestAnimationFrame(()=>{var K;(K=rn.current)==null||K.scrollToBottom($),requestAnimationFrame(()=>{var ge;(ge=rn.current)==null||ge.scrollToBottom($)})})},[]),Aa=g.useCallback($=>{qt.current=$,oE(q,$??iE),$&&on.current!==$&&(on.current=$,R==null||R($))},[q,R]);g.useEffect(()=>{oE(q,qt.current??iE)},[q]);const[br,or]=g.useState(null),os=g.useRef(null);os.current=br;const{followupState:zo,onAcceptFollowup:xl,onDismissFollowup:ef,clear:td}=LV({onAccept:$=>{var K;(K=qt.current)==null||K.insertText($)}}),Kn=u5(),ri=g.useRef(Kn),Pc=g.useRef(Date.now()),X=g.useRef(Kn);X.current==="idle"&&Kn!=="idle"&&(Pc.current=Date.now()),X.current=Kn;const de=g.useMemo(()=>{if(Kn!=="idle"){for(let $=Ke.length-1;$>=0;$--){const K=Ke[$];if((K==null?void 0:K.role)==="user")return K.timestamp??Pc.current}return Pc.current}},[Ke,Kn]),Re=g.useRef(""),st=g.useRef(void 0),en=g.useRef(null),jt=g.useRef(null),[mn,En]=g.useState(!1),Pn=g.useRef(mn);Pn.current=mn;const Tn=Se.status==="connected",[As,Fo]=g.useState([]);g.useEffect(()=>{Tn&&vt.loadSkillsStatus().then($=>{Fo((($==null?void 0:$.skills)??[]).map(K=>({name:K.name,description:K.description??""})).sort((K,ge)=>K.name.localeCompare(ge.name)))}).catch(()=>{})},[Tn,vt]);const[as,si]=g.useState(null),[Ki,tf]=g.useState([]),[Uo,Yi]=g.useState(!1),[Te,fe]=g.useState(!1),[et,pt]=g.useState(!1),[Rt,Mt]=g.useState(!1),[cn,tn]=g.useState(!1),[vr,$s]=g.useState(!1),[ar,xn]=g.useState(!1),[Yn,Xi]=g.useState(!1),[Qi,$c]=g.useState(!1),[zc,$b]=g.useState(null),[o6,nf]=g.useState(!1),[a6,l6]=g.useState(!1),[c6,zb]=g.useState(!1),[jP,DP]=g.useState(0),[OP,BP]=g.useState(0),zs=Yu(),u6=g.useRef((zs==null?void 0:zs.extensionsVersion)??0);g.useEffect(()=>{const $=(zs==null?void 0:zs.extensionsVersion)??0;if($!==u6.current){u6.current=$;const K=zs==null?void 0:zs.lastExtensionChange;if((K==null?void 0:K.status)==="failed"){te.dispatch([{type:"error",text:k("extensions.action.failed",{name:K.name??"",source:K.source??"",error:K.error??k("error.unknown")})}]);return}if((K==null?void 0:K.status)==="installed"){const ge=K.name??K.source??k("extensions.label");te.dispatch([{type:"status",text:K.version?k("extensions.install.installedWithVersion",{name:ge,version:K.version}):k("extensions.install.installed",{name:ge})}])}else if(K!=null&&K.status){const ge=K.name??K.source??k("extensions.label"),ct=K.status==="updated"&&K.version?"extensions.manage.updatedWithVersion":`extensions.manage.${K.status}`;te.dispatch([{type:"status",text:k(ct,{name:ge,version:K.version??""})}])}Ne.refreshCommands().catch(()=>{te.dispatch([{type:"error",text:k("extensions.commands.refreshFailed")}])})}},[zs==null?void 0:zs.extensionsVersion,zs==null?void 0:zs.lastExtensionChange,Ne,te,k]);const[PP,$P]=g.useState("workspace"),[rf,Fb]=g.useState(null),[zP,d6]=g.useState(!1),[FP,h6]=g.useState(!1),Gm=g.useRef(null),nd=g.useRef(null),[Ub,Km]=g.useState(null),[qb,Hb]=g.useState(t??Rs.Dark),[rd,f6]=g.useState(""),Ym=g.useRef(rd);Ym.current=rd;const sd=g.useCallback($=>{Ym.current=$,f6($)},[]),Xr=g.useRef(Se);Xr.current=Se;const ls=g.useCallback(()=>Xr.current.sessionId?!0:(se("info",k("localCommand.noSession")),!1),[se,k]),UP=Se.displayName,[qo,Vb]=g.useState("default"),Wb=g.useRef(qo);Wb.current=qo;const sf=g.useCallback($=>{Wb.current=$,Vb($)},[]),[Gb,Xm]=g.useState(!1),of=g.useRef(null);g.useEffect(()=>{Se.sessionId&&(of.current=null)},[Se.sessionId]);const m6=g.useCallback(()=>Xr.current.sessionId?Promise.resolve():(of.current||(of.current=(async()=>{const $=Ym.current||Xr.current.currentModel,K=Wb.current||Xr.current.currentMode;await eAe({sessionActions:Ne,modelId:$,modeId:K})})().catch($=>{throw of.current=null,$})),of.current),[Ne]),Ji=g.useCallback(async($,K,ge)=>{var je;td();const ct=!$.trimStart().startsWith("/");!(ge!=null&&ge.retry)&&ct&&(Re.current=$,st.current=K,jt.current=null),En(!1);const Ot=!Xr.current.sessionId;Ot&&Xm(!0);try{await m6()}finally{Ot&&Xm(!1)}const yt={images:K,optimisticUserMessage:ge==null?void 0:ge.optimisticUserMessage,retry:ge==null?void 0:ge.retry};return ge!=null&&ge.clearComposerOnPromptStart&&((je=qt.current)==null||je.clear()),await Ne.sendPrompt($,yt)},[td,m6,Ne]),qP=g.useMemo(()=>(Se.models??[]).filter(sE).map($=>({id:$.id,label:xy($.label||$.id)})),[Se.models]),Ea=Te||et||Rt||cn||vr||ar||Yn||Qi||as!==null||Uo||Ub!==null||zc!==null||rf!==null||o6||a6||c6,It=g.useCallback(($,K)=>{if(Dv($))return;if(hN($)){console.debug("[web-shell] turn error rendered in transcript",$);return}if(gd($)){console.debug("[web-shell] error already handled by notice",$);return}const ge=wAe($,K);console.error("[web-shell]",ge,$),se("error",ge)},[se]),HP=g.useCallback($=>se("success",$),[se]),{queuedPrompts:VP,queuedTexts:WP,enqueuePrompt:Fc,removeQueuedPrompt:GP,insertQueuedPrompt:KP,editQueuedPrompt:YP,editLastQueuedPrompt:XP,clearQueuedPrompts:QP}=KTe({connected:Tn,sessionId:Se.sessionId,clientId:Se.clientId,streamingState:Kn,sessionActions:Ne,store:te,editorRef:qt,reportError:It,notifySuccess:HP,t:k});g.useEffect(()=>{xAe(Pt);for(const $ of Pt)_Ae($)?se(kAe($),$.message):$.category==="lifecycle"?console.debug("[web-shell] daemon notice",$):console.warn("[web-shell] daemon notice",$),at($.id)},[at,Pt,se]);const Kb=g.useRef(u);Kb.current=u,g.useEffect(()=>{var $;me.current=Se.sessionId,($=Y.current)==null||$.abort(),Y.current=null,ze(null),Nt(null),Km(null),Zm.current=0},[Se.sessionId]);const p6=g.useCallback(()=>{var Ot;if(!ls())return;const $=`local-recap-${Ut.current++}`,K=De.length,ge=(Ot=De.at(-1))==null?void 0:Ot.id,ct=Se.sessionId;ze({anchorAfterId:ge,anchorIndex:K,message:{id:$,role:"system",content:`※ ${k("recap.label")}: ${k("recap.loading")}`,variant:"info",source:"recap"}}),Ne.recapSession().then(yt=>{me.current===ct&&ze({anchorAfterId:ge,anchorIndex:K,message:{id:$,role:"system",content:yt.recap?`※ ${k("recap.label")}: ${yt.recap}`:k("recap.empty"),variant:"info",source:"recap"}})},yt=>{me.current===ct&&(ze(null),!Dv(yt)&&!gd(yt)&&console.warn("[web-shell] unhandled recap failure",yt))})},[Se.sessionId,De,ls,Ne,k]),g6=g.useCallback($=>{var yt;const K=$.trim();if(!K){se("error",k("btw.empty"));return}if(!ls())return;const ge=`local-btw-${he.current++}`,ct=Se.sessionId;(yt=Y.current)==null||yt.abort();const Ot=new AbortController;Y.current=Ot,Nt({id:ge,role:"btw",question:K,answer:"",isPending:!0}),Ne.btwSession(K,{signal:Ot.signal}).then(kt=>{me.current===ct&&Y.current===Ot&&(Y.current=null,Nt({id:ge,role:"btw",question:K,answer:kt.answer||k("btw.emptyAnswer"),isPending:!1}))},kt=>{me.current===ct&&Y.current===Ot&&(Y.current=null,Nt(null),!Dv(kt)&&!gd(kt)&&console.warn("[web-shell] unhandled btw failure",kt))})},[Se.sessionId,se,ls,Ne,k]),y6=g.useCallback(()=>{var $;($=Y.current)==null||$.abort(),Y.current=null,Nt(null)},[]);g.useEffect(()=>{const $=K=>{var kt;if(Ea||Ze)return;const ge=Je;if(!ge||ge.role!=="btw")return;const ct=K.key.toLowerCase(),Ot=K.key==="Escape"&&!K.ctrlKey&&!K.metaKey&&!K.altKey&&!K.shiftKey,yt=K.ctrlKey&&!K.metaKey&&!K.altKey&&!K.shiftKey&&(ct==="c"||ct==="d");if(ge.isPending){if(!Ot&&!yt)return}else{const je=((kt=qt.current)==null?void 0:kt.hasInput())??!1;if(!(!K.ctrlKey&&!K.metaKey&&!K.altKey&&!K.shiftKey&&(K.key==="Escape"||!je&&(K.key==="Enter"||K.key===" "))))return}K.preventDefault(),K.stopPropagation(),y6()};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[Ea,Je,y6,Ze]);const Ho=g.useCallback(($,K)=>iTe(ri.current!=="idle",$,K,{append:ge=>te.appendLocalUserMessage(ge)}),[te]),Vo=g.useCallback(()=>(se("error",k("queue.commandBlocked")),!1),[se,k]),Qm=g.useCallback($=>{Hb($),n==null||n($)},[n]),id=g.useCallback($=>{B($),s==null||s($)},[s]),b6=g.useCallback(()=>{$s(!0)},[]),v6=MV({autoLoad:!0}),{settings:Uc,setValue:Ma,reload:w6}=v6,od=Uc.find($=>$.key===ou),ad=Uc.find($=>$.key===oAe),ld=Uc.find($=>$.key===m0),JP=(()=>{var K;const $=(K=Uc.find(ge=>ge.key==="voiceModel"))==null?void 0:K.values.effective;return typeof $=="string"&&$.trim()?$.trim():void 0})(),ZP=(()=>{var K;const $=(K=Uc.find(ge=>ge.key==="visionModel"))==null?void 0:K.values.effective;if(!(typeof $!="string"||!$.trim()))return sTe($.trim())})(),e$=(()=>{var K;const $=(K=Uc.find(ge=>ge.key==="fastModel"))==null?void 0:K.values.effective;return typeof $=="string"&&$.trim()?$.trim():void 0})(),t$=Ife(Uc),[Yb,x6]=g.useState(!1),Xb=g.useRef(Yb);Xb.current=Yb,g.useEffect(()=>{if(t){Hb(t);return}const $=p5(od==null?void 0:od.values.effective);$&&Hb($)},[t,od==null?void 0:od.values.effective]),g.useEffect(()=>{if(r!==void 0){B(dc(r));return}const $=h5(ld==null?void 0:ld.values.effective);$&&B($)},[r,ld==null?void 0:ld.values.effective]);const n$=g.useCallback($=>{const K=G,ge=`/language ui ${$}`;id($);const ct=()=>Promise.all([Ne.refreshCommands(),w6()]);if(ri.current!=="idle"){id(K),Vo();return}Ji(ge).then(ct).catch(Ot=>{id(K),It(Ot,"Failed to sync /language command")})},[Vo,id,w6,It,Ji,G,Ne]),_6=g.useCallback(()=>{if(ri.current!=="idle"){te.dispatch([{type:"status",text:k("clear.blocked")}]);return}te.reset()},[te,k]),k6=g.useCallback(()=>{const $=Xb.current,K=!Xb.current;x6(K),Ma("workspace",iAe,K).catch(ge=>{x6($),It(ge,k("compact.saveFailed"))})},[It,Ma,k]),qc=g.useCallback($=>{if(!V3($)){It(new Error(`Unsupported approval mode: ${$}`),k("local.approvalMode"));return}if(!Xr.current.sessionId){sf($);return}Ne.setApprovalMode($).then(K=>{const ge=K.mode||$;Vb(ge);const ct=Sn.current;if(!ct)return;if($==="yolo"||$==="auto-edit"&&CAe(ct)){const yt=ct.options.find(kt=>kt.kind==="allow_once");if(yt){const kt=ct.title||"";te.dispatch([{type:"status",text:k("mode.autoApproved",{tool:kt})}]),Ne.submitPermission(ct.id,yt.id).catch(je=>{It(je,"Failed to auto-approve tool call")})}}}).catch(K=>{It(K,k("local.approvalMode"))})},[Ne,It,te,k,sf]);g.useEffect(()=>{ri.current=Kn},[Kn]),g.useEffect(()=>{let $=null;for(let ge=we.length-1;ge>=0;ge--){const ct=we[ge];if((ct==null?void 0:ct.kind)==="user")break;if((ct==null?void 0:ct.kind)==="error"&&ct.source==="turn_error"){$=ct.id;break}if((ct==null?void 0:ct.kind)!=="debug")break}const K=Tn&&$!==null&&$!==jt.current&&Re.current.length>0;en.current=K?$:null,En(K)},[we,Tn]),g.useEffect(()=>{l==null||l(Kn)},[Kn,l]),g.useEffect(()=>{a==null||a(Se.status)},[Se.status,a]),g.useEffect(()=>{P==null||P(we)},[we,P]),g.useEffect(()=>{if(Se.error){const $=new Error(Se.error);c==null||c($)}},[Se.error,c]),g.useEffect(()=>{f6(Se.currentModel??"")},[Se.currentModel,Se.sessionId]),g.useEffect(()=>{Vb(Se.currentMode??"default")},[Se.currentMode,Se.sessionId]),g.useEffect(()=>{Se.sessionId&&or(null),le.current!==Se.sessionId&&(le.current=Se.sessionId,e==null||e(Se.sessionId))},[Se.sessionId,e]),g.useEffect(()=>{const $=dAe(we);or(K=>$?(K==null?void 0:K.condition)===$.condition&&K.setAt===$.setAt?K:$:K&&null)},[we]),g.useEffect(()=>{const $=K=>{const ge=K.detail;if(!(ge!=null&&ge.active)){or(null);return}ge.condition&&or({condition:ge.condition,setAt:ge.setAt??Date.now()})};return window.addEventListener(qx,$),()=>window.removeEventListener(qx,$)},[]);const Jm=g.useRef(null),Zm=g.useRef(0);g.useEffect(()=>{Zm.current=0},[Se.sessionId]),g.useEffect(()=>{function ge(){if(document.hidden){Jm.current===null&&(Jm.current=Date.now());return}const ct=Jm.current;if(Jm.current=null,ct===null||Date.now()-ct<18e4||ri.current!=="idle"||!Se.sessionId)return;const Ot=te.getSnapshot().blocks.length;Ot-Zm.current<4||(Zm.current=Ot,Ne.recapSession().then(yt=>{yt.recap&&te.dispatch([{type:"status",text:`※ ${k("recap.label")}: ${yt.recap}`,source:"recap"}])},yt=>{console.error("[auto-recap] failed:",yt)}))}return document.addEventListener("visibilitychange",ge),()=>document.removeEventListener("visibilitychange",ge)},[Se.sessionId,Ne,te,k]);const Qb=g.useCallback(()=>{const $=V3(qo)?mg.indexOf(qo):-1,K=mg[($+1)%mg.length];qc(K)},[qo,qc]),af=g.useCallback(($,K)=>{ls()&&(Ho($)||Ne.getContextUsage({detail:K}).then(ge=>{te.dispatch([{type:"status",text:Vae(ge)}]),mt("smooth")}).catch(ge=>{It(ge,"Failed to load context usage")}))},[Ho,te,ls,Ne,It,mt]),r$=g.useCallback(()=>{af("/context detail",!0)},[af]),ep=g.useCallback($=>{ls()&&Ne.branchSession($||void 0).then(K=>{te.dispatch([{type:"status",text:k("branch.success",{name:K.displayName})}])}).catch(K=>{It(K,k("branch.failed"))})},[It,ls,Ne,te,k]),s$=g.useCallback(()=>{ep()},[ep]),tp=g.useCallback(async()=>{oe();try{return await Ne.clearSession(),!0}catch($){return It($,"Failed to start a new chat"),!1}},[oe,It,Ne]),i$=g.useCallback(async $=>{ye($),oe();try{await Ne.loadSession($)}catch(K){throw ye(ge=>ge===$?null:ge),K}},[oe,Ne]);g.useEffect(()=>{be!==null&&Se.sessionId===be&&!Se.loadingTranscript&&!Se.catchingUp&&ye(null)},[Se.catchingUp,Se.loadingTranscript,Se.sessionId,be]);const Jb=g.useCallback(()=>{ls()&&Ne.getTasks().then($=>{Km({snapshot:$})}).catch($=>{It($,"Failed to load tasks")})},[It,ls,Ne]),S6=g.useCallback(($,K)=>{or({condition:$,setAt:K}),te.dispatch([{type:"status",text:kT({kind:"set",condition:$,setAt:K})}])},[te]),T6=g.useCallback($=>{$&&(te.dispatch([{type:"status",text:kT({kind:"cleared",condition:$.condition,durationMs:Date.now()-$.setAt})}]),or(null))},[te]),np=g.useCallback($=>ls()?(te.appendLocalUserMessage($),Ne.clearGoal().catch(K=>{It(K,"Failed to clear /goal")}),!0):!1,[It,ls,Ne,te]),o$=g.useCallback(()=>Ne.getRewindSnapshots(),[Ne]),a$=g.useCallback($=>Ne.rewindSession($,{rewindFiles:!1}).then(()=>{}),[Ne]),l$=g.useCallback($=>{if(gd($))return;const K=$ instanceof Error?$.message:String($);se("error",k("rewind.failed",{reason:K}))},[se,k]),C6=g.useCallback(($,K,ge)=>{const ct=$.replace(/^\/goal\b/i,"").trim(),Ot=ct.toLowerCase(),yt=(ge==null?void 0:ge.sendToDaemon)??!0,kt=()=>{const je=!Xr.current.sessionId;return Ji($,K,{clearComposerOnPromptStart:je}).catch(Ee=>{It(Ee,"Failed to send /goal command")}),!je};return ct&&CP.has(Ot)?yt?np($):(te.appendLocalUserMessage($),T6(os.current),!0):ct?yt?kt():(te.appendLocalUserMessage($),S6(ct,Date.now()),!0):yt?kt():(te.appendLocalUserMessage($),!0)},[T6,S6,np,It,Ji,te,Xr]),lf=g.useMemo(()=>new Set((d??[]).map(jv).filter(Boolean)),[d]),c$=lf.has("settings"),A6=g.useCallback(($,K)=>{var Ot;if(Xr.current.loadingTranscript)return se("warning",k("editor.sessionLoading")),!1;if(rAe({connectionStatus:Xr.current.status}))return se("warning",k("editor.connectionDisconnected")),!1;const ge=ri.current!=="idle",ct=(yt,kt,je,Ee)=>{const an=!Xr.current.sessionId;return Ji(yt,kt,{...Ee,clearComposerOnPromptStart:an}).catch(Vt=>It(Vt,je)),!an};if($.startsWith("/")){const yt=$.match(/^\/([\w-]+)/);if(yt){const kt=yt[1];if(lf.has(jv(kt)))return ge?Fc($,K):ct($,K,"Failed to send hidden slash command");if(kt==="help")return $s(!0),!0;if(kt==="tasks")return Jb(),!0;if(kt==="goal")return ge?cAe($)?np($):Vo():C6($,K);if(kt==="theme"){const je=$.slice(yt[0].length).trim().toLowerCase();return je==="dark"||je==="light"?Qm(je):je?se("error",k("error.unsupportedTheme")):xn(!0),!0}if(kt==="language"){const je=$.slice(yt[0].length).trim(),[Ee,an]=je.split(/\s+/);if(!je)return te.dispatch([{type:"status",text:[k("language.current",{language:f5(G)}),k("language.usage"),k("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Ee==null?void 0:Ee.toLowerCase())==="ui"){if(!an)return te.dispatch([{type:"status",text:[k("language.set"),"",k("language.usage"),"",k("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Vt=an.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Vt))return se("error",k("language.invalid")),!0;const jr=dc(an);if(id(jr),!ge){const Si=!Xr.current.sessionId;return Ji(`/language ui ${jr}`,void 0,{clearComposerOnPromptStart:Si}).then(()=>Ne.refreshCommands()).catch(Ia=>{It(Ia,"Failed to sync /language command")}),!Si}return!0}}if(kt==="copy"){const je=$.slice(yt[0].length).trim();return Y9e(lt.current,je).then(Ee=>{te.dispatch([{type:Ee.status==="error"?"error":"status",text:NAe(Ee.message,k)}])}).catch(Ee=>{It(Ee,k("copy.failedFallback"))}),!0}if(kt==="delete")return pt(!0),!0;if(kt==="release")return Mt(!0),!0;if(kt==="rewind")return ls()?(tn(!0),!0):!1;if(kt==="branch"){if(ge)return Vo();const je=$.slice(yt[0].length).trim();return ep(je||void 0),!0}if(kt==="fork"){if(ge)return Vo();if(!ls())return!1;const je=$.slice(yt[0].length).trim();return je?(Ne.forkSession(je).then(Ee=>{if(!Ee.launched){se("warning",k("fork.notStarted"));return}So(an=>an+1),se("success",k("fork.started",{name:Ee.description}))}).catch(Ee=>{const an=Ee instanceof Error?Ee.message:String(Ee);It(Ee,k("fork.failed",{reason:an}))}),!0):(se("error",k("fork.empty")),!0)}if(kt==="auth")return zb(!0),!0;if(kt==="model"){const je=$.slice(yt[0].length).trim();if(je==="--fast")return si("fast"),!0;if(je.startsWith("--fast "))return ge?Fc($,K):ct($,K,"Failed to send /model --fast");if(je==="--voice")return Ho($,K)||vt.loadProviders().then(Ee=>{tf(Epe(Ee)),si("voice")}).catch(Ee=>It(Ee,k("model.setVoice"))),!0;if(je.startsWith("--voice ")){const Ee=je.replace(/^--voice\s+/,"");return Ma("workspace","voiceModel",Ee).catch(an=>It(an,k("model.setVoice"))),!0}if(je==="--vision")return si("vision"),!0;if(je.startsWith("--vision ")){const Ee=je.replace(/^--vision\s+/,"");return Ma("workspace","visionModel",Ee).catch(an=>It(an,k("model.setVision"))),!0}if(je){if(!Xr.current.sessionId)return sd(je),!0;Ne.setModel(je).then(()=>{sd(je)}).catch(Ee=>{It(Ee,k("model.switch"))})}else si("main");return!0}if(kt==="plan"){if(ge)return Vo();const je=$.slice(yt[0].length).trim();return Xr.current.sessionId?(je&&Xm(!0),Ne.setApprovalMode("plan").then(()=>{if(sf("plan"),je)return Ji(je,K,{clearComposerOnPromptStart:!0}).catch(Ee=>It(Ee,"Failed to send plan prompt"))}).catch(Ee=>{It(Ee,k("mode.plan"))}).finally(()=>{je&&Xm(!1)}),!je):(sf("plan"),je?ct(je,K,"Failed to send plan prompt"):!0)}if(kt==="approval-mode"){const je=$.slice(yt[0].length).trim();return je?qc(je):Yi(!0),!0}if(kt==="mcp"){const je=$.slice(yt[0].length).trim().toLowerCase();return vt.loadMcpStatus().then(async Ee=>{const an={},Vt={};await Promise.all(((Ee==null?void 0:Ee.servers)??[]).map(async Xn=>{await Promise.all([(async()=>{try{an[Xn.name]=await vt.loadMcpTools(Xn.name)}catch{}})(),(async()=>{if(Xn.resourceCount)try{Vt[Xn.name]=await vt.loadMcpResources(Xn.name)}catch{}})()])})),$b({status:Ee,toolsByServer:an,resourcesByServer:Vt,showDescriptions:je==="desc",showSchema:je==="schema",showTips:!je})}).catch(Ee=>{It(Ee,"Failed to load MCP status")}),!0}if(kt==="skills")return $.slice(yt[0].length).trim()?ge?Fc($,K):ct($,K,"Failed to send /skills command"):(Ho($,K)||vt.loadSkillsStatus().then(Ee=>{const an=((Ee==null?void 0:Ee.skills)??[]).map(Vt=>({name:Vt.name,description:Vt.description??""})).sort((Vt,Xn)=>Vt.name.localeCompare(Xn.name));if(Fo(an),an.length===0)te.dispatch([{type:"status",text:k("skills.none")}]);else{const Vt=an.map(Xn=>`- ${Xn.name}`).join(`
`);te.dispatch([{type:"status",text:`${k("skills.available")}

${Vt}`}])}mt("smooth")}).catch(Ee=>{It(Ee,"Failed to load skills")}),!0);if(kt==="tools"){const je=$.slice(yt[0].length).trim().toLowerCase();if(je==="desc"||je==="descriptions")Xi(!0);else{if(Ho($,K))return!0;vt.loadToolsStatus().then(Ee=>{const an=(Ee==null?void 0:Ee.tools)??[];if(an.length===0)te.dispatch([{type:"status",text:k("tools.none")}]);else{const Vt=an.map(Xn=>`- ${Xn.displayName||Xn.name}`).join(`
`);te.dispatch([{type:"status",text:`${k("tools.available")}

${Vt}`}])}mt("smooth")}).catch(Ee=>{It(Ee,"Failed to load tools")})}return!0}if(kt==="settings")return nf(!0),!0;if(kt==="context"){const je=$.slice(yt[0].length).trim().toLowerCase();if(je===""||je==="detail"||je==="-d")return af($,je==="detail"||je==="-d"),!0}if(kt==="memory"){const je=$.slice(yt[0].length).trim().toLowerCase();if(je==="refresh")DP(Ee=>Ee+1);else if(je==="add"||je.startsWith("add ")){const Ee=je.slice(3).trim();$P(Ee==="user"||Ee==="global"?"global":"workspace"),BP(an=>an+1)}return l6(!0),!0}if(kt==="agents"){const je=$.slice(yt[0].length).trim().toLowerCase();let Ee="menu";return je==="create"?Ee="create":je==="create user"||je==="create global"?Ee="create-user":je==="create project"||je==="create workspace"?Ee="create-project":je==="manage"&&(Ee="manage"),Fb(Ee),!0}if(kt==="extensions"){const je=$.slice(yt[0].length).trim(),Ee=(Ot=je.split(/\s+/)[0])==null?void 0:Ot.toLowerCase();if(!Ee||Ee==="manage")return $c(!0),!0;if(Ee==="install"){if(ge)return Vo();const an=je.slice(7).trim().split(/\s+/);let Vt="",Xn,jr,Si,Ia,Wo=null;for(let Zi=0;Zi<an.length;Zi++){const Fs=an[Zi];if(Fs)if(Fs==="--auto-update")Si=!0;else if(Fs==="--pre-release"||Fs==="--allow-pre-release")Ia=!0;else if(Fs==="--ref"||Fs==="--registry"){const Hc=an[Zi+1];if(!Hc||Hc.startsWith("--")){Wo=k("extensions.install.missingOptionValue",{option:Fs});break}Fs==="--ref"?Xn=Hc:jr=Hc,Zi+=1}else if(Fs.startsWith("--")){Wo=k("extensions.install.unknownOption",{option:Fs});break}else if(!Vt)Vt=Fs;else{Wo=k("extensions.install.usage");break}}if(Wo)return te.appendLocalUserMessage($),te.dispatch([{type:"error",text:Wo}]),!0;if(!Vt)return te.appendLocalUserMessage($),te.dispatch([{type:"error",text:k("extensions.install.usage")}]),!0;const Go=Xr.current.clientId;return Go?(te.appendLocalUserMessage($),te.dispatch([{type:"status",text:k("extensions.install.started",{source:Vt})}]),vt.installExtension({source:Vt,...Xn?{ref:Xn}:{},...jr?{registry:jr}:{},...Si!==void 0?{autoUpdate:Si}:{},...Ia!==void 0?{allowPreRelease:Ia}:{},consent:!0},Go).then(()=>{}).catch(Zi=>{It(Zi,k("extensions.install.requestFailed"))}),!0):(se("warning",k("extensions.install.waitForSession")),!0)}return Ho($,K)||te.dispatch([{type:"error",text:k("extensions.install.usage")}]),!0}if(kt==="clear"||kt==="new"||kt==="reset")return tp(),!0;if(kt==="rename"){const je=AAe($.slice(yt[0].length));if(je.type==="auto"||je.type==="delegate")return ge?Fc($,K):ct($,K,"Failed to send /rename command");const Ee=je.displayName;return Ee?ls()?(Ne.renameSession(Ee).then(()=>{te.dispatch([{type:"status",text:k("rename.success",{name:Ee})}])}).catch(an=>{It(an,"Failed to rename session")}),!0):!1:(se("error",k("rename.empty")),!0)}if(kt==="resume"){const je=$.slice(yt[0].length).trim();return je?(oe(),Ne.loadSession(je).catch(Ee=>{It(Ee,"Failed to load session")})):(oe(),fe(!0)),!0}if(kt==="recap")return p6(),!0;if(kt==="btw")return g6($.slice(yt[0].length)),!0;if(kt==="stats"){const je=$.slice(yt[0].length).trim().toLowerCase();let Ee="overview";return je==="model"?Ee="model":je==="tools"&&(Ee="tools"),ls()?(Ho($,K)||Ne.getStats().then(an=>{te.dispatch([{type:"status",text:Ile(an,Ee)}]),mt("smooth")}).catch(()=>{}),!0):!1}if(kt==="status"||kt==="about")return Ho($,K)||Promise.all([vt.loadPreflight().catch(()=>null),vt.loadProviders().catch(()=>null),vt.loadEnv().catch(()=>null)]).then(([je,Ee,an])=>{var Hc,j6,D6,O6,B6,P6;const Vt=QA(je,an);let Xn=Vt.authSource;!Xn&&((Hc=Ee==null?void 0:Ee.current)!=null&&Hc.authType)&&(Xn=Ee.current.authType);const jr=[];Vt.nodeVersion&&jr.push(`Node.js v${Vt.nodeVersion}`),Vt.npmVersion&&jr.push(`npm ${Vt.npmVersion}`);let Si="";Xn&&(Xn.startsWith("oauth")||Xn==="qwen-oauth"?Si="Qwen OAuth":Si=`API Key - ${Xn}`);const Ia=`${Vt.platform} ${Vt.arch}`.trim(),Wo=Ym.current,Go=Xr.current,Fs={cliVersion:((j6=Go.capabilities)==null?void 0:j6.qwenCodeVersion)||"",runtime:jr.join(" / "),platform:Ia,auth:Si,baseUrl:((D6=Ee==null?void 0:Ee.current)==null?void 0:D6.baseUrl)||"",model:Wo||Go.currentModel||((O6=Ee==null?void 0:Ee.current)==null?void 0:O6.modelId)||"",fastModel:((B6=Ee==null?void 0:Ee.current)==null?void 0:B6.fastModelId)||Wo||Go.currentModel||((P6=Ee==null?void 0:Ee.current)==null?void 0:P6.modelId)||"",sessionId:Go.sessionId||"",sandbox:Vt.sandbox,proxy:Vt.proxy,memoryUsage:Vt.memoryUsage};te.dispatch([{type:"status",text:Gle(Fs)}]),mt("smooth")}),!0;if(kt==="bug"){const je=$.slice(yt[0].length).trim();return Ho($,K)||Promise.all([vt.loadPreflight().catch(()=>null),vt.loadEnv().catch(()=>null)]).then(([Ee,an])=>{var Si;const Vt=QA(Ee,an),Xn=((Si=Xr.current.capabilities)==null?void 0:Si.qwenCodeVersion)||"",jr={};if(Xn&&(jr.cliVersion=Xn),Vt.nodeVersion&&(jr.nodeVersion=Vt.nodeVersion),Vt.npmVersion&&(jr.npmVersion=Vt.npmVersion),Vt.platform&&(jr.platform=Vt.platform),Vt.arch&&(jr.arch=Vt.arch),Vt.sandbox&&(jr.sandbox=Vt.sandbox),Vt.memoryUsage&&(jr.memoryUsage=Vt.memoryUsage),Kb.current)Kb.current({title:je,systemInfo:jr}),te.dispatch([{type:"status",text:k("bug.submitted")}]);else{const Ia=Object.entries(jr).filter(([,Zi])=>Zi).map(([Zi,Fs])=>`${Zi}: ${Fs}`).join(`
`),Wo=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(je)}&info=${encodeURIComponent(`
`+Ia+`
`)}`,Go=window.open(Wo,"_blank");Go?(Go.opener=null,te.dispatch([{type:"status",text:k("bug.submitted")}])):se("error",k("bug.popupBlocked"))}}).catch(Ee=>{It(Ee,k("bug.failed"))}),!0}}return ge?Fc($,K):ct($,K,"Failed to send command")}else if($.startsWith("!")){if(ge)return se("error",k("queue.shellBlocked")),!1;const yt=$.slice(1).trim();return!yt||!ls()?!1:(Ne.sendShellCommand(yt).catch(kt=>{It(kt,"Failed to execute shell command")}),!0)}else return ge?Fc($,K):ct($,K,"Failed to send message")},[Ji,Ne,te,Fc,Ho,ep,oe,tp,np,C6,Qm,qc,id,Vo,Jb,lf,se,It,p6,g6,ls,mt,G,sd,sf,Ma,af,k,vt]),u$=g.useCallback(($,K)=>{const ge=A6($,K);return ge!==!1&&mt("smooth"),ge},[A6,mt]),E6=g.useCallback(($,K,ge)=>{Ne.submitPermission($,K,ge).catch(ct=>{It(ct,"Failed to submit permission choice")})},[Ne,It]),Zb=g.useCallback(()=>{Ne.cancel().catch($=>{It($,"Failed to cancel request")})},[Ne,It]),d$=g.useCallback(()=>{var $;return Ea?!1:(($=Dt.current)==null?void 0:$.focusTaskPill())??!1},[Ea]),h$=g.useCallback($=>{var K,ge;if($){(K=qt.current)==null||K.insertText($);return}(ge=qt.current)==null||ge.focus()},[]),f$=g.useCallback($=>{Yr($)},[]),e2=g.useCallback(()=>{Pn.current&&Tn&&ri.current==="idle"&&en.current&&Re.current?(jt.current=en.current,En(!1),Ji(Re.current,st.current,{optimisticUserMessage:!1,retry:!0}).catch($=>It($,"Failed to retry prompt"))):te.dispatch([{type:"status",text:k("retry.none")}])},[Tn,Ji,It,te,k]);g.useEffect(()=>{const $=K=>{if(!Ea&&K.ctrlKey&&!K.metaKey&&!K.altKey&&!K.shiftKey){if(K.key==="l"){K.preventDefault(),_6();return}if(K.key==="o"){K.preventDefault(),k6();return}if(K.key==="y"){K.preventDefault(),e2();return}}};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[Ea,_6,k6,e2,te,k]);const _l=g.useCallback(()=>{Gm.current=null,d6(!1),h6(!1),nd.current&&(clearTimeout(nd.current),nd.current=null)},[]),M6=g.useRef({streamingState:Kn,pendingApproval:Ze,interactionBlocked:Ea,handleCancel:Zb,handleCycleMode:Qb});M6.current={streamingState:Kn,pendingApproval:Ze,interactionBlocked:Ea,handleCancel:Zb,handleCycleMode:Qb};const m$=Kn!=="idle";g.useEffect(()=>{_l()},[m$,_l]),g.useEffect(()=>{const ge=(Ot,yt)=>{Gm.current=Ot,Ot==="cancel"?h6(!0):d6(!0),nd.current&&clearTimeout(nd.current),nd.current=setTimeout(_l,yt)},ct=Ot=>{var je,Ee;if(Ot.defaultPrevented||Ot.isComposing)return;const yt=M6.current;if(Ot.key!=="Escape"){Gm.current!==null&&_l(),Ot.key==="Tab"&&Ot.shiftKey&&!yt.interactionBlocked&&(Ot.preventDefault(),yt.handleCycleMode());return}const kt=tTe({blocked:!!yt.pendingApproval||yt.interactionBlocked,streaming:yt.streamingState!=="idle",hasInput:!!((je=qt.current)!=null&&je.hasInput()),armed:Gm.current});if(kt.kind!=="ignore")switch(Ot.preventDefault(),kt.kind){case"cancel":yt.handleCancel(),_l();break;case"clear":(Ee=qt.current)==null||Ee.clear(),_l();break;case"arm":ge(kt.action,kt.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",ct),()=>{window.removeEventListener("keydown",ct),_l()}},[_l]);const p$=tAe({catchingUp:!!Se.catchingUp,pendingApproval:Ze!==null,isPreparingPrompt:Gb}),t2=g.useCallback($=>{if(!Xr.current.sessionId){sd($);return}Ne.setModel($).then(K=>{const ge=SAe(K);sd((ge==null?void 0:ge.modelId)??$),ge&&te.dispatch({type:"debug",text:TAe(ge),source:"model_switch_summary",data:ge})}).catch(K=>{It(K,k("model.switch"))})},[Ne,te,It,k,sd]),g$=g.useCallback($=>{if(Kn!=="idle"){Vo();return}Ji(`/model --fast ${$}`).catch(K=>{It(K,"Failed to switch fast model")})},[Vo,Ji,Kn,It]),y$=g.useCallback($=>{const K=rTe($);Ma("workspace","voiceModel",K).catch(ge=>It(ge,k("model.setVoice")))},[It,Ma,k]),b$=g.useCallback($=>{const K=nTe($);Ma("workspace","visionModel",K).catch(ge=>It(ge,k("model.setVision")))},[It,Ma,k]),v$={main:t2,fast:g$,voice:y$,vision:b$},I6=g.useMemo(()=>{const $=new Set(Se.skills??[]);return o9e(Se.commands??[],i9e(k)).filter(K=>!lf.has(jv(K.name))).map(K=>$.has(K.name)?{...K,displayCategory:"skill",description:K.description||k("skills.run")}:K)},[Se.commands,Se.skills,lf,k]),cf=g.useMemo(()=>{var $;return{version:(($=Se.capabilities)==null?void 0:$.qwenCodeVersion)||"",cwd:Se.workspaceCwd||"",currentModel:rd,currentMode:qo,hideTips:(ad==null?void 0:ad.values.effective)===!0}},[(L6=Se.capabilities)==null?void 0:L6.qwenCodeVersion,Se.workspaceCwd,rd,qo,ad==null?void 0:ad.values.effective]),w$=g.useMemo(()=>p?p(cf):h.jsx(G3e,{...cf}),[p,cf]),N6=g.useMemo(()=>y==null?void 0:y(cf),[y,cf]),kl=!Se.sessionId&&Ke.length===0&&!An&&!Ze&&!Je,n2=kl?Yg():ee,x$=IP(S),_$=[Yt.app,Yt.appChat,kl?Yt.appChatEmpty:void 0,Q.enabled?Yt.appWithSidebar:void 0,qb===Rs.Light?Yt.themeLight:Yt.themeDark,i].filter(Boolean).join(" "),k$=g.useMemo(()=>({...o,...bAe(n2,S)}),[S,n2,o]),R6=g.useCallback($=>{N($),yAe($)},[]);return g.useLayoutEffect(()=>{const $=nr.current;if(!$)return;const K=fn.current,ge=sn.current,ct=$.getBoundingClientRect();if(ge&&!kl&&K){const Ot=K.top-ct.top;Math.abs(Ot)>1&&($.style.transition="width 320ms ease",$.style.transform=`translateY(${Ot}px)`,requestAnimationFrame(()=>{$.style.transition="width 320ms ease, transform 280ms ease",$.style.transform=""}),window.setTimeout(()=>{$.style.transition=""},320))}fn.current=ct,sn.current=kl},[kl]),h.jsx(vW,{value:qb,children:h.jsx(aW,{language:G,children:h.jsxs("div",{className:_$,style:k$,"data-web-shell-root":!0,children:[!F&&h.jsx(C3e,{toasts:tt,onDismiss:ne}),Te&&h.jsx(ys,{title:k("resume.title"),size:"lg",onClose:()=>fe(!1),children:h.jsx(C_e,{onSelect:$=>{oe(),Ne.loadSession($).catch(K=>{It(K,"Failed to load session")})},onClose:()=>fe(!1)})}),as&&h.jsx(ys,{title:k(lAe[as]),size:"lg",onClose:()=>si(null),children:h.jsx(G_e,{mode:as,models:as==="voice"?Ki:void 0,currentModelId:as==="voice"?JP:as==="vision"?ZP:as==="fast"?e$:void 0,onSelect:$=>{as&&v$[as]($),si(null)}})}),Uo&&h.jsx(ys,{title:k("mode.select"),size:"sm",onClose:()=>Yi(!1),children:h.jsx(T_e,{currentMode:qo,onSelect:$=>{qc($),Yi(!1)}})}),Yn&&h.jsx(ys,{title:k("tools.title"),size:"lg",onClose:()=>Xi(!1),children:h.jsx(t6e,{})}),Qi&&h.jsx(ys,{title:k("extensions.manage.title"),size:"lg",onClose:()=>$c(!1),children:h.jsx(i6e,{})}),zc&&h.jsx(ys,{title:k("mcp.manageServers"),size:"lg",onClose:()=>$b(null),children:h.jsx(ZCe,{message:zc,onClose:()=>$b(null)})}),Ub&&h.jsx(ys,{title:k("tasks.title"),size:"lg",onClose:()=>Km(null),children:h.jsx(fD,{message:Ub,embedded:!0,manageActiveEvent:!1,onClose:()=>Km(null)})}),rf&&h.jsx(ys,{title:k(rf==="manage"?"agent.manage":rf==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>Fb(null),children:h.jsx(oke,{mode:rf,embedded:!0,onMessage:$=>te.dispatch([{type:"status",text:$}]),onClose:()=>Fb(null)})}),o6&&h.jsx(ys,{title:k("settings.title"),size:"lg",onClose:()=>nf(!1),children:h.jsx(V6e,{settingsState:v6,embedded:!0,onLanguageChange:n$,onThemeChange:Qm,chatWidthMode:ee,onChatWidthModeChange:R6,onSubDialog:$=>{nf(!1),$==="fastModel"?si("fast"):$==="visionModel"?si("vision"):$==="tools.approvalMode"&&Yi(!0)}})}),a6&&h.jsx(ys,{title:k("memory.menu"),size:"lg",onClose:()=>l6(!1),children:h.jsx(Cke,{refreshSignal:jP,addSignal:OP,addScope:PP,onMessage:($,K="status")=>{te.dispatch([{type:K,text:$}])}})}),vr&&h.jsx(ys,{title:k("help.title"),size:"md",onClose:()=>$s(!1),children:h.jsx(TSe,{commands:I6})}),ar&&h.jsx(ys,{title:k("theme.title"),size:"sm",onClose:()=>xn(!1),children:h.jsx(CSe,{currentTheme:qb,onSelect:Qm,onClose:()=>xn(!1)})}),c6&&h.jsx(ys,{title:k("auth.title"),size:"lg",onClose:()=>zb(!1),children:h.jsx(Zke,{onMessage:($,K="status")=>{te.dispatch([K==="error"?{type:"error",text:$}:{type:"status",text:$}])},onClose:()=>zb(!1)})}),et&&h.jsx(ys,{title:k("delete.title"),size:"lg",onClose:()=>pt(!1),children:h.jsx(ASe,{onDeleted:$=>{te.dispatch([{type:"status",text:$.length===1?`${k("delete.deleted")} (${$[0].slice(0,8)})`:k("delete.deletedCount",{count:$.length})}])},onError:$=>{if(gd($))return;const K=$ instanceof Error?$.message:String($);se("error",k("delete.failed",{reason:K}))},onClose:()=>pt(!1)})}),Rt&&h.jsx(ys,{title:k("release.title"),size:"lg",onClose:()=>Mt(!1),children:h.jsx(ESe,{onReleased:$=>{te.dispatch([{type:"status",text:`${k("release.released")} (${$.slice(0,8)})`}])},onError:$=>{if(gd($))return;const K=$ instanceof Error?$.message:String($);se("error",k("release.failed",{reason:K}))},onClose:()=>Mt(!1)})}),cn&&h.jsx(ys,{title:k("rewind.title"),subtitle:k("rewind.subtitle"),size:"lg",onClose:()=>tn(!1),children:h.jsx(VSe,{blocks:we,loadSnapshots:o$,rewind:a$,onError:l$,onClose:()=>tn(!1)})}),h.jsxs("div",{className:Yt.appShell,children:[Q.enabled&&h.jsxs("div",{"data-mobile-drawer":"",...ie?{role:"dialog","aria-modal":"true"}:{},"aria-label":k("sidebar.label"),className:[Yt.mobileDrawer,ie?Yt.mobileDrawerOpen:void 0].filter(Boolean).join(" "),children:[h.jsx("div",{className:Yt.mobileBackdrop,onClick:oe,"aria-hidden":"true"}),h.jsx(s9e,{collapsed:ce&&!ie,onCollapsedChange:ve,onOpenSettings:()=>{oe(),nf(!0)},onNewSession:tp,onLoadSession:i$,onError:It,mobileOpen:ie})]}),h.jsxs("div",{className:Yt.chatPane,children:[Q.enabled&&h.jsx("button",{type:"button",className:Yt.hamburgerButton,onClick:()=>re($=>!$),"aria-label":k("sidebar.toggleMenu"),"aria-expanded":ie,children:h.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),h.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),h.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),h.jsxs(nW,{value:qe,children:[h.jsx(Zh.Provider,{value:Yb,children:h.jsx(sAe,{timeline:Qt,details:ni,children:h.jsxs("div",{className:[Yt.content,An||Ke.length>0||Ze?Yt.contentHasMessages:void 0].filter(Boolean).join(" "),children:[h.jsx(Cpe,{ref:rn,messages:Ke,pendingApproval:yn,onShowContextDetail:r$,loadingTranscript:Se.loadingTranscript,catchingUp:Se.catchingUp,isResponding:Kn!=="idle",activeTurnStartedAt:de,workspaceCwd:Se.workspaceCwd||"",shellOutputMaxLines:t$,hideSessionTimeline:n2==="wide",showRetryHint:mn,onRetryClick:e2,onBranchSession:s$,welcomeHeader:kl?w$:void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:f$,virtualScrollThreshold:A}),(Je==null?void 0:Je.role)==="btw"&&h.jsx("div",{className:Yt.btwPanel,children:h.jsx(TD,{question:Je.question,answer:Je.answer,isPending:Je.isPending})})]})})}),h.jsxs("div",{ref:nr,className:Yt.footer,children:[Kr&&h.jsx("div",{className:An?`${Yt.scrollToBottomLayer} ${Yt.scrollToBottomLayerWithTodos}`:Yt.scrollToBottomLayer,children:h.jsx("button",{type:"button",className:Yt.scrollToBottomButton,"aria-label":k("chat.scrollToBottom"),onClick:()=>mt("smooth"),children:h.jsx("svg",{className:Yt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),An&&h.jsx("div",{className:Yt.bottomPanels,children:h.jsx(U3e,{todos:Gi})}),yn&&h.jsx("div",{className:Yt.approvalOverlay,children:h.jsx(b8e,{request:yn,onConfirm:E6,variant:"floating"})}),Wn&&h.jsx("div",{className:Yt.approvalOverlay,children:h.jsx(G8e,{request:Wn,onConfirm:E6,variant:"floating"})}),h.jsxs("div",{className:Yt.composer,children:[h.jsx(g3e,{startedAt:de}),zP&&Kn==="idle"&&h.jsx("div",{className:Yt.escClearStatus,role:"status",children:k("editor.escClearHint")}),h.jsx(VTe,{prompts:VP,t:k,onDelete:GP,onInsert:KP,onEdit:YP}),h.jsx(Lxe,{ref:Aa,onSubmit:u$,onCycleMode:Qb,onToggleShortcuts:b6,onCancel:Zb,isRunning:Kn!=="idle",isPreparing:Gb,cancelArmed:FP,disabled:p$,commands:I6,skills:As,slashCommandCategoryOrder:f,queuedMessages:WP,onFocusFooter:d$,onPopQueuedMessages:XP,onClearQueuedMessages:QP,currentMode:qo,currentModel:rd,chatWidthMode:ee,showChatWidthToggle:!kl,chatWidthToggleMin:x$,visibleToolbarActions:E,availableModels:qP,onSelectMode:qc,onSelectModel:t2,onChatWidthModeChange:R6,sessionName:UP,dialogOpen:Ea,followupState:zo,onAcceptFollowup:xl,onDismissFollowup:ef,composerInput:V,composerInputVersion:J,placeholderText:k(nAe({catchingUp:!!Se.catchingUp,isPreparingPrompt:Gb,isStreaming:Kn!=="idle"}))})]}),We?h.jsx(We,{connected:Tn,mode:qo,model:rd,streamingState:Kn,contextUsageRatio:(Se.contextWindow??0)>0?(Se.tokenCount??0)/(Se.contextWindow??0):0,activeGoal:br,tasks:Be,availableModes:mg,availableModels:(Se.models??[]).filter(sE).map($=>({id:$.id,label:xy($.label||$.id),contextWindow:$.contextWindow})),skills:As,onSelectMode:qc,onSelectModel:t2}):h.jsx(i3e,{onSelectMode:()=>Yi($=>!$),onSelectModel:()=>si($=>$?null:"main"),onShowContext:()=>af("/context",!1),onOpenSettings:()=>nf(!0),ref:Dt,onOpenTasks:()=>Jb(),onReturnToInput:h$,tasks:xe,activeGoal:br,hideSettings:c$,onToggleShortcuts:b6,compact:!0}),kl&&N6&&h.jsx("div",{className:Yt.emptyWelcomeFooter,children:N6})]})]})]})]})]})})})}const lE={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:"重试"}},LAe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},jAe={margin:0,fontSize:"1rem",fontWeight:600},DAe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},OAe={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 BAe({error:e,onRetry:t,language:n="en"}){const r=lE[n]??lE.en;return h.jsxs("div",{role:"alert",style:LAe,"data-web-shell-error":!0,children:[h.jsx("p",{style:jAe,children:r.title}),h.jsx("p",{style:DAe,children:r.body}),!1,h.jsx("button",{type:"button",style:OAe,onClick:t,children:r.retry})]})}function PAe(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?HAe(e):""}let Qf;const $Ae="qwen-daemon-auth",zAe=2500;function FAe(){return Qf||(typeof window>"u"?void 0:(Qf=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,Qf))}function UAe(e=zAe){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const r=o=>{n||(n=!0,window.removeEventListener("message",s),clearTimeout(i),Qf=o,t(o))},s=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)!==$Ae)return;const l=typeof a.token=="string"?a.token:"";r(l.trim()||void 0)},i=setTimeout(()=>r(void 0),e);window.addEventListener("message",s)})}function qAe(){if(typeof window>"u")return;const e=new URL(window.location.href);let t=!1;if(e.searchParams.has("token")&&(e.searchParams.delete("token"),t=!0),e.hash){const n=new URLSearchParams(e.hash.replace(/^#/,""));if(n.has("token")){n.delete("token");const r=n.toString();e.hash=r?`#${r}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function HAe(e){try{const t=new URL(e,window.location.origin);if(!(t.protocol==="http:"||t.protocol==="https:"))return"";if(t.origin===window.location.origin)return t.origin;if(!(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"))return"";const s=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==s?"":t.origin}catch{return""}}const VAe=PAe(),NP="qwen-code-web-shell-language",RP="qwen-code-web-shell-theme";function LP(e){if(e===Rs.Dark||e===Rs.Light)return e}function WAe(){const e=new URLSearchParams(window.location.search).get("theme");return LP(e)}function GAe(){try{return LP(window.localStorage.getItem(RP))}catch{return}}function KAe(e){try{window.localStorage.setItem(RP,e)}catch{}}function YAe(){return WAe()??GAe()??Rs.Dark}function XAe(){try{const e=window.localStorage.getItem(NP);return e?dc(e):void 0}catch{return}}function QAe(e){try{window.localStorage.setItem(NP,e)}catch{}}function JAe(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return dc(t||(XAe()??navigator.language))}function ZAe(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function eEe(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 tEe({daemonToken:e}){const[t,n]=g.useState(()=>YAe()),[r,s]=g.useState(()=>JAe()),[i]=g.useState(()=>ZAe()),o=VAe||window.location.origin;g.useEffect(()=>{const u=document.documentElement;u.classList.remove("theme-dark","theme-light"),u.classList.add(`theme-${t}`);const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const a=g.useCallback(u=>{n(u),KAe(u)},[]),l=g.useCallback(u=>{s(u),QAe(u)},[]),c=g.useCallback(u=>{eEe(u)},[]);return h.jsx(YN,{label:"web-shell-root",fallback:(u,d)=>h.jsx(BAe,{error:u,onRetry:d,language:r}),children:h.jsx(KH,{baseUrl:o,token:e,children:h.jsx(gV,{sessionId:i,suppressOwnUserEcho:!0,children:h.jsx(RAe,{theme:t,onThemeChange:a,language:r,onLanguageChange:l,onSessionIdChange:c,sidebar:!0,compactThinking:!0})},i??"new")})})}async function nEe(){const e=FAe()??await UAe();qAe(),kU.createRoot(document.getElementById("root")).render(h.jsx(H$.StrictMode,{children:h.jsx(tEe,{daemonToken:e})}))}nEe();export{U as _,Xg as c,ky as g,aEe as k};
