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 BL=Object.defineProperty;var zL=(e,t,n)=>t in e?BL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>zL(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 a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 lg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function I1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oC={exports:{}},R1={};/**
 * @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 $L=Symbol.for("react.transitional.element"),PL=Symbol.for("react.fragment");function lC(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:$L,type:e,key:r,ref:t!==void 0?t:null,props:n}}R1.Fragment=PL;R1.jsx=lC;R1.jsxs=lC;oC.exports=R1;var h=oC.exports,cC={exports:{}},Rt={};/**
 * @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 Lw=Symbol.for("react.transitional.element"),qL=Symbol.for("react.portal"),UL=Symbol.for("react.fragment"),HL=Symbol.for("react.strict_mode"),FL=Symbol.for("react.profiler"),VL=Symbol.for("react.consumer"),WL=Symbol.for("react.context"),GL=Symbol.for("react.forward_ref"),KL=Symbol.for("react.suspense"),YL=Symbol.for("react.memo"),uC=Symbol.for("react.lazy"),XL=Symbol.for("react.activity"),fk=Symbol.iterator;function QL(e){return e===null||typeof e!="object"?null:(e=fk&&e[fk]||e["@@iterator"],typeof e=="function"?e:null)}var dC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hC=Object.assign,fC={};function uh(e,t,n){this.props=e,this.context=t,this.refs=fC,this.updater=n||dC}uh.prototype.isReactComponent={};uh.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")};uh.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function mC(){}mC.prototype=uh.prototype;function Bw(e,t,n){this.props=e,this.context=t,this.refs=fC,this.updater=n||dC}var zw=Bw.prototype=new mC;zw.constructor=Bw;hC(zw,uh.prototype);zw.isPureReactComponent=!0;var mk=Array.isArray;function P4(){}var qn={H:null,A:null,T:null,S:null},pC=Object.prototype.hasOwnProperty;function $w(e,t,n){var r=n.ref;return{$$typeof:Lw,type:e,key:t,ref:r!==void 0?r:null,props:n}}function JL(e,t){return $w(e.type,t,e.props)}function Pw(e){return typeof e=="object"&&e!==null&&e.$$typeof===Lw}function ZL(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pk=/\/+/g;function hb(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ZL(""+e.key):t.toString(36)}function eB(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(P4,P4):(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 Qu(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Lw:case qL:a=!0;break;case uC:return a=e._init,Qu(a(e._payload),t,n,r,s)}}if(a)return s=s(e),a=r===""?"."+hb(e,0):r,mk(s)?(n="",a!=null&&(n=a.replace(pk,"$&/")+"/"),Qu(s,t,n,"",function(c){return c})):s!=null&&(Pw(s)&&(s=JL(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(pk,"$&/")+"/")+a)),t.push(s)),1;a=0;var o=r===""?".":r+":";if(mk(e))for(var l=0;l<e.length;l++)r=e[l],i=o+hb(r,l),a+=Qu(r,t,n,i,s);else if(l=QL(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=o+hb(r,l++),a+=Qu(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return Qu(eB(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 a}function _m(e,t,n){if(e==null)return e;var r=[],s=0;return Qu(e,r,"","",function(i){return t.call(n,i,s++)}),r}function tB(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 gk=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)},nB={map:_m,forEach:function(e,t,n){_m(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _m(e,function(){t++}),t},toArray:function(e){return _m(e,function(t){return t})||[]},only:function(e){if(!Pw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Rt.Activity=XL;Rt.Children=nB;Rt.Component=uh;Rt.Fragment=UL;Rt.Profiler=FL;Rt.PureComponent=Bw;Rt.StrictMode=HL;Rt.Suspense=KL;Rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=qn;Rt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return qn.H.useMemoCache(e)}};Rt.cache=function(e){return function(){return e.apply(null,arguments)}};Rt.cacheSignal=function(){return null};Rt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=hC({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!pC.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 a=Array(i),o=0;o<i;o++)a[o]=arguments[o+2];r.children=a}return $w(e.type,s,r)};Rt.createContext=function(e){return e={$$typeof:WL,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:VL,_context:e},e};Rt.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)pC.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var o=Array(a),l=0;l<a;l++)o[l]=arguments[l+2];s.children=o}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return $w(e,i,s)};Rt.createRef=function(){return{current:null}};Rt.forwardRef=function(e){return{$$typeof:GL,render:e}};Rt.isValidElement=Pw;Rt.lazy=function(e){return{$$typeof:uC,_payload:{_status:-1,_result:e},_init:tB}};Rt.memo=function(e,t){return{$$typeof:YL,type:e,compare:t===void 0?null:t}};Rt.startTransition=function(e){var t=qn.T,n={};qn.T=n;try{var r=e(),s=qn.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(P4,gk)}catch(i){gk(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),qn.T=t}};Rt.unstable_useCacheRefresh=function(){return qn.H.useCacheRefresh()};Rt.use=function(e){return qn.H.use(e)};Rt.useActionState=function(e,t,n){return qn.H.useActionState(e,t,n)};Rt.useCallback=function(e,t){return qn.H.useCallback(e,t)};Rt.useContext=function(e){return qn.H.useContext(e)};Rt.useDebugValue=function(){};Rt.useDeferredValue=function(e,t){return qn.H.useDeferredValue(e,t)};Rt.useEffect=function(e,t){return qn.H.useEffect(e,t)};Rt.useEffectEvent=function(e){return qn.H.useEffectEvent(e)};Rt.useId=function(){return qn.H.useId()};Rt.useImperativeHandle=function(e,t,n){return qn.H.useImperativeHandle(e,t,n)};Rt.useInsertionEffect=function(e,t){return qn.H.useInsertionEffect(e,t)};Rt.useLayoutEffect=function(e,t){return qn.H.useLayoutEffect(e,t)};Rt.useMemo=function(e,t){return qn.H.useMemo(e,t)};Rt.useOptimistic=function(e,t){return qn.H.useOptimistic(e,t)};Rt.useReducer=function(e,t,n){return qn.H.useReducer(e,t,n)};Rt.useRef=function(e){return qn.H.useRef(e)};Rt.useState=function(e){return qn.H.useState(e)};Rt.useSyncExternalStore=function(e,t,n){return qn.H.useSyncExternalStore(e,t,n)};Rt.useTransition=function(){return qn.H.useTransition()};Rt.version="19.2.4";cC.exports=Rt;var b=cC.exports;const rB=I1(b);var gC={exports:{}},j1={},yC={exports:{}},bC={};/**
 * @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(Y,Z){var Q=Y.length;Y.push(Z);e:for(;0<Q;){var L=Q-1>>>1,R=Y[L];if(0<s(R,Z))Y[L]=Z,Y[Q]=R,Q=L;else break e}}function n(Y){return Y.length===0?null:Y[0]}function r(Y){if(Y.length===0)return null;var Z=Y[0],Q=Y.pop();if(Q!==Z){Y[0]=Q;e:for(var L=0,R=Y.length,$=R>>>1;L<$;){var I=2*(L+1)-1,M=Y[I],G=I+1,ne=Y[G];if(0>s(M,Q))G<R&&0>s(ne,M)?(Y[L]=ne,Y[G]=Q,L=G):(Y[L]=M,Y[I]=Q,L=I);else if(G<R&&0>s(ne,Q))Y[L]=ne,Y[G]=Q,L=G;else break e}}return Z}function s(Y,Z){var Q=Y.sortIndex-Z.sortIndex;return Q!==0?Q:Y.id-Z.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 a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,d=null,f=3,m=!1,p=!1,y=!1,w=!1,v=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(Y){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=Y)r(c),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=n(c)}}function A(Y){if(y=!1,k(Y),!p)if(n(l)!==null)p=!0,T||(T=!0,D());else{var Z=n(c);Z!==null&&J(A,Z.startTime-Y)}}var T=!1,C=-1,j=5,z=-1;function E(){return w?!0:!(e.unstable_now()-z<j)}function P(){if(w=!1,T){var Y=e.unstable_now();z=Y;var Z=!0;try{e:{p=!1,y&&(y=!1,g(C),C=-1),m=!0;var Q=f;try{t:{for(k(Y),d=n(l);d!==null&&!(d.expirationTime>Y&&E());){var L=d.callback;if(typeof L=="function"){d.callback=null,f=d.priorityLevel;var R=L(d.expirationTime<=Y);if(Y=e.unstable_now(),typeof R=="function"){d.callback=R,k(Y),Z=!0;break t}d===n(l)&&r(l),k(Y)}else r(l);d=n(l)}if(d!==null)Z=!0;else{var $=n(c);$!==null&&J(A,$.startTime-Y),Z=!1}}break e}finally{d=null,f=Q,m=!1}Z=void 0}}finally{Z?D():T=!1}}}var D;if(typeof x=="function")D=function(){x(P)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,W=H.port2;H.port1.onmessage=P,D=function(){W.postMessage(null)}}else D=function(){v(P,0)};function J(Y,Z){C=v(function(){Y(e.unstable_now())},Z)}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(Y){Y.callback=null},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(Y){switch(f){case 1:case 2:case 3:var Z=3;break;default:Z=f}var Q=f;f=Z;try{return Y()}finally{f=Q}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(Y,Z){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var Q=f;f=Y;try{return Z()}finally{f=Q}},e.unstable_scheduleCallback=function(Y,Z,Q){var L=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?L+Q:L):Q=L,Y){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=Q+R,Y={id:u++,callback:Z,priorityLevel:Y,startTime:Q,expirationTime:R,sortIndex:-1},Q>L?(Y.sortIndex=Q,t(c,Y),n(l)===null&&Y===n(c)&&(y?(g(C),C=-1):y=!0,J(A,Q-L))):(Y.sortIndex=R,t(l,Y),p||m||(p=!0,T||(T=!0,D()))),Y},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(Y){var Z=f;return function(){var Q=f;f=Z;try{return Y.apply(this,arguments)}finally{f=Q}}}})(bC);yC.exports=bC;var sB=yC.exports,vC={exports:{}},Ms={};/**
 * @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 iB=b;function xC(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 ll(){}var Ts={d:{f:ll,r:function(){throw Error(xC(522))},D:ll,C:ll,L:ll,m:ll,X:ll,S:ll,M:ll},p:0,findDOMNode:null},aB=Symbol.for("react.portal");function oB(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:aB,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var kf=iB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function D1(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Ms.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ts;Ms.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(xC(299));return oB(e,t,null,n)};Ms.flushSync=function(e){var t=kf.T,n=Ts.p;try{if(kf.T=null,Ts.p=2,e)return e()}finally{kf.T=t,Ts.p=n,Ts.d.f()}};Ms.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ts.d.C(e,t))};Ms.prefetchDNS=function(e){typeof e=="string"&&Ts.d.D(e)};Ms.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=D1(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Ts.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Ts.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Ms.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=D1(t.as,t.crossOrigin);Ts.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&&Ts.d.M(e)};Ms.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=D1(n,t.crossOrigin);Ts.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})}};Ms.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=D1(t.as,t.crossOrigin);Ts.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 Ts.d.m(e)};Ms.requestFormReset=function(e){Ts.d.r(e)};Ms.unstable_batchedUpdates=function(e,t){return e(t)};Ms.useFormState=function(e,t,n){return kf.H.useFormState(e,t,n)};Ms.useFormStatus=function(){return kf.H.useHostTransitionStatus()};Ms.version="19.2.4";function wC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wC)}catch(e){console.error(e)}}wC(),vC.exports=Ms;var O1=vC.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 Lr=sB,_C=b,lB=O1;function le(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 kC(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function L0(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 SC(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 TC(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 yk(e){if(L0(e)!==e)throw Error(le(188))}function cB(e){var t=e.alternate;if(!t){if(t=L0(e),t===null)throw Error(le(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 yk(s),e;if(i===r)return yk(s),t;i=i.sibling}throw Error(le(188))}if(n.return!==r.return)n=s,r=i;else{for(var a=!1,o=s.child;o;){if(o===n){a=!0,n=s,r=i;break}if(o===r){a=!0,r=s,n=i;break}o=o.sibling}if(!a){for(o=i.child;o;){if(o===n){a=!0,n=i,r=s;break}if(o===r){a=!0,r=i,n=s;break}o=o.sibling}if(!a)throw Error(le(189))}}if(n.alternate!==r)throw Error(le(190))}if(n.tag!==3)throw Error(le(188));return n.stateNode.current===n?e:t}function CC(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=CC(e),t!==null)return t;e=e.sibling}return null}var Hn=Object.assign,uB=Symbol.for("react.element"),km=Symbol.for("react.transitional.element"),df=Symbol.for("react.portal"),sd=Symbol.for("react.fragment"),AC=Symbol.for("react.strict_mode"),q4=Symbol.for("react.profiler"),EC=Symbol.for("react.consumer"),ko=Symbol.for("react.context"),qw=Symbol.for("react.forward_ref"),U4=Symbol.for("react.suspense"),H4=Symbol.for("react.suspense_list"),Uw=Symbol.for("react.memo"),pl=Symbol.for("react.lazy"),F4=Symbol.for("react.activity"),dB=Symbol.for("react.memo_cache_sentinel"),bk=Symbol.iterator;function qh(e){return e===null||typeof e!="object"?null:(e=bk&&e[bk]||e["@@iterator"],typeof e=="function"?e:null)}var hB=Symbol.for("react.client.reference");function V4(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===hB?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case sd:return"Fragment";case q4:return"Profiler";case AC:return"StrictMode";case U4:return"Suspense";case H4:return"SuspenseList";case F4:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case df:return"Portal";case ko:return e.displayName||"Context";case EC:return(e._context.displayName||"Context")+".Consumer";case qw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Uw:return t=e.displayName||null,t!==null?t:V4(e.type)||"Memo";case pl:t=e._payload,e=e._init;try{return V4(e(t))}catch{}}return null}var hf=Array.isArray,xt=_C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,dn=lB.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nu={pending:!1,data:null,method:null,action:null},W4=[],id=-1;function Wa(e){return{current:e}}function Vr(e){0>id||(e.current=W4[id],W4[id]=null,id--)}function On(e,t){id++,W4[id]=e.current,e.current=t}var Ua=Wa(null),Zf=Wa(null),Bl=Wa(null),cg=Wa(null);function ug(e,t){switch(On(Bl,t),On(Zf,e),On(Ua,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?S6(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=S6(t),e=KE(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Vr(Ua),On(Ua,e)}function Bd(){Vr(Ua),Vr(Zf),Vr(Bl)}function G4(e){e.memoizedState!==null&&On(cg,e);var t=Ua.current,n=KE(t,e.type);t!==n&&(On(Zf,e),On(Ua,n))}function dg(e){Zf.current===e&&(Vr(Ua),Vr(Zf)),cg.current===e&&(Vr(cg),u0._currentValue=nu)}var fb,vk;function zc(e){if(fb===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);fb=t&&t[1]||"",vk=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+fb+e+vk}var mb=!1;function pb(e,t){if(!e||mb)return"";mb=!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(),a=i[0],o=i[1];if(a&&o){var l=a.split(`
`),c=o.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{mb=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?zc(n):""}function fB(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 pb(e.type,!1);case 11:return pb(e.type.render,!1);case 1:return pb(e.type,!0);case 31:return zc("Activity");default:return""}}function xk(e){try{var t="",n=null;do t+=fB(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var K4=Object.prototype.hasOwnProperty,Hw=Lr.unstable_scheduleCallback,gb=Lr.unstable_cancelCallback,mB=Lr.unstable_shouldYield,pB=Lr.unstable_requestPaint,fi=Lr.unstable_now,gB=Lr.unstable_getCurrentPriorityLevel,MC=Lr.unstable_ImmediatePriority,NC=Lr.unstable_UserBlockingPriority,hg=Lr.unstable_NormalPriority,yB=Lr.unstable_LowPriority,IC=Lr.unstable_IdlePriority,bB=Lr.log,vB=Lr.unstable_setDisableYieldValue,B0=null,mi=null;function Cl(e){if(typeof bB=="function"&&vB(e),mi&&typeof mi.setStrictMode=="function")try{mi.setStrictMode(B0,e)}catch{}}var pi=Math.clz32?Math.clz32:_B,xB=Math.log,wB=Math.LN2;function _B(e){return e>>>=0,e===0?32:31-(xB(e)/wB|0)|0}var Sm=256,Tm=262144,Cm=4194304;function $c(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 L1(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var s=0,i=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var o=r&134217727;return o!==0?(r=o&~i,r!==0?s=$c(r):(a&=o,a!==0?s=$c(a):n||(n=o&~e,n!==0&&(s=$c(n))))):(o=r&~i,o!==0?s=$c(o):a!==0?s=$c(a):n||(n=r&~e,n!==0&&(s=$c(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 z0(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function kB(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 RC(){var e=Cm;return Cm<<=1,!(Cm&62914560)&&(Cm=4194304),e}function yb(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $0(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function SB(e,t,n,r,s,i){var a=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 o=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=a&~n;0<n;){var u=31-pi(n),d=1<<u;o[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&&jC(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(a&~t))}function jC(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 DC(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 OC(e,t){var n=t&-t;return n=n&42?1:Fw(n),n&(e.suspendedLanes|t)?0:n}function Fw(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 Vw(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function LC(){var e=dn.p;return e!==0?e:(e=window.event,e===void 0?32:iM(e.type))}function wk(e,t){var n=dn.p;try{return dn.p=e,t()}finally{dn.p=n}}var uc=Math.random().toString(36).slice(2),Zr="__reactFiber$"+uc,Ys="__reactProps$"+uc,dh="__reactContainer$"+uc,Y4="__reactEvents$"+uc,TB="__reactListeners$"+uc,CB="__reactHandles$"+uc,_k="__reactResources$"+uc,P0="__reactMarker$"+uc;function Ww(e){delete e[Zr],delete e[Ys],delete e[Y4],delete e[TB],delete e[CB]}function ad(e){var t=e[Zr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[dh]||n[Zr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=M6(e);e!==null;){if(n=e[Zr])return n;e=M6(e)}return t}e=n,n=e.parentNode}return null}function hh(e){if(e=e[Zr]||e[dh]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ff(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(le(33))}function _d(e){var t=e[_k];return t||(t=e[_k]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ur(e){e[P0]=!0}var BC=new Set,zC={};function Su(e,t){zd(e,t),zd(e+"Capture",t)}function zd(e,t){for(zC[e]=t,e=0;e<t.length;e++)BC.add(t[e])}var AB=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]*$"),kk={},Sk={};function EB(e){return K4.call(Sk,e)?!0:K4.call(kk,e)?!1:AB.test(e)?Sk[e]=!0:(kk[e]=!0,!1)}function Ap(e,t,n){if(EB(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 Am(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 ao(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 Ii(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $C(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function MB(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(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function X4(e){if(!e._valueTracker){var t=$C(e)?"checked":"value";e._valueTracker=MB(e,t,""+e[t])}}function PC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$C(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function fg(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 NB=/[\n"\\]/g;function Bi(e){return e.replace(NB,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Q4(e,t,n,r,s,i,a,o){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ii(t)):e.value!==""+Ii(t)&&(e.value=""+Ii(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?J4(e,a,Ii(t)):n!=null?J4(e,a,Ii(n)):r!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Ii(o):e.removeAttribute("name")}function qC(e,t,n,r,s,i,a,o){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)){X4(e);return}n=n!=null?""+Ii(n):"",t=t!=null?""+Ii(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}r=r??s,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=o?e.checked:!!r,e.defaultChecked=!!r,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),X4(e)}function J4(e,t,n){t==="number"&&fg(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function kd(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=""+Ii(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 UC(e,t,n){if(t!=null&&(t=""+Ii(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Ii(n):""}function HC(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(le(92));if(hf(r)){if(1<r.length)throw Error(le(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Ii(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),X4(e)}function $d(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var IB=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 Tk(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||IB.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function FC(e,t,n){if(t!=null&&typeof t!="object")throw Error(le(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&&Tk(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&Tk(e,i,t[i])}function Gw(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 RB=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"]]),jB=/^[\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 Ep(e){return jB.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function So(){}var Z4=null;function Kw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var od=null,Sd=null;function Ck(e){var t=hh(e);if(t&&(e=t.stateNode)){var n=e[Ys]||null;e:switch(e=t.stateNode,t.type){case"input":if(Q4(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="'+Bi(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[Ys]||null;if(!s)throw Error(le(90));Q4(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&&PC(r)}break e;case"textarea":UC(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&kd(e,!!n.multiple,t,!1)}}}var bb=!1;function VC(e,t,n){if(bb)return e(t,n);bb=!0;try{var r=e(t);return r}finally{if(bb=!1,(od!==null||Sd!==null)&&(K1(),od&&(t=od,e=Sd,Sd=od=null,Ck(t),e)))for(t=0;t<e.length;t++)Ck(e[t])}}function e0(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ys]||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(le(231,t,typeof n));return n}var Lo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),e2=!1;if(Lo)try{var Uh={};Object.defineProperty(Uh,"passive",{get:function(){e2=!0}}),window.addEventListener("test",Uh,Uh),window.removeEventListener("test",Uh,Uh)}catch{e2=!1}var Al=null,Yw=null,Mp=null;function WC(){if(Mp)return Mp;var e,t=Yw,n=t.length,r,s="value"in Al?Al.value:Al.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===s[i-r];r++);return Mp=s.slice(e,1<r?1-r:void 0)}function Np(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 Em(){return!0}function Ak(){return!1}function Js(e){function t(n,r,s,i,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Em:Ak,this.isPropagationStopped=Ak,this}return Hn(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=Em)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Em)},persist:function(){},isPersistent:Em}),t}var Tu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},B1=Js(Tu),q0=Hn({},Tu,{view:0,detail:0}),DB=Js(q0),vb,xb,Hh,z1=Hn({},q0,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xw,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!==Hh&&(Hh&&e.type==="mousemove"?(vb=e.screenX-Hh.screenX,xb=e.screenY-Hh.screenY):xb=vb=0,Hh=e),vb)},movementY:function(e){return"movementY"in e?e.movementY:xb}}),Ek=Js(z1),OB=Hn({},z1,{dataTransfer:0}),LB=Js(OB),BB=Hn({},q0,{relatedTarget:0}),wb=Js(BB),zB=Hn({},Tu,{animationName:0,elapsedTime:0,pseudoElement:0}),$B=Js(zB),PB=Hn({},Tu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qB=Js(PB),UB=Hn({},Tu,{data:0}),Mk=Js(UB),HB={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},FB={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"},VB={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function WB(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=VB[e])?!!t[e]:!1}function Xw(){return WB}var GB=Hn({},q0,{key:function(e){if(e.key){var t=HB[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Np(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?FB[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xw,charCode:function(e){return e.type==="keypress"?Np(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Np(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),KB=Js(GB),YB=Hn({},z1,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nk=Js(YB),XB=Hn({},q0,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xw}),QB=Js(XB),JB=Hn({},Tu,{propertyName:0,elapsedTime:0,pseudoElement:0}),ZB=Js(JB),ez=Hn({},z1,{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}),tz=Js(ez),nz=Hn({},Tu,{newState:0,oldState:0}),rz=Js(nz),sz=[9,13,27,32],Qw=Lo&&"CompositionEvent"in window,Sf=null;Lo&&"documentMode"in document&&(Sf=document.documentMode);var iz=Lo&&"TextEvent"in window&&!Sf,GC=Lo&&(!Qw||Sf&&8<Sf&&11>=Sf),Ik=" ",Rk=!1;function KC(e,t){switch(e){case"keyup":return sz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function YC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ld=!1;function az(e,t){switch(e){case"compositionend":return YC(t);case"keypress":return t.which!==32?null:(Rk=!0,Ik);case"textInput":return e=t.data,e===Ik&&Rk?null:e;default:return null}}function oz(e,t){if(ld)return e==="compositionend"||!Qw&&KC(e,t)?(e=WC(),Mp=Yw=Al=null,ld=!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 GC&&t.locale!=="ko"?null:t.data;default:return null}}var lz={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 jk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!lz[e.type]:t==="textarea"}function XC(e,t,n,r){od?Sd?Sd.push(r):Sd=[r]:od=r,t=Ig(t,"onChange"),0<t.length&&(n=new B1("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Tf=null,t0=null;function cz(e){VE(e,0)}function $1(e){var t=ff(e);if(PC(t))return e}function Dk(e,t){if(e==="change")return t}var QC=!1;if(Lo){var _b;if(Lo){var kb="oninput"in document;if(!kb){var Ok=document.createElement("div");Ok.setAttribute("oninput","return;"),kb=typeof Ok.oninput=="function"}_b=kb}else _b=!1;QC=_b&&(!document.documentMode||9<document.documentMode)}function Lk(){Tf&&(Tf.detachEvent("onpropertychange",JC),t0=Tf=null)}function JC(e){if(e.propertyName==="value"&&$1(t0)){var t=[];XC(t,t0,e,Kw(e)),VC(cz,t)}}function uz(e,t,n){e==="focusin"?(Lk(),Tf=t,t0=n,Tf.attachEvent("onpropertychange",JC)):e==="focusout"&&Lk()}function dz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $1(t0)}function hz(e,t){if(e==="click")return $1(t)}function fz(e,t){if(e==="input"||e==="change")return $1(t)}function mz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var vi=typeof Object.is=="function"?Object.is:mz;function n0(e,t){if(vi(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(!K4.call(t,s)||!vi(e[s],t[s]))return!1}return!0}function Bk(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zk(e,t){var n=Bk(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=Bk(n)}}function ZC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ZC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function eA(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=fg(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=fg(e.document)}return t}function Jw(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 pz=Lo&&"documentMode"in document&&11>=document.documentMode,cd=null,t2=null,Cf=null,n2=!1;function $k(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;n2||cd==null||cd!==fg(r)||(r=cd,"selectionStart"in r&&Jw(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}),Cf&&n0(Cf,r)||(Cf=r,r=Ig(t2,"onSelect"),0<r.length&&(t=new B1("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=cd)))}function Mc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ud={animationend:Mc("Animation","AnimationEnd"),animationiteration:Mc("Animation","AnimationIteration"),animationstart:Mc("Animation","AnimationStart"),transitionrun:Mc("Transition","TransitionRun"),transitionstart:Mc("Transition","TransitionStart"),transitioncancel:Mc("Transition","TransitionCancel"),transitionend:Mc("Transition","TransitionEnd")},Sb={},tA={};Lo&&(tA=document.createElement("div").style,"AnimationEvent"in window||(delete ud.animationend.animation,delete ud.animationiteration.animation,delete ud.animationstart.animation),"TransitionEvent"in window||delete ud.transitionend.transition);function Cu(e){if(Sb[e])return Sb[e];if(!ud[e])return e;var t=ud[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in tA)return Sb[e]=t[n];return e}var nA=Cu("animationend"),rA=Cu("animationiteration"),sA=Cu("animationstart"),gz=Cu("transitionrun"),yz=Cu("transitionstart"),bz=Cu("transitioncancel"),iA=Cu("transitionend"),aA=new Map,r2="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(" ");r2.push("scrollEnd");function ha(e,t){aA.set(e,t),Su(t,[e])}var mg=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)},Ni=[],dd=0,Zw=0;function P1(){for(var e=dd,t=Zw=dd=0;t<e;){var n=Ni[t];Ni[t++]=null;var r=Ni[t];Ni[t++]=null;var s=Ni[t];Ni[t++]=null;var i=Ni[t];if(Ni[t++]=null,r!==null&&s!==null){var a=r.pending;a===null?s.next=s:(s.next=a.next,a.next=s),r.pending=s}i!==0&&oA(n,s,i)}}function q1(e,t,n,r){Ni[dd++]=e,Ni[dd++]=t,Ni[dd++]=n,Ni[dd++]=r,Zw|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function e_(e,t,n,r){return q1(e,t,n,r),pg(e)}function Au(e,t){return q1(e,null,null,t),pg(e)}function oA(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 pg(e){if(50<Of)throw Of=0,S2=null,Error(le(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var hd={};function vz(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 ci(e,t,n,r){return new vz(e,t,n,r)}function t_(e){return e=e.prototype,!(!e||!e.isReactComponent)}function No(e,t){var n=e.alternate;return n===null?(n=ci(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 lA(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 Ip(e,t,n,r,s,i){var a=0;if(r=e,typeof e=="function")t_(e)&&(a=1);else if(typeof e=="string")a=S$(e,n,Ua.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F4:return e=ci(31,n,t,s),e.elementType=F4,e.lanes=i,e;case sd:return ru(n.children,s,i,t);case AC:a=8,s|=24;break;case q4:return e=ci(12,n,t,s|2),e.elementType=q4,e.lanes=i,e;case U4:return e=ci(13,n,t,s),e.elementType=U4,e.lanes=i,e;case H4:return e=ci(19,n,t,s),e.elementType=H4,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ko:a=10;break e;case EC:a=9;break e;case qw:a=11;break e;case Uw:a=14;break e;case pl:a=16,r=null;break e}a=29,n=Error(le(130,e===null?"null":typeof e,"")),r=null}return t=ci(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ru(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function Tb(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function cA(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function Cb(e,t,n){return t=ci(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Pk=new WeakMap;function zi(e,t){if(typeof e=="object"&&e!==null){var n=Pk.get(e);return n!==void 0?n:(t={value:e,source:t,stack:xk(t)},Pk.set(e,t),t)}return{value:e,source:t,stack:xk(t)}}var fd=[],md=0,gg=null,r0=0,Ri=[],ji=0,Yl=null,Oa=1,La="";function yo(e,t){fd[md++]=r0,fd[md++]=gg,gg=e,r0=t}function uA(e,t,n){Ri[ji++]=Oa,Ri[ji++]=La,Ri[ji++]=Yl,Yl=e;var r=Oa;e=La;var s=32-pi(r)-1;r&=~(1<<s),n+=1;var i=32-pi(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Oa=1<<32-pi(t)+s|n<<s|r,La=i+e}else Oa=1<<i|n<<s|r,La=e}function n_(e){e.return!==null&&(yo(e,1),uA(e,1,0))}function r_(e){for(;e===gg;)gg=fd[--md],fd[md]=null,r0=fd[--md],fd[md]=null;for(;e===Yl;)Yl=Ri[--ji],Ri[ji]=null,La=Ri[--ji],Ri[ji]=null,Oa=Ri[--ji],Ri[ji]=null}function dA(e,t){Ri[ji++]=Oa,Ri[ji++]=La,Ri[ji++]=Yl,Oa=t.id,La=t.overflow,Yl=e}var es=null,Pn=null,Yt=!1,zl=null,$i=!1,s2=Error(le(519));function Xl(e){var t=Error(le(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw s0(zi(t,e)),s2}function qk(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Zr]=e,t[Ys]=r,n){case"dialog":Ut("cancel",t),Ut("close",t);break;case"iframe":case"object":case"embed":Ut("load",t);break;case"video":case"audio":for(n=0;n<l0.length;n++)Ut(l0[n],t);break;case"source":Ut("error",t);break;case"img":case"image":case"link":Ut("error",t),Ut("load",t);break;case"details":Ut("toggle",t);break;case"input":Ut("invalid",t),qC(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ut("invalid",t);break;case"textarea":Ut("invalid",t),HC(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||GE(t.textContent,n)?(r.popover!=null&&(Ut("beforetoggle",t),Ut("toggle",t)),r.onScroll!=null&&Ut("scroll",t),r.onScrollEnd!=null&&Ut("scrollend",t),r.onClick!=null&&(t.onclick=So),t=!0):t=!1,t||Xl(e,!0)}function Uk(e){for(es=e.return;es;)switch(es.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:es=es.return}}function Fu(e){if(e!==es)return!1;if(!Yt)return Uk(e),Yt=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||M2(e.type,e.memoizedProps)),n=!n),n&&Pn&&Xl(e),Uk(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(le(317));Pn=E6(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(le(317));Pn=E6(e)}else t===27?(t=Pn,dc(e.type)?(e=j2,j2=null,Pn=e):Pn=t):Pn=es?Vi(e.stateNode.nextSibling):null;return!0}function fu(){Pn=es=null,Yt=!1}function Ab(){var e=zl;return e!==null&&(Us===null?Us=e:Us.push.apply(Us,e),zl=null),e}function s0(e){zl===null?zl=[e]:zl.push(e)}var i2=Wa(null),Eu=null,To=null;function wl(e,t,n){On(i2,t._currentValue),t._currentValue=n}function Io(e){e._currentValue=i2.current,Vr(i2)}function a2(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 o2(e,t,n,r){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var a=s.child;i=i.firstContext;e:for(;i!==null;){var o=i;i=s;for(var l=0;l<t.length;l++)if(o.context===t[l]){i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),a2(i.return,n,e),r||(a=null);break e}i=o.next}}else if(s.tag===18){if(a=s.return,a===null)throw Error(le(341));a.lanes|=n,i=a.alternate,i!==null&&(i.lanes|=n),a2(a,n,e),a=null}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}}function fh(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 a=s.alternate;if(a===null)throw Error(le(387));if(a=a.memoizedProps,a!==null){var o=s.type;vi(s.pendingProps.value,a.value)||(e!==null?e.push(o):e=[o])}}else if(s===cg.current){if(a=s.alternate,a===null)throw Error(le(387));a.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(u0):e=[u0])}s=s.return}e!==null&&o2(t,e,n,r),t.flags|=262144}function yg(e){for(e=e.firstContext;e!==null;){if(!vi(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function mu(e){Eu=e,To=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ts(e){return hA(Eu,e)}function Mm(e,t){return Eu===null&&mu(e),hA(e,t)}function hA(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},To===null){if(e===null)throw Error(le(308));To=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else To=To.next=t;return n}var xz=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()})}},wz=Lr.unstable_scheduleCallback,_z=Lr.unstable_NormalPriority,xr={$$typeof:ko,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function s_(){return{controller:new xz,data:new Map,refCount:0}}function U0(e){e.refCount--,e.refCount===0&&wz(_z,function(){e.controller.abort()})}var Af=null,l2=0,Pd=0,Td=null;function kz(e,t){if(Af===null){var n=Af=[];l2=0,Pd=M_(),Td={status:"pending",value:void 0,then:function(r){n.push(r)}}}return l2++,t.then(Hk,Hk),t}function Hk(){if(--l2===0&&Af!==null){Td!==null&&(Td.status="fulfilled");var e=Af;Af=null,Pd=0,Td=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sz(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 Fk=xt.S;xt.S=function(e,t){CE=fi(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&kz(e,t),Fk!==null&&Fk(e,t)};var su=Wa(null);function i_(){var e=su.current;return e!==null?e:Nn.pooledCache}function Rp(e,t){t===null?On(su,su.current):On(su,t.pool)}function fA(){var e=i_();return e===null?null:{parent:xr._currentValue,pool:e}}var mh=Error(le(460)),a_=Error(le(474)),U1=Error(le(542)),bg={then:function(){}};function Vk(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mA(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(So,So),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Gk(e),e;default:if(typeof t.status=="string")t.then(So,So);else{if(e=Nn,e!==null&&100<e.shellSuspendCounter)throw Error(le(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,Gk(e),e}throw iu=t,mh}}function Pc(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(iu=n,mh):n}}var iu=null;function Wk(){if(iu===null)throw Error(le(459));var e=iu;return iu=null,e}function Gk(e){if(e===mh||e===U1)throw Error(le(483))}var Cd=null,i0=0;function Nm(e){var t=i0;return i0+=1,Cd===null&&(Cd=[]),mA(Cd,e,t)}function Fh(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Im(e,t){throw t.$$typeof===uB?Error(le(525)):(e=Object.prototype.toString.call(t),Error(le(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function pA(e){function t(v,g){if(e){var x=v.deletions;x===null?(v.deletions=[g],v.flags|=16):x.push(g)}}function n(v,g){if(!e)return null;for(;g!==null;)t(v,g),g=g.sibling;return null}function r(v){for(var g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function s(v,g){return v=No(v,g),v.index=0,v.sibling=null,v}function i(v,g,x){return v.index=x,e?(x=v.alternate,x!==null?(x=x.index,x<g?(v.flags|=67108866,g):x):(v.flags|=67108866,g)):(v.flags|=1048576,g)}function a(v){return e&&v.alternate===null&&(v.flags|=67108866),v}function o(v,g,x,k){return g===null||g.tag!==6?(g=Tb(x,v.mode,k),g.return=v,g):(g=s(g,x),g.return=v,g)}function l(v,g,x,k){var A=x.type;return A===sd?u(v,g,x.props.children,k,x.key):g!==null&&(g.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===pl&&Pc(A)===g.type)?(g=s(g,x.props),Fh(g,x),g.return=v,g):(g=Ip(x.type,x.key,x.props,null,v.mode,k),Fh(g,x),g.return=v,g)}function c(v,g,x,k){return g===null||g.tag!==4||g.stateNode.containerInfo!==x.containerInfo||g.stateNode.implementation!==x.implementation?(g=Cb(x,v.mode,k),g.return=v,g):(g=s(g,x.children||[]),g.return=v,g)}function u(v,g,x,k,A){return g===null||g.tag!==7?(g=ru(x,v.mode,k,A),g.return=v,g):(g=s(g,x),g.return=v,g)}function d(v,g,x){if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return g=Tb(""+g,v.mode,x),g.return=v,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case km:return x=Ip(g.type,g.key,g.props,null,v.mode,x),Fh(x,g),x.return=v,x;case df:return g=Cb(g,v.mode,x),g.return=v,g;case pl:return g=Pc(g),d(v,g,x)}if(hf(g)||qh(g))return g=ru(g,v.mode,x,null),g.return=v,g;if(typeof g.then=="function")return d(v,Nm(g),x);if(g.$$typeof===ko)return d(v,Mm(v,g),x);Im(v,g)}return null}function f(v,g,x,k){var A=g!==null?g.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return A!==null?null:o(v,g,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case km:return x.key===A?l(v,g,x,k):null;case df:return x.key===A?c(v,g,x,k):null;case pl:return x=Pc(x),f(v,g,x,k)}if(hf(x)||qh(x))return A!==null?null:u(v,g,x,k,null);if(typeof x.then=="function")return f(v,g,Nm(x),k);if(x.$$typeof===ko)return f(v,g,Mm(v,x),k);Im(v,x)}return null}function m(v,g,x,k,A){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return v=v.get(x)||null,o(g,v,""+k,A);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case km:return v=v.get(k.key===null?x:k.key)||null,l(g,v,k,A);case df:return v=v.get(k.key===null?x:k.key)||null,c(g,v,k,A);case pl:return k=Pc(k),m(v,g,x,k,A)}if(hf(k)||qh(k))return v=v.get(x)||null,u(g,v,k,A,null);if(typeof k.then=="function")return m(v,g,x,Nm(k),A);if(k.$$typeof===ko)return m(v,g,x,Mm(g,k),A);Im(g,k)}return null}function p(v,g,x,k){for(var A=null,T=null,C=g,j=g=0,z=null;C!==null&&j<x.length;j++){C.index>j?(z=C,C=null):z=C.sibling;var E=f(v,C,x[j],k);if(E===null){C===null&&(C=z);break}e&&C&&E.alternate===null&&t(v,C),g=i(E,g,j),T===null?A=E:T.sibling=E,T=E,C=z}if(j===x.length)return n(v,C),Yt&&yo(v,j),A;if(C===null){for(;j<x.length;j++)C=d(v,x[j],k),C!==null&&(g=i(C,g,j),T===null?A=C:T.sibling=C,T=C);return Yt&&yo(v,j),A}for(C=r(C);j<x.length;j++)z=m(C,v,j,x[j],k),z!==null&&(e&&z.alternate!==null&&C.delete(z.key===null?j:z.key),g=i(z,g,j),T===null?A=z:T.sibling=z,T=z);return e&&C.forEach(function(P){return t(v,P)}),Yt&&yo(v,j),A}function y(v,g,x,k){if(x==null)throw Error(le(151));for(var A=null,T=null,C=g,j=g=0,z=null,E=x.next();C!==null&&!E.done;j++,E=x.next()){C.index>j?(z=C,C=null):z=C.sibling;var P=f(v,C,E.value,k);if(P===null){C===null&&(C=z);break}e&&C&&P.alternate===null&&t(v,C),g=i(P,g,j),T===null?A=P:T.sibling=P,T=P,C=z}if(E.done)return n(v,C),Yt&&yo(v,j),A;if(C===null){for(;!E.done;j++,E=x.next())E=d(v,E.value,k),E!==null&&(g=i(E,g,j),T===null?A=E:T.sibling=E,T=E);return Yt&&yo(v,j),A}for(C=r(C);!E.done;j++,E=x.next())E=m(C,v,j,E.value,k),E!==null&&(e&&E.alternate!==null&&C.delete(E.key===null?j:E.key),g=i(E,g,j),T===null?A=E:T.sibling=E,T=E);return e&&C.forEach(function(D){return t(v,D)}),Yt&&yo(v,j),A}function w(v,g,x,k){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 km:e:{for(var A=x.key;g!==null;){if(g.key===A){if(A=x.type,A===sd){if(g.tag===7){n(v,g.sibling),k=s(g,x.props.children),k.return=v,v=k;break e}}else if(g.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===pl&&Pc(A)===g.type){n(v,g.sibling),k=s(g,x.props),Fh(k,x),k.return=v,v=k;break e}n(v,g);break}else t(v,g);g=g.sibling}x.type===sd?(k=ru(x.props.children,v.mode,k,x.key),k.return=v,v=k):(k=Ip(x.type,x.key,x.props,null,v.mode,k),Fh(k,x),k.return=v,v=k)}return a(v);case df:e:{for(A=x.key;g!==null;){if(g.key===A)if(g.tag===4&&g.stateNode.containerInfo===x.containerInfo&&g.stateNode.implementation===x.implementation){n(v,g.sibling),k=s(g,x.children||[]),k.return=v,v=k;break e}else{n(v,g);break}else t(v,g);g=g.sibling}k=Cb(x,v.mode,k),k.return=v,v=k}return a(v);case pl:return x=Pc(x),w(v,g,x,k)}if(hf(x))return p(v,g,x,k);if(qh(x)){if(A=qh(x),typeof A!="function")throw Error(le(150));return x=A.call(x),y(v,g,x,k)}if(typeof x.then=="function")return w(v,g,Nm(x),k);if(x.$$typeof===ko)return w(v,g,Mm(v,x),k);Im(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,g!==null&&g.tag===6?(n(v,g.sibling),k=s(g,x),k.return=v,v=k):(n(v,g),k=Tb(x,v.mode,k),k.return=v,v=k),a(v)):n(v,g)}return function(v,g,x,k){try{i0=0;var A=w(v,g,x,k);return Cd=null,A}catch(C){if(C===mh||C===U1)throw C;var T=ci(29,C,null,v.mode);return T.lanes=k,T.return=v,T}finally{}}}var pu=pA(!0),gA=pA(!1),gl=!1;function o_(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function c2(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 $l(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pl(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,cn&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=pg(e),oA(e,null,n),t}return q1(e,r,t,n),pg(e)}function Ef(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,DC(e,n)}}function Eb(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 a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?s=i=a:i=i.next=a,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 u2=!1;function Mf(){if(u2){var e=Td;if(e!==null)throw e}}function Nf(e,t,n,r){u2=!1;var s=e.updateQueue;gl=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?i=c:a.next=c,a=l;var u=e.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=s.baseState;a=0,u=c=l=null,o=i;do{var f=o.lane&-536870913,m=f!==o.lane;if(m?(Wt&f)===f:(r&f)===f){f!==0&&f===Pd&&(u2=!0),u!==null&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var p=e,y=o;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=Hn({},d,f);break e;case 2:gl=!0}}f=o.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:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=m,l=d):u=u.next=m,a|=f;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;m=o,o=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),Jl|=a,e.lanes=a,e.memoizedState=d}}function yA(e,t){if(typeof e!="function")throw Error(le(191,e));e.call(t)}function bA(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)yA(n[e],t)}var qd=Wa(null),vg=Wa(0);function Kk(e,t){e=Po,On(vg,e),On(qd,t),Po=e|t.baseLanes}function d2(){On(vg,Po),On(qd,qd.current)}function l_(){Po=vg.current,Vr(qd),Vr(vg)}var xi=Wa(null),Fi=null;function _l(e){var t=e.alternate;On(hr,hr.current&1),On(xi,e),Fi===null&&(t===null||qd.current!==null||t.memoizedState!==null)&&(Fi=e)}function h2(e){On(hr,hr.current),On(xi,e),Fi===null&&(Fi=e)}function vA(e){e.tag===22?(On(hr,hr.current),On(xi,e),Fi===null&&(Fi=e)):kl()}function kl(){On(hr,hr.current),On(xi,xi.current)}function li(e){Vr(xi),Fi===e&&(Fi=null),Vr(hr)}var hr=Wa(0);function xg(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||I2(n)||R2(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 Bo=0,Dt=null,Tn=null,yr=null,wg=!1,Ad=!1,gu=!1,_g=0,a0=0,Ed=null,Tz=0;function rr(){throw Error(le(321))}function c_(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vi(e[n],t[n]))return!1;return!0}function u_(e,t,n,r,s,i){return Bo=i,Dt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xt.H=e===null||e.memoizedState===null?XA:w_,gu=!1,i=n(r,s),gu=!1,Ad&&(i=wA(t,n,r,s)),xA(e),i}function xA(e){xt.H=o0;var t=Tn!==null&&Tn.next!==null;if(Bo=0,yr=Tn=Dt=null,wg=!1,a0=0,Ed=null,t)throw Error(le(300));e===null||wr||(e=e.dependencies,e!==null&&yg(e)&&(wr=!0))}function wA(e,t,n,r){Dt=e;var s=0;do{if(Ad&&(Ed=null),a0=0,Ad=!1,25<=s)throw Error(le(301));if(s+=1,yr=Tn=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}xt.H=QA,i=t(n,r)}while(Ad);return i}function Cz(){var e=xt.H,t=e.useState()[0];return t=typeof t.then=="function"?H0(t):t,e=e.useState()[0],(Tn!==null?Tn.memoizedState:null)!==e&&(Dt.flags|=1024),t}function d_(){var e=_g!==0;return _g=0,e}function h_(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function f_(e){if(wg){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}wg=!1}Bo=0,yr=Tn=Dt=null,Ad=!1,a0=_g=0,Ed=null}function bs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yr===null?Dt.memoizedState=yr=e:yr=yr.next=e,yr}function fr(){if(Tn===null){var e=Dt.alternate;e=e!==null?e.memoizedState:null}else e=Tn.next;var t=yr===null?Dt.memoizedState:yr.next;if(t!==null)yr=t,Tn=e;else{if(e===null)throw Dt.alternate===null?Error(le(467)):Error(le(310));Tn=e,e={memoizedState:Tn.memoizedState,baseState:Tn.baseState,baseQueue:Tn.baseQueue,queue:Tn.queue,next:null},yr===null?Dt.memoizedState=yr=e:yr=yr.next=e}return yr}function H1(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function H0(e){var t=a0;return a0+=1,Ed===null&&(Ed=[]),e=mA(Ed,e,t),t=Dt,(yr===null?t.memoizedState:yr.next)===null&&(t=t.alternate,xt.H=t===null||t.memoizedState===null?XA:w_),e}function F1(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return H0(e);if(e.$$typeof===ko)return ts(e)}throw Error(le(438,String(e)))}function m_(e){var t=null,n=Dt.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Dt.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=H1(),Dt.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]=dB;return t.index++,n}function zo(e,t){return typeof t=="function"?t(e):t}function jp(e){var t=fr();return p_(t,Tn,e)}function p_(e,t,n){var r=e.queue;if(r===null)throw Error(le(311));r.lastRenderedReducer=n;var s=e.baseQueue,i=r.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}t.baseQueue=s=i,r.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var o=a=null,l=null,c=t,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(Wt&d)===d:(Bo&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===Pd&&(u=!0);else if((Bo&f)===f){c=c.next,f===Pd&&(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?(o=l=d,a=i):l=l.next=d,Dt.lanes|=f,Jl|=f;d=c.action,gu&&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?(o=l=f,a=i):l=l.next=f,Dt.lanes|=d,Jl|=d;c=c.next}while(c!==null&&c!==t);if(l===null?a=i:l.next=o,!vi(i,e.memoizedState)&&(wr=!0,u&&(n=Td,n!==null)))throw n;e.memoizedState=i,e.baseState=a,e.baseQueue=l,r.lastRenderedState=i}return s===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Mb(e){var t=fr(),n=t.queue;if(n===null)throw Error(le(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);vi(i,t.memoizedState)||(wr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function _A(e,t,n){var r=Dt,s=fr(),i=Yt;if(i){if(n===void 0)throw Error(le(407));n=n()}else n=t();var a=!vi((Tn||s).memoizedState,n);if(a&&(s.memoizedState=n,wr=!0),s=s.queue,g_(TA.bind(null,r,s,e),[e]),s.getSnapshot!==t||a||yr!==null&&yr.memoizedState.tag&1){if(r.flags|=2048,Ud(9,{destroy:void 0},SA.bind(null,r,s,n,t),null),Nn===null)throw Error(le(349));i||Bo&127||kA(r,t,n)}return n}function kA(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Dt.updateQueue,t===null?(t=H1(),Dt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function SA(e,t,n,r){t.value=n,t.getSnapshot=r,CA(t)&&AA(e)}function TA(e,t,n){return n(function(){CA(t)&&AA(e)})}function CA(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vi(e,n)}catch{return!0}}function AA(e){var t=Au(e,2);t!==null&&Gs(t,e,2)}function f2(e){var t=bs();if(typeof e=="function"){var n=e;if(e=n(),gu){Cl(!0);try{n()}finally{Cl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t}function EA(e,t,n,r){return e.baseState=n,p_(e,Tn,typeof r=="function"?r:zo)}function Az(e,t,n,r,s){if(W1(e))throw Error(le(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(a){i.listeners.push(a)}};xt.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,MA(t,i)):(i.next=n.next,t.pending=n.next=i)}}function MA(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=xt.T,a={};xt.T=a;try{var o=n(s,r),l=xt.S;l!==null&&l(a,o),Yk(e,t,o)}catch(c){m2(e,t,c)}finally{i!==null&&a.types!==null&&(i.types=a.types),xt.T=i}}else try{i=n(s,r),Yk(e,t,i)}catch(c){m2(e,t,c)}}function Yk(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){Xk(e,t,r)},function(r){return m2(e,t,r)}):Xk(e,t,n)}function Xk(e,t,n){t.status="fulfilled",t.value=n,NA(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,MA(e,n)))}function m2(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,NA(t),t=t.next;while(t!==r)}e.action=null}function NA(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function IA(e,t){return t}function Qk(e,t){if(Yt){var n=Nn.formState;if(n!==null){e:{var r=Dt;if(Yt){if(Pn){t:{for(var s=Pn,i=$i;s.nodeType!==8;){if(!i){s=null;break t}if(s=Vi(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Pn=Vi(s.nextSibling),r=s.data==="F!";break e}}Xl(r)}r=!1}r&&(t=n[0])}}return n=bs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:IA,lastRenderedState:t},n.queue=r,n=GA.bind(null,Dt,r),r.dispatch=n,r=f2(!1),i=x_.bind(null,Dt,!1,r.queue),r=bs(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=Az.bind(null,Dt,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function Jk(e){var t=fr();return RA(t,Tn,e)}function RA(e,t,n){if(t=p_(e,t,IA)[0],e=jp(zo)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=H0(t)}catch(a){throw a===mh?U1:a}else r=t;t=fr();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(Dt.flags|=2048,Ud(9,{destroy:void 0},Ez.bind(null,s,n),null)),[r,i,e]}function Ez(e,t){e.action=t}function Zk(e){var t=fr(),n=Tn;if(n!==null)return RA(t,n,e);fr(),t=t.memoizedState,n=fr();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ud(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Dt.updateQueue,t===null&&(t=H1(),Dt.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 jA(){return fr().memoizedState}function Dp(e,t,n,r){var s=bs();Dt.flags|=e,s.memoizedState=Ud(1|t,{destroy:void 0},n,r===void 0?null:r)}function V1(e,t,n,r){var s=fr();r=r===void 0?null:r;var i=s.memoizedState.inst;Tn!==null&&r!==null&&c_(r,Tn.memoizedState.deps)?s.memoizedState=Ud(t,i,n,r):(Dt.flags|=e,s.memoizedState=Ud(1|t,i,n,r))}function e6(e,t){Dp(8390656,8,e,t)}function g_(e,t){V1(2048,8,e,t)}function Mz(e){Dt.flags|=4;var t=Dt.updateQueue;if(t===null)t=H1(),Dt.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function DA(e){var t=fr().memoizedState;return Mz({ref:t,nextImpl:e}),function(){if(cn&2)throw Error(le(440));return t.impl.apply(void 0,arguments)}}function OA(e,t){return V1(4,2,e,t)}function LA(e,t){return V1(4,4,e,t)}function BA(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 zA(e,t,n){n=n!=null?n.concat([e]):null,V1(4,4,BA.bind(null,t,e),n)}function y_(){}function $A(e,t){var n=fr();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&c_(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function PA(e,t){var n=fr();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&c_(t,r[1]))return r[0];if(r=e(),gu){Cl(!0);try{e()}finally{Cl(!1)}}return n.memoizedState=[r,t],r}function b_(e,t,n){return n===void 0||Bo&1073741824&&!(Wt&261930)?e.memoizedState=t:(e.memoizedState=n,e=EE(),Dt.lanes|=e,Jl|=e,n)}function qA(e,t,n,r){return vi(n,t)?n:qd.current!==null?(e=b_(e,n,r),vi(e,t)||(wr=!0),e):!(Bo&42)||Bo&1073741824&&!(Wt&261930)?(wr=!0,e.memoizedState=n):(e=EE(),Dt.lanes|=e,Jl|=e,t)}function UA(e,t,n,r,s){var i=dn.p;dn.p=i!==0&&8>i?i:8;var a=xt.T,o={};xt.T=o,x_(e,!1,t,n);try{var l=s(),c=xt.S;if(c!==null&&c(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=Sz(l,r);If(e,t,u,gi(e))}else If(e,t,r,gi(e))}catch(d){If(e,t,{then:function(){},status:"rejected",reason:d},gi())}finally{dn.p=i,a!==null&&o.types!==null&&(a.types=o.types),xt.T=a}}function Nz(){}function p2(e,t,n,r){if(e.tag!==5)throw Error(le(476));var s=HA(e).queue;UA(e,s,t,nu,n===null?Nz:function(){return FA(e),n(r)})}function HA(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:nu,baseState:nu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:nu},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function FA(e){var t=HA(e);t.next===null&&(t=e.alternate.memoizedState),If(e,t.next.queue,{},gi())}function v_(){return ts(u0)}function VA(){return fr().memoizedState}function WA(){return fr().memoizedState}function Iz(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gi();e=$l(n);var r=Pl(t,e,n);r!==null&&(Gs(r,t,n),Ef(r,t,n)),t={cache:s_()},e.payload=t;return}t=t.return}}function Rz(e,t,n){var r=gi();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},W1(e)?KA(t,n):(n=e_(e,t,n,r),n!==null&&(Gs(n,e,r),YA(n,t,r)))}function GA(e,t,n){var r=gi();If(e,t,n,r)}function If(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(W1(e))KA(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(s.hasEagerState=!0,s.eagerState=o,vi(o,a))return q1(e,t,s,0),Nn===null&&P1(),!1}catch{}finally{}if(n=e_(e,t,s,r),n!==null)return Gs(n,e,r),YA(n,t,r),!0}return!1}function x_(e,t,n,r){if(r={lane:2,revertLane:M_(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},W1(e)){if(t)throw Error(le(479))}else t=e_(e,n,r,2),t!==null&&Gs(t,e,2)}function W1(e){var t=e.alternate;return e===Dt||t!==null&&t===Dt}function KA(e,t){Ad=wg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function YA(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,DC(e,n)}}var o0={readContext:ts,use:F1,useCallback:rr,useContext:rr,useEffect:rr,useImperativeHandle:rr,useLayoutEffect:rr,useInsertionEffect:rr,useMemo:rr,useReducer:rr,useRef:rr,useState:rr,useDebugValue:rr,useDeferredValue:rr,useTransition:rr,useSyncExternalStore:rr,useId:rr,useHostTransitionStatus:rr,useFormState:rr,useActionState:rr,useOptimistic:rr,useMemoCache:rr,useCacheRefresh:rr};o0.useEffectEvent=rr;var XA={readContext:ts,use:F1,useCallback:function(e,t){return bs().memoizedState=[e,t===void 0?null:t],e},useContext:ts,useEffect:e6,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Dp(4194308,4,BA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Dp(4194308,4,e,t)},useInsertionEffect:function(e,t){Dp(4,2,e,t)},useMemo:function(e,t){var n=bs();t=t===void 0?null:t;var r=e();if(gu){Cl(!0);try{e()}finally{Cl(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=bs();if(n!==void 0){var s=n(t);if(gu){Cl(!0);try{n(t)}finally{Cl(!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=Rz.bind(null,Dt,e),[r.memoizedState,e]},useRef:function(e){var t=bs();return e={current:e},t.memoizedState=e},useState:function(e){e=f2(e);var t=e.queue,n=GA.bind(null,Dt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:y_,useDeferredValue:function(e,t){var n=bs();return b_(n,e,t)},useTransition:function(){var e=f2(!1);return e=UA.bind(null,Dt,e.queue,!0,!1),bs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Dt,s=bs();if(Yt){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),Nn===null)throw Error(le(349));Wt&127||kA(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,e6(TA.bind(null,r,i,e),[e]),r.flags|=2048,Ud(9,{destroy:void 0},SA.bind(null,r,i,n,t),null),n},useId:function(){var e=bs(),t=Nn.identifierPrefix;if(Yt){var n=La,r=Oa;n=(r&~(1<<32-pi(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=_g++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Tz++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:v_,useFormState:Qk,useActionState:Qk,useOptimistic:function(e){var t=bs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=x_.bind(null,Dt,!0,n),n.dispatch=t,[e,t]},useMemoCache:m_,useCacheRefresh:function(){return bs().memoizedState=Iz.bind(null,Dt)},useEffectEvent:function(e){var t=bs(),n={impl:e};return t.memoizedState=n,function(){if(cn&2)throw Error(le(440));return n.impl.apply(void 0,arguments)}}},w_={readContext:ts,use:F1,useCallback:$A,useContext:ts,useEffect:g_,useImperativeHandle:zA,useInsertionEffect:OA,useLayoutEffect:LA,useMemo:PA,useReducer:jp,useRef:jA,useState:function(){return jp(zo)},useDebugValue:y_,useDeferredValue:function(e,t){var n=fr();return qA(n,Tn.memoizedState,e,t)},useTransition:function(){var e=jp(zo)[0],t=fr().memoizedState;return[typeof e=="boolean"?e:H0(e),t]},useSyncExternalStore:_A,useId:VA,useHostTransitionStatus:v_,useFormState:Jk,useActionState:Jk,useOptimistic:function(e,t){var n=fr();return EA(n,Tn,e,t)},useMemoCache:m_,useCacheRefresh:WA};w_.useEffectEvent=DA;var QA={readContext:ts,use:F1,useCallback:$A,useContext:ts,useEffect:g_,useImperativeHandle:zA,useInsertionEffect:OA,useLayoutEffect:LA,useMemo:PA,useReducer:Mb,useRef:jA,useState:function(){return Mb(zo)},useDebugValue:y_,useDeferredValue:function(e,t){var n=fr();return Tn===null?b_(n,e,t):qA(n,Tn.memoizedState,e,t)},useTransition:function(){var e=Mb(zo)[0],t=fr().memoizedState;return[typeof e=="boolean"?e:H0(e),t]},useSyncExternalStore:_A,useId:VA,useHostTransitionStatus:v_,useFormState:Zk,useActionState:Zk,useOptimistic:function(e,t){var n=fr();return Tn!==null?EA(n,Tn,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:m_,useCacheRefresh:WA};QA.useEffectEvent=DA;function Nb(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Hn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var g2={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gi(),s=$l(r);s.payload=t,n!=null&&(s.callback=n),t=Pl(e,s,r),t!==null&&(Gs(t,e,r),Ef(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gi(),s=$l(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Pl(e,s,r),t!==null&&(Gs(t,e,r),Ef(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gi(),r=$l(n);r.tag=2,t!=null&&(r.callback=t),t=Pl(e,r,n),t!==null&&(Gs(t,e,n),Ef(t,e,n))}};function t6(e,t,n,r,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!n0(n,r)||!n0(s,i):!0}function n6(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&&g2.enqueueReplaceState(t,t.state,null)}function yu(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=Hn({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function JA(e){mg(e)}function ZA(e){console.error(e)}function eE(e){mg(e)}function kg(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function r6(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 y2(e,t,n){return n=$l(n),n.tag=3,n.payload={element:null},n.callback=function(){kg(e,t)},n}function tE(e){return e=$l(e),e.tag=3,e}function nE(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(){r6(t,n,r)}}var a=n.stateNode;a!==null&&typeof a.componentDidCatch=="function"&&(e.callback=function(){r6(t,n,r),typeof s!="function"&&(ql===null?ql=new Set([this]):ql.add(this));var o=r.stack;this.componentDidCatch(r.value,{componentStack:o!==null?o:""})})}function jz(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&fh(t,n,s,!0),n=xi.current,n!==null){switch(n.tag){case 31:case 13:return Fi===null?Eg():n.alternate===null&&ir===0&&(ir=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===bg?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qb(e,r,s)),!1;case 22:return n.flags|=65536,r===bg?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)),qb(e,r,s)),!1}throw Error(le(435,n.tag))}return qb(e,r,s),Eg(),!1}if(Yt)return t=xi.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==s2&&(e=Error(le(422),{cause:r}),s0(zi(e,n)))):(r!==s2&&(t=Error(le(423),{cause:r}),s0(zi(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=zi(r,n),s=y2(e.stateNode,r,s),Eb(e,s),ir!==4&&(ir=2)),!1;var i=Error(le(520),{cause:r});if(i=zi(i,n),Df===null?Df=[i]:Df.push(i),ir!==4&&(ir=2),t===null)return!0;r=zi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=y2(n.stateNode,r,e),Eb(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"&&(ql===null||!ql.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=tE(s),nE(s,e,n,r),Eb(n,s),!1}n=n.return}while(n!==null);return!1}var __=Error(le(461)),wr=!1;function Xr(e,t,n,r){t.child=e===null?gA(t,null,n,r):pu(t,e.child,n,r)}function s6(e,t,n,r,s){n=n.render;var i=t.ref;if("ref"in r){var a={};for(var o in r)o!=="ref"&&(a[o]=r[o])}else a=r;return mu(t),r=u_(e,t,n,a,i,s),o=d_(),e!==null&&!wr?(h_(e,t,s),$o(e,t,s)):(Yt&&o&&n_(t),t.flags|=1,Xr(e,t,r,s),t.child)}function i6(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!t_(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,rE(e,t,i,r,s)):(e=Ip(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!k_(e,s)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:n0,n(a,r)&&e.ref===t.ref)return $o(e,t,s)}return t.flags|=1,e=No(i,r),e.ref=t.ref,e.return=t,t.child=e}function rE(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(n0(i,r)&&e.ref===t.ref)if(wr=!1,t.pendingProps=r=i,k_(e,s))e.flags&131072&&(wr=!0);else return t.lanes=e.lanes,$o(e,t,s)}return b2(e,t,n,r,s)}function sE(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 a6(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Rp(t,i!==null?i.cachePool:null),i!==null?Kk(t,i):d2(),vA(t);else return r=t.lanes=536870912,a6(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(Rp(t,i.cachePool),Kk(t,i),kl(),t.memoizedState=null):(e!==null&&Rp(t,null),d2(),kl());return Xr(e,t,s,n),t.child}function mf(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function a6(e,t,n,r,s){var i=i_();return i=i===null?null:{parent:xr._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&Rp(t,null),d2(),vA(t),e!==null&&fh(e,t,r,!0),t.childLanes=s,null}function Op(e,t){return t=Sg({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function o6(e,t,n){return pu(t,e.child,null,n),e=Op(t,t.pendingProps),e.flags|=2,li(t),t.memoizedState=null,e}function Dz(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Yt){if(r.mode==="hidden")return e=Op(t,r),t.lanes=536870912,mf(null,e);if(h2(t),(e=Pn)?(e=XE(e,$i),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yl!==null?{id:Oa,overflow:La}:null,retryLane:536870912,hydrationErrors:null},n=cA(e),n.return=t,t.child=n,es=t,Pn=null)):e=null,e===null)throw Xl(t);return t.lanes=536870912,null}return Op(t,r)}var i=e.memoizedState;if(i!==null){var a=i.dehydrated;if(h2(t),s)if(t.flags&256)t.flags&=-257,t=o6(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(le(558));else if(wr||fh(e,t,n,!1),s=(n&e.childLanes)!==0,wr||s){if(r=Nn,r!==null&&(a=OC(r,n),a!==0&&a!==i.retryLane))throw i.retryLane=a,Au(e,a),Gs(r,e,a),__;Eg(),t=o6(e,t,n)}else e=i.treeContext,Pn=Vi(a.nextSibling),es=t,Yt=!0,zl=null,$i=!1,e!==null&&dA(t,e),t=Op(t,r),t.flags|=4096;return t}return e=No(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Lp(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(le(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function b2(e,t,n,r,s){return mu(t),n=u_(e,t,n,r,void 0,s),r=d_(),e!==null&&!wr?(h_(e,t,s),$o(e,t,s)):(Yt&&r&&n_(t),t.flags|=1,Xr(e,t,n,s),t.child)}function l6(e,t,n,r,s,i){return mu(t),t.updateQueue=null,n=wA(t,r,n,s),xA(e),r=d_(),e!==null&&!wr?(h_(e,t,i),$o(e,t,i)):(Yt&&r&&n_(t),t.flags|=1,Xr(e,t,n,i),t.child)}function c6(e,t,n,r,s){if(mu(t),t.stateNode===null){var i=hd,a=n.contextType;typeof a=="object"&&a!==null&&(i=ts(a)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=g2,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},o_(t),a=n.contextType,i.context=typeof a=="object"&&a!==null?ts(a):hd,i.state=t.memoizedState,a=n.getDerivedStateFromProps,typeof a=="function"&&(Nb(t,n,a,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(a=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),a!==i.state&&g2.enqueueReplaceState(i,i.state,null),Nf(t,r,i,s),Mf(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var o=t.memoizedProps,l=yu(n,o);i.props=l;var c=i.context,u=n.contextType;a=hd,typeof u=="object"&&u!==null&&(a=ts(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o||c!==a)&&n6(t,i,r,a),gl=!1;var f=t.memoizedState;i.state=f,Nf(t,r,i,s),Mf(),c=t.memoizedState,o||f!==c||gl?(typeof d=="function"&&(Nb(t,n,d,r),c=t.memoizedState),(l=gl||t6(t,n,l,r,f,c,a))?(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=a,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,c2(e,t),a=t.memoizedProps,u=yu(n,a),i.props=u,d=t.pendingProps,f=i.context,c=n.contextType,l=hd,typeof c=="object"&&c!==null&&(l=ts(c)),o=n.getDerivedStateFromProps,(c=typeof o=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==d||f!==l)&&n6(t,i,r,l),gl=!1,f=t.memoizedState,i.state=f,Nf(t,r,i,s),Mf();var m=t.memoizedState;a!==d||f!==m||gl||e!==null&&e.dependencies!==null&&yg(e.dependencies)?(typeof o=="function"&&(Nb(t,n,o,r),m=t.memoizedState),(u=gl||t6(t,n,u,r,f,m,l)||e!==null&&e.dependencies!==null&&yg(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"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===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"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Lp(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=pu(t,e.child,null,s),t.child=pu(t,null,n,s)):Xr(e,t,n,s),t.memoizedState=i.state,e=t.child):e=$o(e,t,s),e}function u6(e,t,n,r){return fu(),t.flags|=256,Xr(e,t,n,r),t.child}var Ib={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rb(e){return{baseLanes:e,cachePool:fA()}}function jb(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=di),e}function iE(e,t,n){var r=t.pendingProps,s=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(hr.current&2)!==0),a&&(s=!0,t.flags&=-129),a=(t.flags&32)!==0,t.flags&=-33,e===null){if(Yt){if(s?_l(t):kl(),(e=Pn)?(e=XE(e,$i),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yl!==null?{id:Oa,overflow:La}:null,retryLane:536870912,hydrationErrors:null},n=cA(e),n.return=t,t.child=n,es=t,Pn=null)):e=null,e===null)throw Xl(t);return R2(e)?t.lanes=32:t.lanes=536870912,null}var o=r.children;return r=r.fallback,s?(kl(),s=t.mode,o=Sg({mode:"hidden",children:o},s),r=ru(r,s,n,null),o.return=t,r.return=t,o.sibling=r,t.child=o,r=t.child,r.memoizedState=Rb(n),r.childLanes=jb(e,a,n),t.memoizedState=Ib,mf(null,r)):(_l(t),v2(t,o))}var l=e.memoizedState;if(l!==null&&(o=l.dehydrated,o!==null)){if(i)t.flags&256?(_l(t),t.flags&=-257,t=Db(e,t,n)):t.memoizedState!==null?(kl(),t.child=e.child,t.flags|=128,t=null):(kl(),o=r.fallback,s=t.mode,r=Sg({mode:"visible",children:r.children},s),o=ru(o,s,n,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,pu(t,e.child,null,n),r=t.child,r.memoizedState=Rb(n),r.childLanes=jb(e,a,n),t.memoizedState=Ib,t=mf(null,r));else if(_l(t),R2(o)){if(a=o.nextSibling&&o.nextSibling.dataset,a)var c=a.dgst;a=c,r=Error(le(419)),r.stack="",r.digest=a,s0({value:r,source:null,stack:null}),t=Db(e,t,n)}else if(wr||fh(e,t,n,!1),a=(n&e.childLanes)!==0,wr||a){if(a=Nn,a!==null&&(r=OC(a,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Au(e,r),Gs(a,e,r),__;I2(o)||Eg(),t=Db(e,t,n)}else I2(o)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pn=Vi(o.nextSibling),es=t,Yt=!0,zl=null,$i=!1,e!==null&&dA(t,e),t=v2(t,r.children),t.flags|=4096);return t}return s?(kl(),o=r.fallback,s=t.mode,l=e.child,c=l.sibling,r=No(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?o=No(c,o):(o=ru(o,s,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,mf(null,r),r=t.child,o=e.child.memoizedState,o===null?o=Rb(n):(s=o.cachePool,s!==null?(l=xr._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=fA(),o={baseLanes:o.baseLanes|n,cachePool:s}),r.memoizedState=o,r.childLanes=jb(e,a,n),t.memoizedState=Ib,mf(e.child,r)):(_l(t),n=e.child,e=n.sibling,n=No(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(a=t.deletions,a===null?(t.deletions=[e],t.flags|=16):a.push(e)),t.child=n,t.memoizedState=null,n)}function v2(e,t){return t=Sg({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Sg(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function Db(e,t,n){return pu(t,e.child,null,n),e=v2(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function d6(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),a2(e.return,t,n)}function Ob(e,t,n,r,s,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s,treeForkCount:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=s,a.treeForkCount=i)}function aE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var a=hr.current,o=(a&2)!==0;if(o?(a=a&1|2,t.flags|=128):a&=1,On(hr,a),Xr(e,t,r,n),r=Yt?r0:0,!o&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&d6(e,n,t);else if(e.tag===19)d6(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&&xg(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Ob(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&&xg(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Ob(t,!0,n,null,i,r);break;case"together":Ob(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function $o(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,!(n&t.childLanes))if(e!==null){if(fh(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(le(153));if(t.child!==null){for(e=t.child,n=No(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=No(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function k_(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&yg(e)))}function Oz(e,t,n){switch(t.tag){case 3:ug(t,t.stateNode.containerInfo),wl(t,xr,e.memoizedState.cache),fu();break;case 27:case 5:G4(t);break;case 4:ug(t,t.stateNode.containerInfo);break;case 10:wl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,h2(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(_l(t),t.flags|=128,null):n&t.child.childLanes?iE(e,t,n):(_l(t),e=$o(e,t,n),e!==null?e.sibling:null);_l(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(fh(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return aE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),On(hr,hr.current),r)break;return null;case 22:return t.lanes=0,sE(e,t,n,t.pendingProps);case 24:wl(t,xr,e.memoizedState.cache)}return $o(e,t,n)}function oE(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)wr=!0;else{if(!k_(e,n)&&!(t.flags&128))return wr=!1,Oz(e,t,n);wr=!!(e.flags&131072)}else wr=!1,Yt&&t.flags&1048576&&uA(t,r0,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Pc(t.elementType),t.type=e,typeof e=="function")t_(e)?(r=yu(e,r),t.tag=1,t=c6(null,t,e,r,n)):(t.tag=0,t=b2(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===qw){t.tag=11,t=s6(null,t,e,r,n);break e}else if(s===Uw){t.tag=14,t=i6(null,t,e,r,n);break e}}throw t=V4(e)||e,Error(le(306,t,""))}}return t;case 0:return b2(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=yu(r,t.pendingProps),c6(e,t,r,s,n);case 3:e:{if(ug(t,t.stateNode.containerInfo),e===null)throw Error(le(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,c2(e,t),Nf(t,r,null,n);var a=t.memoizedState;if(r=a.cache,wl(t,xr,r),r!==i.cache&&o2(t,[xr],n,!0),Mf(),r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=u6(e,t,r,n);break e}else if(r!==s){s=zi(Error(le(424)),t),s0(s),t=u6(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(Pn=Vi(e.firstChild),es=t,Yt=!0,zl=null,$i=!0,n=gA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(fu(),r===s){t=$o(e,t,n);break e}Xr(e,t,r,n)}t=t.child}return t;case 26:return Lp(e,t),e===null?(n=I6(t.type,null,t.pendingProps,null))?t.memoizedState=n:Yt||(n=t.type,e=t.pendingProps,r=Rg(Bl.current).createElement(n),r[Zr]=t,r[Ys]=e,rs(r,n,e),Ur(r),t.stateNode=r):t.memoizedState=I6(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return G4(t),e===null&&Yt&&(r=t.stateNode=QE(t.type,t.pendingProps,Bl.current),es=t,$i=!0,s=Pn,dc(t.type)?(j2=s,Pn=Vi(r.firstChild)):Pn=s),Xr(e,t,t.pendingProps.children,n),Lp(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Yt&&((s=r=Pn)&&(r=d$(r,t.type,t.pendingProps,$i),r!==null?(t.stateNode=r,es=t,Pn=Vi(r.firstChild),$i=!1,s=!0):s=!1),s||Xl(t)),G4(t),s=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,r=i.children,M2(s,i)?r=null:a!==null&&M2(s,a)&&(t.flags|=32),t.memoizedState!==null&&(s=u_(e,t,Cz,null,null,n),u0._currentValue=s),Lp(e,t),Xr(e,t,r,n),t.child;case 6:return e===null&&Yt&&((e=n=Pn)&&(n=h$(n,t.pendingProps,$i),n!==null?(t.stateNode=n,es=t,Pn=null,e=!0):e=!1),e||Xl(t)),null;case 13:return iE(e,t,n);case 4:return ug(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=pu(t,null,r,n):Xr(e,t,r,n),t.child;case 11:return s6(e,t,t.type,t.pendingProps,n);case 7:return Xr(e,t,t.pendingProps,n),t.child;case 8:return Xr(e,t,t.pendingProps.children,n),t.child;case 12:return Xr(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,wl(t,t.type,r.value),Xr(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,mu(t),s=ts(s),r=r(s),t.flags|=1,Xr(e,t,r,n),t.child;case 14:return i6(e,t,t.type,t.pendingProps,n);case 15:return rE(e,t,t.type,t.pendingProps,n);case 19:return aE(e,t,n);case 31:return Dz(e,t,n);case 22:return sE(e,t,n,t.pendingProps);case 24:return mu(t),r=ts(xr),e===null?(s=i_(),s===null&&(s=Nn,i=s_(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},o_(t),wl(t,xr,s)):(e.lanes&n&&(c2(e,t),Nf(t,null,null,n),Mf()),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),wl(t,xr,r)):(r=i.cache,wl(t,xr,r),r!==s.cache&&o2(t,[xr],n,!0))),Xr(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(le(156,t.tag))}function oo(e){e.flags|=4}function Lb(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(IE())e.flags|=8192;else throw iu=bg,a_}else e.flags&=-16777217}function h6(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!eM(t))if(IE())e.flags|=8192;else throw iu=bg,a_}function Rm(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?RC():536870912,e.lanes|=t,Hd|=t)}function Vh(e,t){if(!Yt)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 zn(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 Lz(e,t,n){var r=t.pendingProps;switch(r_(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zn(t),null;case 1:return zn(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Io(xr),Bd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fu(t)?oo(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ab())),zn(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(oo(t),i!==null?(zn(t),h6(t,i)):(zn(t),Lb(t,s,null,r,n))):i?i!==e.memoizedState?(oo(t),zn(t),h6(t,i)):(zn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&oo(t),zn(t),Lb(t,s,e,r,n)),null;case 27:if(dg(t),n=Bl.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&oo(t);else{if(!r){if(t.stateNode===null)throw Error(le(166));return zn(t),null}e=Ua.current,Fu(t)?qk(t):(e=QE(s,r,n),t.stateNode=e,oo(t))}return zn(t),null;case 5:if(dg(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&oo(t);else{if(!r){if(t.stateNode===null)throw Error(le(166));return zn(t),null}if(i=Ua.current,Fu(t))qk(t);else{var a=Rg(Bl.current);switch(i){case 1:i=a.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=a.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=a.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=a.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=a.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?a.createElement(s,{is:r.is}):a.createElement(s)}}i[Zr]=t,i[Ys]=r;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)i.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=i;e:switch(rs(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&&oo(t)}}return zn(t),Lb(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&oo(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(le(166));if(e=Bl.current,Fu(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=es,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[Zr]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||GE(e.nodeValue,n)),e||Xl(t,!0)}else e=Rg(e).createTextNode(r),e[Zr]=t,t.stateNode=e}return zn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fu(t),n!==null){if(e===null){if(!r)throw Error(le(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(le(557));e[Zr]=t}else fu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zn(t),e=!1}else n=Ab(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(li(t),t):(li(t),null);if(t.flags&128)throw Error(le(558))}return zn(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Fu(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(le(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(le(317));s[Zr]=t}else fu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zn(t),s=!1}else s=Ab(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(li(t),t):(li(t),null)}return li(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),Rm(t,t.updateQueue),zn(t),null);case 4:return Bd(),e===null&&N_(t.stateNode.containerInfo),zn(t),null;case 10:return Io(t.type),zn(t),null;case 19:if(Vr(hr),r=t.memoizedState,r===null)return zn(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)Vh(r,!1);else{if(ir!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=xg(e),i!==null){for(t.flags|=128,Vh(r,!1),e=i.updateQueue,t.updateQueue=e,Rm(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)lA(n,e),n=n.sibling;return On(hr,hr.current&1|2),Yt&&yo(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&fi()>Cg&&(t.flags|=128,s=!0,Vh(r,!1),t.lanes=4194304)}else{if(!s)if(e=xg(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Rm(t,e),Vh(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!Yt)return zn(t),null}else 2*fi()-r.renderingStartTime>Cg&&n!==536870912&&(t.flags|=128,s=!0,Vh(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=fi(),e.sibling=null,n=hr.current,On(hr,s?n&1|2:n&1),Yt&&yo(t,r.treeForkCount),e):(zn(t),null);case 22:case 23:return li(t),l_(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zn(t),t.subtreeFlags&6&&(t.flags|=8192)):zn(t),n=t.updateQueue,n!==null&&Rm(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&&Vr(su),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Io(xr),zn(t),null;case 25:return null;case 30:return null}throw Error(le(156,t.tag))}function Bz(e,t){switch(r_(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Io(xr),Bd(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return dg(t),null;case 31:if(t.memoizedState!==null){if(li(t),t.alternate===null)throw Error(le(340));fu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(li(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));fu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vr(hr),null;case 4:return Bd(),null;case 10:return Io(t.type),null;case 22:case 23:return li(t),l_(),e!==null&&Vr(su),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Io(xr),null;case 25:return null;default:return null}}function lE(e,t){switch(r_(t),t.tag){case 3:Io(xr),Bd();break;case 26:case 27:case 5:dg(t);break;case 4:Bd();break;case 31:t.memoizedState!==null&&li(t);break;case 13:li(t);break;case 19:Vr(hr);break;case 10:Io(t.type);break;case 22:case 23:li(t),l_(),e!==null&&Vr(su);break;case 24:Io(xr)}}function F0(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,a=n.inst;r=i(),a.destroy=r}n=n.next}while(n!==s)}}catch(o){wn(t,t.return,o)}}function Ql(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 a=r.inst,o=a.destroy;if(o!==void 0){a.destroy=void 0,s=t;var l=n,c=o;try{c()}catch(u){wn(s,l,u)}}}r=r.next}while(r!==i)}}catch(u){wn(t,t.return,u)}}function cE(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{bA(t,n)}catch(r){wn(e,e.return,r)}}}function uE(e,t,n){n.props=yu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){wn(e,t,r)}}function Rf(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){wn(e,t,s)}}function Ba(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){wn(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){wn(e,t,s)}else n.current=null}function dE(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){wn(e,e.return,s)}}function Bb(e,t,n){try{var r=e.stateNode;i$(r,e.type,n,t),r[Ys]=t}catch(s){wn(e,e.return,s)}}function hE(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&dc(e.type)||e.tag===4}function zb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||hE(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&&dc(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 x2(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=So));else if(r!==4&&(r===27&&dc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(x2(e,t,n),e=e.sibling;e!==null;)x2(e,t,n),e=e.sibling}function Tg(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&&dc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Tg(e,t,n),e=e.sibling;e!==null;)Tg(e,t,n),e=e.sibling}function fE(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);rs(t,r,n),t[Zr]=e,t[Ys]=n}catch(i){wn(e,e.return,i)}}var xo=!1,br=!1,$b=!1,f6=typeof WeakSet=="function"?WeakSet:Set,qr=null;function zz(e,t){if(e=e.containerInfo,A2=Lg,e=eA(e),Jw(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 a=0,o=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var m;d!==n||s!==0&&d.nodeType!==3||(o=a+s),d!==i||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++c===s&&(o=a),f===i&&++u===r&&(l=a),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(E2={focusedElem:e,selectionRange:n},Lg=!1,qr=t;qr!==null;)if(t=qr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,qr=e;else for(;qr!==null;){switch(t=qr,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=yu(n.type,s);e=r.getSnapshotBeforeUpdate(p,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(y){wn(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)N2(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":N2(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(le(163))}if(e=t.sibling,e!==null){e.return=t.return,qr=e;break}qr=t.return}}function mE(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:co(e,n),r&4&&F0(5,n);break;case 1:if(co(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(a){wn(n,n.return,a)}else{var s=yu(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(a){wn(n,n.return,a)}}r&64&&cE(n),r&512&&Rf(n,n.return);break;case 3:if(co(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{bA(e,t)}catch(a){wn(n,n.return,a)}}break;case 27:t===null&&r&4&&fE(n);case 26:case 5:co(e,n),t===null&&r&4&&dE(n),r&512&&Rf(n,n.return);break;case 12:co(e,n);break;case 31:co(e,n),r&4&&yE(e,n);break;case 13:co(e,n),r&4&&bE(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Gz.bind(null,n),f$(e,n))));break;case 22:if(r=n.memoizedState!==null||xo,!r){t=t!==null&&t.memoizedState!==null||br,s=xo;var i=br;xo=r,(br=t)&&!i?go(e,n,(n.subtreeFlags&8772)!==0):co(e,n),xo=s,br=i}break;case 30:break;default:co(e,n)}}function pE(e){var t=e.alternate;t!==null&&(e.alternate=null,pE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ww(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 Wn=null,Ps=!1;function lo(e,t,n){for(n=n.child;n!==null;)gE(e,t,n),n=n.sibling}function gE(e,t,n){if(mi&&typeof mi.onCommitFiberUnmount=="function")try{mi.onCommitFiberUnmount(B0,n)}catch{}switch(n.tag){case 26:br||Ba(n,t),lo(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:br||Ba(n,t);var r=Wn,s=Ps;dc(n.type)&&(Wn=n.stateNode,Ps=!1),lo(e,t,n),Lf(n.stateNode),Wn=r,Ps=s;break;case 5:br||Ba(n,t);case 6:if(r=Wn,s=Ps,Wn=null,lo(e,t,n),Wn=r,Ps=s,Wn!==null)if(Ps)try{(Wn.nodeType===9?Wn.body:Wn.nodeName==="HTML"?Wn.ownerDocument.body:Wn).removeChild(n.stateNode)}catch(i){wn(n,t,i)}else try{Wn.removeChild(n.stateNode)}catch(i){wn(n,t,i)}break;case 18:Wn!==null&&(Ps?(e=Wn,C6(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Gd(e)):C6(Wn,n.stateNode));break;case 4:r=Wn,s=Ps,Wn=n.stateNode.containerInfo,Ps=!0,lo(e,t,n),Wn=r,Ps=s;break;case 0:case 11:case 14:case 15:Ql(2,n,t),br||Ql(4,n,t),lo(e,t,n);break;case 1:br||(Ba(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&uE(n,t,r)),lo(e,t,n);break;case 21:lo(e,t,n);break;case 22:br=(r=br)||n.memoizedState!==null,lo(e,t,n),br=r;break;default:lo(e,t,n)}}function yE(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gd(e)}catch(n){wn(t,t.return,n)}}}function bE(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gd(e)}catch(n){wn(t,t.return,n)}}function $z(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new f6),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new f6),t;default:throw Error(le(435,e.tag))}}function jm(e,t){var n=$z(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=Kz.bind(null,e,r);r.then(s,s)}})}function Ls(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r],i=e,a=t,o=a;e:for(;o!==null;){switch(o.tag){case 27:if(dc(o.type)){Wn=o.stateNode,Ps=!1;break e}break;case 5:Wn=o.stateNode,Ps=!1;break e;case 3:case 4:Wn=o.stateNode.containerInfo,Ps=!0;break e}o=o.return}if(Wn===null)throw Error(le(160));gE(i,a,s),Wn=null,Ps=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)vE(t,e),t=t.sibling}var aa=null;function vE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ls(t,e),Bs(e),r&4&&(Ql(3,e,e.return),F0(3,e),Ql(5,e,e.return));break;case 1:Ls(t,e),Bs(e),r&512&&(br||n===null||Ba(n,n.return)),r&64&&xo&&(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=aa;if(Ls(t,e),Bs(e),r&512&&(br||n===null||Ba(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[P0]||i[Zr]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),rs(i,r,n),i[Zr]=e,Ur(i),r=i;break e;case"link":var a=j6("link","href",s).get(r+(n.href||""));if(a){for(var o=0;o<a.length;o++)if(i=a[o],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)){a.splice(o,1);break t}}i=s.createElement(r),rs(i,r,n),s.head.appendChild(i);break;case"meta":if(a=j6("meta","content",s).get(r+(n.content||""))){for(o=0;o<a.length;o++)if(i=a[o],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)){a.splice(o,1);break t}}i=s.createElement(r),rs(i,r,n),s.head.appendChild(i);break;default:throw Error(le(468,r))}i[Zr]=e,Ur(i),r=i}e.stateNode=r}else D6(s,e.type,e.stateNode);else e.stateNode=R6(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?D6(s,e.type,e.stateNode):R6(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Bb(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ls(t,e),Bs(e),r&512&&(br||n===null||Ba(n,n.return)),n!==null&&r&4&&Bb(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ls(t,e),Bs(e),r&512&&(br||n===null||Ba(n,n.return)),e.flags&32){s=e.stateNode;try{$d(s,"")}catch(p){wn(e,e.return,p)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,Bb(e,s,n!==null?n.memoizedProps:s)),r&1024&&($b=!0);break;case 6:if(Ls(t,e),Bs(e),r&4){if(e.stateNode===null)throw Error(le(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(p){wn(e,e.return,p)}}break;case 3:if($p=null,s=aa,aa=jg(t.containerInfo),Ls(t,e),aa=s,Bs(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Gd(t.containerInfo)}catch(p){wn(e,e.return,p)}$b&&($b=!1,xE(e));break;case 4:r=aa,aa=jg(e.stateNode.containerInfo),Ls(t,e),Bs(e),aa=r;break;case 12:Ls(t,e),Bs(e);break;case 31:Ls(t,e),Bs(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,jm(e,r)));break;case 13:Ls(t,e),Bs(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(G1=fi()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,jm(e,r)));break;case 22:s=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=xo,u=br;if(xo=c||s,br=u||l,Ls(t,e),br=u,xo=c,Bs(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||l||xo||br||qc(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,s)a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none";else{o=l.stateNode;var d=l.memoizedProps.style,f=d!=null&&d.hasOwnProperty("display")?d.display:null;o.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(p){wn(l,l.return,p)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(p){wn(l,l.return,p)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;s?A6(m,!0):A6(l.stateNode,!1)}catch(p){wn(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,jm(e,n))));break;case 19:Ls(t,e),Bs(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,jm(e,r)));break;case 30:break;case 21:break;default:Ls(t,e),Bs(e)}}function Bs(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(hE(r)){n=r;break}r=r.return}if(n==null)throw Error(le(160));switch(n.tag){case 27:var s=n.stateNode,i=zb(e);Tg(e,i,s);break;case 5:var a=n.stateNode;n.flags&32&&($d(a,""),n.flags&=-33);var o=zb(e);Tg(e,o,a);break;case 3:case 4:var l=n.stateNode.containerInfo,c=zb(e);x2(e,c,l);break;default:throw Error(le(161))}}catch(u){wn(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xE(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xE(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function co(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)mE(e,t.alternate,t),t=t.sibling}function qc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ql(4,t,t.return),qc(t);break;case 1:Ba(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&uE(t,t.return,n),qc(t);break;case 27:Lf(t.stateNode);case 26:case 5:Ba(t,t.return),qc(t);break;case 22:t.memoizedState===null&&qc(t);break;case 30:qc(t);break;default:qc(t)}e=e.sibling}}function go(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,s=e,i=t,a=i.flags;switch(i.tag){case 0:case 11:case 15:go(s,i,n),F0(4,i);break;case 1:if(go(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){wn(r,r.return,c)}if(r=i,s=r.updateQueue,s!==null){var o=r.stateNode;try{var l=s.shared.hiddenCallbacks;if(l!==null)for(s.shared.hiddenCallbacks=null,s=0;s<l.length;s++)yA(l[s],o)}catch(c){wn(r,r.return,c)}}n&&a&64&&cE(i),Rf(i,i.return);break;case 27:fE(i);case 26:case 5:go(s,i,n),n&&r===null&&a&4&&dE(i),Rf(i,i.return);break;case 12:go(s,i,n);break;case 31:go(s,i,n),n&&a&4&&yE(s,i);break;case 13:go(s,i,n),n&&a&4&&bE(s,i);break;case 22:i.memoizedState===null&&go(s,i,n),Rf(i,i.return);break;case 30:break;default:go(s,i,n)}t=t.sibling}}function S_(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&&U0(n))}function T_(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&U0(e))}function ta(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wE(e,t,n,r),t=t.sibling}function wE(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:ta(e,t,n,r),s&2048&&F0(9,t);break;case 1:ta(e,t,n,r);break;case 3:ta(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&&U0(e)));break;case 12:if(s&2048){ta(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,a=i.id,o=i.onPostCommit;typeof o=="function"&&o(a,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){wn(t,t.return,l)}}else ta(e,t,n,r);break;case 31:ta(e,t,n,r);break;case 13:ta(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,a=t.alternate,t.memoizedState!==null?i._visibility&2?ta(e,t,n,r):jf(e,t):i._visibility&2?ta(e,t,n,r):(i._visibility|=2,Ju(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&S_(a,t);break;case 24:ta(e,t,n,r),s&2048&&T_(t.alternate,t);break;default:ta(e,t,n,r)}}function Ju(e,t,n,r,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,a=t,o=n,l=r,c=a.flags;switch(a.tag){case 0:case 11:case 15:Ju(i,a,o,l,s),F0(8,a);break;case 23:break;case 22:var u=a.stateNode;a.memoizedState!==null?u._visibility&2?Ju(i,a,o,l,s):jf(i,a):(u._visibility|=2,Ju(i,a,o,l,s)),s&&c&2048&&S_(a.alternate,a);break;case 24:Ju(i,a,o,l,s),s&&c&2048&&T_(a.alternate,a);break;default:Ju(i,a,o,l,s)}t=t.sibling}}function jf(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:jf(n,r),s&2048&&S_(r.alternate,r);break;case 24:jf(n,r),s&2048&&T_(r.alternate,r);break;default:jf(n,r)}t=t.sibling}}var pf=8192;function Vu(e,t,n){if(e.subtreeFlags&pf)for(e=e.child;e!==null;)_E(e,t,n),e=e.sibling}function _E(e,t,n){switch(e.tag){case 26:Vu(e,t,n),e.flags&pf&&e.memoizedState!==null&&T$(n,aa,e.memoizedState,e.memoizedProps);break;case 5:Vu(e,t,n);break;case 3:case 4:var r=aa;aa=jg(e.stateNode.containerInfo),Vu(e,t,n),aa=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=pf,pf=16777216,Vu(e,t,n),pf=r):Vu(e,t,n));break;default:Vu(e,t,n)}}function kE(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 Wh(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];qr=r,TE(r,e)}kE(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)SE(e),e=e.sibling}function SE(e){switch(e.tag){case 0:case 11:case 15:Wh(e),e.flags&2048&&Ql(9,e,e.return);break;case 3:Wh(e);break;case 12:Wh(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bp(e)):Wh(e);break;default:Wh(e)}}function Bp(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];qr=r,TE(r,e)}kE(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ql(8,t,t.return),Bp(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Bp(t));break;default:Bp(t)}e=e.sibling}}function TE(e,t){for(;qr!==null;){var n=qr;switch(n.tag){case 0:case 11:case 15:Ql(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:U0(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,qr=r;else e:for(n=e;qr!==null;){r=qr;var s=r.sibling,i=r.return;if(pE(r),r===n){qr=null;break e}if(s!==null){s.return=i,qr=s;break e}qr=i}}}var Pz={getCacheForType:function(e){var t=ts(xr),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ts(xr).controller.signal}},qz=typeof WeakMap=="function"?WeakMap:Map,cn=0,Nn=null,Ht=null,Wt=0,vn=0,ai=null,El=!1,ph=!1,C_=!1,Po=0,ir=0,Jl=0,au=0,A_=0,di=0,Hd=0,Df=null,Us=null,w2=!1,G1=0,CE=0,Cg=1/0,Ag=null,ql=null,Dr=0,Ul=null,Fd=null,Ro=0,_2=0,k2=null,AE=null,Of=0,S2=null;function gi(){return cn&2&&Wt!==0?Wt&-Wt:xt.T!==null?M_():LC()}function EE(){if(di===0)if(!(Wt&536870912)||Yt){var e=Tm;Tm<<=1,!(Tm&3932160)&&(Tm=262144),di=e}else di=536870912;return e=xi.current,e!==null&&(e.flags|=32),di}function Gs(e,t,n){(e===Nn&&(vn===2||vn===9)||e.cancelPendingCommit!==null)&&(Vd(e,0),Ml(e,Wt,di,!1)),$0(e,n),(!(cn&2)||e!==Nn)&&(e===Nn&&(!(cn&2)&&(au|=n),ir===4&&Ml(e,Wt,di,!1)),Ga(e))}function ME(e,t,n){if(cn&6)throw Error(le(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||z0(e,t),s=r?Fz(e,t):Pb(e,t,!0),i=r;do{if(s===0){ph&&!r&&Ml(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Uz(n)){s=Pb(e,t,!1),i=!1;continue}if(s===2){if(i=t,e.errorRecoveryDisabledLanes&i)var a=0;else a=e.pendingLanes&-536870913,a=a!==0?a:a&536870912?536870912:0;if(a!==0){t=a;e:{var o=e;s=Df;var l=o.current.memoizedState.isDehydrated;if(l&&(Vd(o,a).flags|=256),a=Pb(o,a,!1),a!==2){if(C_&&!l){o.errorRecoveryDisabledLanes|=i,au|=i,s=4;break e}i=Us,Us=s,i!==null&&(Us===null?Us=i:Us.push.apply(Us,i))}s=a}if(i=!1,s!==2)continue}}if(s===1){Vd(e,0),Ml(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(le(345));case 4:if((t&4194048)!==t)break;case 6:Ml(r,t,di,!El);break e;case 2:Us=null;break;case 3:case 5:break;default:throw Error(le(329))}if((t&62914560)===t&&(s=G1+300-fi(),10<s)){if(Ml(r,t,di,!El),L1(r,0,!0)!==0)break e;Ro=t,r.timeoutHandle=YE(m6.bind(null,r,n,Us,Ag,w2,t,di,au,Hd,El,i,"Throttled",-0,0),s);break e}m6(r,n,Us,Ag,w2,t,di,au,Hd,El,i,null,-0,0)}}break}while(!0);Ga(e)}function m6(e,t,n,r,s,i,a,o,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:So},_E(t,i,d);var p=(i&62914560)===i?G1-fi():(i&4194048)===i?CE-fi():0;if(p=C$(d,p),p!==null){Ro=i,e.cancelPendingCommit=p(g6.bind(null,e,t,i,n,r,s,a,o,l,u,d,null,f,m)),Ml(e,i,a,!c);return}}g6(e,t,i,n,r,s,a,o,l)}function Uz(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(!vi(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 Ml(e,t,n,r){t&=~A_,t&=~au,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-pi(s),a=1<<i;r[i]=-1,s&=~a}n!==0&&jC(e,n,t)}function K1(){return cn&6?!0:(V0(0),!1)}function E_(){if(Ht!==null){if(vn===0)var e=Ht.return;else e=Ht,To=Eu=null,f_(e),Cd=null,i0=0,e=Ht;for(;e!==null;)lE(e.alternate,e),e=e.return;Ht=null}}function Vd(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,l$(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ro=0,E_(),Nn=e,Ht=n=No(e.current,null),Wt=t,vn=0,ai=null,El=!1,ph=z0(e,t),C_=!1,Hd=di=A_=au=Jl=ir=0,Us=Df=null,w2=!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 Po=t,P1(),n}function NE(e,t){Dt=null,xt.H=o0,t===mh||t===U1?(t=Wk(),vn=3):t===a_?(t=Wk(),vn=4):vn=t===__?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ai=t,Ht===null&&(ir=1,kg(e,zi(t,e.current)))}function IE(){var e=xi.current;return e===null?!0:(Wt&4194048)===Wt?Fi===null:(Wt&62914560)===Wt||Wt&536870912?e===Fi:!1}function RE(){var e=xt.H;return xt.H=o0,e===null?o0:e}function jE(){var e=xt.A;return xt.A=Pz,e}function Eg(){ir=4,El||(Wt&4194048)!==Wt&&xi.current!==null||(ph=!0),!(Jl&134217727)&&!(au&134217727)||Nn===null||Ml(Nn,Wt,di,!1)}function Pb(e,t,n){var r=cn;cn|=2;var s=RE(),i=jE();(Nn!==e||Wt!==t)&&(Ag=null,Vd(e,t)),t=!1;var a=ir;e:do try{if(vn!==0&&Ht!==null){var o=Ht,l=ai;switch(vn){case 8:E_(),a=6;break e;case 3:case 2:case 9:case 6:xi.current===null&&(t=!0);var c=vn;if(vn=0,ai=null,pd(e,o,l,c),n&&ph){a=0;break e}break;default:c=vn,vn=0,ai=null,pd(e,o,l,c)}}Hz(),a=ir;break}catch(u){NE(e,u)}while(!0);return t&&e.shellSuspendCounter++,To=Eu=null,cn=r,xt.H=s,xt.A=i,Ht===null&&(Nn=null,Wt=0,P1()),a}function Hz(){for(;Ht!==null;)DE(Ht)}function Fz(e,t){var n=cn;cn|=2;var r=RE(),s=jE();Nn!==e||Wt!==t?(Ag=null,Cg=fi()+500,Vd(e,t)):ph=z0(e,t);e:do try{if(vn!==0&&Ht!==null){t=Ht;var i=ai;t:switch(vn){case 1:vn=0,ai=null,pd(e,t,i,1);break;case 2:case 9:if(Vk(i)){vn=0,ai=null,p6(t);break}t=function(){vn!==2&&vn!==9||Nn!==e||(vn=7),Ga(e)},i.then(t,t);break e;case 3:vn=7;break e;case 4:vn=5;break e;case 7:Vk(i)?(vn=0,ai=null,p6(t)):(vn=0,ai=null,pd(e,t,i,7));break;case 5:var a=null;switch(Ht.tag){case 26:a=Ht.memoizedState;case 5:case 27:var o=Ht;if(a?eM(a):o.stateNode.complete){vn=0,ai=null;var l=o.sibling;if(l!==null)Ht=l;else{var c=o.return;c!==null?(Ht=c,Y1(c)):Ht=null}break t}}vn=0,ai=null,pd(e,t,i,5);break;case 6:vn=0,ai=null,pd(e,t,i,6);break;case 8:E_(),ir=6;break e;default:throw Error(le(462))}}Vz();break}catch(u){NE(e,u)}while(!0);return To=Eu=null,xt.H=r,xt.A=s,cn=n,Ht!==null?0:(Nn=null,Wt=0,P1(),ir)}function Vz(){for(;Ht!==null&&!mB();)DE(Ht)}function DE(e){var t=oE(e.alternate,e,Po);e.memoizedProps=e.pendingProps,t===null?Y1(e):Ht=t}function p6(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=l6(n,t,t.pendingProps,t.type,void 0,Wt);break;case 11:t=l6(n,t,t.pendingProps,t.type.render,t.ref,Wt);break;case 5:f_(t);default:lE(n,t),t=Ht=lA(t,Po),t=oE(n,t,Po)}e.memoizedProps=e.pendingProps,t===null?Y1(e):Ht=t}function pd(e,t,n,r){To=Eu=null,f_(t),Cd=null,i0=0;var s=t.return;try{if(jz(e,s,t,n,Wt)){ir=1,kg(e,zi(n,e.current)),Ht=null;return}}catch(i){if(s!==null)throw Ht=s,i;ir=1,kg(e,zi(n,e.current)),Ht=null;return}t.flags&32768?(Yt||r===1?e=!0:ph||Wt&536870912?e=!1:(El=e=!0,(r===2||r===9||r===3||r===6)&&(r=xi.current,r!==null&&r.tag===13&&(r.flags|=16384))),OE(t,e)):Y1(t)}function Y1(e){var t=e;do{if(t.flags&32768){OE(t,El);return}e=t.return;var n=Lz(t.alternate,t,Po);if(n!==null){Ht=n;return}if(t=t.sibling,t!==null){Ht=t;return}Ht=t=e}while(t!==null);ir===0&&(ir=5)}function OE(e,t){do{var n=Bz(e.alternate,e);if(n!==null){n.flags&=32767,Ht=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ht=e;return}Ht=e=n}while(e!==null);ir=6,Ht=null}function g6(e,t,n,r,s,i,a,o,l){e.cancelPendingCommit=null;do X1();while(Dr!==0);if(cn&6)throw Error(le(327));if(t!==null){if(t===e.current)throw Error(le(177));if(i=t.lanes|t.childLanes,i|=Zw,SB(e,n,i,a,o,l),e===Nn&&(Ht=Nn=null,Wt=0),Fd=t,Ul=e,Ro=n,_2=i,k2=s,AE=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yz(hg,function(){return PE(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=xt.T,xt.T=null,s=dn.p,dn.p=2,a=cn,cn|=4;try{zz(e,t,n)}finally{cn=a,dn.p=s,xt.T=r}}Dr=1,LE(),BE(),zE()}}function LE(){if(Dr===1){Dr=0;var e=Ul,t=Fd,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=xt.T,xt.T=null;var r=dn.p;dn.p=2;var s=cn;cn|=4;try{vE(t,e);var i=E2,a=eA(e.containerInfo),o=i.focusedElem,l=i.selectionRange;if(a!==o&&o&&o.ownerDocument&&ZC(o.ownerDocument.documentElement,o)){if(l!==null&&Jw(o)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in o)o.selectionStart=c,o.selectionEnd=Math.min(u,o.value.length);else{var d=o.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var m=f.getSelection(),p=o.textContent.length,y=Math.min(l.start,p),w=l.end===void 0?y:Math.min(l.end,p);!m.extend&&y>w&&(a=w,w=y,y=a);var v=zk(o,y),g=zk(o,w);if(v&&g&&(m.rangeCount!==1||m.anchorNode!==v.node||m.anchorOffset!==v.offset||m.focusNode!==g.node||m.focusOffset!==g.offset)){var x=d.createRange();x.setStart(v.node,v.offset),m.removeAllRanges(),y>w?(m.addRange(x),m.extend(g.node,g.offset)):(x.setEnd(g.node,g.offset),m.addRange(x))}}}}for(d=[],m=o;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<d.length;o++){var k=d[o];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}Lg=!!A2,E2=A2=null}finally{cn=s,dn.p=r,xt.T=n}}e.current=t,Dr=2}}function BE(){if(Dr===2){Dr=0;var e=Ul,t=Fd,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=xt.T,xt.T=null;var r=dn.p;dn.p=2;var s=cn;cn|=4;try{mE(e,t.alternate,t)}finally{cn=s,dn.p=r,xt.T=n}}Dr=3}}function zE(){if(Dr===4||Dr===3){Dr=0,pB();var e=Ul,t=Fd,n=Ro,r=AE;t.subtreeFlags&10256||t.flags&10256?Dr=5:(Dr=0,Fd=Ul=null,$E(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(ql=null),Vw(n),t=t.stateNode,mi&&typeof mi.onCommitFiberRoot=="function")try{mi.onCommitFiberRoot(B0,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=xt.T,s=dn.p,dn.p=2,xt.T=null;try{for(var i=e.onRecoverableError,a=0;a<r.length;a++){var o=r[a];i(o.value,{componentStack:o.stack})}}finally{xt.T=t,dn.p=s}}Ro&3&&X1(),Ga(e),s=e.pendingLanes,n&261930&&s&42?e===S2?Of++:(Of=0,S2=e):Of=0,V0(0)}}function $E(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,U0(t)))}function X1(){return LE(),BE(),zE(),PE()}function PE(){if(Dr!==5)return!1;var e=Ul,t=_2;_2=0;var n=Vw(Ro),r=xt.T,s=dn.p;try{dn.p=32>n?32:n,xt.T=null,n=k2,k2=null;var i=Ul,a=Ro;if(Dr=0,Fd=Ul=null,Ro=0,cn&6)throw Error(le(331));var o=cn;if(cn|=4,SE(i.current),wE(i,i.current,a,n),cn=o,V0(0,!1),mi&&typeof mi.onPostCommitFiberRoot=="function")try{mi.onPostCommitFiberRoot(B0,i)}catch{}return!0}finally{dn.p=s,xt.T=r,$E(e,t)}}function y6(e,t,n){t=zi(n,t),t=y2(e.stateNode,t,2),e=Pl(e,t,2),e!==null&&($0(e,2),Ga(e))}function wn(e,t,n){if(e.tag===3)y6(e,e,n);else for(;t!==null;){if(t.tag===3){y6(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ql===null||!ql.has(r))){e=zi(n,e),n=tE(2),r=Pl(t,n,2),r!==null&&(nE(n,r,t,e),$0(r,2),Ga(r));break}}t=t.return}}function qb(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new qz;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)||(C_=!0,s.add(n),e=Wz.bind(null,e,t,n),t.then(e,e))}function Wz(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Nn===e&&(Wt&n)===n&&(ir===4||ir===3&&(Wt&62914560)===Wt&&300>fi()-G1?!(cn&2)&&Vd(e,0):A_|=n,Hd===Wt&&(Hd=0)),Ga(e)}function qE(e,t){t===0&&(t=RC()),e=Au(e,t),e!==null&&($0(e,t),Ga(e))}function Gz(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qE(e,n)}function Kz(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(le(314))}r!==null&&r.delete(t),qE(e,n)}function Yz(e,t){return Hw(e,t)}var Mg=null,Zu=null,T2=!1,Ng=!1,Ub=!1,Nl=0;function Ga(e){e!==Zu&&e.next===null&&(Zu===null?Mg=Zu=e:Zu=Zu.next=e),Ng=!0,T2||(T2=!0,Qz())}function V0(e,t){if(!Ub&&Ng){Ub=!0;do for(var n=!1,r=Mg;r!==null;){if(e!==0){var s=r.pendingLanes;if(s===0)var i=0;else{var a=r.suspendedLanes,o=r.pingedLanes;i=(1<<31-pi(42|e)+1)-1,i&=s&~(a&~o),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,b6(r,i))}else i=Wt,i=L1(r,r===Nn?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||z0(r,i)||(n=!0,b6(r,i));r=r.next}while(n);Ub=!1}}function Xz(){UE()}function UE(){Ng=T2=!1;var e=0;Nl!==0&&o$()&&(e=Nl);for(var t=fi(),n=null,r=Mg;r!==null;){var s=r.next,i=HE(r,t);i===0?(r.next=null,n===null?Mg=s:n.next=s,s===null&&(Zu=n)):(n=r,(e!==0||i&3)&&(Ng=!0)),r=s}Dr!==0&&Dr!==5||V0(e),Nl!==0&&(Nl=0)}function HE(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var a=31-pi(i),o=1<<a,l=s[a];l===-1?(!(o&n)||o&r)&&(s[a]=kB(o,t)):l<=t&&(e.expiredLanes|=o),i&=~o}if(t=Nn,n=Wt,n=L1(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(vn===2||vn===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&gb(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||z0(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&gb(r),Vw(n)){case 2:case 8:n=NC;break;case 32:n=hg;break;case 268435456:n=IC;break;default:n=hg}return r=FE.bind(null,e),n=Hw(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&gb(r),e.callbackPriority=2,e.callbackNode=null,2}function FE(e,t){if(Dr!==0&&Dr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(X1()&&e.callbackNode!==n)return null;var r=Wt;return r=L1(e,e===Nn?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(ME(e,r,t),HE(e,fi()),e.callbackNode!=null&&e.callbackNode===n?FE.bind(null,e):null)}function b6(e,t){if(X1())return null;ME(e,t,!0)}function Qz(){c$(function(){cn&6?Hw(MC,Xz):UE()})}function M_(){if(Nl===0){var e=Pd;e===0&&(e=Sm,Sm<<=1,!(Sm&261888)&&(Sm=256)),Nl=e}return Nl}function v6(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ep(""+e)}function x6(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 Jz(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=v6((s[Ys]||null).action),a=r.submitter;a&&(t=(t=a[Ys]||null)?v6(t.formAction):a.getAttribute("formAction"),t!==null&&(i=t,a=null));var o=new B1("action","action",null,r,s);e.push({event:o,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Nl!==0){var l=a?x6(s,a):new FormData(s);p2(n,{pending:!0,data:l,method:s.method,action:i},null,l)}}else typeof i=="function"&&(o.preventDefault(),l=a?x6(s,a):new FormData(s),p2(n,{pending:!0,data:l,method:s.method,action:i},i,l))},currentTarget:s}]})}}for(var Hb=0;Hb<r2.length;Hb++){var Fb=r2[Hb],Zz=Fb.toLowerCase(),e$=Fb[0].toUpperCase()+Fb.slice(1);ha(Zz,"on"+e$)}ha(nA,"onAnimationEnd");ha(rA,"onAnimationIteration");ha(sA,"onAnimationStart");ha("dblclick","onDoubleClick");ha("focusin","onFocus");ha("focusout","onBlur");ha(gz,"onTransitionRun");ha(yz,"onTransitionStart");ha(bz,"onTransitionCancel");ha(iA,"onTransitionEnd");zd("onMouseEnter",["mouseout","mouseover"]);zd("onMouseLeave",["mouseout","mouseover"]);zd("onPointerEnter",["pointerout","pointerover"]);zd("onPointerLeave",["pointerout","pointerover"]);Su("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Su("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Su("onBeforeInput",["compositionend","keypress","textInput","paste"]);Su("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Su("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Su("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var l0="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(" "),t$=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(l0));function VE(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 a=r.length-1;0<=a;a--){var o=r[a],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==i&&s.isPropagationStopped())break e;i=o,s.currentTarget=c;try{i(s)}catch(u){mg(u)}s.currentTarget=null,i=l}else for(a=0;a<r.length;a++){if(o=r[a],l=o.instance,c=o.currentTarget,o=o.listener,l!==i&&s.isPropagationStopped())break e;i=o,s.currentTarget=c;try{i(s)}catch(u){mg(u)}s.currentTarget=null,i=l}}}}function Ut(e,t){var n=t[Y4];n===void 0&&(n=t[Y4]=new Set);var r=e+"__bubble";n.has(r)||(WE(t,e,2,!1),n.add(r))}function Vb(e,t,n){var r=0;t&&(r|=4),WE(n,e,r,t)}var Dm="_reactListening"+Math.random().toString(36).slice(2);function N_(e){if(!e[Dm]){e[Dm]=!0,BC.forEach(function(n){n!=="selectionchange"&&(t$.has(n)||Vb(n,!1,e),Vb(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Dm]||(t[Dm]=!0,Vb("selectionchange",!1,t))}}function WE(e,t,n,r){switch(iM(t)){case 2:var s=M$;break;case 8:s=N$;break;default:s=D_}n=s.bind(null,t,n,e),s=void 0,!e2||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 Wb(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===s)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&a.stateNode.containerInfo===s)return;a=a.return}for(;o!==null;){if(a=ad(o),a===null)return;if(l=a.tag,l===5||l===6||l===26||l===27){r=i=a;continue e}o=o.parentNode}}r=r.return}VC(function(){var c=i,u=Kw(n),d=[];e:{var f=aA.get(e);if(f!==void 0){var m=B1,p=e;switch(e){case"keypress":if(Np(n)===0)break e;case"keydown":case"keyup":m=KB;break;case"focusin":p="focus",m=wb;break;case"focusout":p="blur",m=wb;break;case"beforeblur":case"afterblur":m=wb;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=Ek;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=LB;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=QB;break;case nA:case rA:case sA:m=$B;break;case iA:m=ZB;break;case"scroll":case"scrollend":m=DB;break;case"wheel":m=tz;break;case"copy":case"cut":case"paste":m=qB;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Nk;break;case"toggle":case"beforetoggle":m=rz}var y=(t&4)!==0,w=!y&&(e==="scroll"||e==="scrollend"),v=y?f!==null?f+"Capture":null:f;y=[];for(var g=c,x;g!==null;){var k=g;if(x=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||x===null||v===null||(k=e0(g,v),k!=null&&y.push(c0(g,k,x))),w)break;g=g.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!==Z4&&(p=n.relatedTarget||n.fromElement)&&(ad(p)||p[dh]))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?ad(p):null,p!==null&&(w=L0(p),y=p.tag,p!==w||y!==5&&y!==27&&y!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=Ek,k="onMouseLeave",v="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(y=Nk,k="onPointerLeave",v="onPointerEnter",g="pointer"),w=m==null?f:ff(m),x=p==null?f:ff(p),f=new y(k,g+"leave",m,n,u),f.target=w,f.relatedTarget=x,k=null,ad(u)===c&&(y=new y(v,g+"enter",p,n,u),y.target=x,y.relatedTarget=w,k=y),w=k,m&&p)t:{for(y=n$,v=m,g=p,x=0,k=v;k;k=y(k))x++;k=0;for(var A=g;A;A=y(A))k++;for(;0<x-k;)v=y(v),x--;for(;0<k-x;)g=y(g),k--;for(;x--;){if(v===g||g!==null&&v===g.alternate){y=v;break t}v=y(v),g=y(g)}y=null}else y=null;m!==null&&w6(d,f,m,y,!1),p!==null&&w!==null&&w6(d,w,p,y,!0)}}e:{if(f=c?ff(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var T=Dk;else if(jk(f))if(QC)T=fz;else{T=dz;var C=uz}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&Gw(c.elementType)&&(T=Dk):T=hz;if(T&&(T=T(e,c))){XC(d,T,n,u);break e}C&&C(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&J4(f,"number",f.value)}switch(C=c?ff(c):window,e){case"focusin":(jk(C)||C.contentEditable==="true")&&(cd=C,t2=c,Cf=null);break;case"focusout":Cf=t2=cd=null;break;case"mousedown":n2=!0;break;case"contextmenu":case"mouseup":case"dragend":n2=!1,$k(d,n,u);break;case"selectionchange":if(pz)break;case"keydown":case"keyup":$k(d,n,u)}var j;if(Qw)e:{switch(e){case"compositionstart":var z="onCompositionStart";break e;case"compositionend":z="onCompositionEnd";break e;case"compositionupdate":z="onCompositionUpdate";break e}z=void 0}else ld?KC(e,n)&&(z="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(z="onCompositionStart");z&&(GC&&n.locale!=="ko"&&(ld||z!=="onCompositionStart"?z==="onCompositionEnd"&&ld&&(j=WC()):(Al=u,Yw="value"in Al?Al.value:Al.textContent,ld=!0)),C=Ig(c,z),0<C.length&&(z=new Mk(z,e,null,n,u),d.push({event:z,listeners:C}),j?z.data=j:(j=YC(n),j!==null&&(z.data=j)))),(j=iz?az(e,n):oz(e,n))&&(z=Ig(c,"onBeforeInput"),0<z.length&&(C=new Mk("onBeforeInput","beforeinput",null,n,u),d.push({event:C,listeners:z}),C.data=j)),Jz(d,e,c,n,u)}VE(d,t)})}function c0(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ig(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=e0(e,n),s!=null&&r.unshift(c0(e,s,i)),s=e0(e,t),s!=null&&r.push(c0(e,s,i))),e.tag===3)return r;e=e.return}return[]}function n$(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function w6(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var o=n,l=o.alternate,c=o.stateNode;if(o=o.tag,l!==null&&l===r)break;o!==5&&o!==26&&o!==27||c===null||(l=c,s?(c=e0(n,i),c!=null&&a.unshift(c0(n,c,l))):s||(c=e0(n,i),c!=null&&a.push(c0(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var r$=/\r\n?/g,s$=/\u0000|\uFFFD/g;function _6(e){return(typeof e=="string"?e:""+e).replace(r$,`
`).replace(s$,"")}function GE(e,t){return t=_6(t),_6(e)===t}function Sn(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||$d(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&$d(e,""+r);break;case"className":Am(e,"class",r);break;case"tabIndex":Am(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Am(e,n,r);break;case"style":FC(e,r,i);break;case"data":if(t!=="object"){Am(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=Ep(""+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"&&Sn(e,t,"name",s.name,s,null),Sn(e,t,"formEncType",s.formEncType,s,null),Sn(e,t,"formMethod",s.formMethod,s,null),Sn(e,t,"formTarget",s.formTarget,s,null)):(Sn(e,t,"encType",s.encType,s,null),Sn(e,t,"method",s.method,s,null),Sn(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Ep(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=So);break;case"onScroll":r!=null&&Ut("scroll",e);break;case"onScrollEnd":r!=null&&Ut("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(le(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(le(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=Ep(""+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":Ut("beforetoggle",e),Ut("toggle",e),Ap(e,"popover",r);break;case"xlinkActuate":ao(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ao(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ao(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ao(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ao(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ao(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ao(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ao(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ao(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ap(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=RB.get(n)||n,Ap(e,n,r))}}function C2(e,t,n,r,s,i){switch(n){case"style":FC(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(le(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(le(60));e.innerHTML=n}}break;case"children":typeof r=="string"?$d(e,r):(typeof r=="number"||typeof r=="bigint")&&$d(e,""+r);break;case"onScroll":r!=null&&Ut("scroll",e);break;case"onScrollEnd":r!=null&&Ut("scrollend",e);break;case"onClick":r!=null&&(e.onclick=So);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zC.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[Ys]||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,""):Ap(e,n,r)}}}function rs(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ut("error",e),Ut("load",e);var r=!1,s=!1,i;for(i in n)if(n.hasOwnProperty(i)){var a=n[i];if(a!=null)switch(i){case"src":r=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(le(137,t));default:Sn(e,t,i,a,n,null)}}s&&Sn(e,t,"srcSet",n.srcSet,n,null),r&&Sn(e,t,"src",n.src,n,null);return;case"input":Ut("invalid",e);var o=i=a=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":a=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":i=u;break;case"defaultValue":o=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(le(137,t));break;default:Sn(e,t,r,u,n,null)}}qC(e,i,o,l,c,a,s,!1);return;case"select":Ut("invalid",e),r=a=i=null;for(s in n)if(n.hasOwnProperty(s)&&(o=n[s],o!=null))switch(s){case"value":i=o;break;case"defaultValue":a=o;break;case"multiple":r=o;default:Sn(e,t,s,o,n,null)}t=i,n=a,e.multiple=!!r,t!=null?kd(e,!!r,t,!1):n!=null&&kd(e,!!r,n,!0);return;case"textarea":Ut("invalid",e),i=s=r=null;for(a in n)if(n.hasOwnProperty(a)&&(o=n[a],o!=null))switch(a){case"value":r=o;break;case"defaultValue":s=o;break;case"children":i=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(le(91));break;default:Sn(e,t,a,o,n,null)}HC(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:Sn(e,t,l,r,n,null)}return;case"dialog":Ut("beforetoggle",e),Ut("toggle",e),Ut("cancel",e),Ut("close",e);break;case"iframe":case"object":Ut("load",e);break;case"video":case"audio":for(r=0;r<l0.length;r++)Ut(l0[r],e);break;case"image":Ut("error",e),Ut("load",e);break;case"details":Ut("toggle",e);break;case"embed":case"source":case"link":Ut("error",e),Ut("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(le(137,t));default:Sn(e,t,c,r,n,null)}return;default:if(Gw(t)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&C2(e,t,u,r,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(r=n[o],r!=null&&Sn(e,t,o,r,n,null))}function i$(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,a=null,o=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)||Sn(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":a=m;break;case"defaultValue":o=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(le(137,t));break;default:m!==d&&Sn(e,t,f,m,r,d)}}Q4(e,a,o,l,c,u,i,s);return;case"select":m=a=o=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)||Sn(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":o=i;break;case"multiple":a=i;default:i!==l&&Sn(e,t,s,i,r,l)}t=o,n=a,r=m,f!=null?kd(e,!!n,f,!1):!!r!=!!n&&(t!=null?kd(e,!!n,t,!0):kd(e,!!n,n?[]:"",!1));return;case"textarea":m=f=null;for(o in n)if(s=n[o],n.hasOwnProperty(o)&&s!=null&&!r.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Sn(e,t,o,null,r,s)}for(a in r)if(s=r[a],i=n[a],r.hasOwnProperty(a)&&(s!=null||i!=null))switch(a){case"value":f=s;break;case"defaultValue":m=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(le(91));break;default:s!==i&&Sn(e,t,a,s,r,i)}UC(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:Sn(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:Sn(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)&&Sn(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(le(137,t));break;default:Sn(e,t,c,f,r,m)}return;default:if(Gw(t)){for(var w in n)f=n[w],n.hasOwnProperty(w)&&f!==void 0&&!r.hasOwnProperty(w)&&C2(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||C2(e,t,u,f,r,m);return}}for(var v in n)f=n[v],n.hasOwnProperty(v)&&f!=null&&!r.hasOwnProperty(v)&&Sn(e,t,v,null,r,f);for(d in r)f=r[d],m=n[d],!r.hasOwnProperty(d)||f===m||f==null&&m==null||Sn(e,t,d,f,r,m)}function k6(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function a$(){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,a=s.initiatorType,o=s.duration;if(i&&o&&k6(a)){for(a=0,o=s.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>o)break;var u=l.transferSize,d=l.initiatorType;u&&k6(d)&&(l=l.responseEnd,a+=u*(l<o?1:(o-c)/(l-c)))}if(--r,t+=8*(i+a)/(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 A2=null,E2=null;function Rg(e){return e.nodeType===9?e:e.ownerDocument}function S6(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 KE(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 M2(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 Gb=null;function o$(){var e=window.event;return e&&e.type==="popstate"?e===Gb?!1:(Gb=e,!0):(Gb=null,!1)}var YE=typeof setTimeout=="function"?setTimeout:void 0,l$=typeof clearTimeout=="function"?clearTimeout:void 0,T6=typeof Promise=="function"?Promise:void 0,c$=typeof queueMicrotask=="function"?queueMicrotask:typeof T6<"u"?function(e){return T6.resolve(null).then(e).catch(u$)}:YE;function u$(e){setTimeout(function(){throw e})}function dc(e){return e==="head"}function C6(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),Gd(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Lf(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Lf(n);for(var i=n.firstChild;i;){var a=i.nextSibling,o=i.nodeName;i[P0]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=a}}else n==="body"&&Lf(e.ownerDocument.body);n=s}while(n);Gd(t)}function A6(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 N2(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":N2(n),Ww(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function d$(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[P0])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=Vi(e.nextSibling),e===null)break}return null}function h$(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Vi(e.nextSibling),e===null))return null;return e}function XE(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Vi(e.nextSibling),e===null))return null;return e}function I2(e){return e.data==="$?"||e.data==="$~"}function R2(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function f$(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 Vi(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 j2=null;function E6(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Vi(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function M6(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 QE(e,t,n){switch(t=Rg(n),e){case"html":if(e=t.documentElement,!e)throw Error(le(452));return e;case"head":if(e=t.head,!e)throw Error(le(453));return e;case"body":if(e=t.body,!e)throw Error(le(454));return e;default:throw Error(le(451))}}function Lf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ww(e)}var Gi=new Map,N6=new Set;function jg(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Fo=dn.d;dn.d={f:m$,r:p$,D:g$,C:y$,L:b$,m:v$,X:w$,S:x$,M:_$};function m$(){var e=Fo.f(),t=K1();return e||t}function p$(e){var t=hh(e);t!==null&&t.tag===5&&t.type==="form"?FA(t):Fo.r(e)}var gh=typeof document>"u"?null:document;function JE(e,t,n){var r=gh;if(r&&typeof t=="string"&&t){var s=Bi(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),N6.has(s)||(N6.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),rs(t,"link",e),Ur(t),r.head.appendChild(t)))}}function g$(e){Fo.D(e),JE("dns-prefetch",e,null)}function y$(e,t){Fo.C(e,t),JE("preconnect",e,t)}function b$(e,t,n){Fo.L(e,t,n);var r=gh;if(r&&e&&t){var s='link[rel="preload"][as="'+Bi(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Bi(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Bi(n.imageSizes)+'"]')):s+='[href="'+Bi(e)+'"]';var i=s;switch(t){case"style":i=Wd(e);break;case"script":i=yh(e)}Gi.has(i)||(e=Hn({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Gi.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(W0(i))||t==="script"&&r.querySelector(G0(i))||(t=r.createElement("link"),rs(t,"link",e),Ur(t),r.head.appendChild(t)))}}function v$(e,t){Fo.m(e,t);var n=gh;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Bi(r)+'"][href="'+Bi(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=yh(e)}if(!Gi.has(i)&&(e=Hn({rel:"modulepreload",href:e},t),Gi.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(G0(i)))return}r=n.createElement("link"),rs(r,"link",e),Ur(r),n.head.appendChild(r)}}}function x$(e,t,n){Fo.S(e,t,n);var r=gh;if(r&&e){var s=_d(r).hoistableStyles,i=Wd(e);t=t||"default";var a=s.get(i);if(!a){var o={loading:0,preload:null};if(a=r.querySelector(W0(i)))o.loading=5;else{e=Hn({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Gi.get(i))&&I_(e,n);var l=a=r.createElement("link");Ur(l),rs(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,zp(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:o},s.set(i,a)}}}function w$(e,t){Fo.X(e,t);var n=gh;if(n&&e){var r=_d(n).hoistableScripts,s=yh(e),i=r.get(s);i||(i=n.querySelector(G0(s)),i||(e=Hn({src:e,async:!0},t),(t=Gi.get(s))&&R_(e,t),i=n.createElement("script"),Ur(i),rs(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function _$(e,t){Fo.M(e,t);var n=gh;if(n&&e){var r=_d(n).hoistableScripts,s=yh(e),i=r.get(s);i||(i=n.querySelector(G0(s)),i||(e=Hn({src:e,async:!0,type:"module"},t),(t=Gi.get(s))&&R_(e,t),i=n.createElement("script"),Ur(i),rs(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function I6(e,t,n,r){var s=(s=Bl.current)?jg(s):null;if(!s)throw Error(le(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Wd(n.href),n=_d(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=Wd(n.href);var i=_d(s).hoistableStyles,a=i.get(e);if(a||(s=s.ownerDocument||s,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,a),(i=s.querySelector(W0(e)))&&!i._p&&(a.instance=i,a.state.loading=5),Gi.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},Gi.set(e,n),i||k$(s,e,n,a.state))),t&&r===null)throw Error(le(528,""));return a}if(t&&r!==null)throw Error(le(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=yh(n),n=_d(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(le(444,e))}}function Wd(e){return'href="'+Bi(e)+'"'}function W0(e){return'link[rel="stylesheet"]['+e+"]"}function ZE(e){return Hn({},e,{"data-precedence":e.precedence,precedence:null})}function k$(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}),rs(t,"link",n),Ur(t),e.head.appendChild(t))}function yh(e){return'[src="'+Bi(e)+'"]'}function G0(e){return"script[async]"+e}function R6(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Bi(n.href)+'"]');if(r)return t.instance=r,Ur(r),r;var s=Hn({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Ur(r),rs(r,"style",s),zp(r,n.precedence,e),t.instance=r;case"stylesheet":s=Wd(n.href);var i=e.querySelector(W0(s));if(i)return t.state.loading|=4,t.instance=i,Ur(i),i;r=ZE(n),(s=Gi.get(s))&&I_(r,s),i=(e.ownerDocument||e).createElement("link"),Ur(i);var a=i;return a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),rs(i,"link",r),t.state.loading|=4,zp(i,n.precedence,e),t.instance=i;case"script":return i=yh(n.src),(s=e.querySelector(G0(i)))?(t.instance=s,Ur(s),s):(r=n,(s=Gi.get(i))&&(r=Hn({},n),R_(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),Ur(s),rs(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(le(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zp(r,n.precedence,e));return t.instance}function zp(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,a=0;a<r.length;a++){var o=r[a];if(o.dataset.precedence===t)i=o;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 I_(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function R_(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var $p=null;function j6(e,t,n){if($p===null){var r=new Map,s=$p=new Map;s.set(n,r)}else s=$p,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[P0]||i[Zr]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var a=i.getAttribute(t)||"";a=e+a;var o=r.get(a);o?o.push(i):r.set(a,[i])}}return r}function D6(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function S$(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 eM(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function T$(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=Wd(r.href),i=t.querySelector(W0(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Dg.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Ur(i);return}i=t.ownerDocument||t,r=ZE(r),(s=Gi.get(s))&&I_(r,s),i=i.createElement("link"),Ur(i);var a=i;a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),rs(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=Dg.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Kb=0;function C$(e,t){return e.stylesheets&&e.count===0&&Pp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Pp(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Kb===0&&(Kb=62500*a$());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Pp(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Kb?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function Dg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Og=null;function Pp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Og=new Map,t.forEach(A$,e),Og=null,Dg.call(e))}function A$(e,t){if(!(t.state.loading&4)){var n=Og.get(e);if(n)var r=n.get(null);else{n=new Map,Og.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var a=s[i];(a.nodeName==="LINK"||a.getAttribute("media")!=="not all")&&(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}s=t.instance,a=s.getAttribute("data-precedence"),i=n.get(a)||r,i===r&&n.set(null,s),n.set(a,s),this.count++,r=Dg.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 u0={$$typeof:ko,Provider:null,Consumer:null,_currentValue:nu,_currentValue2:nu,_threadCount:0};function E$(e,t,n,r,s,i,a,o,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=yb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yb(0),this.hiddenUpdates=yb(null),this.identifierPrefix=r,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function tM(e,t,n,r,s,i,a,o,l,c,u,d){return e=new E$(e,t,n,a,l,c,u,d,o),t=1,i===!0&&(t|=24),i=ci(3,null,null,t),e.current=i,i.stateNode=e,t=s_(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},o_(i),e}function nM(e){return e?(e=hd,e):hd}function rM(e,t,n,r,s,i){s=nM(s),r.context===null?r.context=s:r.pendingContext=s,r=$l(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Pl(e,r,t),n!==null&&(Gs(n,e,t),Ef(n,e,t))}function O6(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function j_(e,t){O6(e,t),(e=e.alternate)&&O6(e,t)}function sM(e){if(e.tag===13||e.tag===31){var t=Au(e,67108864);t!==null&&Gs(t,e,67108864),j_(e,67108864)}}function L6(e){if(e.tag===13||e.tag===31){var t=gi();t=Fw(t);var n=Au(e,t);n!==null&&Gs(n,e,t),j_(e,t)}}var Lg=!0;function M$(e,t,n,r){var s=xt.T;xt.T=null;var i=dn.p;try{dn.p=2,D_(e,t,n,r)}finally{dn.p=i,xt.T=s}}function N$(e,t,n,r){var s=xt.T;xt.T=null;var i=dn.p;try{dn.p=8,D_(e,t,n,r)}finally{dn.p=i,xt.T=s}}function D_(e,t,n,r){if(Lg){var s=D2(r);if(s===null)Wb(e,t,r,Bg,n),B6(e,r);else if(R$(s,e,t,n,r))r.stopPropagation();else if(B6(e,r),t&4&&-1<I$.indexOf(e)){for(;s!==null;){var i=hh(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var a=$c(i.pendingLanes);if(a!==0){var o=i;for(o.pendingLanes|=2,o.entangledLanes|=2;a;){var l=1<<31-pi(a);o.entanglements[1]|=l,a&=~l}Ga(i),!(cn&6)&&(Cg=fi()+500,V0(0))}}break;case 31:case 13:o=Au(i,2),o!==null&&Gs(o,i,2),K1(),j_(i,2)}if(i=D2(r),i===null&&Wb(e,t,r,Bg,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Wb(e,t,r,null,n)}}function D2(e){return e=Kw(e),O_(e)}var Bg=null;function O_(e){if(Bg=null,e=ad(e),e!==null){var t=L0(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=SC(t),e!==null)return e;e=null}else if(n===31){if(e=TC(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 Bg=e,null}function iM(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(gB()){case MC:return 2;case NC:return 8;case hg:case yB:return 32;case IC:return 268435456;default:return 32}default:return 32}}var O2=!1,Hl=null,Fl=null,Vl=null,d0=new Map,h0=new Map,Sl=[],I$="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 B6(e,t){switch(e){case"focusin":case"focusout":Hl=null;break;case"dragenter":case"dragleave":Fl=null;break;case"mouseover":case"mouseout":Vl=null;break;case"pointerover":case"pointerout":d0.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":h0.delete(t.pointerId)}}function Gh(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=hh(t),t!==null&&sM(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function R$(e,t,n,r,s){switch(t){case"focusin":return Hl=Gh(Hl,e,t,n,r,s),!0;case"dragenter":return Fl=Gh(Fl,e,t,n,r,s),!0;case"mouseover":return Vl=Gh(Vl,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return d0.set(i,Gh(d0.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,h0.set(i,Gh(h0.get(i)||null,e,t,n,r,s)),!0}return!1}function aM(e){var t=ad(e.target);if(t!==null){var n=L0(t);if(n!==null){if(t=n.tag,t===13){if(t=SC(n),t!==null){e.blockedOn=t,wk(e.priority,function(){L6(n)});return}}else if(t===31){if(t=TC(n),t!==null){e.blockedOn=t,wk(e.priority,function(){L6(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 qp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=D2(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Z4=r,n.target.dispatchEvent(r),Z4=null}else return t=hh(n),t!==null&&sM(t),e.blockedOn=n,!1;t.shift()}return!0}function z6(e,t,n){qp(e)&&n.delete(t)}function j$(){O2=!1,Hl!==null&&qp(Hl)&&(Hl=null),Fl!==null&&qp(Fl)&&(Fl=null),Vl!==null&&qp(Vl)&&(Vl=null),d0.forEach(z6),h0.forEach(z6)}function Om(e,t){e.blockedOn===t&&(e.blockedOn=null,O2||(O2=!0,Lr.unstable_scheduleCallback(Lr.unstable_NormalPriority,j$)))}var Lm=null;function $6(e){Lm!==e&&(Lm=e,Lr.unstable_scheduleCallback(Lr.unstable_NormalPriority,function(){Lm===e&&(Lm=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(O_(r||n)===null)continue;break}var i=hh(n);i!==null&&(e.splice(t,3),t-=3,p2(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function Gd(e){function t(l){return Om(l,e)}Hl!==null&&Om(Hl,e),Fl!==null&&Om(Fl,e),Vl!==null&&Om(Vl,e),d0.forEach(t),h0.forEach(t);for(var n=0;n<Sl.length;n++){var r=Sl[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Sl.length&&(n=Sl[0],n.blockedOn===null);)aM(n),n.blockedOn===null&&Sl.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],a=s[Ys]||null;if(typeof i=="function")a||$6(n);else if(a){var o=null;if(i&&i.hasAttribute("formAction")){if(s=i,a=i[Ys]||null)o=a.formAction;else if(O_(s)!==null)continue}else o=a.action;typeof o=="function"?n[r+1]=o:(n.splice(r,3),r-=3),$6(n)}}}function oM(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(a){return s=a})},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 L_(e){this._internalRoot=e}Q1.prototype.render=L_.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(le(409));var n=t.current,r=gi();rM(n,r,e,t,null,null)};Q1.prototype.unmount=L_.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rM(e.current,2,null,e,null,null),K1(),t[dh]=null}};function Q1(e){this._internalRoot=e}Q1.prototype.unstable_scheduleHydration=function(e){if(e){var t=LC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Sl.length&&t!==0&&t<Sl[n].priority;n++);Sl.splice(n,0,e),n===0&&aM(e)}};var P6=_C.version;if(P6!=="19.2.4")throw Error(le(527,P6,"19.2.4"));dn.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(le(188)):(e=Object.keys(e).join(","),Error(le(268,e)));return e=cB(t),e=e!==null?CC(e):null,e=e===null?null:e.stateNode,e};var D$={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:xt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bm.isDisabled&&Bm.supportsFiber)try{B0=Bm.inject(D$),mi=Bm}catch{}}j1.createRoot=function(e,t){if(!kC(e))throw Error(le(299));var n=!1,r="",s=JA,i=ZA,a=eE;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&&(a=t.onRecoverableError)),t=tM(e,1,!1,null,null,n,r,null,s,i,a,oM),e[dh]=t.current,N_(e),new L_(t)};j1.hydrateRoot=function(e,t,n){if(!kC(e))throw Error(le(299));var r=!1,s="",i=JA,a=ZA,o=eE,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&&(a=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=tM(e,1,!0,t,n??null,r,s,l,i,a,o,oM),t.context=nM(null),n=t.current,r=gi(),r=Fw(r),s=$l(r),s.callback=null,Pl(n,s,r),n=r,t.current.lanes=n,$0(t,n),Ga(t),e[dh]=t.current,N_(e),new Q1(t)};j1.version="19.2.4";function lM(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lM)}catch(e){console.error(e)}}lM(),gC.exports=j1;var O$=gC.exports;const L$=I1(O$);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const B$="agent";function z$(e){return e===B$}var $$=3e4,P$=new Set(["authorized","expired","error","cancelled"]),q$=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 U$(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 U$(e,t,n,r){return await H$(e,t,n,r)}async function q6(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof bu&&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 U6(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function H$(e,t,n,r){var u;let s=r.signal,i=U6(r.timeoutMs,{allowZero:!0}),a=U6(r.pollOverrideMs),o=i!==void 0?Date.now()+i:t.expiresAt+$$,l=Math.max(1e3,a??t.intervalMs??5e3),c=l;for(;;){if(s!=null&&s.aborted)throw L2(s);if(Date.now()>=o)return await q6(e,t,n,s);let d=await q6(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)),P$.has(d.status))return d;await F$(l,s)}}async function F$(e,t){if(t!=null&&t.aborted)throw L2(t);await new Promise((n,r)=>{let s=setTimeout(()=>{a(),n()},e),i=()=>{a(),r(L2(t))};function a(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function L2(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var bu=class extends Error{constructor(t,n,r){super(r);se(this,"status");se(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},H6=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},V$=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},F6=16*1024*1024;async function*W$(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 a,o;try{({value:a,done:o}=await n.read())}catch(c){if(t!=null&&t.aborted)return;throw c}if(o){if(s+=r.decode(),s.length>0){let c=V6(s);for(let u of c.frames){let d=Yb(u);d&&(yield d)}if(c.tail.length>0){let u=Yb(c.tail);u&&(yield u)}}return}if(s+=r.decode(a,{stream:!0}),s.length>F6)throw new V$(`parseSseStream: unread buffer exceeded ${F6} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=V6(s);if(l.frames.length>0)for(let c of l.frames){let u=Yb(c);u&&(yield u)}s=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function V6(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 Yb(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 G$=class{constructor(e,t,n){se(this,"baseUrl");se(this,"token");se(this,"_fetch");se(this,"_disposed",!1);se(this,"type","rest");se(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 H6;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var u;if(this._disposed)throw new H6;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 a=t.signal?K$([t.signal,r.signal]):r.signal,o=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(o+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let l;try{l=await this._fetch(o,{headers:n,signal:a})}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 bu(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 bu(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*W$(l.body,t.signal)}dispose(){this._disposed=!0}};function K$(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 a=()=>{n.abort(i.reason),s()};i.addEventListener("abort",a,{once:!0}),r.push(()=>i.removeEventListener("abort",a))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}var Y$=3e4,X$=5,Kh=33e4,Q$="X-Qwen-Client-Id";function cM(e){if(e===void 0)return X$;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 J$(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function Z$(){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 W6=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 uM(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var dM=class{constructor(e){se(this,"baseUrl");se(this,"token");se(this,"_fetch");se(this,"fetchTimeoutMs");se(this,"promptLimit");se(this,"promptCounts",Object.create(null));se(this,"transport");se(this,"_authFlow");this.baseUrl=J$(e.baseUrl),this.token=e.token??Z$(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??Y$;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=cM(e.maxPendingPromptsPerSession),this.transport=e.transport??new G$(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new q$(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 W6(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){let s=this.fetchTimeoutMs;if(r!==void 0&&Number.isFinite(r)&&r>=0&&(s=r),!s||!Number.isFinite(s)){let c=await this.transport.fetch(e,t);return n?n(c):c}let i=new AbortController,a=setTimeout(()=>{i.abort(new DOMException("timeout","TimeoutError"))},s);typeof a=="object"&&a&&"unref"in a&&a.unref();let o=t.signal??void 0,l=o?G6([o,i.signal]):i.signal;try{let c=await this.transport.fetch(e,{...t,signal:l});return n?await n(c):c}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[Q$]=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 W6(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new bu(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()})}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 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 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()},Kh)}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 a=await this.failOnError(s,"DELETE /workspace/agents/:agentType"),o=a.body;if(o&&o.code==="agent_not_found")return;throw a}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){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/${encodeURIComponent(e)}/sessions`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/:id/sessions");return(await t.json()).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 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 workspacePermissions(e){return this.jsonRequest("/workspace/permissions","GET /workspace/permissions",{clientId:e==null?void 0:e.clientId})}async setWorkspacePermissionRules(e,t,n,r){return 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=n.trim(),i=await this.workspacePermissions(r),a=i[e].rules[t];return a.includes(s)?i:this.setWorkspacePermissionRules(e,t,[...a,s],r)}async removeWorkspacePermissionRule(e,t,n,r){let s=n.trim(),i=await this.workspacePermissions(r),a=i[e].rules[t],o=a.filter(l=>l!==s);return o.length===a.length?i:this.setWorkspacePermissionRules(e,t,o,r)}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)??Kh)}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)??Kh)}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)??Kh)}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)??Kh)}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 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 a=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(a.status===202){let o=await a.json();i=!1;try{return await this._awaitTurnComplete(e,o.promptId,o.lastEventId,n,r)}finally{s()}}if(!a.ok)throw await this.failOnError(a,"POST /session/:id/prompt",e);return await a.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,a=r?G6([r,i.signal]):i.signal;try{let o=this.subscribeEvents(e,{lastEventId:n,signal:a});for await(let l of o){let c=B_(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(o){throw r!=null&&r.aborted&&o instanceof DOMException&&o.name==="AbortError"&&this.cancel(e,s).catch(()=>{}),o}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,a;if(s.status===200){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!0}if(s.status===404){try{await((a=s.body)==null?void 0:a.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 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 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 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 G6(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 a=()=>{n.abort(i.reason),s()};i.addEventListener("abort",a,{once:!0}),r.push(()=>i.removeEventListener("abort",a))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}function B_(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 bu(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function hM(e){return"promptId"in e&&"lastEventId"in e}var zm=class Up{constructor(t){se(this,"client");se(this,"session");se(this,"state");se(this,"replaySnapshot");se(this,"lastSeenEventId");se(this,"subscriptionActive",!1);se(this,"reattaching");se(this,"promptLimit");se(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=$m(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:cM(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 Up({client:t,session:s,lastEventId:i})}static async load(t,n,r={},s){let{state:i,compactedReplay:a,liveJournal:o,lastEventId:l,...c}=await t.loadSession(n,r,s);return new Up({client:t,session:c,state:i,lastEventId:l??0,replaySnapshot:{compactedReplay:a??[],liveJournal:o??[]}})}static async resume(t,n,r={},s){let{state:i,lastEventId:a,...o}=await t.resumeSession(n,r,s);return new Up({client:t,session: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=$m(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)),!hM(s))return r(),s;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw r(),i}return new Promise((i,a)=>{let o=()=>{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",o);this._pendingPrompts.set(s.promptId,{resolve:c=>{l(),r(),i(c)},reject:c=>{l(),r(),a(c)}}),n!=null&&n.aborted?o():n==null||n.addEventListener("abort",o,{once:!0})})}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!eP(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 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 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 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=$m(t.lastEventId),r=!1,s=!1,i=()=>{s||(s=!0,this.subscriptionActive=!1)},a=()=>{if(!r){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,r=!0}},o=this.iterateEvents({...t,lastEventId:n},i);return{next:async l=>(s||a(),await o.next(l)),return:async()=>{try{return await o.return(void 0)}finally{i()}},throw:async l=>{try{return await o.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 a of this.client.subscribeEvents(this.sessionId,{...s,lastEventId:i}))this._dispatchTurnEvent(a),yield a,a.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,$m(a.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=B_(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 $m(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function eP(e){return e instanceof bu&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var fM="mid_turn_message_injected",tP=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated",fM,"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","workspace_initialized","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(tP);var nP=["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"],J1=["plan","default","auto-edit","auto","yolo"],B2="daemon-plan";function Ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function we(e,t){if(!Ke(e))return;let n=e[t];return typeof n=="string"?n:void 0}function sn(e,t){if(Ke(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function Zl(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 qo(e){return Zl(Co(e))}function Co(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Co(n,t+1)):Ke(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,mM(n)?"[redacted]":Co(r,t+1)])):e}function mM(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 Xb(e){if(typeof e=="string")return e;if(!Ke(e))return"";let t=e.text;return typeof t=="string"?t:""}function rP(e){if(typeof e=="string")return{kind:"text",text:e};if(!Ke(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=Ke(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=Ke(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 sP=64;function zg(e,t=0){if(t>sP)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>zg(r,t+1)).filter(Boolean).join(`
`);if(!Ke(e))return e===void 0?"":Zl(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=zg(n,t+1);if(r)return r}return Zl(e)}var iP=new Set(nP),pM=new Set(["qwen","qwen-oauth"]),aP=new Set(["in_flight","disabled","budget_would_exceed"]),K6=4096;function oP(e,t={}){let n=fP(e,t);switch(e.type){case"session_update":return mP(e,n,t);case"shell_output":{let r=zg(e.data),s=$2(e.data),i=P2(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return _P(e,n);case"permission_resolved":case"permission_already_resolved":return kP(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:we(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:we(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=X6(we(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:we(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${we(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:we(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=X6(we(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:we(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=we(e.data,"code"),s=we(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{promptId:s}:{},text:we(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return lP(e,n);case"session_rewound":return cP(e,n);case"session_branched":return uP(e,n);case"prompt_cancelled":{let r=WP(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return dP(e,n);case"mid_turn_message_injected":return hP(e,n);case"user_shell_command":{let r=we(e.data,"command"),s=we(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=Kn(e.data,"exitCode"),s=Ke(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=Kn(e.data,"replayedCount")??0,s=Kn(e.data,"lastReplayedEventId")??Kn(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return EP(e,n);case"approval_mode_changed":return MP(e,n);case"memory_changed":return NP(e,n);case"agent_changed":return IP(e,n);case"tool_toggled":return RP(e,n);case"settings_changed":return jP(e,n);case"workspace_initialized":return DP(e,n);case"mcp_budget_warning":return OP(e,n);case"mcp_child_refused_batch":return LP(e,n);case"mcp_server_restarted":return BP(e,n);case"mcp_server_restart_refused":return zP(e,n);case"extensions_changed":return $P(e,n);case"auth_device_flow_started":return PP(e,n);case"auth_device_flow_throttled":return qP(e,n);case"auth_device_flow_authorized":return UP(e,n);case"auth_device_flow_failed":return HP(e,n);case"auth_device_flow_cancelled":return VP(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${qo(e.data)}`}]}}function lP(e,t){let n=we(e.data,"reason"),r=Kn(e.data,"lastDeliveredId"),s=Kn(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?Fn(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function cP(e,t){let n=we(e.data,"promptId"),r=Kn(e.data,"targetTurnIndex");if(!n||r===void 0)return Fn(e,t,"malformed session_rewound payload");let s=we(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function uP(e,t){let n=we(e.data,"sourceSessionId"),r=we(e.data,"newSessionId"),s=we(e.data,"displayName");return!n||!r||!s?Fn(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function dP(e,t){let n=we(e.data,"sessionId"),r=we(e.data,"suggestion"),s=we(e.data,"promptId");return!n||!r||!s?Fn(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function hP(e,t){if(!Ke(e.data))return Fn(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?Fn(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function fP(e,t){let n=gM(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Co(e.data)}}:{}}}function gM(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(Ke(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(Ke(e.data)){let r=e.data._meta;if(Ke(r)){let i=r.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let s=e.data.update;if(Ke(s)){let i=s._meta;if(Ke(i)){let a=i.serverTimestamp;if(typeof a=="number"&&Number.isFinite(a))return a;let o=i.timestamp;if(typeof o=="number"&&Number.isFinite(o))return o}}}}function mP(e,t,n){let r=SP(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${qo(e.data)}`}];let s=we(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=r.content,a=rP(i);if(a){if(a.kind==="image"){let l=a.source.data,c=a.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 a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text}]:[]:[]}let o=Xb(i);return o?[{...t,type:"user.text.delta",text:o}]:[]}case"agent_message_chunk":{let i=Xb(r.content),a=Y6(r),o=pP(r),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...a?{parentToolCallId:a}:{},...o?{meta:o}:{}});let c=gP(r);return c&&l.push({...t,type:"assistant.usage",usage:c,...a?{parentToolCallId:a}:{}}),l}case"agent_thought_chunk":{let i=Xb(r.content);if(!i)return[];let a=Y6(r);return[{...t,type:"thought.text.delta",text:i,...a?{parentToolCallId:a}:{}}]}case"tool_call":case"tool_call_update":return[yP(r,t)];case"shell_output":case"tool_output":{let i=zg(r),a=$2(r)??$2(e.data),o=P2(r)??P2(e.data);return i?[{...t,type:o==="user-shell"?"user.shell.output":"shell.output",text:i,...a?{stream:a}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(r.availableCommands)?r.availableCommands:[]).filter(Ke);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[bP(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${qo(r)}`}]}}function Y6(e){let t=Ke(e._meta)?e._meta:void 0;return t?we(t,"parentToolCallId"):void 0}function pP(e){let t=Ke(e._meta)?e._meta:void 0;return t?{...t}:void 0}function gP(e){let t=Ke(e._meta)?e._meta:void 0,n=t&&Ke(t.usage)?t.usage:void 0;if(!n)return;let r=Kn(n,"inputTokens"),s=Kn(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=Kn(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function yP(e,t){let n=Ke(e._meta)?e._meta:void 0,r=we(e,"toolName")??we(e,"name")??(n?we(n,"toolName"):void 0)??(n?we(n,"name"):void 0),s=we(e,"kind"),i=we(e,"title")??r??s,a=e.rawInput??e.input??e.args,o=e.rawOutput??e.output??e.result,l=a!==void 0?Co(a):void 0,c=o!==void 0?Co(o):void 0,u=e.content!==void 0?Co(e.content):void 0,d=e.locations!==void 0?Co(e.locations):void 0,f=we(e,"toolCallId"),m=we(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}=wP(e,r),w=we(e,"parentToolCallId")??(n?we(n,"parentToolCallId"):void 0),v=w&&w!==f?w:void 0,g=we(e,"subagentType")??(n?we(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}:{},...v?{parentToolCallId:v}:{},...g?{subagentType:g}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:z2(qo(l))}:c!==void 0?{details:z2(qo(c))}:{}}}function bP(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=z2(vP(n)),s=t.eventId!==void 0?`${B2}-${t.eventId}`:B2,i=Ke(e._meta)?e._meta:void 0,a=i&&Ke(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:a?{entries:n,stats:a}:{entries:n}}}function vP(e){return e.flatMap(t=>{if(!Ke(t))return[];let n=we(t,"content");return n?[`- [${xP(we(t,"status"))}] ${n}`]:[]}).join(`
`)}function xP(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function wP(e,t){let n=we(e,"provenance"),r=we(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 X6(e){if(e)return iP.has(e)?e:void 0}function z2(e){return e.length<=K6?e:`${e.slice(0,K6)}... [truncated]`}function _P(e,t){if(!Ke(e.data))return[{...t,type:"debug",text:`permission_request: ${qo(e.data)}`}];let n=we(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${qo(e.data)}`}];let r=e.data.toolCall!==void 0?Co(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:we(e.data,"sessionId"),title:AP(r),options:TP(e.data.options),toolCall:r}]}function kP(e,t){let n=we(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${qo(e.data)}`}];let r=we(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:CP(e.data),...r?{voterClientId:r}:{}}]}function SP(e){if(!Ke(e))return;let t=e.update;return Ke(t)?t:e}function TP(e){return Array.isArray(e)?e.flatMap(t=>{if(!Ke(t))return[];let n=we(t,"optionId");return n?[{optionId:n,label:we(t,"label")??we(t,"title")??we(t,"name")??n,...we(t,"description")?{description:we(t,"description")}:{},raw:t}]:[]}):[]}function CP(e){if(!Ke(e))return Zl(e);let t=e.outcome;if(typeof t=="string")return t;if(Ke(t)){let n=we(t,"outcome")??"selected",r=we(t,"optionId");return r?`${n}:${r}`:n}return sn(e,["status","reason"])??Zl(e)}function AP(e){return Ke(e)?we(e,"title")??we(e,"name")??we(e,"kind")??we(e,"toolName")??"Tool permission":"Tool permission"}function $2(e){let t=we(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function P2(e){if(!Ke(e))return;let t=we(e,"source");if(t)return t;let n=e._meta;return Ke(n)?we(n,"source"):void 0}function Fn(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function EP(e,t){let n=we(e.data,"sessionId");if(!n)return Fn(e,t,"missing sessionId");let r=we(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function MP(e,t){let n=we(e.data,"sessionId"),r=we(e.data,"previous"),s=we(e.data,"next");if(!n||!r||!s)return Fn(e,t,"missing sessionId / previous / next");let i=Ke(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 NP(e,t){let n=we(e.data,"scope"),r=we(e.data,"filePath"),s=we(e.data,"mode"),i=Kn(Ke(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?Fn(e,t,"malformed memory_changed payload"):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function IP(e,t){let n=we(e.data,"change"),r=we(e.data,"name"),s=we(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?Fn(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function RP(e,t){let n=we(e.data,"toolName"),r=Ke(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?Fn(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function jP(e,t){let n=we(e.data,"key"),r=we(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:Ke(e.data)?e.data.value:void 0}]:Fn(e,t,"malformed settings_changed payload")}function DP(e,t){let n=we(e.data,"path"),r=we(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?Fn(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function OP(e,t){if(!Ke(e.data))return Fn(e,t,"non-object payload");let n=Kn(e.data,"liveCount"),r=Kn(e.data,"reservedCount"),s=Kn(e.data,"budget"),i=Kn(e.data,"thresholdRatio"),a=we(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||a!=="warn"&&a!=="enforce"?Fn(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:a}]}function LP(e,t){if(!Ke(e.data))return Fn(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(Ke).map(a=>{let o=we(a,"name"),l=we(a,"transport"),c=we(a,"reason");return!o||!l||c!=="budget_exhausted"?null:{name:o,transport:l,reason:"budget_exhausted"}}).filter(a=>a!==null):[],r=Kn(e.data,"budget"),s=Kn(e.data,"liveCount"),i=Kn(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?Fn(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function BP(e,t){let n=we(e.data,"serverName"),r=Kn(e.data,"durationMs");return!n||r===void 0?Fn(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function zP(e,t){let n=we(e.data,"serverName"),r=we(e.data,"reason");return!n||!r||!aP.has(r)?Fn(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function $P(e,t){let n=Kn(e.data,"refreshed"),r=Kn(e.data,"failed"),s=we(e.data,"status"),i=we(e.data,"source"),a=we(e.data,"name"),o=we(e.data,"version"),l=we(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"?Fn(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:r,...s?{status:s}:{},...i?{source:i}:{},...a?{name:a}:{},...o?{version:o}:{},...l?{error:l}:{}}]}function PP(e,t){let n=we(e.data,"deviceFlowId"),r=we(e.data,"providerId"),s=Kn(e.data,"expiresAt");return!n||!r||!pM.has(r)||s===void 0?Fn(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function qP(e,t){let n=we(e.data,"deviceFlowId"),r=Kn(e.data,"intervalMs");return!n||r===void 0?Fn(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function UP(e,t){let n=we(e.data,"deviceFlowId"),r=we(e.data,"providerId");if(!n||!r||!pM.has(r))return Fn(e,t,"malformed auth_device_flow_authorized payload");let s=Kn(e.data,"expiresAt"),i=we(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function HP(e,t){let n=we(e.data,"deviceFlowId"),r=we(e.data,"errorKind");if(!n||!FP(r))return Fn(e,t,"malformed auth_device_flow_failed payload");let s=we(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function FP(e){return typeof e=="string"&&e.trim().length>0}function VP(e,t){let n=we(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Fn(e,t,"malformed auth_device_flow_cancelled payload")}function Kn(e,t){if(!Ke(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function WP(e,t){if(!Ke(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var GP=8;function $g(e,t={},n=0){if(n>GP){let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(Ke(e)){let p=e.rawInput??e.input??e.args;if(p!==void 0&&p!==e){let y=$g(p,{title:t.title??sn(e,["title"]),toolName:t.toolName??sn(e,["toolName","name"]),toolKind:t.toolKind??sn(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let r=JP(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=QP(e,t);if(s)return s;let i=nq(e,t);if(i)return i;let a=rq(e,t);if(a)return a;let o=sq(e,t);if(o)return o;let l=KP(e,t);if(l)return l;let c=YP(e,t);if(c)return c;let u=XP(e);if(u)return u;let d=iq(e,t);if(d)return d;let f=aq(e);if(f)return f;if(Ke(e)){let p=sn(e,["command","cmd"]);if(p){let w=sn(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...w?{cwd:w}:{}}}let y=eq(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 KP(e,t={}){if(!Ke(e))return;let n=sn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=sn(e,["oldText","old_text","old_str","oldString"]),s=sn(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),a=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!r,o=s===void 0&&a?sn(e,["content"]):void 0,l=s??o,c=sn(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 YP(e,t){if(!Ke(e))return;let n=sn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??sn(e,["toolName","name"]),s=r!==void 0&&/read|view|cat/i.test(r),i=e.lineRange??e.line_range??e.range,a;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")a=[i[0],i[1]];else{let o=e.offset,l=e.limit;typeof o=="number"&&typeof l=="number"&&l>0&&(a=[o+1,o+l])}if(!(!s&&!a))return{kind:"file_read",path:n,...a?{range:a}:{}}}function XP(e){if(!Ke(e))return;let t=sn(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=sn(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function QP(e,t){let n=t.toolName??(Ke(e)?sn(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),a=r.slice(s+2),o;if(Ke(e)){let l=e.arguments??e.args??e;if(Ke(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&&(o=c)}}return{kind:"mcp_invocation",serverId:i,toolName:a,...o?{argsSummary:o}:{}}}function JP(e){return!Ke(e)||!Array.isArray(e.questions)?[]:e.questions.filter(Ke).map(t=>{let n=sn(t,["header","title","label"]),r=sn(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(Ke).map(ZP):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function ZP(e){let t=sn(e,["label","title","value"])??"Option",n=sn(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function eq(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=sn(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)||Ke(s)||t.push({label:r,value:mM(r)?"[redacted]":qo(s)});return t}var Q6=50,tq=5;function nq(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!Ke(e))return;let r=sn(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=sn(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=sn(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function rq(e,t){if(!Ke(e))return;let n=sn(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,a=e.results??e.matches;return Array.isArray(a)&&(i=a.slice(0,tq).map(o=>typeof o=="string"?o:Ke(o)?sn(o,["path","file","name","title","text"])??Zl(o).slice(0,120):String(o)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...s!==void 0?{resultCount:s}:{},...i?{top:i}:{}}}function sq(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!Ke(e))return;let r=sn(e,["prompt","description","query"]);if(!r)return;let s=sn(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=sn(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function iq(e,t){if(!Ke(e))return;let n=sn(e,["code","snippet","source"]);if(!n)return;let r=sn(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 a=sn(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...a?{origin:a}:{}}}function aq(e){if(!Ke(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let s=t.filter(a=>typeof a=="string").slice(0,30);if(s.length===0)return;let i=n.slice(0,Q6).map(a=>Array.isArray(a)?a.map(o=>typeof o=="string"?o:Zl(o).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&&Ke(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,Q6).map(a=>{let o=a;return s.map(l=>{let c=o[l];return typeof c=="string"?c:Zl(c).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var oq=1e3,ou="__trimmed_tool_block__",Z1="__trimmed_permission_block__",q2=1e5,J6=`
[truncated]
`,lq=16;function cq(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??oq}}var z_=new Set(["pending","confirming","running","in_progress"]),uq=new Set(["completed","success","failed","error","canceled","cancelled"]),dq=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function hq(e,t,n={}){let r=xM(e,n);U_(r);let s=H_(r,"user",t);return n.images&&n.images.length>0&&(s.images=[...n.images]),Ka(r,s),r.activeUserBlockId=s.id,wM(r)}function fq(e,t,n={}){if(t.length===0)return e;let r=xM(e,n);for(let i of t)mq(r,i);let s=wM(r);return Object.freeze(s.blocks),s}function $_(e){let t={};return e.forEach((n,r)=>{t[n.id]=r}),t}function mq(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!dq.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),Qb(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let r=Ki(e,e.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:t.data,mimeType:t.mimeType}])}else{let r=H_(e,"user","");r.images=[{data:t.data,mimeType:t.mimeType}],Ka(e,r),e.activeUserBlockId=r.id}break}case"assistant.text.delta":Qb(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":U_(e,t),(t.reason==="cancelled"||t.reason==="error")&&U2(e);break;case"assistant.usage":yq(e,t);break;case"thought.text.delta":Qb(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":vM(e,t);break;case"shell.output":xq(e,t);break;case"user.shell.output":wq(e,t);break;case"permission.request":_q(e,t);break;case"permission.resolved":kq(e,t);break;case"model.changed":Bf(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Bf(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":pq(e,t);break;case"prompt.cancelled":U2(e),t.reason!=="forward_failed"&&Sq(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":Cq(e,t.targetTurnIndex);break;case"session.branched":Bf(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function pq(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},U2(e),Bf(e,"error",`State resync required: ${gq(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function gq(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 ey(e,t,n){let r=Ki(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),(n==null?void 0:n.serverTimestamp)!==void 0&&(r.serverTimestamp=n.serverTimestamp))}function yM(e,t){ey(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function yq(e,t){let n=Ki(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 bM(e,t){ey(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function P_(e,t,n){ey(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function q_(e,t,n){ey(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function Qb(e,t,n,r,s){let i=t!=="user"&&"parentToolCallId"in s?s.parentToolCallId:void 0,a=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,o=a&&i!=null?a[i]:e[n],l=Ki(e,o);if(l&&l.kind===t&&bq(l,s)){l.text=V_(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=H_(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),Ka(e,c),a&&i!=null?a[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&q_(e,i),t==="thought"&&P_(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&yM(e),t!=="thought"&&bM(e))}function bq(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 U_(e,t){yM(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))P_(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))q_(e,n,t);bM(e,t)}function vM(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===ou){if(Tq(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],vM(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Bf(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let r=Ki(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=$g(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 a=e.toolBlockByCallId[r.parentToolCallId];a&&a!==ou&&(r.parentBlockId=a)}t.subagentType&&!r.subagentType&&(r.subagentType=t.subagentType),Z6(e,t.toolCallId,t.status);return}let s=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==ou?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:hc(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:$g(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}:{}};Ka(e,i),e.toolBlockByCallId[t.toolCallId]=i.id;for(let a of e.blocks)if(a.kind==="tool"&&a.parentToolCallId===t.toolCallId&&!a.parentBlockId){let o=Ki(e,a.id);(o==null?void 0:o.kind)==="tool"&&(o.parentBlockId=i.id)}Z6(e,t.toolCallId,t.status??"pending"),Mu(e,t.parentToolCallId)}function Z6(e,t,n){if(n!==void 0){if(z_.has(n)){e.currentToolCallId=t;return}if(uq.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=vq(e));return}}}function vq(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"&&z_.has(n.status))return n.toolCallId}}function U2(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===ou)continue;let n=Ki(e,t);!n||n.kind!=="tool"||z_.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function xq(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=Ki(e,n.id);(s==null?void 0:s.kind)==="shell"&&(s.text=V_(s.text,t.text),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId));return}let r={id:hc(e,"shell"),kind:"shell",text:K0(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}:{}};Ka(e,r),Mu(e)}function wq(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===t.stream&&!e.pendingUserShellCommand){let a=Ki(e,n.id);(a==null?void 0:a.kind)==="user_shell"&&(a.text=V_(a.text,t.text),a.updatedAt=e.now,t.eventId!==void 0&&(a.eventId=t.eventId));return}let r=e.pendingUserShellCommand,s=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:hc(e,"user-shell"),kind:"user_shell",text:K0(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,Ka(e,i),Mu(e)}function _q(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===Z1)return;let r=Ki(e,n),s=$g(t.toolCall,{title:t.title});if((r==null?void 0:r.kind)==="permission"){r.title=t.title,r.options=t.options.map(a=>({...a})),r.toolCall=t.toolCall,r.preview=s,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let i={id:hc(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(a=>({...a})),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}:{}};Ka(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,Mu(e)}function kq(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===Z1)return;let r=Ki(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:hc(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}:{}};Ka(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,Mu(e)}function Bf(e,t,n,r,s={}){let i={id:hc(e,t),kind:t,text:K0(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}}:{}};Ka(e,i),s.clearActiveText!==!1&&Mu(e)}function Sq(e,t){let n={id:hc(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}:{}};Ka(e,n),Mu(e)}function H_(e,t,n,r,s,i){return{id:hc(e,t),kind:t,text:K0(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...i?{meta:{...i}}:{}}}function xM(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 wM(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=$_(t),Pg.set(e,e.blocks);for(let[r,s]of Object.entries(e.toolBlockByCallId))n.has(s)||(e.toolBlockByCallId[r]=ou);Mq(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==ou&&delete e.trimmedToolNotificationByCallId[r];for(let[r,s]of Object.entries(e.permissionBlockByRequestId))n.has(s)||(e.permissionBlockByRequestId[r]=Z1);Nq(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let s=Ki(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 Tq(e){return e.toolCallId===B2||e.toolKind==="updated_plan"}var Pg=new WeakMap;function F_(e){Pg.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},Pg.set(e,e.blocks))}function Cq(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){eS(e,i);return}n+=1}r>=0&&t>=n&&eS(e,r)}function eS(e,t){F_(e),e.blocks=e.blocks.slice(0,t),Pg.set(e,e.blocks),Aq(e)}function Aq(e){e.blockIndexById=$_(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 Ka(e,t){F_(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function Ki(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=Eq(r);return F_(e),e.blocks[n]=s,s}function Eq(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Ma(t)),toolCall:Ma(e.toolCall),preview:Ma(e.preview)}:e.kind==="tool"?{...e,preview:Ma(e.preview),content:Ma(e.content),locations:Ma(e.locations),rawInput:Ma(e.rawInput),rawOutput:Ma(e.rawOutput)}:{...e}}function hc(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function Mu(e,t){t?(P_(e,t),q_(e,t)):(U_(e),e.activeUserBlockId=void 0)}function V_(e,t){return e.length>=q2?e:K0(e+t)}function K0(e){if(e.length<=q2)return e;let t=Math.max(0,q2-J6.length);return`${e.slice(0,t)}${J6}`}function Mq(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===ou).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 Nq(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===Z1).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function Ma(e,t=0){return t>lq?e:Array.isArray(e)?e.map(n=>Ma(n,t+1)):Ke(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ma(r,t+1)])):e}function Iq(e={}){let t=tS(e),n=new Set,r=!1,s=()=>{for(let a of n)try{a()}catch(o){Rq(o)}},i=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,s()}))};return{getSnapshot(){return t},subscribe(a){return n.add(a),()=>{n.delete(a)}},dispatch(a){let o=Array.isArray(a)?a:[a];o.length!==0&&(t=fq(t,o),i())},appendLocalUserMessage(a,o){t=hq(t,a,{images:o}),i()},reset(a={}){t=tS({maxBlocks:a.maxBlocks??t.maxBlocks,...a}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function Rq(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 tS(e){let t=e.blocks?[...e.blocks]:[];return{...cq({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:$_(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 jq="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Dq(e,t){var n;if(!e)return{models:[]};const r=new Set,s=[];let i=(n=e.current)==null?void 0:n.modelId,a;for(const o of e.providers)for(const l of o.models){!i&&l.isCurrent&&(i=l.modelId),a===void 0&&(i?l.modelId===i:l.isCurrent)&&(a=l.contextLimit);const c=[o.authType,l.modelId,l.baseUrl??"",l.envKey??""].join("\0");r.has(c)||(r.add(c),s.push({id:l.modelId,baseModelId:l.baseModelId,label:l.name||l.modelId,authType:o.authType,...l.contextLimit!==void 0?{contextWindow:l.contextLimit}:{},...l.modalities!==void 0?{modalities:l.modalities}:{},...l.baseUrl!==void 0?{baseUrl:l.baseUrl}:{},...l.envKey!==void 0?{envKey:l.envKey}:{},...l.isRuntime?{isRuntime:!0}:{}}))}return{models:s,currentModel:i,contextWindow:a}}function Oq(e){var t;const n=cs((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=vr(n,"currentModelId")??vr(n,"currentModel"),s=n.availableModels,i=[];let a;if(Array.isArray(s))for(const o of s){const l=cs(o),c=vr(l,"modelId")??vr(l,"id")??vr(l,"value");if(!c)continue;const u=cs(l==null?void 0:l._meta),d=gf(u,"contextLimit")??gf(u,"contextWindow")??gf(l,"contextLimit")??gf(l,"contextWindow");a===void 0&&r!==void 0&&c===r&&(a=d),i.push({id:c,baseModelId:vr(l,"baseModelId")??qq(c),label:vr(l,"name")??vr(l,"label")??c,...d!==void 0?{contextWindow:d}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:a}}function _M(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}:{},...TM(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:kM(t,n),skills:e.availableSkills}}function kM(...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 Lq(e,t){var n;if(e.type==="session_update"){const r=cs((n=cs(e.data))==null?void 0:n.update),s=SM(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:W_(s)})),vr(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:a}=Pq(r);t(o=>({...o,commands:i.length>0?i:o.commands,skills:a}))}return}switch(e.type){case"session_metadata_updated":{const r=cs(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:vr(r,"displayName")}));break}case"model_switched":{const r=vr(cs(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=cs(e.data),s=vr(r,"next")??vr(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function Bq(e){const t=vr(e,"displayName");return t!=null&&t.trim()?t:void 0}function zq(e){var t;const n=cs((t=e==null?void 0:e.state)==null?void 0:t.modes);return vr(n,"currentModeId")??vr(n,"currentMode")}function W_(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 $q(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=cs((t=cs(r.data))==null?void 0:t.update),i=SM(s);if(i)return i}catch{}}function SM(e){const t=cs(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=cs(t==null?void 0:t.usage),r={...Yh(n,"inputTokens"),...Yh(n,"outputTokens"),...Yh(n,"totalTokens"),...Yh(n,"thoughtTokens"),...Yh(n,"cachedReadTokens")};return W_(r)!==void 0?r:void 0}function Yh(e,t){const n=gf(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function Pq(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var a;const o=cs(i),l=vr(o,"name");if(!l)return[];const c=cs(o==null?void 0:o.input),u={name:l,description:vr(o,"description")??"",input:c?{hint:vr(c,"hint")??""}:null,_meta:cs(o==null?void 0:o._meta)??null};return[{name:l,description:u.description??"",...(a=u.input)!=null&&a.hint?{argumentHint:u.input.hint}:{},...TM(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:kM(n,s),skills:r}}function TM(e){const n=vr(e??void 0,"source");return{...n?{source:n}:{}}}function cs(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function vr(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function gf(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function qq(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 Uq(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 Hq=3e4;function Fq(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),a=Math.min(i,s),o=.8+Math.random()*.4;return Math.min(s,Math.max(1,Math.round(a*o)))}async function Fe(e,t,n=Hq){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 Vq(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 Mr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Wq(e,t,n="replay",r=80,s){Mr(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 Gq="qwen-code-webui-client-id:session:";function nS(e,t){if(e)return e;if(typeof window>"u")return Jb();try{if(t){const n=window.sessionStorage.getItem(CM(t));if(n)return n}return Jb()}catch{return Jb()}}function H2(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(CM(t),e)}catch{}}async function rS(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Kq(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 Jb(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function CM(e){return`${Gq}${encodeURIComponent(e)}`}function Kq(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 Yq({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:a,passiveAssistantDoneTimerRef:o,getCreateSessionRequest:l,addNotice:c,setConnection:u,setPromptStatus:d,setRestoreSessionId:f,setRestoreMode:m,setRestoreSessionNonce:p,setNewSessionNonce:y}){function w(v,g){const x=i.current+1;i.current=x,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${g} superseded by a newer request`,"AbortError")));const k=new Promise((A,T)=>{const C=setTimeout(()=>{var j;((j=s.current)==null?void 0:j.id)===x&&(s.current=void 0,T(yn(c,`${eU(g)} session failed`,new Error(`Session ${g} timed out`),g==="load"?"load_session":"resume_session")))},3e4);s.current={id:x,sessionId:v,mode:g,timeout:C,resolve:A,reject:T}});return d("idle"),r.current.clear(),Mr(o),e.reset(),m(g),f(v),p(A=>A+1),k}return{async sendPrompt(v,g){var x,k,A,T;const C=$n(c,t.current,"Prompt failed","send_prompt"),j=C.sessionId;if(n.current.has(j))throw yn(c,"Prompt failed","A prompt is already in progress","send_prompt");Mr(o),d("waiting");const z=new AbortController;n.current.set(j,{controller:z});try{const E=((g==null?void 0:g.images)??[]).map(H=>({data:H.data,mimeType:H.mimeType||H.mediaType||H.media_type||"image/*"}));(g==null?void 0:g.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(v,E);const P={prompt:Uq(v,E)};g!=null&&g.retry&&(P.retry=!0);const D=await C.prompt(P,z.signal);return hM(D)?await Xq(n.current,r.current,j,z,D.promptId):(((x=t.current)==null?void 0:x.sessionId)===j&&e.dispatch({type:"assistant.done",reason:D.stopReason}),D)}catch(E){if(Hp(E))return((k=t.current)==null?void 0:k.sessionId)===j&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw((A=t.current)==null?void 0:A.sessionId)===j&&e.dispatch({type:"assistant.done",reason:"error"}),uM(E)?E:yn(c,"Prompt failed",E,"send_prompt")}finally{const E=n.current.get(j);(E==null?void 0:E.controller)===z&&n.current.delete(j),((T=t.current)==null?void 0:T.sessionId)===j&&!n.current.has(j)&&d("idle")}},async cancel(){var v,g;const x=$n(c,t.current,"Cancel failed","cancel_prompt"),k=n.current.get(x.sessionId);k==null||k.controller.abort(),Mr(o);const A=k?new AbortController:void 0;A&&n.current.set(x.sessionId,{controller:A});try{await Fe(x.cancel(),"Cancel timed out")}catch(T){throw yn(c,"Cancel failed",T,"cancel_prompt")}finally{A&&((v=n.current.get(x.sessionId))==null?void 0:v.controller)===A&&n.current.delete(x.sessionId),((g=t.current)==null?void 0:g.sessionId)===x.sessionId&&!n.current.has(x.sessionId)&&d("idle")}},async setModel(v){const g=$n(c,t.current,"Set model failed","switch_model");try{const x=await Fe(g.setModel(v),"Set model timed out");return u(k=>({...k,currentModel:v})),x}catch(x){throw yn(c,"Set model failed",x,"switch_model")}},async setApprovalMode(v,g){const x=$n(c,t.current,"Set approval mode failed","set_approval_mode");try{const k=await Fe(x.client.setSessionApprovalMode(x.sessionId,v,{persist:g==null?void 0:g.persist,clientId:x.clientId}),"Set approval mode timed out");return u(A=>({...A,currentMode:k.mode||v})),k}catch(k){throw yn(c,"Set approval mode failed",k,"set_approval_mode")}},async respondToPermission(v,g){const x=$n(c,t.current,"Permission response failed","submit_permission");try{return await Fe(x.respondToSessionPermission(v,g),"Permission response timed out")}catch(k){throw yn(c,"Permission response failed",k,"submit_permission")}},async submitPermission(v,g,x){const k=$n(c,t.current,"Permission response failed","submit_permission"),A=g!==void 0&&g.length>0?{outcome:{outcome:"selected",optionId:g},...x?{answers:x}:{}}:{outcome:{outcome:"cancelled"},...x?{answers:x}:{}};try{return await Fe(k.respondToSessionPermission(v,A),"Permission response timed out")}catch(T){throw yn(c,"Permission response failed",T,"submit_permission")}},async heartbeat(){const v=t.current;if(!(!v||!a.current))return Fe(v.heartbeat(),"Heartbeat timed out")},async listSessions(){const v=t.current;if(!v)return[];try{return await Fe(v.client.listWorkspaceSessions(v.workspaceCwd),"List sessions timed out")}catch(g){throw yn(c,"List sessions failed",g,"list_sessions")}},async loadSession(v){return w(v,"load")},async resumeSession(v){return w(v,"resume")},async createSession(){const v=$n(c,t.current,"Create session failed","create_session"),g=await Fe(v.client.createOrAttachSession(l()),"Create session timed out");return H2(g.clientId,g.sessionId),g},async newSession(){for(const[,v]of n.current)v.controller.abort();n.current.clear(),r.current.clear(),d("idle"),Mr(o),s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException("New session requested","AbortError")),s.current=void 0),e.reset(),f(void 0),y(v=>v+1)},async releaseSession(v){try{const g=$n(c,t.current,"Release session failed","release_session");await Fe(g.client.closeSession(v),"Release session timed out")}catch(g){throw yn(c,"Release session failed",g,"release_session")}},async closeSession(){const v=$n(c,t.current,"Close session failed","close_session");try{await Fe(v.close(),"Close session timed out")}catch(g){throw yn(c,"Close session failed",g,"close_session")}},async refreshCommands(){const v=$n(c,t.current,"Refresh commands failed","refresh_commands");try{const g=await Fe(v.supportedCommands(),"Refresh commands timed out"),{commands:x,skills:k}=_M(g);u(A=>({...A,commands:x,skills:k,supportedCommands:g}))}catch(g){throw yn(c,"Refresh commands failed",g,"refresh_commands")}},async getContext(){const v=$n(c,t.current,"Load context failed","load_context");try{const g=await Fe(v.context(),"Load context timed out");return u(x=>({...x,context:g,currentMode:Qq(g)??x.currentMode,currentModel:Jq(g)??x.currentModel})),g}catch(g){throw yn(c,"Load context failed",g,"load_context")}},async getContextUsage(v){const g=$n(c,t.current,"Load context usage failed","load_context_usage");try{return await Fe(g.contextUsage(v),"Load context usage timed out")}catch(x){throw yn(c,"Load context usage failed",x,"load_context_usage")}},async renameSession(v){const g=$n(c,t.current,"Rename session failed","rename_session");try{return await Fe(g.updateMetadata({displayName:v}),"Rename session timed out")}catch(x){throw yn(c,"Rename session failed",x,"rename_session")}},async recapSession(){const v=$n(c,t.current,"Recap session failed","recap_session");try{return await Fe(v.recap(),"Recap session timed out")}catch(g){throw yn(c,"Recap session failed",g,"recap_session")}},async getRewindSnapshots(){const v=$n(c,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await Fe(v.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(g){throw yn(c,"Load rewind snapshots failed",g,"rewind_snapshots")}},async rewindSession(v,g){const x=$n(c,t.current,"Rewind session failed","rewind_session");try{return await Fe(x.rewind(v,g),"Rewind session timed out")}catch(k){throw yn(c,"Rewind session failed",k,"rewind_session")}},async btwSession(v,g){var x;const k=$n(c,t.current,"Side question failed","btw_session");try{return await Fe(k.btw(v,g),"Side question timed out")}catch(A){throw(x=g==null?void 0:g.signal)!=null&&x.aborted||Hp(A)?A:yn(c,"Side question failed",A,"btw_session")}},async enqueueMidTurnMessage(v,g){const x=t.current;if(!x)return{accepted:!1};try{return await x.enqueueMidTurnMessage(v,g)}catch(k){return k instanceof DOMException&&k.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",k),{accepted:!1}}},async sendShellCommand(v){var g,x;const k=$n(c,t.current,"Shell command failed","send_shell_command"),A=`${k.sessionId}:shell`;d("waiting");const T=new AbortController;n.current.set(A,{controller:T});try{return await k.shellCommand(v,T.signal)}catch(C){throw yn(c,"Shell command failed",C,"send_shell_command")}finally{((g=n.current.get(A))==null?void 0:g.controller)===T&&n.current.delete(A),((x=t.current)==null?void 0:x.sessionId)===k.sessionId&&d("idle")}},async getTasks(){const v=$n(c,t.current,"Get tasks failed","load_tasks");try{return await Fe(v.tasks(),"Get tasks timed out")}catch(g){throw yn(c,"Get tasks failed",g,"load_tasks")}},async cancelTask(v,g){const x=$n(c,t.current,"Cancel task failed","cancel_task");try{return await Fe(x.cancelTask(v,g),"Cancel task timed out")}catch(k){throw yn(c,"Cancel task failed",k,"cancel_task")}},async clearGoal(){const v=$n(c,t.current,"Clear goal failed","clear_goal");try{return await Fe(v.clearGoal(),"Clear goal timed out")}catch(g){throw yn(c,"Clear goal failed",g,"clear_goal")}},async getStats(){const v=$n(c,t.current,"Load stats failed","load_stats");try{return await Fe(v.stats(),"Load stats timed out")}catch(g){throw yn(c,"Load stats failed",g,"load_stats")}},async respondToGlobalPermission(v,g){const x=$n(c,t.current,"Global permission response failed","submit_permission");try{return await Fe(x.client.respondToPermission(v,g),"Global permission response timed out")}catch(k){throw yn(c,"Global permission response failed",k,"submit_permission")}},async branchSession(v){const g=$n(c,t.current,"Branch session failed","branch_session");try{const x=await Fe(g.client.branchSession(g.sessionId,{name:v},g.clientId),"Branch session timed out");return H2(x.clientId,x.sessionId),w(x.sessionId,"load").catch(k=>{Hp(k)||yn(c,"Branch session failed",k,"branch_session")}),{sessionId:x.sessionId,displayName:x.displayName}}catch(x){throw yn(c,"Branch session failed",x,"branch_session")}},async forkSession(v){const g=$n(c,t.current,"Fork session failed","fork_session");try{return await Fe(g.fork(v),"Fork session timed out")}catch(x){throw yn(c,"Fork session failed",x,"fork_session")}}}}function Xq(e,t,n,r,s){return new Promise((i,a)=>{const o=F2(n,s),l=t.get(o);if(l){t.delete(o),l.status==="resolved"?i(l.result):a(l.error);return}const c=e.get(n);if((c==null?void 0:c.controller)!==r){a(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==s){a(new Error(`Prompt accepted with unexpected id ${s}`));return}if(r.signal.aborted){e.delete(n),a(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(),a(r.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:s,resolve:f=>{u(),i(f)},reject:f=>{u(),a(f)}}),r.signal.addEventListener("abort",d,{once:!0})})}function F2(e,t){return JSON.stringify([e,t])}function Qq(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 Jq(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 $n(e,t,n,r){if(!t)throw yn(e,n,"Daemon session is not connected",r);return t}function yn(e,t,n,r){if(Hp(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",a=new Error(i);return a.name="AbortError",a}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}),Zq(n instanceof Error?n:new Error(s))}function Hp(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Zq(e){return Object.assign(e,{_alreadyDispatched:!0})}function eU(e){return e.charAt(0).toUpperCase()+e.slice(1)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const tU=33e4;function nU({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(){const s=St(e,"List sessions failed"),i=t();return i?Fe(s.listWorkspaceSessions(i),"List sessions timed out"):[]},async deleteSession(s){const i=St(e,"Delete session failed"),a=await Fe(i.deleteSessionsData([s]),"Delete session timed out");if(a.errors.length>0)throw new Error(a.errors[0].error);return a.removed.length>0||a.notFound.length>0},async deleteSessions(s){const i=St(e,"Delete sessions failed");return Fe(i.deleteSessionsData(s),"Delete sessions timed out")},async loadMcpStatus(){const s=St(e,"Load MCP status failed");return Fe(s.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(s){const i=St(e,"Load MCP tools failed");try{return await Fe(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 restartMcpServer(s){const i=St(e,"Restart MCP server failed");return Fe(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const a=St(e,"Manage MCP server failed"),o=i==="authenticate"?10*6e4:5*6e4;return Fe(a.manageMcpServer(s,i),"Manage MCP server timed out",o)},async loadSkillsStatus(){const s=St(e,"Load skills failed");return Fe(s.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const s=St(e,"Load extensions failed");return Fe(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=St(e,"Load tools failed");return Fe(s.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(s,i){const a=St(e,"Set tool enabled failed");return Fe(a.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=St(e,"Load settings failed");return Fe(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,a){const o=St(e,"Set setting failed");return Fe(o.setWorkspaceSetting(s,i,a),"Set setting timed out")},async loadMemoryStatus(){const s=St(e,"Load memory failed");return Fe(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=St(e,"Read workspace file failed");return Fe(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=St(e,"Write memory failed");return Fe(i.writeWorkspaceMemory(s),"Write memory timed out")},async listAgents(){const s=St(e,"List agents failed");return Fe(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s){const i=St(e,"Get agent failed");return Fe(i.getWorkspaceAgent(s),"Get agent timed out")},async createAgent(s){const i=St(e,"Create agent failed");return Fe(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=St(e,"Generate agent failed");return Fe(i.generateWorkspaceAgent(s),"Generate agent timed out",tU)},async deleteAgent(s,i){const a=St(e,"Delete agent failed");return Fe(a.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){St(e,"Glob workspace failed");const a=ev(n,"/glob");a.searchParams.set("pattern",s),(i==null?void 0:i.maxResults)!==void 0&&a.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&a.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&a.searchParams.set("cwd",i.cwd);const o=await Fe(fetch(tv(a,n),{headers:Zb(r)}),"Glob workspace timed out");if(!o.ok)throw new Error(await nv(o,"GET /glob"));const l=await o.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const s=St(e,"Load providers failed");return Fe(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const a=St(e,"Read file bytes failed");return Fe(a.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=St(e,"Write file failed");return Fe(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=St(e,"Edit file failed");return Fe(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){St(e,"Stat file failed");const i=ev(n,"/stat");i.searchParams.set("path",s);const a=await Fe(fetch(tv(i,n),{headers:Zb(r)}),"Stat file timed out");if(!a.ok)throw new Error(await nv(a,"GET /stat"));return await a.json()},async listDirectory(s){St(e,"List directory failed");const i=ev(n,"/list");i.searchParams.set("path",s);const a=await Fe(fetch(tv(i,n),{headers:Zb(r)}),"List directory timed out");if(!a.ok)throw new Error(await nv(a,"GET /list"));return await a.json()},async loadEnv(){const s=St(e,"Load env failed");return Fe(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=St(e,"Load preflight failed");return Fe(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=St(e,"Init workspace failed");return Fe(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,a){const o=St(e,"Update agent failed");return Fe(o.updateWorkspaceAgent(s,i,a?{scope:a}:{}),"Update agent timed out")},async installExtension(s,i){const a=St(e,"Install extension failed");return Fe(a.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=St(e,"Load extension operation failed");return Fe(i.extensionOperationStatus(s),"Load extension operation timed out")},async checkExtensionUpdates(s){const i=St(e,"Check extension updates failed");return Fe(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=St(e,"Refresh extensions failed");return Fe(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,a){const o=St(e,"Enable extension failed");return Fe(o.enableExtension(s,i,a),"Enable extension timed out")},async disableExtension(s,i,a){const o=St(e,"Disable extension failed");return Fe(o.disableExtension(s,i,a),"Disable extension timed out")},async updateExtension(s,i){const a=St(e,"Update extension failed");return Fe(a.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const a=St(e,"Uninstall extension failed");return Fe(a.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=St(e,"Start device flow failed");return Fe(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const a=St(e,"Get device flow failed");return Fe(a.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=St(e,"Cancel device flow failed");return Fe(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=St(e,"Get auth status failed");return Fe(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=St(e,"Get auth providers failed");return Fe(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=St(e,"Install auth provider failed");return Fe(i.installAuthProvider(s),"Install auth provider timed out")}}}function St(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function Zb(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function ev(e,t){const n=AM(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function tv(e,t){return AM(t)?e.toString():`${e.pathname}${e.search}`}function AM(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 nv(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 G_=b.createContext(void 0);let Xh;function rU({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const a=b.useMemo(()=>r?new dM({baseUrl:e,token:t,transport:s}):void 0,[r,e,t,s]),o=b.useRef(a);o.current=a;const l=b.useRef(void 0),c=b.useRef(void 0),u=b.useRef(n),[d,f]=b.useState(void 0),[m,p]=b.useState(r?"connecting":"idle"),[y,w]=b.useState(void 0),v=b.useCallback(()=>{if(!a)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==a&&(l.current=a,c.current=void 0),!c.current){const k=a.capabilities().catch(A=>{throw c.current===k&&(c.current=void 0),A});c.current=k}return c.current},[a]);b.useEffect(()=>{if(!a)return;p("connecting"),w(void 0),f(void 0),Xh===a&&(Xh=void 0);let k=!1;return v().then(A=>{k||(f(A),p("connected"))}).catch(A=>{k||(w(A instanceof Error?A:new Error(String(A))),p("error"))}),()=>{k=!0,Xh=a,queueMicrotask(()=>{Xh===a&&(Xh=void 0,a.dispose())})}},[a,v]),u.current=(d==null?void 0:d.workspaceCwd)??n;const g=b.useMemo(()=>nU({getClient:()=>o.current,getWorkspaceCwd:()=>u.current,baseUrl:e,token:t}),[e,t]),x=b.useMemo(()=>{if(a)return{client:a,token:t,baseUrl:e,workspaceCwd:(d==null?void 0:d.workspaceCwd)??n,status:m,error:y,capabilities:d,getCapabilities:v,actions:g}},[a,t,e,n,m,y,d,v,g]);return h.jsx(G_.Provider,{value:x,children:i})}function K_(){const e=b.useContext(G_);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function fc(){return K_().actions}function EM(){return b.useContext(G_)}function sU(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&sS(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&sS(t)||(t==null?void 0:t.kind)==="tool"&&iS(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"&&iS(r))return"responding"}return"idle"}function iU(e,t="idle"){const n=sU(e);return t==="idle"||n!=="idle"?n:t==="waiting"?"waiting":"responding"}function sS(e){return e.streaming===!0}function iS(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const V2=new Set;let qg;function aS(){return qg}function aU(e){return V2.add(e),()=>{V2.delete(e)}}function oU(e){qg={...e},MM()}function rv(){qg!==void 0&&(qg=void 0,MM())}function MM(){for(const e of V2)e()}function lU(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,a=r.promptId;if(!(typeof s!="string"||typeof i!="string"||i.length===0||typeof a!="string"))return{sessionId:s,suggestion:i,promptId:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const W2=new Set,NM=Object.freeze([]),sv=64;let Il=NM;function oS(){return Il}function cU(e){return W2.add(e),()=>{W2.delete(e)}}function uU(e){const t=[...Il,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>sv){const n=t.length-sv;console.debug(`[mid-turn] sidechannel buffer over ${sv}; evicting ${n} oldest batch(es)`),Il=t.slice(n)}else Il=t;IM()}function dU(e){if(e.length===0||Il.length===0)return;const t=new Set(e),n=Il.filter(r=>!t.has(r));n.length!==Il.length&&(Il=n.length===0?NM:n,IM())}function IM(){for(const e of W2)e()}function hU(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==fM)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 a=i.filter(l=>typeof l=="string"&&l.length>0);if(a.length===0)return;const o=t.originatorClientId;return{sessionId:s,messages:a,...typeof o=="string"?{originatorClientId:o}:{}}}function yl(e,t){const n=gM(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const RM=b.createContext(void 0),jM=b.createContext(void 0),Y_=b.createContext(void 0),DM=b.createContext(void 0),OM=b.createContext(void 0),LM=b.createContext(void 0),fU=new Set([401,403,404,410]),mU=2e5,pU={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},gU=new Set([401,403]);function yU({baseUrl:e,token:t,workspaceCwd:n,initialSessionId:r,clientId:s,createSessionRequest:i,maxQueued:a=1024,maxBlocks:o=mU,suppressOwnUserEcho:l=!0,includeRawEvent:c=!1,autoConnect:u=!0,autoReconnect:d=!0,missingSessionBehavior:f="create",reconnectDelayMs:m=1e3,maxReconnectDelayMs:p=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:w=3,loadWarnings:v,children:g}){const x=EM(),k=e??(x==null?void 0:x.baseUrl),A=t??(x==null?void 0:x.token),T=n??(x==null?void 0:x.workspaceCwd),C=b.useRef(x==null?void 0:x.client);C.current=x==null?void 0:x.client;const j=b.useRef(x==null?void 0:x.capabilities);j.current=x==null?void 0:x.capabilities;const z=b.useRef(x==null?void 0:x.getCapabilities);z.current=x==null?void 0:x.getCapabilities;const E=b.useRef(T);E.current=T;const P=b.useMemo(()=>Iq({maxBlocks:o}),[o]),D=b.useRef(void 0),H=b.useRef(void 0),W=b.useRef(new Map),J=b.useRef(new Map),Y=b.useRef(void 0),Z=b.useRef(0),Q=b.useRef(void 0),L=b.useRef(!1),R=b.useRef({suppressOwnUserEcho:l,includeRawEvent:c}),$=b.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),I=b.useRef(v),M=b.useRef(void 0);(!M.current||s)&&(M.current=nS(s)),R.current={suppressOwnUserEcho:l,includeRawEvent:c},$.current={reconnectDelayMs:m,maxReconnectDelayMs:p},I.current=v;const G=i==null?void 0:i.modelServiceId,ne=i==null?void 0:i.sessionScope,fe=b.useRef(i);fe.current=i;const[Pe,oe]=b.useState("idle"),[Xe,ht]=b.useState(r),[At,zt]=b.useState("load"),[Vt,gt]=b.useState(0),[Le,qt]=b.useState(0),[tn,Mt]=b.useState({status:u?"connecting":"idle"}),Kt=b.useRef(0),[$t,gn]=b.useState([]),Xt=b.useCallback(ae=>{const pe={...ae,id:ae.id??`daemon-notice-${Date.now()}-${++Kt.current}`,createdAt:ae.createdAt??Date.now()};return gn(wt=>[...wt.slice(-49),pe]),pe},[]),Be=b.useCallback(ae=>{gn(pe=>pe.filter(wt=>wt.id!==ae))},[]),Qe=b.useCallback(()=>{gn([])},[]),st=b.useMemo(()=>({notices:$t,dismissNotice:Be,clearNotices:Qe}),[Qe,Be,$t]),[te,ue]=b.useState(pU);b.useEffect(()=>{if(!u)return;if(!C.current&&!k){Mt({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const ae=new AbortController;let pe=!1;return(async()=>{var Je,_t,fn,Vn,de,je,Te,Nt,An,Tr,Ee;const it=C.current??new dM({baseUrl:k,token:A});let bt,Is,ei=Xe,bc=!Xe&&Le>0,pa=0,Xo=!1;for(;!pe&&!ae.signal.aborted;){try{let _n=!1,Rs=!1,js=!1,Ds,Ln;if(!bt){Mt(ot=>({...ot,status:"connecting",error:void 0}));const rt=z.current,on=j.current??(rt?await rt():await it.capabilities());if(pe||ae.signal.aborted)return;Is=on,L.current=Array.isArray(on.features)&&on.features.includes("client_heartbeat");const mr=E.current??on.workspaceCwd,K=Xe&&At==="resume"?zm.resume:zm.load,ye=s?M.current:nS(void 0,Xe??ei),_e=Xe?await K(it,Xe,{workspaceCwd:mr},ye):ei?await zm.load(it,ei,{workspaceCwd:mr},ye):await zm.createOrAttach(it,{...G!==void 0?{modelServiceId:G}:{},...bc?{sessionScope:"thread"}:ne!==void 0?{sessionScope:ne}:{},workspaceCwd:mr},ye);if(!s&&_e.clientId&&(M.current=_e.clientId,H2(_e.clientId,_e.sessionId)),pe||ae.signal.aborted){rS({baseUrl:k,token:A,sessionId:_e.sessionId,clientId:_e.clientId}).catch(ot=>console.warn("[DaemonSessionProvider] detach failed:",ot));return}const kt=H.current;kt!==_e.sessionId&&Qe(),kt!==void 0&&_e.sessionId!==kt?(oe("idle"),Mr(Q),js=!0):kt!==void 0&&(_e.replaySnapshot.compactedReplay.length+_e.replaySnapshot.liveJournal.length>0?(oe("idle"),Mr(Q),js=!0):(P.dispatch({type:"assistant.done",reason:"reconnected"}),P.getSnapshot().awaitingResync&&P.clearAwaitingResync())),_n=kt!==void 0&&kt===_e.sessionId,Rs=_e.replaySnapshot.compactedReplay.length>0||_e.replaySnapshot.liveJournal.length>0;const at=[..._e.replaySnapshot.compactedReplay,..._e.replaySnapshot.liveJournal];Ds=$q(at),Ln=W_(Ds),bt=_e,ei=bt.sessionId,bc=!1,H.current=bt.sessionId,D.current=bt}const ft=bt,[ss,Bn,Jo]=await Promise.allSettled([it.workspaceProviders(),ft.supportedCommands(),ft.context()]),Zo=ss.status==="fulfilled"?ss.value:void 0,Ji=Bn.status==="fulfilled"?Bn.value:void 0,el=Jo.status==="fulfilled"?Jo.value:void 0,vc=[ss.status==="rejected"?(Je=I.current)==null?void 0:Je.models:void 0,Bn.status==="rejected"?(_t=I.current)==null?void 0:_t.commands:void 0,Jo.status==="rejected"?(fn=I.current)==null?void 0:fn.context:void 0].filter(rt=>!!rt),ga=Dq(Zo),Si=Oq(el),tl=Si&&Si.models.length>0?Si.models:ga.models,nn=(Si==null?void 0:Si.currentModel)??ga.currentModel,an=nn===ga.currentModel?ga.contextWindow:(Vn=ga.models.find(rt=>rt.id===nn))==null?void 0:Vn.contextWindow,Zi=(Si==null?void 0:Si.contextWindow)??((de=tl.find(rt=>rt.id===nn))==null?void 0:de.contextWindow)??an,{commands:nl,skills:xc}=_M(Ji),wc=zq(el);Mt(rt=>({status:"connected",sessionId:ft.sessionId,...ft.clientId?{clientId:ft.clientId}:{},workspaceCwd:ft.workspaceCwd,commands:nl,skills:xc,models:tl,currentModel:nn,currentMode:wc,displayName:Bq(ft.state)??(rt.sessionId===ft.sessionId?rt.displayName:void 0),tokenUsage:Ds!==void 0?Ds:rt.sessionId===ft.sessionId?rt.tokenUsage:void 0,tokenCount:Ln!==void 0?Ln:rt.sessionId===ft.sessionId?rt.tokenCount??0:0,contextWindow:Zi,providers:Zo,supportedCommands:Ji,context:el,capabilities:Is,catchingUp:_n||ft.lastEventId!=null||void 0})),oe(W.current.has(ft.sessionId)?"streaming":"idle"),vc.length>0&&P.dispatch(vc.map(rt=>({type:"status",text:rt})));const ti=Y.current,no=(ti==null?void 0:ti.sessionId)===ft.sessionId?ti:void 0,{compactedReplay:ni,liveJournal:Os}=ft.replaySnapshot,ri=[...ni,...Os];if(js&&!(Rs&&ri.length>0)&&P.reset(),Rs&&ri.length>0){const rt={...R.current,suppressOwnUserEcho:!1},on=[];for(const ee of ri)try{const ye=lS(ee,ft.clientId,rt,Mt,{updateConnection:!1});if(on.push(...cS(ee,ye,Xt)),ee.type==="turn_complete"){const _e=((je=ee.data)==null?void 0:je.stopReason)??"end_turn";on.push(yl(ee,_e))}else ee.type==="turn_error"&&on.push(yl(ee,"error"))}catch(ye){const _e=ye instanceof Error?ye.message:String(ye);Xt({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:_e,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",ye)}js&&P.reset(),on.length>0&&(P.dispatch(on),ov(on,ue));for(const ee of ri)iv(W.current,J.current,ft.sessionId,ee,P,oe,Q,{requireBoundPromptId:!0});const mr=ri.some(ee=>ee.type==="turn_complete"||ee.type==="turn_error"||ee.type==="prompt_cancelled");ri.some(vU)&&!mr&&oe(ee=>ee==="idle"?"waiting":ee),Mt(ee=>({...ee,catchingUp:void 0}))}no&&(Y.current=void 0,clearTimeout(no.timeout),no.resolve());let rl=!1,sl=!1,tr,ro=[];for await(const rt of ft.events({signal:ae.signal,maxQueued:a})){rl||(rl=!0,pa=0);try{const on=lU(rt);if(on){oU(on);continue}const mr=hU(rt);mr&&uU(mr);const K=lS(rt,ft.clientId,R.current,Mt),ee=cS(rt,K,Xt);if(rt.type==="state_resync_required"&&(typeof rt.data=="object"&&rt.data!==null?rt.data.reason:void 0)==="epoch_reset"){oe("idle"),Mr(Q),ft.setLastEventId(0),tr=[],ro=[];continue}if(tr){if(ro.push(rt),tr.push(...ee),rt.type==="turn_complete"){const ut=((Te=rt.data)==null?void 0:Te.stopReason)??"end_turn";tr.push(yl(rt,ut))}else rt.type==="turn_error"&&tr.push(yl(rt,"error"));if(ee.some(ut=>ut.type==="session.replay_complete")){W.current.has(ft.sessionId)||(Mr(Q),tr.push({type:"assistant.done",reason:"replay_complete"}),oe("idle"));const ut=tr,jn=ro;tr=void 0,ro=[],P.reset(),ut.length>0&&(P.dispatch(ut),ov(ut,ue));for(const kn of jn)iv(W.current,J.current,ft.sessionId,kn,P,oe,Q,{requireBoundPromptId:!0});Mt(kn=>({...kn,catchingUp:void 0}))}if(rt.type==="session_closed"&&((Nt=rt.data)==null?void 0:Nt.reason)==="client_close"){Xo=!0;const ut=ft.sessionId,jn=W.current.get(ut);jn==null||jn.controller.abort(),W.current.delete(ut),bt=void 0,D.current=void 0;break}continue}if(ov(ee,ue),ee.length>0){const ot=av(ee);oe(ut=>ut==="waiting"||ut==="idle"&&ot?"streaming":ut)}const ye=iv(W.current,J.current,ft.sessionId,rt,P,oe,Q),kt=!W.current.has(ft.sessionId)&&P.getSnapshot().activeAssistantBlockId!=null?ee.filter(ot=>ot.type!=="debug"):ee;P.dispatch(kt);for(const ot of ee)ot.type==="prompt.cancelled"&&ot.originatorClientId!==ft.clientId?(oe("idle"),Mr(Q),W.current.delete(ft.sessionId)):ot.type==="session.replay_complete"&&(Mt(ut=>({...ut,catchingUp:void 0})),P.getSnapshot().awaitingResync&&P.clearAwaitingResync(),W.current.has(ft.sessionId)||(Mr(Q),P.dispatch({type:"assistant.done",reason:"replay_complete"}),oe("idle")));const at=!ye&&!W.current.has(ft.sessionId);if(at&&(ee.some(ut=>ut.type==="user.text.delta")?oe("waiting"):av(ee)&&oe(ut=>ut==="idle"?"streaming":ut)),at&&rt.type==="turn_complete"){Mr(Q);const ot=((An=rt.data)==null?void 0:An.stopReason)??"end_turn";P.dispatch(yl(rt,ot)),oe("idle")}else at&&rt.type==="turn_error"?(Mr(Q),P.dispatch(yl(rt,"error")),oe("idle")):at&&av(ee)&&Wq(P,Q,"passive_observer",3e3,()=>oe("idle"));if(rt.type==="state_resync_required"){const ot=typeof rt.data=="object"&&rt.data!==null?rt.data.reason:void 0;if(oe("idle"),Mr(Q),P.reset(),ot==="epoch_reset")ft.setLastEventId(0);else{console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",ft.sessionId),sl=!0,bt=void 0,D.current=void 0,Mt(ut=>({...ut,status:"connecting",error:void 0}));break}}if(rt.type==="session_closed"&&((Tr=rt.data)==null?void 0:Tr.reason)==="client_close"){Xo=!0;const ot=ft.sessionId,ut=W.current.get(ot);ut==null||ut.controller.abort(),W.current.delete(ot),bt=void 0,D.current=void 0;break}}catch(on){const mr=on instanceof Error?on.message:String(on);Xt({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:mr,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",on)}}if(Xo){P.dispatch({type:"assistant.done",reason:"cancelled"}),oe("idle"),Mr(Q),Mt(rt=>({...rt,status:"disconnected",sessionId:void 0,error:void 0}));return}!pe&&!ae.signal.aborted&&!sl&&(((Ee=D.current)==null?void 0:Ee.sessionId)===ft.sessionId&&(Mr(Q),oe("idle"),console.debug("[DaemonSessionProvider] SSE stream ended"),P.dispatch({type:"assistant.done",reason:"stream_ended"})),Mt(rt=>({...rt,status:"disconnected",error:void 0})))}catch(_n){if(pe||ae.signal.aborted)return;const Rs=_n instanceof Error?_n.message:String(_n),js=bt==null?void 0:bt.sessionId,Ds=EU(_n),Ln=AU(_n),ft=Ln&&!Ds&&f==="disconnect";if(js&&(Ds||Ln)){const Bn=W.current.get(js);Bn==null||Bn.controller.abort(),W.current.delete(js)}Mr(Q),oe("idle");const ss=Y.current;if(ss&&(ss.sessionId===Xe||ss.sessionId===ei)&&(Y.current=void 0,clearTimeout(ss.timeout),ss.reject(_n)),Ds||Ln){if(bt=void 0,D.current=void 0,Ds){Mt({status:"error",error:Rs});return}if(ft){Mt(Bn=>({...Bn,status:"disconnected",sessionId:void 0,error:Rs}));return}ei=void 0,Xe&&ht(void 0)}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",bt==null?void 0:bt.sessionId);if(!d){bt=void 0,D.current=void 0,Mt({status:"error",error:Rs});return}Mt(Bn=>({...Bn,status:"disconnected",error:Rs}))}if(!d){D.current=void 0,Mt(_n=>({..._n,status:"disconnected"}));return}pa+=1;const Qo=$.current,to=Fq(pa,Qo.reconnectDelayMs,Qo.maxReconnectDelayMs);Mt(_n=>({..._n,status:"disconnected",error:`Reconnecting in ${to}ms`})),await Vq(to,ae.signal)}})(),()=>{const Je=D.current;pe=!0,ae.abort(),oe("idle"),Mr(Q),Y.current&&(clearTimeout(Y.current.timeout),Y.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),Y.current=void 0),Je!=null&&Je.clientId&&rS({baseUrl:k,token:A,sessionId:Je.sessionId,clientId:Je.clientId}).catch(_t=>console.warn("[DaemonSessionProvider] detach failed:",_t)),D.current=void 0}},[u,d,f,k,A,n,G,ne,a,P,Xe,At,Vt,Le,s,Qe,Xt]),b.useEffect(()=>{if(!L.current||y<=0||w<=0||!tn.sessionId)return;let ae=!1,pe=0;const wt=setInterval(()=>{const Je=D.current;Je&&Je.heartbeat().then(()=>{ae||(pe>=w&&Mt(_t=>_t.sessionId===Je.sessionId?{..._t,status:"connected",error:void 0}:_t),pe=0)}).catch(_t=>{if(ae||(pe+=1,pe<w))return;const fn=_t instanceof Error?_t.message:"Session heartbeat failed";Mt(Vn=>Vn.sessionId===Je.sessionId?{...Vn,status:"disconnected",error:fn}:Vn)})},y);return()=>{ae=!0,clearInterval(wt)}},[tn.sessionId,w,y]);const re=b.useMemo(()=>Yq({store:P,sessionRef:D,activePromptsRef:W,settledPromptsRef:J,pendingSessionLoadRef:Y,pendingSessionLoadIdRef:Z,heartbeatSupportedRef:L,passiveAssistantDoneTimerRef:Q,getCreateSessionRequest:()=>{var ae;return{...fe.current,sessionScope:"thread",workspaceCwd:E.current??((ae=D.current)==null?void 0:ae.workspaceCwd)}},addNotice:Xt,setConnection:Mt,setPromptStatus:oe,setRestoreSessionId:ht,setRestoreMode:zt,setRestoreSessionNonce:gt,setNewSessionNonce:qt}),[Xt,P]);return h.jsx(RM.Provider,{value:P,children:h.jsx(jM.Provider,{value:tn,children:h.jsx(DM.Provider,{value:Pe,children:h.jsx(OM.Provider,{value:st,children:h.jsx(LM.Provider,{value:te,children:h.jsx(Y_.Provider,{value:re,children:g})})})})})})}function iv(e,t,n,r,s,i,a,o={}){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||o.requireBoundPromptId&&u.promptId===void 0||u.promptId!==void 0&&u.promptId!==c)return!1;Mr(a);try{const d=B_(r,c);if(!d)return!1;s.dispatch(yl(r,d.stopReason)),i("idle"),u.resolve?(e.delete(n),u.resolve(d)):(e.delete(n),t.set(F2(n,c),{status:"resolved",result:d}))}catch(d){s.dispatch(yl(r,"error")),i("idle"),u.reject?(e.delete(n),u.reject(d)):(e.delete(n),t.set(F2(n,c),{status:"rejected",error:d}))}return!0}function bU(e){return e.type==="turn_complete"}function vU(e){var t;if(e.type!=="session_update")return!1;const n=e.data;return((t=n==null?void 0:n.update)==null?void 0:t.sessionUpdate)==="user_message_chunk"}function lS(e,t,n,r,s={}){s.updateConnection!==!1&&Lq(e,r);const i=oP(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),a=SU(e);return bU(e)?a?[a]:[]:a?[...i,a]:i}function cS(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(xU(e,s));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return r}function xU(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 X_(){const e=b.useContext(RM);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function ty(){const e=X_(),t=b.useCallback(()=>e.getSnapshot().blocks,[e]);return b.useSyncExternalStore(e.subscribe,t,t)}function Q_(){const e=ty(),t=_U();return b.useMemo(()=>iU(e,t),[e,t])}function J_(){const e=b.useContext(Y_);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function wU(){return b.useContext(Y_)}function Nu(){return b.useContext(LM)}function _U(){const e=b.useContext(DM);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Iu(){const e=b.useContext(jM);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function kU(){const e=b.useContext(OM);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function av(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function SU(e){if(e.type!=="session_update")return null;const t=bo(e.data)?e.data:void 0,n=bo(t==null?void 0:t.update)?t.update:bo(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!bo(r))return null;const s=TU(r.goalStatus);if(s)return uS(e,s);const i=CU(r.goalTerminal);if(i)return uS(e,i);const a=r.stopHookLoop;if(!bo(a))return null;const o=a.goal;return!bo(o)||!lu(o,"condition"),null}function uS(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function TU(e){if(!bo(e))return null;const t=lu(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=lu(e,"condition");if(!n)return null;const r=zf(e,"iterations"),s=zf(e,"durationMs"),i=zf(e,"setAt"),a=lu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i!==void 0?{setAt:i}:{},...a?{lastReason:a}:{}}}function CU(e){if(!bo(e))return null;const t=lu(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=lu(e,"condition");if(!n)return null;const r=zf(e,"iterations"),s=zf(e,"durationMs"),i=lu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function lu(e,t){const n=e[t];return typeof n=="string"?n:void 0}function zf(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ov(e,t){let n=0,r=0,s=0,i=0,a=0,o=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":a+=1;break;case"workspace.extensions.changed":o+=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+a+o+c+u!==0&&t(d=>({memoryVersion:d.memoryVersion+n,agentsVersion:d.agentsVersion+r,toolsVersion:d.toolsVersion+s,settingsVersion:d.settingsVersion+i,mcpVersion:d.mcpVersion+a,extensionsVersion:d.extensionsVersion+o,...l?{lastExtensionChange:l}:{},initVersion:d.initVersion+c,authVersion:d.authVersion+u}))}function AU(e){const t=BM(e);return t!==void 0&&fU.has(t)}function EU(e){const t=BM(e);return t!==void 0&&gU.has(t)}function BM(e){if(e instanceof bu||bo(e)&&typeof e.status=="number")return e.status}function bo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function bh(e,t){const{autoLoad:n=!1,enabled:r=!0}=t,[s,i]=b.useState({data:void 0,loading:!1,error:void 0}),a=b.useRef(0),o=b.useCallback(async()=>{if(!r)return;const l=++a.current;i(c=>({...c,loading:!0,error:void 0}));try{const c=await e();return l!==a.current?void 0:(i({data:c,loading:!1,error:void 0}),c)}catch(c){if(l!==a.current)return;const u=c instanceof Error?c:new Error(String(c));i(d=>({...d,loading:!1,error:u}));return}},[r,e]);return b.useEffect(()=>{!n||!r||o()},[n,r,o]),{...s,reload:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Y0(e,t,n){const r=b.useRef(!1);b.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 MU(e={}){var t;const n=fc(),r=b.useCallback(()=>n.listAgents(),[n]),s=bh(r,e),i=Nu();return Y0(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 zM(e={}){const t=fc(),n=b.useCallback(()=>t.loadMcpStatus(),[t]),r=bh(n,e),s=Nu();return Y0(s==null?void 0:s.mcpVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,loadTools:t.loadMcpTools,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function NU(e={}){var t;const n=fc(),r=b.useCallback(()=>n.loadMemoryStatus(),[n]),s=bh(r,e),i=Nu();return Y0(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 Z_(e={}){const t=K_(),n=wU(),r=b.useCallback(()=>t.actions.listSessions(),[t.actions]),s=!!t.workspaceCwd,i=bh(r,{...e,enabled:(e.enabled??!0)&&s}),{reload:a}=i,o=b.useCallback(async c=>{const u=await t.actions.deleteSession(c);return u&&a(),u},[t.actions,a]),l=b.useCallback(async c=>{const u=await t.actions.deleteSessions(c);return(u.removed.length>0||u.notFound.length>0)&&a(),u},[t.actions,a]);return{...i,sessions:i.data??[],loadSession:n==null?void 0:n.loadSession,resumeSession:n==null?void 0:n.resumeSession,newSession:n==null?void 0:n.newSession,releaseSession:n==null?void 0:n.releaseSession,deleteSession:o,deleteSessions:l}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $M(e={}){var t;const n=fc(),r=b.useCallback(()=>n.loadToolsStatus(),[n]),s=bh(r,e),i=Nu();return Y0(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 IU(e={}){var t;const n=fc(),r=b.useCallback(()=>n.loadSettingsStatus(),[n]),s=bh(r,e),i=Nu();return Y0(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 RU=300,jU=100,ed=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function lv(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function DU(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=ed,a=null,o=!1,l=null;function c(w){i=w,n(w)}function u(){a&&(clearTimeout(a),a=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:w=>{if(a&&(clearTimeout(a),a=null),!w){c(ed);return}t&&(a=setTimeout(()=>{c({suggestion:w,isVisible:!0,shownAt:Date.now()})},RU))},accept:(w,v)=>{var g;if(o)return;a&&(clearTimeout(a),a=null),o=!0;const x=i.suggestion,{shownAt:k}=i;if(!x){o=!1;return}try{(g=s())==null||g({outcome:"accepted",accept_method:w,time_ms:k>0?Date.now()-k:0,suggestion_length:x.length})}catch(A){console.error("[followup] onOutcome callback threw:",A)}c(ed),queueMicrotask(()=>{var A;try{v!=null&&v.skipOnAccept||(A=r())==null||A(x)}catch(T){console.error("[followup] onAccept callback threw:",T)}finally{l&&clearTimeout(l),l=setTimeout(()=>{o=!1},jU)}})},dismiss:()=>{var w;if(a&&(clearTimeout(a),a=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(v){console.error("[followup] onOutcome callback threw:",v)}c(ed)}},clear:()=>{u(),o=!1,c(ed)},cleanup:()=>{u(),o=!1}}}function OU(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=X_(),[i,a]=b.useState(ed),o=b.useRef(n);o.current=n;const l=b.useRef(r);l.current=r;const c=b.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),d=b.useSyncExternalStore(aU,aS,aS)??c,f=b.useMemo(()=>DU({enabled:t,onStateChange:a,getOnAccept:()=>o.current,getOnOutcome:()=>l.current}),[t]),{setSuggestion:m}=f;b.useEffect(()=>(t||f.clear(),()=>f.cleanup()),[f,t]);const p=b.useRef(void 0);b.useEffect(()=>{const g=d==null?void 0:d.promptId;g!==p.current&&(p.current=g,m((d==null?void 0:d.suggestion)??null))},[d,m]);const y=b.useCallback(()=>{f.clear(),lv(s),rv(),p.current=void 0},[f,s]),w=b.useCallback((g,x)=>{f.accept(g,x),lv(s),rv(),p.current=void 0},[f,s]),v=b.useCallback(()=>{f.dismiss(),lv(s),rv(),p.current=void 0},[f,s]);return b.useMemo(()=>({followupState:i,onAcceptFollowup:w,onDismissFollowup:v,clear:y}),[i,w,v,y])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function LU(){const e=b.useSyncExternalStore(cU,oS,oS),t=b.useCallback(n=>dU(n),[]);return{batches:e,consume:t}}function BU(e){for(const t of e){if(!zU(t))continue;const n=t;if(n.resolved)continue;const r=gd(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,a=gd(r==null?void 0:r._meta),o=typeof(a==null?void 0:a.toolName)=="string"?a.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:s,title:n.title,toolKind:i,toolName:o,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(l=>({id:l.optionId,label:l.label,kind:PU(l.raw)})),rawInput:$U(n.toolCall)}}return null}function zU(e){return e.kind==="permission"}function $U(e){const t=gd(e);return t?gd(t.rawInput)??gd(t.input)??gd(t.args)??t:void 0}function gd(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function PU(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}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function qU(e,t,n,r){const s=[...e];let i=!1;for(const a of t)if(a.sessionId===n&&!(a.originatorClientId!==void 0&&a.originatorClientId!==r))for(const o of a.messages){const l=s.findIndex(c=>c.text===o&&(!c.images||c.images.length===0));l>=0&&(s.splice(l,1),i=!0)}return i?s:null}function UU(e,t,n){const r=new Array(e);return new Proxy(r,{get(s,i,a){if(typeof i=="string"){const o=i.charCodeAt(0);if(o>=48&&o<=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,a)}})}function Wu(e,t,n){let r=n.initialDeps??[],s,i=!0;function a(){const o=e();return(o.length!==r.length||o.some((c,u)=>r[u]!==c))&&(r=o,s=t(...o),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(s),i=!1),s}return a.updateDeps=o=>{r=o},a}function dS(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const HU=(e,t)=>Math.abs(e-t)<1.01,FU=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let Qh;const cv=()=>{if(Qh!==void 0)return Qh;if(typeof navigator>"u")return Qh=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Qh=!0;const e=navigator.maxTouchPoints;return Qh=navigator.platform==="MacIntel"&&e!==void 0&&e>0},hS=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},VU=e=>e,WU=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},GU=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:o,height:l}=a;t({width:Math.round(o),height:Math.round(l)})};if(s(hS(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(hS(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Ug={passive:!0},KU=typeof window>"u"?!0:"onscrollend"in window,YU=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&KU;let a=0;const o=i?null:FU(s,()=>t(a,!1),e.options.isScrollingResetDelay),l=d=>()=>{a=n(r),o==null||o(),t(a,d)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,Ug),i&&r.addEventListener("scrollend",u,Ug),()=>{r.removeEventListener("scroll",c),i&&r.removeEventListener("scrollend",u)}},XU=(e,t)=>YU(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),QU=(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"]},JU=(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})},ZU=JU;class eH{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 a=()=>{const o=i.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[c,u]of this.elementsCache)if(u===o){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));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:VU,rangeExtractor:WU,onChange:()=>{},measureElement:QU,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 a=this.options;let o=null,l=null,c=!1;if(a!==void 0&&a.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const f=a.count,m=i.count,p=this.getMeasurements(),y=f>0?((r=p[0])==null?void 0:r.key)??a.getItemKey(0):null,w=f>0?((s=p[f-1])==null?void 0:s.key)??a.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&&(o=[x.key,this.getScrollOffset()-x.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&m>f&&this.isAtEnd(a.scrollEndThreshold)&&(f===0||i.getItemKey(m-1)!==w)&&(l=k)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(o&&this.scrollOffset!==null){const[f,m]=o,p=this.getMeasurements(),{count:y,getItemKey:w}=this.options;let v=0;for(;v<y&&w(v)!==f;)v++;if(v<y){const g=p[v];if(g){const x=g.start+m;x!==this.scrollOffset&&(d=x-this.scrollOffset,this.scrollOffset=x,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?o[0]:null,u?o[1]:0,l,d])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Wu(()=>(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,a)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!cv()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",a,Ug),i.addEventListener("touchend",o,Ug),this.unsubs.push(()=>{i.removeEventListener("touchstart",a),i.removeEventListener("touchend",o),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,a,o,l]=s;i!==null&&!o&&(cv()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}},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 a=r-1;a>=0;a--){const o=n[a];if(s.has(o.lane))continue;const l=i.get(o.lane);if(l==null||o.end>l.end?i.set(o.lane,o):o.end<l.end&&s.set(o.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,o)=>a.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=Wu(()=>[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,a,o,l)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Wu(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o,laneAssignmentMode:l},c)=>{const u=this.itemSizeCache;if(!a)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),o===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 v;if(d===0)v=r+s;else{const x=d-1;v=w[x*2]+w[x*2+1]+p}for(let x=d;x<n;x++){const k=i(x),A=u.get(k),T=typeof A=="number"?A:this.options.estimateSize(x);w[x*2]=v,w[x*2+1]=T,v+=T+p}const g=UU(n,w,i);return this.measurementsCache=g,g}const f=this.measurementsCache.slice(0,d),m=new Array(o).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 v,g;const x=l==="estimate"||u.has(y);if(w!==void 0&&this.options.lanes>1){v=w;const C=m[v],j=C!==void 0?f[C]:void 0;g=j?j.end+this.options.gap:r+s}else{const C=this.options.lanes===1?f[p-1]:this.getFurthestMeasurement(f,p);g=C?C.end+this.options.gap:r+s,v=C?C.lane:p%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(p,v)}const k=u.get(y),A=typeof k=="number"?k:this.options.estimateSize(p),T=g+A;f[p]={index:p,start:g,size:A,end:T,key:y,lane:v},m[v]=p}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Wu(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?tH({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=Wu(()=>{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,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,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)),a=Math.max(0,s-i),o=Math.min(this.options.count-1,s+i);return n>=a&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});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 a,o,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),o=c[n*2],a=c[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;l=f.key,o=f.start,a=f.size}const u=this.itemSizeCache.get(l)??a,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:o,size:a,end:o+a,lane:0},d,this):o<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=Wu(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;i<a;i++){const o=n[i],l=r[o];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,a=PM(0,r.length-1,i?o=>s[o*2]:o=>dS(r[o]).start,n);return dS(r[a])},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(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,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(),a=this.measurementsCache[n];if(!a)return;if(r==="auto")if(a.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(a.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:a,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[a,o]=i,l=this.now();this.scrollState={index:n,align:o,behavior:s,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{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,a=this._flatMeasurements;a!=null?s=a[i*2]+a[i*2+1]:s=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==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&&(cv()&&(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,a=s!==this.scrollState.lastTargetOffset;if(!a&&HU(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,a){const o=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>o;this.scrollState.lastTargetOffset=s,c||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const PM=(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 tH({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const i=e.length-1,a=s?u=>s[u*2]:u=>e[u].start,o=s?u=>s[u*2]+s[u*2+1]:u=>e[u].end;if(e.length<=r)return{startIndex:0,endIndex:i};let l=PM(0,i,a,n),c=l;if(r===1)for(;c<i&&o(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 uv=typeof document<"u"?b.useLayoutEffect:b.useEffect;function nH({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=b.useReducer(c=>c+1,0)[1],i=b.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const a=c=>{const u=i.current;if(!u.enabled)return;const d=c.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const v=c.options.horizontal?"width":"height";u.container.style[v]=`${d}px`}const f=!!c.options.horizontal,m=u.mode==="transform",p=f?"left":"top",y=c.options.scrollMargin,w=c.getVirtualItems();for(const v of w){const g=v.start-y,x=c.elementsCache.get(v.key);x&&u.lastPositions.get(x)!==g&&(u.lastPositions.set(x,g),m?x.style.transform=f?`translate3d(${g}px, 0, 0)`:`translate3d(0, ${g}px, 0)`:x.style[p]=`${g}px`)}},o={...r,onChange:(c,u)=>{var d;const f=i.current;let m=!0;if(f.enabled){a(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?O1.flushSync(s):s()),(d=r.onChange)==null||d.call(r,c,u)}},[l]=b.useState(()=>{const c=new eH(o);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(o),uv(()=>l._didMount(),[]),uv(()=>l._willUpdate()),uv(()=>{a(l)}),l}function rH(e){return nH({observeElementRect:GU,observeElementOffset:XU,scrollToFn:ZU,...e})}function qM(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function sH(e){var t;return((t=qM(e))==null?void 0:t.type)==="task_execution"}function ny(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||sH(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function UM(e){var n;if(!ny(e))return!1;const t=qM(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const HM=b.createContext({}),iH=HM.Provider;function Ru(){return b.useContext(HM)}const aH=["en","zh-CN"],e3={"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":"No, suggest changes (esc)","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","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.footer":"↑/↓: Navigate | ←/→: Switch tabs | Enter: Select | Esc: Cancel","askUser.footerMulti":"↑/↓: Navigate | Space: Toggle | ←/→: Switch tabs | Enter: Confirm | Esc: Cancel","askUser.submit":"Submit","askUser.submitAnswers":"Submit answers","askUser.cancel":"Cancel","askUser.confirmTitle":"Your answers:","askUser.confirmPrompt":"Ready to submit your answers?","askUser.multiHint":"multiple choice","askUser.typePlaceholder":"Type something...","askUser.title":e=>`Ask user ${(e==null?void 0:e.count)??0} question${Number((e==null?void 0:e.count)??0)===1?"":"s"} ←`,"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!","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.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.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":"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","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.cleared":"Queued messages cleared","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.insertFailed":"Failed to insert 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]","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.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.","extensions.install.waitForTurn":"Wait for the current turn to finish 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.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":"Approve for Me","mode.label.auto":"Classifier Approval","mode.label.yolo":"Full Access","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 low-risk edits and ask for 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.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.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.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"}`},"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`,"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.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=>`Finished thinking${e!=null&&e.duration?` ${e.duration}`:""}`,"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","welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.tipLabel":"Tips:"},oH={...e3,"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":"否，建议更改 (esc)","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"在本项目中总是允许","approval.option.allowAlwaysUser":"对该用户总是允许","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.footer":"↑/↓: 导航 | ←/→: 切换标签页 | Enter: 选择 | Esc: 取消","askUser.footerMulti":"↑/↓: 导航 | 空格: 切换 | ←/→: 切换标签页 | Enter: 确认 | Esc: 取消","askUser.submit":"提交","askUser.submitAnswers":"提交答案","askUser.cancel":"取消","askUser.confirmTitle":"您的答案：","askUser.confirmPrompt":"准备好提交您的答案了吗？","askUser.multiHint":"可多选","askUser.typePlaceholder":"输入内容...","askUser.title":e=>`向用户询问 ${(e==null?void 0:e.count)??0} 个问题 ←`,"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":"已复制！","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.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.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":"设置目标","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.cleared":"已清空排队消息","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.insertFailed":"插入排队消息失败","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]","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.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":"等待会话连接后再安装扩展。","extensions.install.waitForTurn":"等待当前回合结束后再安装扩展。","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.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.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.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.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.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} 次`,"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} 次工具调用`,"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.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.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.tipLabel":"提示："},lH={en:e3,"zh-CN":oH},cH={en:"English [en]","zh-CN":"中文 [zh-CN]"},FM=b.createContext({language:"en",t:e=>e});function Wl(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function t3(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Wl(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 n3(e){return cH[e]}function VM(e){const t=lH[e];return(n,r)=>{const s=t[n]??e3[n]??n;return typeof s=="function"?s(r):s}}function uH({language:e,children:t}){const n=b.useMemo(()=>({language:e,t:VM(e)}),[e]);return h.jsx(FM.Provider,{value:n,children:t})}function nt(){return b.useContext(FM)}const dH="_row_1mha3_1",hH="_tip_1mha3_12",fH="_chatRow_1mha3_34",mH="_chatTip_1mha3_38",pH="_chatActions_1mha3_51",gH="_copyButton_1mha3_67",cl={row:dH,tip:hH,chatRow:fH,chatTip:mH,chatActions:pH,copyButton:gH};function G2({timestamp:e,children:t,chatMode:n=!1,copyText:r,copyTitle:s="Copy"}){const[i,a]=b.useState(!1),o=b.useCallback(()=>{var c;r&&((c=navigator.clipboard)==null||c.writeText(r).then(()=>{a(!0),window.setTimeout(()=>a(!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:cl.copyButton,title:s,"aria-label":s,onClick:o,children:i?h.jsx(bH,{}):h.jsx(yH,{})}):null;return e===void 0?h.jsxs("div",{className:n?cl.chatRow:cl.row,children:[t,l]}):h.jsxs("div",{className:n?cl.chatRow:cl.row,children:[t,n?h.jsxs("span",{className:cl.chatActions,children:[l,h.jsx("span",{className:cl.chatTip,"aria-hidden":"true",children:Kd(e)})]}):h.jsx("span",{className:cl.tip,"aria-hidden":"true",children:Kd(e)})]})}function yH(){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 bH(){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 Kd(e,t=new Date){const n=new Date(e),r=a=>String(a).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 vH="modulepreload",xH=function(e){return"/"+e},fS={},q=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=xH(l),l in fS)return;fS[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":vH,c||(d.as="script"),d.crossOrigin="",d.href=l,o&&d.setAttribute("nonce",o),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(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})},us={Dark:"dark",Light:"light"},WM=[us.Dark,us.Light],GM=b.createContext(us.Dark),wH=GM.Provider;function r3(){return b.useContext(GM)}const Fc="ui.theme",$f="general.language";function s3(e,t){return e===us.Light||e==="Qwen Light"?us.Light:e===us.Dark||e==="Qwen Dark"?us.Dark:t}function _H(e){return e===us.Light?"Qwen Light":"Qwen Dark"}function mS(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function KM(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const kH=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SH=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TH={};function pS(e,t){return(TH.jsx?SH:kH).test(e)}const CH=/[ \t\n\f\r]/g;function ry(e){return typeof e=="object"?e.type==="text"?gS(e.value):!1:gS(e)}function gS(e){return e.replace(CH,"")===""}class X0{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}X0.prototype.normal={};X0.prototype.property={};X0.prototype.space=void 0;function YM(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new X0(n,r,t)}function f0(e){return e.toLowerCase()}class Zs{constructor(t,n){this.attribute=n,this.property=t}}Zs.prototype.attribute="";Zs.prototype.booleanish=!1;Zs.prototype.boolean=!1;Zs.prototype.commaOrSpaceSeparated=!1;Zs.prototype.commaSeparated=!1;Zs.prototype.defined=!1;Zs.prototype.mustUseProperty=!1;Zs.prototype.number=!1;Zs.prototype.overloadedBoolean=!1;Zs.prototype.property="";Zs.prototype.spaceSeparated=!1;Zs.prototype.space=void 0;let AH=0;const Tt=ju(),gr=ju(),K2=ju(),Ce=ju(),En=ju(),cu=ju(),ii=ju();function ju(){return 2**++AH}const Y2=Object.freeze(Object.defineProperty({__proto__:null,boolean:Tt,booleanish:gr,commaOrSpaceSeparated:ii,commaSeparated:cu,number:Ce,overloadedBoolean:K2,spaceSeparated:En},Symbol.toStringTag,{value:"Module"})),dv=Object.keys(Y2);class i3 extends Zs{constructor(t,n,r,s){let i=-1;if(super(t,n),yS(this,"space",s),typeof r=="number")for(;++i<dv.length;){const a=dv[i];yS(this,dv[i],(r&Y2[a])===Y2[a])}}}i3.prototype.defined=!0;function yS(e,t,n){n&&(e[t]=n)}function vh(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new i3(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[f0(r)]=r,n[f0(i.attribute)]=r}return new X0(t,n,e.space)}const XM=vh({properties:{ariaActiveDescendant:null,ariaAtomic:gr,ariaAutoComplete:null,ariaBusy:gr,ariaChecked:gr,ariaColCount:Ce,ariaColIndex:Ce,ariaColSpan:Ce,ariaControls:En,ariaCurrent:null,ariaDescribedBy:En,ariaDetails:null,ariaDisabled:gr,ariaDropEffect:En,ariaErrorMessage:null,ariaExpanded:gr,ariaFlowTo:En,ariaGrabbed:gr,ariaHasPopup:null,ariaHidden:gr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:En,ariaLevel:Ce,ariaLive:null,ariaModal:gr,ariaMultiLine:gr,ariaMultiSelectable:gr,ariaOrientation:null,ariaOwns:En,ariaPlaceholder:null,ariaPosInSet:Ce,ariaPressed:gr,ariaReadOnly:gr,ariaRelevant:null,ariaRequired:gr,ariaRoleDescription:En,ariaRowCount:Ce,ariaRowIndex:Ce,ariaRowSpan:Ce,ariaSelected:gr,ariaSetSize:Ce,ariaSort:null,ariaValueMax:Ce,ariaValueMin:Ce,ariaValueNow:Ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function QM(e,t){return t in e?e[t]:t}function JM(e,t){return QM(e,t.toLowerCase())}const EH=vh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:cu,acceptCharset:En,accessKey:En,action:null,allow:null,allowFullScreen:Tt,allowPaymentRequest:Tt,allowUserMedia:Tt,alpha:Tt,alt:null,as:null,async:Tt,autoCapitalize:null,autoComplete:En,autoFocus:Tt,autoPlay:Tt,blocking:En,capture:null,charSet:null,checked:Tt,cite:null,className:En,closedBy:null,colorSpace:null,cols:Ce,colSpan:Ce,command:null,commandFor:null,content:null,contentEditable:gr,controls:Tt,controlsList:En,coords:Ce|cu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Tt,defer:Tt,dir:null,dirName:null,disabled:Tt,download:K2,draggable:gr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Tt,formTarget:null,headers:En,height:Ce,hidden:K2,high:Ce,href:null,hrefLang:null,htmlFor:En,httpEquiv:En,id:null,imageSizes:null,imageSrcSet:null,inert:Tt,inputMode:null,integrity:null,is:null,isMap:Tt,itemId:null,itemProp:En,itemRef:En,itemScope:Tt,itemType:En,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Tt,low:Ce,manifest:null,max:null,maxLength:Ce,media:null,method:null,min:null,minLength:Ce,multiple:Tt,muted:Tt,name:null,nonce:null,noModule:Tt,noValidate:Tt,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:Tt,optimum:Ce,pattern:null,ping:En,placeholder:null,playsInline:Tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Tt,referrerPolicy:null,rel:En,required:Tt,reversed:Tt,rows:Ce,rowSpan:Ce,sandbox:En,scope:null,scoped:Tt,seamless:Tt,selected:Tt,shadowRootClonable:Tt,shadowRootCustomElementRegistry:Tt,shadowRootDelegatesFocus:Tt,shadowRootMode:null,shadowRootSerializable:Tt,shape:null,size:Ce,sizes:null,slot:null,span:Ce,spellCheck:gr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ce,step:null,style:null,tabIndex:Ce,target:null,title:null,translate:null,type:null,typeMustMatch:Tt,useMap:null,value:gr,width:Ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:En,axis:null,background:null,bgColor:null,border:Ce,borderColor:null,bottomMargin:Ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Tt,declare:Tt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ce,leftMargin:Ce,link:null,longDesc:null,lowSrc:null,marginHeight:Ce,marginWidth:Ce,noResize:Tt,noHref:Tt,noShade:Tt,noWrap:Tt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ce,rules:null,scheme:null,scrolling:gr,standby:null,summary:null,text:null,topMargin:Ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ce,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Tt,disablePictureInPicture:Tt,disableRemotePlayback:Tt,exportParts:cu,part:En,prefix:null,property:null,results:Ce,security:null,unselectable:null},space:"html",transform:JM}),MH=vh({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:ii,accentHeight:Ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ce,amplitude:Ce,arabicForm:null,ascent:Ce,attributeName:null,attributeType:null,azimuth:Ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ce,by:null,calcMode:null,capHeight:Ce,className:En,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:Ce,diffuseConstant:Ce,direction:null,display:null,dur:null,divisor:Ce,dominantBaseline:null,download:Tt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ce,enableBackground:null,end:null,event:null,exponent:Ce,externalResourcesRequired:null,fill:null,fillOpacity:Ce,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:cu,g2:cu,glyphName:cu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ce,horizOriginX:Ce,horizOriginY:Ce,id:null,ideographic:Ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ce,k:Ce,k1:Ce,k2:Ce,k3:Ce,k4:Ce,kernelMatrix:ii,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ce,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:Ce,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:Ce,overlineThickness:Ce,paintOrder:null,panose1:null,path:null,pathLength:Ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:En,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ce,pointsAtY:Ce,pointsAtZ:Ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ii,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ii,rev:ii,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ii,requiredFeatures:ii,requiredFonts:ii,requiredFormats:ii,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:Ce,specularExponent:Ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ce,strikethroughThickness:Ce,string:null,stroke:null,strokeDashArray:ii,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ce,strokeOpacity:Ce,strokeWidth:null,style:null,surfaceScale:Ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ii,tabIndex:Ce,tableValues:null,target:null,targetX:Ce,targetY:Ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ii,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ce,underlineThickness:Ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ce,values:null,vAlphabetic:Ce,vMathematical:Ce,vectorEffect:null,vHanging:Ce,vIdeographic:Ce,version:null,vertAdvY:Ce,vertOriginX:Ce,vertOriginY:Ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:QM}),ZM=vh({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()}}),eN=vh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:JM}),tN=vh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),NH={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"},IH=/[A-Z]/g,bS=/-[a-z]/g,RH=/^data[-\w.:]+$/i;function a3(e,t){const n=f0(t);let r=t,s=Zs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&RH.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(bS,DH);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!bS.test(i)){let a=i.replace(IH,jH);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=i3}return new s(r,t)}function jH(e){return"-"+e.toLowerCase()}function DH(e){return e.charAt(1).toUpperCase()}const o3=YM([XM,EH,ZM,eN,tN],"html"),xh=YM([XM,MH,ZM,eN,tN],"svg");function vS(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function nN(e){return e.join(" ").trim()}var l3={},xS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,OH=/\n/g,LH=/^\s*/,BH=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,zH=/^:\s*/,$H=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,PH=/^[;\s]*/,qH=/^\s+|\s+$/g,UH=`
`,wS="/",_S="*",Vc="",HH="comment",FH="declaration";function VH(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(OH);y&&(n+=y.length);var w=p.lastIndexOf(UH);r=~w?p.length-w:r+p.length}function i(){var p={line:n,column:r};return function(y){return y.position=new a(p),c(),y}}function a(p){this.start=p,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(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(LH)}function u(p){var y;for(p=p||[];y=d();)y!==!1&&p.push(y);return p}function d(){var p=i();if(!(wS!=e.charAt(0)||_S!=e.charAt(1))){for(var y=2;Vc!=e.charAt(y)&&(_S!=e.charAt(y)||wS!=e.charAt(y+1));)++y;if(y+=2,Vc===e.charAt(y-1))return o("End of comment missing");var w=e.slice(2,y-2);return r+=2,s(w),e=e.slice(y),r+=2,p({type:HH,comment:w})}}function f(){var p=i(),y=l(BH);if(y){if(d(),!l(zH))return o("property missing ':'");var w=l($H),v=p({type:FH,property:kS(y[0].replace(xS,Vc)),value:w?kS(w[0].replace(xS,Vc)):Vc});return l(PH),v}}function m(){var p=[];u(p);for(var y;y=f();)y!==!1&&(p.push(y),u(p));return p}return c(),m()}function kS(e){return e?e.replace(qH,Vc):Vc}var WH=VH,GH=lg&&lg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l3,"__esModule",{value:!0});l3.default=YH;const KH=GH(WH);function YH(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,KH.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:o}=i;s?t(a,o,i):o&&(n=n||{},n[a]=o)}),n}var sy={};Object.defineProperty(sy,"__esModule",{value:!0});sy.camelCase=void 0;var XH=/^--[a-zA-Z0-9_-]+$/,QH=/-([a-z])/g,JH=/^[^-]+$/,ZH=/^-(webkit|moz|ms|o|khtml)-/,eF=/^-(ms)-/,tF=function(e){return!e||JH.test(e)||XH.test(e)},nF=function(e,t){return t.toUpperCase()},SS=function(e,t){return"".concat(t,"-")},rF=function(e,t){return t===void 0&&(t={}),tF(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(eF,SS):e=e.replace(ZH,SS),e.replace(QH,nF))};sy.camelCase=rF;var sF=lg&&lg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},iF=sF(l3),aF=sy;function X2(e,t){var n={};return!e||typeof e!="string"||(0,iF.default)(e,function(r,s){r&&s&&(n[(0,aF.camelCase)(r,t)]=s)}),n}X2.default=X2;var oF=X2;const lF=I1(oF),rN=sN("end"),c3=sN("start");function sN(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 cF(e){const t=c3(e),n=rN(e);if(t&&n)return{start:t,end:n}}function Pf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?TS(e.position):"start"in e||"end"in e?TS(e):"line"in e||"column"in e?Q2(e):""}function Q2(e){return CS(e&&e.line)+":"+CS(e&&e.column)}function TS(e){return Q2(e&&e.start)+"-"+Q2(e&&e.end)}function CS(e){return e&&typeof e=="number"?e:1}class ms extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!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&&(a=!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 o=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=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Pf(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=a&&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}}ms.prototype.file="";ms.prototype.name="";ms.prototype.reason="";ms.prototype.message="";ms.prototype.stack="";ms.prototype.column=void 0;ms.prototype.line=void 0;ms.prototype.ancestors=void 0;ms.prototype.cause=void 0;ms.prototype.fatal=void 0;ms.prototype.place=void 0;ms.prototype.ruleId=void 0;ms.prototype.source=void 0;const u3={}.hasOwnProperty,uF=new Map,dF=/[A-Z]/g,hF=new Set(["table","tbody","thead","tfoot","tr"]),fF=new Set(["td","th"]),iN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mF(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=_F(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=wF(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"?xh:o3,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=aN(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function aN(e,t,n){if(t.type==="element")return pF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bF(e,t,n);if(t.type==="mdxjsEsm")return yF(e,t);if(t.type==="root")return vF(e,t,n);if(t.type==="text")return xF(e,t)}function pF(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=xh,e.schema=s),e.ancestors.push(t);const i=lN(e,t.tagName,!1),a=kF(e,t);let o=h3(e,t);return hF.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!ry(l):!0})),oN(e,a,i,t),d3(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function gF(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)}m0(e,t.position)}function yF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);m0(e,t.position)}function bF(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=xh,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:lN(e,t.name,!0),a=SF(e,t),o=h3(e,t);return oN(e,a,i,t),d3(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function vF(e,t,n){const r={};return d3(r,h3(e,t)),e.create(t,e.Fragment,r,n)}function xF(e,t){return t.value}function oN(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function d3(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function wF(e,t,n){return r;function r(s,i,a,o){const c=Array.isArray(a.children)?n:t;return o?c(i,a,o):c(i,a)}}function _F(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),l=c3(r);return t(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function kF(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&u3.call(t.properties,s)){const i=TF(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&fF.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function SF(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 a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else m0(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 o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else m0(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function h3(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:uF;for(;++r<t.children.length;){const i=t.children[r];let a;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;a=l+"-"+c,s.set(l,c+1)}}const o=aN(e,i,a);o!==void 0&&n.push(o)}return n}function TF(e,t,n){const r=a3(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?KM(n):nN(n)),r.property==="style"){let s=typeof n=="object"?n:CF(e,String(n));return e.stylePropertyNameCase==="css"&&(s=AF(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?NH[r.property]||r.property:r.attribute,n]}}function CF(e,t){try{return lF(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new ms("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=iN+"#cannot-parse-style-attribute",s}}function lN(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const o=pS(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=a}else r=pS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return u3.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);m0(e)}function m0(e,t){const n=new ms("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=iN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function AF(e){const t={};let n;for(n in e)u3.call(e,n)&&(t[EF(n)]=e[n]);return t}function EF(e){let t=e.replace(dF,MF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function MF(e){return"-"+e.toLowerCase()}const hv={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"]},NF={};function f3(e,t){const n=NF,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return cN(e,r,s)}function cN(e,t,n){if(IF(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 AS(e.children,t,n)}return Array.isArray(e)?AS(e,t,n):""}function AS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=cN(e[s],t,n);return r.join("")}function IF(e){return!!(e&&typeof e=="object")}const ES=document.createElement("i");function m3(e){const t="&"+e+";";ES.innerHTML=t;const n=ES.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yi(e,t,n,r){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Di(e,t){return e.length>0?(yi(e,e.length,0,t),e):t}const MS={}.hasOwnProperty;function uN(e){const t={};let n=-1;for(;++n<e.length;)RF(t,e[n]);return t}function RF(e,t){let n;for(n in t){const s=(MS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){MS.call(s,a)||(s[a]=[]);const o=i[a];jF(s[a],Array.isArray(o)?o:o?[o]:[])}}}function jF(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yi(e,0,0,r)}function dN(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 ca(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ss=mc(/[A-Za-z]/),ds=mc(/[\dA-Za-z]/),DF=mc(/[#-'*+\--9=?A-Z^-~]/);function Hg(e){return e!==null&&(e<32||e===127)}const J2=mc(/\d/),OF=mc(/[\dA-Fa-f]/),LF=mc(/[!-/:-@[-`{-~]/);function tt(e){return e!==null&&e<-2}function In(e){return e!==null&&(e<0||e===32)}function Ft(e){return e===-2||e===-1||e===32}const iy=mc(new RegExp("\\p{P}|\\p{S}","u")),vu=mc(/\s/);function mc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function wh(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&ds(e.charCodeAt(n+1))&&ds(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Pt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return Ft(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ft(l)&&i++<s?(e.consume(l),o):(e.exit(n),t(l))}}const BF={tokenize:zF};function zF(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Pt(e,t,"linePrefix")}function s(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return tt(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),a)}}const $F={tokenize:PF},NS={tokenize:qF};function PF(e){const t=this,n=[];let r=0,s,i,a;return o;function o(x){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,c)(x)}return c(x)}function l(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&g();const k=t.events.length;let A=k,T;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){T=t.events[A][1].end;break}v(r);let C=k;for(;C<t.events.length;)t.events[C][1].end={...T},C++;return yi(t.events,A+1,0,t.events.slice(k)),t.events.length=C,c(x)}return o(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(NS,u,d)(x)}function u(x){return s&&g(),v(r),f(x)}function d(x){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,p(x)}function f(x){return t.containerState={},e.attempt(NS,m,p)(x)}function m(x){return r++,n.push([t.currentConstruct,t.containerState]),f(x)}function p(x){if(x===null){s&&g(),v(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),v(0),e.consume(x);return}return tt(x)?(e.consume(x),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(x),y)}function w(x,k){const A=t.sliceStream(x);if(k&&A.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(A),t.parser.lazy[x.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<a&&(!s.events[T][1].end||s.events[T][1].end.offset>a))return;const C=t.events.length;let j=C,z,E;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){if(z){E=t.events[j][1].end;break}z=!0}for(v(r),T=C;T<t.events.length;)t.events[T][1].end={...E},T++;yi(t.events,j+1,0,t.events.slice(C)),t.events.length=T}}function v(x){let k=n.length;for(;k-- >x;){const A=n[k];t.containerState=A[1],A[0].exit.call(t,e)}n.length=x}function g(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function qF(e,t,n){return Pt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Yd(e){if(e===null||In(e)||vu(e))return 1;if(iy(e))return 2}function ay(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 Z2={name:"attention",resolveAll:UF,tokenize:HF};function UF(e,t){let n=-1,r,s,i,a,o,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};IS(d,-l),IS(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={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:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Di(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Di(c,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),c=Di(c,ay(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Di(c,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Di(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yi(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 HF(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Yd(r);let i;return a;function a(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const c=e.exit("attentionSequence"),u=Yd(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 IS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const FF={name:"autolink",tokenize:VF};function VF(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 Ss(m)?(e.consume(m),a):m===64?n(m):c(m)}function a(m){return m===43||m===45||m===46||ds(m)?(r=1,o(m)):c(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||ds(m))&&r++<32?(e.consume(m),o):(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||Hg(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),u):DF(m)?(e.consume(m),c):n(m)}function u(m){return ds(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||ds(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const Q0={partial:!0,tokenize:WF};function WF(e,t,n){return r;function r(i){return Ft(i)?Pt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||tt(i)?t(i):n(i)}}const hN={continuation:{tokenize:KF},exit:YF,name:"blockQuote",tokenize:GF};function GF(e,t,n){const r=this;return s;function s(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Ft(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function KF(e,t,n){const r=this;return s;function s(a){return Ft(a)?Pt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(hN,t,n)(a)}}function YF(e){e.exit("blockQuote")}const fN={name:"characterEscape",tokenize:XF};function XF(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 LF(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const mN={name:"characterReference",tokenize:QF};function QF(e,t,n){const r=this;let s=0,i,a;return o;function o(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,a=ds,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=OF,u):(e.enter("characterReferenceValue"),i=7,a=J2,u(d))}function u(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return a===ds&&!m3(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&s++<i?(e.consume(d),u):n(d)}}const RS={partial:!0,tokenize:ZF},jS={concrete:!0,name:"codeFenced",tokenize:JF};function JF(e,t,n){const r=this,s={partial:!0,tokenize:A};let i=0,a=0,o;return l;function l(T){return c(T)}function c(T){const C=r.events[r.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(T)}function u(T){return T===o?(a++,e.consume(T),u):a<3?n(T):(e.exit("codeFencedFenceSequence"),Ft(T)?Pt(e,d,"whitespace")(T):d(T))}function d(T){return T===null||tt(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(RS,y,k)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(T))}function f(T){return T===null||tt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(T)):Ft(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Pt(e,m,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),f)}function m(T){return T===null||tt(T)?d(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||tt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(T)):T===96&&T===o?n(T):(e.consume(T),p)}function y(T){return e.attempt(s,k,w)(T)}function w(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v}function v(T){return i>0&&Ft(T)?Pt(e,g,"linePrefix",i+1)(T):g(T)}function g(T){return T===null||tt(T)?e.check(RS,y,k)(T):(e.enter("codeFlowValue"),x(T))}function x(T){return T===null||tt(T)?(e.exit("codeFlowValue"),g(T)):(e.consume(T),x)}function k(T){return e.exit("codeFenced"),t(T)}function A(T,C,j){let z=0;return E;function E(J){return T.enter("lineEnding"),T.consume(J),T.exit("lineEnding"),P}function P(J){return T.enter("codeFencedFence"),Ft(J)?Pt(T,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):D(J)}function D(J){return J===o?(T.enter("codeFencedFenceSequence"),H(J)):j(J)}function H(J){return J===o?(z++,T.consume(J),H):z>=a?(T.exit("codeFencedFenceSequence"),Ft(J)?Pt(T,W,"whitespace")(J):W(J)):j(J)}function W(J){return J===null||tt(J)?(T.exit("codeFencedFence"),C(J)):j(J)}}}function ZF(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const fv={name:"codeIndented",tokenize:tV},eV={partial:!0,tokenize:nV};function tV(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),Pt(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?a(c):n(c)}function a(c){return c===null?l(c):tt(c)?e.attempt(eV,a,l)(c):(e.enter("codeFlowValue"),o(c))}function o(c){return c===null||tt(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),o)}function l(c){return e.exit("codeIndented"),t(c)}}function nV(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):tt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Pt(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):tt(a)?s(a):n(a)}}const rV={name:"codeText",previous:iV,resolve:sV,tokenize:aV};function sV(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 iV(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function aV(e,t,n){let r=0,s,i;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),o(d)}function o(d){return d===96?(e.consume(d),r++,o):(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)):tt(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||tt(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 oV{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&&Jh(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),Jh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Jh(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);Jh(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Jh(this.left,n.reverse())}}}function Jh(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 pN(e){const t={};let n=-1,r,s,i,a,o,l,c;const u=new oV(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,lV(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=u.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},o=u.slice(s,n),o.unshift(r),u.splice(s,n-s+1,o))}}return yi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function lV(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.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&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<o.length;)o[f][0]==="exit"&&o[f-1][0]==="enter"&&o[f][1].type===o[f-1][1].type&&o[f][1].start.line!==o[f][1].end.line&&(y=f+1,w.push(y),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):w.pop(),f=w.length;f--;){const v=o.slice(w[f],w[f+1]),g=i.pop();l.push([g,g+v.length-1]),e.splice(g,2,v)}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 cV={resolve:dV,tokenize:hV},uV={partial:!0,tokenize:fV};function dV(e){return pN(e),e}function hV(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(o)}function s(o){return o===null?i(o):tt(o)?e.check(uV,a,i)(o):(e.consume(o),s)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function fV(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Pt(e,i,"linePrefix")}function i(a){if(a===null||tt(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function gN(e,t,n,r,s,i,a,o,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(v){return v===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(v),e.exit(i),f):v===null||v===32||v===41||Hg(v)?n(v):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),y(v))}function f(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(o),f(v)):v===null||v===60||tt(v)?n(v):(e.consume(v),v===92?p:m)}function p(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function y(v){return!u&&(v===null||v===41||In(v))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(v)):u<c&&v===40?(e.consume(v),u++,y):v===41?(e.consume(v),u--,y):v===null||v===32||v===40||Hg(v)?n(v):(e.consume(v),v===92?w:y)}function w(v){return v===40||v===41||v===92?(e.consume(v),y):y(v)}}function yN(e,t,n,r,s,i){const a=this;let o=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 o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(i),e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):tt(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||tt(m)||o++>999?(e.exit("chunkString"),u(m)):(e.consume(m),l||(l=!Ft(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function bN(e,t,n,r,s,i){let a;return o;function o(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===a?(e.exit(i),l(a)):f===null?n(f):tt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Pt(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||tt(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===a||f===92?(e.consume(f),u):u(f)}}function qf(e,t){let n;return r;function r(s){return tt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ft(s)?Pt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const mV={name:"definition",tokenize:gV},pV={partial:!0,tokenize:yV};function gV(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),a(m)}function a(m){return yN.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return s=ca(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 In(m)?qf(e,c)(m):c(m)}function c(m){return gN(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return e.attempt(pV,d,d)(m)}function d(m){return Ft(m)?Pt(e,f,"whitespace")(m):f(m)}function f(m){return m===null||tt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function yV(e,t,n){return r;function r(o){return In(o)?qf(e,s)(o):n(o)}function s(o){return bN(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ft(o)?Pt(e,a,"whitespace")(o):a(o)}function a(o){return o===null||tt(o)?t(o):n(o)}}const bV={name:"hardBreakEscape",tokenize:vV};function vV(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return tt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const xV={name:"headingAtx",resolve:wV,tokenize:_V};function wV(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"},yi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function _V(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(e.consume(u),a):u===null||In(u)?(e.exit("atxHeadingSequence"),o(u)):n(u)}function o(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||tt(u)?(e.exit("atxHeading"),t(u)):Ft(u)?Pt(e,o,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),o(u))}function c(u){return u===null||u===35||In(u)?(e.exit("atxHeadingText"),o(u)):(e.consume(u),c)}}const kV=["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"],DS=["pre","script","style","textarea"],SV={concrete:!0,name:"htmlFlow",resolveTo:AV,tokenize:EV},TV={partial:!0,tokenize:NV},CV={partial:!0,tokenize:MV};function AV(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 EV(e,t,n){const r=this;let s,i,a,o,l;return c;function c(M){return u(M)}function u(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),d}function d(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),i=!0,y):M===63?(e.consume(M),s=3,r.interrupt?t:R):Ss(M)?(e.consume(M),a=String.fromCharCode(M),w):n(M)}function f(M){return M===45?(e.consume(M),s=2,m):M===91?(e.consume(M),s=5,o=0,p):Ss(M)?(e.consume(M),s=4,r.interrupt?t:R):n(M)}function m(M){return M===45?(e.consume(M),r.interrupt?t:R):n(M)}function p(M){const G="CDATA[";return M===G.charCodeAt(o++)?(e.consume(M),o===G.length?r.interrupt?t:D:p):n(M)}function y(M){return Ss(M)?(e.consume(M),a=String.fromCharCode(M),w):n(M)}function w(M){if(M===null||M===47||M===62||In(M)){const G=M===47,ne=a.toLowerCase();return!G&&!i&&DS.includes(ne)?(s=1,r.interrupt?t(M):D(M)):kV.includes(a.toLowerCase())?(s=6,G?(e.consume(M),v):r.interrupt?t(M):D(M)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):i?g(M):x(M))}return M===45||ds(M)?(e.consume(M),a+=String.fromCharCode(M),w):n(M)}function v(M){return M===62?(e.consume(M),r.interrupt?t:D):n(M)}function g(M){return Ft(M)?(e.consume(M),g):E(M)}function x(M){return M===47?(e.consume(M),E):M===58||M===95||Ss(M)?(e.consume(M),k):Ft(M)?(e.consume(M),x):E(M)}function k(M){return M===45||M===46||M===58||M===95||ds(M)?(e.consume(M),k):A(M)}function A(M){return M===61?(e.consume(M),T):Ft(M)?(e.consume(M),A):x(M)}function T(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),l=M,C):Ft(M)?(e.consume(M),T):j(M)}function C(M){return M===l?(e.consume(M),l=null,z):M===null||tt(M)?n(M):(e.consume(M),C)}function j(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||In(M)?A(M):(e.consume(M),j)}function z(M){return M===47||M===62||Ft(M)?x(M):n(M)}function E(M){return M===62?(e.consume(M),P):n(M)}function P(M){return M===null||tt(M)?D(M):Ft(M)?(e.consume(M),P):n(M)}function D(M){return M===45&&s===2?(e.consume(M),Y):M===60&&s===1?(e.consume(M),Z):M===62&&s===4?(e.consume(M),$):M===63&&s===3?(e.consume(M),R):M===93&&s===5?(e.consume(M),L):tt(M)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(TV,I,H)(M)):M===null||tt(M)?(e.exit("htmlFlowData"),H(M)):(e.consume(M),D)}function H(M){return e.check(CV,W,I)(M)}function W(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),J}function J(M){return M===null||tt(M)?H(M):(e.enter("htmlFlowData"),D(M))}function Y(M){return M===45?(e.consume(M),R):D(M)}function Z(M){return M===47?(e.consume(M),a="",Q):D(M)}function Q(M){if(M===62){const G=a.toLowerCase();return DS.includes(G)?(e.consume(M),$):D(M)}return Ss(M)&&a.length<8?(e.consume(M),a+=String.fromCharCode(M),Q):D(M)}function L(M){return M===93?(e.consume(M),R):D(M)}function R(M){return M===62?(e.consume(M),$):M===45&&s===2?(e.consume(M),R):D(M)}function $(M){return M===null||tt(M)?(e.exit("htmlFlowData"),I(M)):(e.consume(M),$)}function I(M){return e.exit("htmlFlow"),t(M)}}function MV(e,t,n){const r=this;return s;function s(a){return tt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function NV(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Q0,t,n)}}const IV={name:"htmlText",tokenize:RV};function RV(e,t,n){const r=this;let s,i,a;return o;function o(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),l}function l(R){return R===33?(e.consume(R),c):R===47?(e.consume(R),A):R===63?(e.consume(R),x):Ss(R)?(e.consume(R),j):n(R)}function c(R){return R===45?(e.consume(R),u):R===91?(e.consume(R),i=0,p):Ss(R)?(e.consume(R),g):n(R)}function u(R){return R===45?(e.consume(R),m):n(R)}function d(R){return R===null?n(R):R===45?(e.consume(R),f):tt(R)?(a=d,Z(R)):(e.consume(R),d)}function f(R){return R===45?(e.consume(R),m):d(R)}function m(R){return R===62?Y(R):R===45?f(R):d(R)}function p(R){const $="CDATA[";return R===$.charCodeAt(i++)?(e.consume(R),i===$.length?y:p):n(R)}function y(R){return R===null?n(R):R===93?(e.consume(R),w):tt(R)?(a=y,Z(R)):(e.consume(R),y)}function w(R){return R===93?(e.consume(R),v):y(R)}function v(R){return R===62?Y(R):R===93?(e.consume(R),v):y(R)}function g(R){return R===null||R===62?Y(R):tt(R)?(a=g,Z(R)):(e.consume(R),g)}function x(R){return R===null?n(R):R===63?(e.consume(R),k):tt(R)?(a=x,Z(R)):(e.consume(R),x)}function k(R){return R===62?Y(R):x(R)}function A(R){return Ss(R)?(e.consume(R),T):n(R)}function T(R){return R===45||ds(R)?(e.consume(R),T):C(R)}function C(R){return tt(R)?(a=C,Z(R)):Ft(R)?(e.consume(R),C):Y(R)}function j(R){return R===45||ds(R)?(e.consume(R),j):R===47||R===62||In(R)?z(R):n(R)}function z(R){return R===47?(e.consume(R),Y):R===58||R===95||Ss(R)?(e.consume(R),E):tt(R)?(a=z,Z(R)):Ft(R)?(e.consume(R),z):Y(R)}function E(R){return R===45||R===46||R===58||R===95||ds(R)?(e.consume(R),E):P(R)}function P(R){return R===61?(e.consume(R),D):tt(R)?(a=P,Z(R)):Ft(R)?(e.consume(R),P):z(R)}function D(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),s=R,H):tt(R)?(a=D,Z(R)):Ft(R)?(e.consume(R),D):(e.consume(R),W)}function H(R){return R===s?(e.consume(R),s=void 0,J):R===null?n(R):tt(R)?(a=H,Z(R)):(e.consume(R),H)}function W(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||In(R)?z(R):(e.consume(R),W)}function J(R){return R===47||R===62||In(R)?z(R):n(R)}function Y(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function Z(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),Q}function Q(R){return Ft(R)?Pt(e,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):L(R)}function L(R){return e.enter("htmlTextData"),a(R)}}const p3={name:"labelEnd",resolveAll:LV,resolveTo:BV,tokenize:zV},jV={tokenize:$V},DV={tokenize:PV},OV={tokenize:qV};function LV(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&&yi(e,0,e.length,n),e}function BV(e,t){let n=e.length,r=0,s,i,a,o;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(a){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"&&(a=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[a][1].end}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=Di(o,e.slice(i+1,i+r+3)),o=Di(o,[["enter",u,t]]),o=Di(o,ay(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Di(o,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),o=Di(o,e.slice(a+1)),o=Di(o,[["exit",l,t]]),yi(e,i,e.length,o),e}function zV(e,t,n){const r=this;let s=r.events.length,i,a;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 o;function o(f){return i?i._inactive?d(f):(a=r.parser.defined.includes(ca(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(jV,u,a?u:d)(f):f===91?e.attempt(DV,u,a?c:d)(f):a?u(f):d(f)}function c(f){return e.attempt(OV,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function $V(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 In(d)?qf(e,i)(d):i(d)}function i(d){return d===41?u(d):gN(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return In(d)?qf(e,l)(d):u(d)}function o(d){return n(d)}function l(d){return d===34||d===39||d===40?bN(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return In(d)?qf(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 PV(e,t,n){const r=this;return s;function s(o){return yN.call(r,e,i,a,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ca(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function qV(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 UV={name:"labelStartImage",resolveAll:p3.resolveAll,tokenize:HV};function HV(e,t,n){const r=this;return s;function s(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const FV={name:"labelStartLink",resolveAll:p3.resolveAll,tokenize:VV};function VV(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const mv={name:"lineEnding",tokenize:WV};function WV(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Pt(e,t,"linePrefix")}}const Fp={name:"thematicBreak",tokenize:GV};function GV(e,t,n){let r=0,s;return i;function i(c){return e.enter("thematicBreak"),a(c)}function a(c){return s=c,o(c)}function o(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||tt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===s?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ft(c)?Pt(e,o,"whitespace")(c):o(c))}}const zs={continuation:{tokenize:QV},exit:ZV,name:"list",tokenize:XV},KV={partial:!0,tokenize:eW},YV={partial:!0,tokenize:JV};function XV(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,a=0;return o;function o(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:J2(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(Fp,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 J2(m)&&++a<10?(e.consume(m),l):(!r.interrupt||a<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(Q0,r.interrupt?n:u,e.attempt(KV,f,d))}function u(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return Ft(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 QV(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Q0,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Pt(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ft(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(YV,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Pt(e,e.attempt(zs,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function JV(e,t,n){const r=this;return Pt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function ZV(e){e.exit(this.containerState.type)}function eW(e,t,n){const r=this;return Pt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Ft(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const OS={name:"setextUnderline",resolveTo:tW,tokenize:nW};function tW(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 a={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",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function nW(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,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===s?(e.consume(c),o):(e.exit("setextHeadingLineSequence"),Ft(c)?Pt(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||tt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const rW={tokenize:sW};function sW(e){const t=this,n=e.attempt(Q0,r,e.attempt(this.parser.constructs.flowInitial,s,Pt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(cV,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 iW={resolveAll:xN()},aW=vN("string"),oW=vN("text");function vN(e){return{resolveAll:xN(e==="text"?lW:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(u){return c(u)?i(u):o(u)}function o(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 xN(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 lW(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,a=-1,o=0,l;for(;i--;){const c=s[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const c={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},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 cW={42:zs,43:zs,45:zs,48:zs,49:zs,50:zs,51:zs,52:zs,53:zs,54:zs,55:zs,56:zs,57:zs,62:hN},uW={91:mV},dW={[-2]:fv,[-1]:fv,32:fv},hW={35:xV,42:Fp,45:[OS,Fp],60:SV,61:OS,95:Fp,96:jS,126:jS},fW={38:mN,92:fN},mW={[-5]:mv,[-4]:mv,[-3]:mv,33:UV,38:mN,42:Z2,60:[FF,IV],91:FV,92:[bV,fN],93:p3,95:Z2,96:rV},pW={null:[Z2,iW]},gW={null:[42,95]},yW={null:[]},bW=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gW,contentInitial:uW,disable:yW,document:cW,flow:hW,flowInitial:dW,insideSpan:pW,string:fW,text:mW},Symbol.toStringTag,{value:"Module"}));function vW(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 a=[],o=[];const l={attempt:C(A),check:C(T),consume:g,enter:x,exit:k,interrupt:C(T,{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(P){return a=Di(a,P),w(),a[a.length-1]!==null?[]:(j(t,0),c.events=ay(i,c.events,c),c.events)}function f(P,D){return wW(m(P),D)}function m(P){return xW(a,P)}function p(){const{_bufferIndex:P,_index:D,line:H,column:W,offset:J}=r;return{_bufferIndex:P,_index:D,line:H,column:W,offset:J}}function y(P){s[P.line]=P.column,E()}function w(){let P;for(;r._index<a.length;){const D=a[r._index];if(typeof D=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<D.length;)v(D.charCodeAt(r._bufferIndex));else v(D)}}function v(P){u=u(P)}function g(P){tt(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,E()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=P}function x(P,D){const H=D||{};return H.type=P,H.start=p(),c.events.push(["enter",H,c]),o.push(H),H}function k(P){const D=o.pop();return D.end=p(),c.events.push(["exit",D,c]),D}function A(P,D){j(P,D.from)}function T(P,D){D.restore()}function C(P,D){return H;function H(W,J,Y){let Z,Q,L,R;return Array.isArray(W)?I(W):"tokenize"in W?I([W]):$(W);function $(fe){return Pe;function Pe(oe){const Xe=oe!==null&&fe[oe],ht=oe!==null&&fe.null,At=[...Array.isArray(Xe)?Xe:Xe?[Xe]:[],...Array.isArray(ht)?ht:ht?[ht]:[]];return I(At)(oe)}}function I(fe){return Z=fe,Q=0,fe.length===0?Y:M(fe[Q])}function M(fe){return Pe;function Pe(oe){return R=z(),L=fe,fe.partial||(c.currentConstruct=fe),fe.name&&c.parser.constructs.disable.null.includes(fe.name)?ne():fe.tokenize.call(D?Object.assign(Object.create(c),D):c,l,G,ne)(oe)}}function G(fe){return P(L,R),J}function ne(fe){return R.restore(),++Q<Z.length?M(Z[Q]):Y}}}function j(P,D){P.resolveAll&&!i.includes(P)&&i.push(P),P.resolve&&yi(c.events,D,c.events.length-D,P.resolve(c.events.slice(D),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function z(){const P=p(),D=c.previous,H=c.currentConstruct,W=c.events.length,J=Array.from(o);return{from:W,restore:Y};function Y(){r=P,c.previous=D,c.currentConstruct=H,c.events.length=W,o=J,E()}}function E(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function xW(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,i)];else{if(a=e.slice(n,s),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function wW(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
`;break}case-3:{a=`\r
`;break}case-2:{a=t?" ":"	";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function _W(e){const r={constructs:uN([bW,...(e||{}).extensions||[]]),content:s(BF),defined:[],document:s($F),flow:s(rW),lazy:{},string:s(aW),text:s(oW)};return r;function s(i){return a;function a(o){return vW(r,i,o)}}}function kW(e){for(;!pN(e););return e}const LS=/[\0\t\n\r]/g;function SW(){let e=1,t="",n=!0,r;return s;function s(i,a,o){const l=[];let c,u,d,f,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(LS.lastIndex=d,c=LS.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 o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const TW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function CW(e){return e.replace(TW,AW)}function AW(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return dN(n.slice(i?2:1),i?16:10)}return m3(n)||e}const wN={}.hasOwnProperty;function EW(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),MW(n)(kW(_W(n).document().write(SW()(e,t,!0))))}function MW(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Kt),autolinkProtocol:z,autolinkEmail:z,atxHeading:i(Le),blockQuote:i(ht),characterEscape:z,characterReference:z,codeFenced:i(At),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(At,a),codeText:i(zt,a),codeTextData:z,data:z,codeFlowValue:z,definition:i(Vt),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(gt),hardBreakEscape:i(qt),hardBreakTrailing:i(qt),htmlFlow:i(tn,a),htmlFlowData:z,htmlText:i(tn,a),htmlTextData:z,image:i(Mt),label:a,link:i(Kt),listItem:i(gn),listItemValue:f,listOrdered:i($t,d),listUnordered:i($t),paragraph:i(Xt),reference:M,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Le),strong:i(Be),thematicBreak:i(st)},exit:{atxHeading:l(),atxHeadingSequence:A,autolink:l(),autolinkEmail:Xe,autolinkProtocol:oe,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:fe,characterReference:Pe,codeFenced:l(w),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:E,codeIndented:l(v),codeText:l(J),codeTextData:E,data:E,definition:l(),definitionDestinationString:k,definitionLabelString:g,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(D),hardBreakTrailing:l(D),htmlFlow:l(H),htmlFlowData:E,htmlText:l(W),htmlTextData:E,image:l(Z),label:L,labelText:Q,lineEnding:P,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:G,resourceDestinationString:R,resourceTitleString:$,resource:I,setextHeading:l(j),setextHeadingLineSequence:C,setextHeadingText:T,strong:l(),thematicBreak:l()}};_N(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(te){let ue={type:"root",children:[]};const re={stack:[ue],tokenStack:[],config:t,enter:o,exit:c,buffer:a,resume:u,data:n},ae=[];let pe=-1;for(;++pe<te.length;)if(te[pe][1].type==="listOrdered"||te[pe][1].type==="listUnordered")if(te[pe][0]==="enter")ae.push(pe);else{const wt=ae.pop();pe=s(te,wt,pe)}for(pe=-1;++pe<te.length;){const wt=t[te[pe][0]];wN.call(wt,te[pe][1].type)&&wt[te[pe][1].type].call(Object.assign({sliceSerialize:te[pe][2].sliceSerialize},re),te[pe][1])}if(re.tokenStack.length>0){const wt=re.tokenStack[re.tokenStack.length-1];(wt[1]||BS).call(re,void 0,wt[0])}for(ue.position={start:ul(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:ul(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe<t.transforms.length;)ue=t.transforms[pe](ue)||ue;return ue}function s(te,ue,re){let ae=ue-1,pe=-1,wt=!1,Je,_t,fn,Vn;for(;++ae<=re;){const de=te[ae];switch(de[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{de[0]==="enter"?pe++:pe--,Vn=void 0;break}case"lineEndingBlank":{de[0]==="enter"&&(Je&&!Vn&&!pe&&!fn&&(fn=ae),Vn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vn=void 0}if(!pe&&de[0]==="enter"&&de[1].type==="listItemPrefix"||pe===-1&&de[0]==="exit"&&(de[1].type==="listUnordered"||de[1].type==="listOrdered")){if(Je){let je=ae;for(_t=void 0;je--;){const Te=te[je];if(Te[1].type==="lineEnding"||Te[1].type==="lineEndingBlank"){if(Te[0]==="exit")continue;_t&&(te[_t][1].type="lineEndingBlank",wt=!0),Te[1].type="lineEnding",_t=je}else if(!(Te[1].type==="linePrefix"||Te[1].type==="blockQuotePrefix"||Te[1].type==="blockQuotePrefixWhitespace"||Te[1].type==="blockQuoteMarker"||Te[1].type==="listItemIndent"))break}fn&&(!_t||fn<_t)&&(Je._spread=!0),Je.end=Object.assign({},_t?te[_t][1].start:de[1].end),te.splice(_t||ae,0,["exit",Je,de[2]]),ae++,re++}if(de[1].type==="listItemPrefix"){const je={type:"listItem",_spread:!1,start:Object.assign({},de[1].start),end:void 0};Je=je,te.splice(ae,0,["enter",je,de[2]]),ae++,re++,fn=void 0,Vn=!0}}}return te[ue][1]._spread=wt,re}function i(te,ue){return re;function re(ae){o.call(this,te(ae),ae),ue&&ue.call(this,ae)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(te,ue,re){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([ue,re||void 0]),te.position={start:ul(ue.start),end:void 0}}function l(te){return ue;function ue(re){te&&te.call(this,re),c.call(this,re)}}function c(te,ue){const re=this.stack.pop(),ae=this.tokenStack.pop();if(ae)ae[0].type!==te.type&&(ue?ue.call(this,te,ae[0]):(ae[1]||BS).call(this,te,ae[0]));else throw new Error("Cannot close `"+te.type+"` ("+Pf({start:te.start,end:te.end})+"): it’s not open");re.position.end=ul(te.end)}function u(){return f3(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(te){if(this.data.expectingFirstListItemValue){const ue=this.stack[this.stack.length-2];ue.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function m(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.lang=te}function p(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.meta=te}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.value=te.replace(/(\r?\n|\r)$/g,"")}function g(te){const ue=this.resume(),re=this.stack[this.stack.length-1];re.label=ue,re.identifier=ca(this.sliceSerialize(te)).toLowerCase()}function x(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.title=te}function k(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.url=te}function A(te){const ue=this.stack[this.stack.length-1];if(!ue.depth){const re=this.sliceSerialize(te).length;ue.depth=re}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function C(te){const ue=this.stack[this.stack.length-1];ue.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function j(){this.data.setextHeadingSlurpLineEnding=void 0}function z(te){const re=this.stack[this.stack.length-1].children;let ae=re[re.length-1];(!ae||ae.type!=="text")&&(ae=Qe(),ae.position={start:ul(te.start),end:void 0},re.push(ae)),this.stack.push(ae)}function E(te){const ue=this.stack.pop();ue.value+=this.sliceSerialize(te),ue.position.end=ul(te.end)}function P(te){const ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=ue.children[ue.children.length-1];re.position.end=ul(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ue.type)&&(z.call(this,te),E.call(this,te))}function D(){this.data.atHardBreak=!0}function H(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.value=te}function W(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.value=te}function J(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.value=te}function Y(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=ue,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function Z(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=ue,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function Q(te){const ue=this.sliceSerialize(te),re=this.stack[this.stack.length-2];re.label=CW(ue),re.identifier=ca(ue).toLowerCase()}function L(){const te=this.stack[this.stack.length-1],ue=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const ae=te.children;re.children=ae}else re.alt=ue}function R(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.url=te}function $(){const te=this.resume(),ue=this.stack[this.stack.length-1];ue.title=te}function I(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function G(te){const ue=this.resume(),re=this.stack[this.stack.length-1];re.label=ue,re.identifier=ca(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function ne(te){this.data.characterReferenceType=te.type}function fe(te){const ue=this.sliceSerialize(te),re=this.data.characterReferenceType;let ae;re?(ae=dN(ue,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ae=m3(ue);const pe=this.stack[this.stack.length-1];pe.value+=ae}function Pe(te){const ue=this.stack.pop();ue.position.end=ul(te.end)}function oe(te){E.call(this,te);const ue=this.stack[this.stack.length-1];ue.url=this.sliceSerialize(te)}function Xe(te){E.call(this,te);const ue=this.stack[this.stack.length-1];ue.url="mailto:"+this.sliceSerialize(te)}function ht(){return{type:"blockquote",children:[]}}function At(){return{type:"code",lang:null,meta:null,value:""}}function zt(){return{type:"inlineCode",value:""}}function Vt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function gt(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function qt(){return{type:"break"}}function tn(){return{type:"html",value:""}}function Mt(){return{type:"image",title:null,url:"",alt:null}}function Kt(){return{type:"link",title:null,url:"",children:[]}}function $t(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function gn(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Xt(){return{type:"paragraph",children:[]}}function Be(){return{type:"strong",children:[]}}function Qe(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function ul(e){return{line:e.line,column:e.column,offset:e.offset}}function _N(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?_N(e,r):NW(e,r)}}function NW(e,t){let n;for(n in t)if(wN.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 BS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Pf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Pf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Pf({start:t.start,end:t.end})+") is still open")}function IW(e){const t=this;t.parser=n;function n(r){return EW(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function RW(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 jW(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function DW(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 OW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=wh(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function zW(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 $W(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function kN(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 a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function PW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kN(e,t);const s={src:wh(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 qW(e,t){const n={src:wh(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 UW(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 HW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return kN(e,t);const s={href:wh(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 FW(e,t){const n={href:wh(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 VW(e,t,n){const r=e.all(t),s=n?WW(n):SN(t),i={},a=[];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 o=-1;for(;++o<r.length;){const u=r[o];(s||o!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
`}),u.type==="element"&&u.tagName==="p"&&!s?a.push(...u.children):a.push(u)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,c),e.applyData(t,c)}function WW(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=SN(n[r])}return t}function SN(e){const t=e.spread;return t??e.children.length>1}function GW(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 a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.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 KW(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YW(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function XW(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QW(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=c3(t.children[1]),l=rN(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function JW(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let l=-1;const c=[];for(;++l<o;){const d=t.children[l],f={},m=a?a[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 ZW(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const zS=9,$S=32;function eG(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(PS(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(PS(t.slice(s),s>0,!1)),i.join("")}function PS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===zS||i===$S;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===zS||i===$S;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function tG(e,t){const n={type:"text",value:eG(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function nG(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const rG={blockquote:RW,break:jW,code:DW,delete:OW,emphasis:LW,footnoteReference:BW,heading:zW,html:$W,imageReference:PW,image:qW,inlineCode:UW,linkReference:HW,link:FW,listItem:VW,list:GW,paragraph:KW,root:YW,strong:XW,table:QW,tableCell:ZW,tableRow:JW,text:tG,thematicBreak:nG,toml:Pm,yaml:Pm,definition:Pm,footnoteDefinition:Pm};function Pm(){}const TN=-1,oy=0,Uf=1,Fg=2,g3=3,y3=4,b3=5,v3=6,CN=7,AN=8,qS=typeof self=="object"?self:globalThis,sG=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case oy:case TN:return n(a,s);case Uf:{const o=n([],s);for(const l of a)o.push(r(l));return o}case Fg:{const o=n({},s);for(const[l,c]of a)o[r(l)]=r(c);return o}case g3:return n(new Date(a),s);case y3:{const{source:o,flags:l}=a;return n(new RegExp(o,l),s)}case b3:{const o=n(new Map,s);for(const[l,c]of a)o.set(r(l),r(c));return o}case v3:{const o=n(new Set,s);for(const l of a)o.add(r(l));return o}case CN:{const{name:o,message:l}=a;return n(new qS[o](l),s)}case AN:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new qS[i](a),s)};return r},US=e=>sG(new Map,e)(0),Gu="",{toString:iG}={},{keys:aG}=Object,Zh=e=>{const t=typeof e;if(t!=="object"||!e)return[oy,t];const n=iG.call(e).slice(8,-1);switch(n){case"Array":return[Uf,Gu];case"Object":return[Fg,Gu];case"Date":return[g3,Gu];case"RegExp":return[y3,Gu];case"Map":return[b3,Gu];case"Set":return[v3,Gu];case"DataView":return[Uf,n]}return n.includes("Array")?[Uf,n]:n.includes("Error")?[CN,n]:[Fg,n]},qm=([e,t])=>e===oy&&(t==="function"||t==="symbol"),oG=(e,t,n,r)=>{const s=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},i=a=>{if(n.has(a))return n.get(a);let[o,l]=Zh(a);switch(o){case oy:{let u=a;switch(l){case"bigint":o=AN,u=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([TN],a)}return s([o,u],a)}case Uf:{if(l){let f=a;return l==="DataView"?f=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(a)),s([l,[...f]],a)}const u=[],d=s([o,u],a);for(const f of a)u.push(i(f));return d}case Fg:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const u=[],d=s([o,u],a);for(const f of aG(a))(e||!qm(Zh(a[f])))&&u.push([i(f),i(a[f])]);return d}case g3:return s([o,a.toISOString()],a);case y3:{const{source:u,flags:d}=a;return s([o,{source:u,flags:d}],a)}case b3:{const u=[],d=s([o,u],a);for(const[f,m]of a)(e||!(qm(Zh(f))||qm(Zh(m))))&&u.push([i(f),i(m)]);return d}case v3:{const u=[],d=s([o,u],a);for(const f of a)(e||!qm(Zh(f)))&&u.push(i(f));return d}}const{message:c}=a;return s([o,{name:l,message:c}],a)};return i},HS=(e,{json:t,lossy:n}={})=>{const r=[];return oG(!(t||n),!!t,new Map,r)(e),r},Vg=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?US(HS(e,t)):structuredClone(e):(e,t)=>US(HS(e,t));function lG(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 cG(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function uG(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||lG,r=e.options.footnoteBackLabel||cG,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];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=wh(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 g=typeof n=="string"?n:n(l,m);typeof g=="string"&&(g={type:"text",value:g}),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(g)?g:[g]})}const w=u[u.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const g=w.children[w.children.length-1];g&&g.type==="text"?g.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...p)}else u.push(...p);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,v),o.push(v)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Vg(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
`}]}}const J0=function(e){if(e==null)return mG;if(typeof e=="function")return ly(e);if(typeof e=="object")return Array.isArray(e)?dG(e):hG(e);if(typeof e=="string")return fG(e);throw new Error("Expected function, string, or object as test")};function dG(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=J0(e[n]);return ly(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function hG(e){const t=e;return ly(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function fG(e){return ly(t);function t(n){return n&&n.type===e}}function ly(e){return t;function t(n,r,s){return!!(pG(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function mG(){return!0}function pG(e){return e!==null&&typeof e=="object"&&"type"in e}const EN=[],gG=!0,ex=!1,MN="skip";function x3(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=J0(s),a=r?-1:1;o(e,void 0,[])();function o(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=EN,p,y,w;if((!t||i(l,c,u[u.length-1]||void 0))&&(m=yG(n(l,u)),m[0]===ex))return m;if("children"in l&&l.children){const v=l;if(v.children&&m[0]!==MN)for(y=(r?v.children.length:-1)+a,w=u.concat(v);y>-1&&y<v.children.length;){const g=v.children[y];if(p=o(g,y,w)(),p[0]===ex)return p;y=typeof p[1]=="number"?p[1]:y+a}}return m}}}function yG(e){return Array.isArray(e)?e:typeof e=="number"?[gG,e]:e==null?EN:[e]}function w3(e,t,n,r){let s,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,s=n):(i=t,a=n,s=r),x3(e,i,o,s);function o(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return a(l,d,u)}}const tx={}.hasOwnProperty,bG={};function vG(e,t){const n=t||bG,r=new Map,s=new Map,i=new Map,a={...rG,...n.handlers},o={all:c,applyData:wG,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:l,options:n,patch:xG,wrap:kG};return w3(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)}}),o;function l(u,d){const f=u.type,m=o.handlers[f];if(tx.call(o.handlers,f)&&m)return m(o,u,d);if(o.options.passThrough&&o.options.passThrough.includes(f)){if("children"in u){const{children:y,...w}=u,v=Vg(w);return v.children=o.all(u),v}return Vg(u)}return(o.options.unknownHandler||_G)(o,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let m=-1;for(;++m<f.length;){const p=o.one(f[m],u);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=FS(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=FS(y.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function xG(e,t){e.position&&(t.position=cF(e))}function wG(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 a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,Vg(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function _G(e,t){const n=t.data||{},r="value"in t&&!(tx.call(n,"hProperties")||tx.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 kG(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 FS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function VS(e,t){const n=vG(e,t),r=n.one(e,void 0),s=uG(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function SG(e,t){return e&&"run"in e?async function(n,r){const s=VS(n,{file:r,...t});await e.run(s,r)}:function(n,r){return VS(n,{file:r,...e||t})}}function WS(e){if(e)throw e}var Vp=Object.prototype.hasOwnProperty,NN=Object.prototype.toString,GS=Object.defineProperty,KS=Object.getOwnPropertyDescriptor,YS=function(t){return typeof Array.isArray=="function"?Array.isArray(t):NN.call(t)==="[object Array]"},XS=function(t){if(!t||NN.call(t)!=="[object Object]")return!1;var n=Vp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Vp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Vp.call(t,s)},QS=function(t,n){GS&&n.name==="__proto__"?GS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},JS=function(t,n){if(n==="__proto__")if(Vp.call(t,n)){if(KS)return KS(t,n).value}else return;return t[n]},TG=function e(){var t,n,r,s,i,a,o=arguments[0],l=1,c=arguments.length,u=!1;for(typeof o=="boolean"&&(u=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=JS(o,n),s=JS(t,n),o!==s&&(u&&s&&(XS(s)||(i=YS(s)))?(i?(i=!1,a=r&&YS(r)?r:[]):a=r&&XS(r)?r:{},QS(o,{name:n,newValue:e(u,a,s)})):typeof s<"u"&&QS(o,{name:n,newValue:s}));return o};const pv=I1(TG);function nx(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 CG(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...s);function o(l,...c){const u=e[++i];let d=-1;if(l){a(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?AG(u,o)(...c):a(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 AG(e,t){let n;return r;function r(...a){const o=e.length>a.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(c){const u=c;if(o&&n)throw u;return s(u)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const Na={basename:EG,dirname:MG,extname:NG,join:IG,sep:"/"};function EG(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Z0(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 a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function MG(e){if(Z0(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 NG(e){Z0(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===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 IG(...e){let t=-1,n;for(;++t<e.length;)Z0(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":RG(n)}function RG(e){Z0(e);const t=e.codePointAt(0)===47;let n=jG(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jG(e,t){let n="",r=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||i===1))if(s!==a-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=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function Z0(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const DG={cwd:OG};function OG(){return"/"}function rx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function LG(e){if(typeof e=="string")e=new URL(e);else if(!rx(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 BG(e)}function BG(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 gv=["history","path","basename","stem","extname","dirname"];class IN{constructor(t){let n;t?rx(t)?n={path:t}:typeof t=="string"||zG(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":DG.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<gv.length;){const i=gv[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)gv.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Na.basename(this.path):void 0}set basename(t){bv(t,"basename"),yv(t,"basename"),this.path=Na.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Na.dirname(this.path):void 0}set dirname(t){ZS(this.basename,"dirname"),this.path=Na.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Na.extname(this.path):void 0}set extname(t){if(yv(t,"extname"),ZS(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=Na.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){rx(t)&&(t=LG(t)),bv(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Na.basename(this.path,this.extname):void 0}set stem(t){bv(t,"stem"),yv(t,"stem"),this.path=Na.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 ms(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 yv(e,t){if(e&&e.includes(Na.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Na.sep+"`")}function bv(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ZS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function zG(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $G=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},PG={}.hasOwnProperty;class _3 extends $G{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=CG()}copy(){const t=new _3;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(pv(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(wv("data",this.frozen),this.namespace[t]=n,this):PG.call(this.namespace,t)&&this.namespace[t]||void 0:t?(wv("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=Um(t),r=this.parser||this.Parser;return vv("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),vv("process",this.parser||this.Parser),xv("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const o=Um(t),l=r.parse(o);r.run(l,o,function(u,d,f){if(u||!d||!f)return c(u);const m=d,p=r.stringify(m,f);HG(p)?f.value=p:f.result=p,c(u,f)});function c(u,d){u||!d?a(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),vv("processSync",this.parser||this.Parser),xv("processSync",this.compiler||this.Compiler),this.process(t,s),t8("processSync","process",n),r;function s(i,a){n=!0,WS(i),r=a}}run(t,n,r){e8(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(a,o){const l=Um(n);s.run(t,l,c);function c(u,d,f){const m=d||t;u?o(u):a?a(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),t8("runSync","run",r),s;function i(a,o){WS(a),s=o,r=!0}}stringify(t,n){this.freeze();const r=Um(n),s=this.compiler||this.Compiler;return xv("stringify",s),e8(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(wv("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(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 a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(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");o(c.plugins),c.settings&&(s.settings=pv(!0,s.settings,c.settings))}function o(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];nx(y)&&nx(m)&&(m=pv(!0,y,m)),r[f]=[c,m,...p]}}}}const qG=new _3().freeze();function vv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xv(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function wv(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 e8(e){if(!nx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function t8(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Um(e){return UG(e)?e:new IN(e)}function UG(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function HG(e){return typeof e=="string"||FG(e)}function FG(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VG="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",n8=[],r8={allowDangerousHtml:!0},WG=/^(https?|ircs?|mailto|xmpp)$/i,GG=[{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 KG(e){const t=YG(e),n=XG(e);return QG(t.runSync(t.parse(n),n),e)}function YG(e){const t=e.rehypePlugins||n8,n=e.remarkPlugins||n8,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...r8}:r8;return qG().use(IW).use(n).use(SG,r).use(t)}function XG(e){const t=e.children||"",n=new IN;return typeof t=="string"&&(n.value=t),n}function QG(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||JG;for(const u of GG)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+VG+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),w3(e,c),mF(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 a?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let m;for(m in hv)if(Object.hasOwn(hv,m)&&Object.hasOwn(u.properties,m)){const p=u.properties[m],y=hv[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 o&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function JG(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||WG.test(e.slice(0,t))?e:""}function Wg(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 ZG(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eK(e,t,n){const s=J0((n||{}).ignore||[]),i=tK(t);let a=-1;for(;++a<i.length;)x3(e,"text",o);function o(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[a][0],m=i[a][1];let p=0;const w=d.children.indexOf(c);let v=!1,g=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const k=x.index,A={index:x.index,input:x.input,stack:[...u,c]};let T=m(...x,A);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?f.lastIndex=k+1:(p!==k&&g.push({type:"text",value:c.value.slice(p,k)}),Array.isArray(T)?g.push(...T):T&&g.push(T),p=k+x[0].length,v=!0),!f.global)break;x=f.exec(c.value)}return v?(p<c.value.length&&g.push({type:"text",value:c.value.slice(p)}),d.children.splice(w,1,...g)):g=[c],w+g.length}}function tK(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([nK(s[0]),rK(s[1])])}return t}function nK(e){return typeof e=="string"?new RegExp(ZG(e),"g"):e}function rK(e){return typeof e=="function"?e:function(){return e}}const _v="phrasing",kv=["autolink","link","image","label"];function sK(){return{transforms:[dK],enter:{literalAutolink:aK,literalAutolinkEmail:Sv,literalAutolinkHttp:Sv,literalAutolinkWww:Sv},exit:{literalAutolink:uK,literalAutolinkEmail:cK,literalAutolinkHttp:oK,literalAutolinkWww:lK}}}function iK(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_v,notInConstruct:kv},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_v,notInConstruct:kv},{character:":",before:"[ps]",after:"\\/",inConstruct:_v,notInConstruct:kv}]}}function aK(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Sv(e){this.config.enter.autolinkProtocol.call(this,e)}function oK(e){this.config.exit.autolinkProtocol.call(this,e)}function lK(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 cK(e){this.config.exit.autolinkEmail.call(this,e)}function uK(e){this.exit(e)}function dK(e){eK(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,hK],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),fK]],{ignore:["link","linkReference"]})}function hK(e,t,n,r,s){let i="";if(!RN(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!mK(n)))return!1;const a=pK(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:i+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function fK(e,t,n,r){return!RN(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function mK(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 pK(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=Wg(e,"(");let i=Wg(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 RN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||vu(n)||iy(n))&&(!t||n!==47)}jN.peek=SK;function gK(){this.buffer()}function yK(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bK(){this.buffer()}function vK(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ca(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wK(e){this.exit(e)}function _K(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ca(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kK(e){this.exit(e)}function SK(){return"["}function jN(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function TK(){return{enter:{gfmFootnoteCallString:gK,gfmFootnoteCall:yK,gfmFootnoteDefinitionLabelString:bK,gfmFootnoteDefinition:vK},exit:{gfmFootnoteCallString:xK,gfmFootnoteCall:wK,gfmFootnoteDefinitionLabelString:_K,gfmFootnoteDefinition:kK}}}function CK(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:jN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=o.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?`
`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?DN:AK))),c(),l}}function AK(e,t,n){return t===0?e:DN(e,t,n)}function DN(e,t,n){return(n?"":"    ")+e}const EK=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ON.peek=jK;function MK(){return{canContainEols:["delete"],enter:{strikethrough:IK},exit:{strikethrough:RK}}}function NK(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:EK}],handlers:{delete:ON}}}function IK(e){this.enter({type:"delete",children:[]},e)}function RK(e){this.exit(e)}function ON(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function jK(){return"~"}function DK(e){return e.length}function OK(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||DK,i=[],a=[],o=[],l=[];let c=0,u=-1;for(;++u<e.length;){const y=[],w=[];let v=-1;for(e[u].length>c&&(c=e[u].length);++v<e[u].length;){const g=LK(e[u][v]);if(n.alignDelimiters!==!1){const x=s(g);w[v]=x,(l[v]===void 0||x>l[v])&&(l[v]=x)}y.push(g)}a[u]=y,o[u]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=s8(r[d]);else{const y=s8(r);for(;++d<c;)i[d]=y}d=-1;const f=[],m=[];for(;++d<c;){const y=i[d];let w="",v="";y===99?(w=":",v=":"):y===108?w=":":y===114&&(v=":");let g=n.alignDelimiters===!1?1:Math.max(1,l[d]-w.length-v.length);const x=w+"-".repeat(g)+v;n.alignDelimiters!==!1&&(g=w.length+g+v.length,g>l[d]&&(l[d]=g),m[d]=g),f[d]=x}a.splice(1,0,f),o.splice(1,0,m),u=-1;const p=[];for(;++u<a.length;){const y=a[u],w=o[u];d=-1;const v=[];for(;++d<c;){const g=y[d]||"";let x="",k="";if(n.alignDelimiters!==!1){const A=l[d]-(w[d]||0),T=i[d];T===114?x=" ".repeat(A):T===99?A%2?(x=" ".repeat(A/2+.5),k=" ".repeat(A/2-.5)):(x=" ".repeat(A/2),k=x):k=" ".repeat(A)}n.delimiterStart!==!1&&!d&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&g==="")&&(n.delimiterStart!==!1||d)&&v.push(" "),n.alignDelimiters!==!1&&v.push(x),v.push(g),n.alignDelimiters!==!1&&v.push(k),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&v.push("|")}p.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return p.join(`
`)}function LK(e){return e==null?"":String(e)}function s8(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 i8={}.hasOwnProperty;function BK(e,t){const n=t||{};function r(s,...i){let a=r.invalid;const o=r.handlers;if(s&&i8.call(s,e)){const l=String(s[e]);a=i8.call(o,l)?o[l]:r.unknown}if(a)return a.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function zK(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),$K);return s(),a}function $K(e,t,n){return">"+(n?"":" ")+e}function PK(e,t){return a8(e,t.inConstruct,!0)&&!a8(e,t.notInConstruct,!1)}function a8(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 o8(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&PK(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function LN(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>a&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function qK(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 UK(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 HK(e,t,n,r){const s=UK(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(qK(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,FK);return d(),f}const o=n.createTracker(r),l=s.repeat(Math.max(LN(i,s)+1,3)),c=n.enter("codeFenced");let u=o.move(l);if(e.lang){const d=n.enter(`codeFencedLang${a}`);u+=o.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${a}`);u+=o.move(" "),u+=o.move(n.safe(e.meta,{before:u,after:`
`,encode:["`"],...o.current()})),d()}return u+=o.move(`
`),i&&(u+=o.move(i+`
`)),u+=o.move(l),c(),u}function FK(e,t,n){return(n?"":"    ")+e}function k3(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 VK(e,t,n,r){const s=k3(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=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("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
`,...l.current()}))),o(),e.title&&(o=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),o()),a(),c}function WK(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 p0(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Gg(e,t,n){const r=Yd(e),s=Yd(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}}BN.peek=GK;function BN(e,t,n,r){const s=WK(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let l=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const c=l.charCodeAt(0),u=Gg(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=p0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Gg(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+p0(d));const m=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},o+l+m}function GK(e,t,n){return n.options.emphasis||"*"}function KK(e,t){let n=!1;return w3(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ex}),!!((!e.depth||e.depth<3)&&f3(e)&&(t.options.setext||n))}function YK(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(KK(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 a="#".repeat(s),o=n.enter("headingAtx"),l=n.enter("phrasing");i.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(c)&&(c=p0(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),o(),c}zN.peek=XK;function zN(e){return e.value||""}function XK(){return"<"}$N.peek=QK;function $N(e,t,n,r){const s=k3(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=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("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=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),o()),c+=l.move(")"),a(),c}function QK(){return"!"}PN.peek=JK;function PN(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const c=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=u,i(),s==="full"||!c||c!==d?l+=o.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function JK(){return"!"}qN.peek=ZK;function qN(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 a=n.unsafe[i],o=n.compilePattern(a);let l;if(a.atBreak)for(;l=o.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 ZK(){return"`"}function UN(e,t){const n=f3(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))}HN.peek=eY;function HN(e,t,n,r){const s=k3(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(UN(e,n)){const u=n.stack;n.stack=[],o=n.enter("autolink");let d=a.move("<");return d+=a.move(n.containerPhrasing(e,{before:d,after:">",...a.current()})),d+=a.move(">"),o(),n.stack=u,d}o=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(e,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=a.move(" "+s),c+=a.move(n.safe(e.title,{before:c,after:s,...a.current()})),c+=a.move(s),l()),c+=a.move(")"),o(),c}function eY(e,t,n){return UN(e,n)?"<":"["}FN.peek=tY;function FN(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=u,i(),s==="full"||!c||c!==d?l+=o.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function tY(){return"["}function S3(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 nY(e){const t=S3(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 rY(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 VN(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 sY(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?rY(n):S3(n);const o=e.ordered?a==="."?")":".":nY(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&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),VN(n)===a&&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&&(a=o),n.bulletCurrent=a;const c=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=i,s(),c}function iY(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 aY(e,t,n,r){const s=iY(n);let i=n.bulletCurrent||S3(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 a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,o.current()),u);return l(),c;function u(d,f,m){return f?(m?"":" ".repeat(a))+d:(m?i:i+" ".repeat(a-i.length))+d}}function oY(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const lY=J0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function cY(e,t,n,r){return(e.children.some(function(a){return lY(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function uY(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}WN.peek=dY;function WN(e,t,n,r){const s=uY(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let l=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const c=l.charCodeAt(0),u=Gg(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=p0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Gg(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+p0(d));const m=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},o+l+m}function dY(e,t,n){return n.options.strong||"*"}function hY(e,t,n,r){return n.safe(e.value,r)}function fY(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 mY(e,t,n){const r=(VN(n)+(n.options.ruleSpaces?" ":"")).repeat(fY(n));return n.options.ruleSpaces?r.slice(0,-1):r}const GN={blockquote:zK,break:o8,code:HK,definition:VK,emphasis:BN,hardBreak:o8,heading:YK,html:zN,image:$N,imageReference:PN,inlineCode:qN,link:HN,linkReference:FN,list:sY,listItem:aY,paragraph:oY,root:cY,strong:WN,text:hY,thematicBreak:mY};function pY(){return{enter:{table:gY,tableData:l8,tableHeader:l8,tableRow:bY},exit:{codeText:vY,table:yY,tableData:Tv,tableHeader:Tv,tableRow:Tv}}}function gY(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 yY(e){this.exit(e),this.data.inTable=void 0}function bY(e){this.enter({type:"tableRow",children:[]},e)}function Tv(e){this.exit(e)}function l8(e){this.enter({type:"tableCell",children:[]},e)}function vY(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,xY));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function xY(e,t){return t==="|"?t:e}function wY(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:a,tableCell:l,tableRow:o}};function a(m,p,y,w){return c(u(m,y,w),m.align)}function o(m,p,y,w){const v=d(m,y,w),g=c([v]);return g.slice(0,g.indexOf(`
`))}function l(m,p,y,w){const v=y.enter("tableCell"),g=y.enter("phrasing"),x=y.containerPhrasing(m,{...w,before:i,after:i});return g(),v(),x}function c(m,p){return OK(m,{align:p,alignDelimiters:r,padding:n,stringLength:s})}function u(m,p,y){const w=m.children;let v=-1;const g=[],x=p.enter("table");for(;++v<w.length;)g[v]=d(w[v],p,y);return x(),g}function d(m,p,y){const w=m.children;let v=-1;const g=[],x=p.enter("tableRow");for(;++v<w.length;)g[v]=l(w[v],m,p,y);return x(),g}function f(m,p,y){let w=GN.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function _Y(){return{exit:{taskListCheckValueChecked:c8,taskListCheckValueUnchecked:c8,paragraph:SY}}}function kY(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:TY}}}function c8(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function SY(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,a;for(;++i<s.length;){const o=s[i];if(o.type==="paragraph"){a=o;break}}a===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 TY(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);i&&o.move(a);let l=GN.listItem(e,t,n,{...r,...o.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+a}}function CY(){return[sK(),TK(),MK(),pY(),_Y()]}function AY(e){return{extensions:[iK(),CK(e),NK(),wY(e),kY()]}}const EY={tokenize:DY,partial:!0},KN={tokenize:OY,partial:!0},YN={tokenize:LY,partial:!0},XN={tokenize:BY,partial:!0},MY={tokenize:zY,partial:!0},QN={name:"wwwAutolink",tokenize:RY,previous:ZN},JN={name:"protocolAutolink",tokenize:jY,previous:eI},Vo={name:"emailAutolink",tokenize:IY,previous:tI},Ya={};function NY(){return{text:Ya}}let Nc=48;for(;Nc<123;)Ya[Nc]=Vo,Nc++,Nc===58?Nc=65:Nc===91&&(Nc=97);Ya[43]=Vo;Ya[45]=Vo;Ya[46]=Vo;Ya[95]=Vo;Ya[72]=[Vo,JN];Ya[104]=[Vo,JN];Ya[87]=[Vo,QN];Ya[119]=[Vo,QN];function IY(e,t,n){const r=this;let s,i;return a;function a(d){return!sx(d)||!tI.call(r,r.previous)||T3(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return sx(d)?(e.consume(d),o):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(MY,u,c)(d):d===45||d===95||ds(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&&Ss(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function RY(e,t,n){const r=this;return s;function s(a){return a!==87&&a!==119||!ZN.call(r,r.previous)||T3(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(EY,e.attempt(KN,e.attempt(YN,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function jY(e,t,n){const r=this;let s="",i=!1;return a;function a(d){return(d===72||d===104)&&eI.call(r,r.previous)&&!T3(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),o):n(d)}function o(d){if(Ss(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),o;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||Hg(d)||In(d)||vu(d)||iy(d)?n(d):e.attempt(KN,e.attempt(YN,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function DY(e,t,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),s):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function OY(e,t,n){let r,s,i;return a;function a(c){return c===46||c===95?e.check(XN,l,o)(c):c===null||In(c)||vu(c)||c!==45&&iy(c)?l(c):(i=!0,e.consume(c),a)}function o(c){return c===95?r=!0:(s=r,r=void 0),e.consume(c),a}function l(c){return s||r||!i?n(c):t(c)}}function LY(e,t){let n=0,r=0;return s;function s(a){return a===40?(n++,e.consume(a),s):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(XN,t,i)(a):a===null||In(a)||vu(a)?t(a):(e.consume(a),s)}function i(a){return a===41&&r++,e.consume(a),s}}function BY(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),i):o===93?(e.consume(o),s):o===60||o===null||In(o)||vu(o)?t(o):n(o)}function s(o){return o===null||o===40||o===91||In(o)||vu(o)?t(o):r(o)}function i(o){return Ss(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):Ss(o)?(e.consume(o),a):n(o)}}function zY(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return ds(i)?n(i):t(i)}}function ZN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||In(e)}function eI(e){return!Ss(e)}function tI(e){return!(e===47||sx(e))}function sx(e){return e===43||e===45||e===46||e===95||ds(e)}function T3(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 $Y={tokenize:GY,partial:!0};function PY(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:FY,continuation:{tokenize:VY},exit:WY}},text:{91:{name:"gfmFootnoteCall",tokenize:HY},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qY,resolveTo:UY}}}}function qY(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const c=ca(r.sliceSerialize({start:a.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 UY(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)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[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",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function HY(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(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&&!a||d===null||d===91||In(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(ca(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return In(d)||(a=!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 FY(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;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(a>999||p===93&&!o||p===null||p===91||In(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=ca(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return In(p)||(o=!0),a++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),a++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s.includes(i)||s.push(i),Pt(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function VY(e,t,n){return e.check(Q0,t,e.attempt($Y,t,n))}function WY(e){e.exit("gfmFootnoteDefinition")}function GY(e,t,n){const r=this;return Pt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function KY(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(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",u,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&yi(f,f.length,0,ay(m,a.slice(c+1,l),o)),yi(f,f.length,0,[["exit",d,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",u,o]]),yi(a,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,o,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):(a.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const y=Yd(c);if(p===126)return d>1?l(p):(a.consume(p),d++,m);if(d<2&&!n)return l(p);const w=a.exit("strikethroughSequenceTemporary"),v=Yd(p);return w._open=!v||v===2&&!!y,w._close=!y||y===2&&!!v,o(p)}}}class YY{constructor(){this.map=[]}add(t,n,r){XY(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[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 XY(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 QY(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 JY(){return{flow:{null:{name:"table",tokenize:ZY,resolveAll:eX}}}}function ZY(e,t,n){const r=this;let s=0,i=0,a;return o;function o(E){let P=r.events.length-1;for(;P>-1;){const W=r.events[P][1].type;if(W==="lineEnding"||W==="linePrefix")P--;else break}const D=P>-1?r.events[P][1].type:null,H=D==="tableHead"||D==="tableRow"?T:l;return H===T&&r.parser.lazy[r.now().line]?n(E):H(E)}function l(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(a=!0,i+=1),u(E)}function u(E){return E===null?n(E):tt(E)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),m):n(E):Ft(E)?Pt(e,u,"whitespace")(E):(i+=1,a&&(a=!1,s+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),a=!0,u):(e.enter("data"),d(E)))}function d(E){return E===null||E===124||In(E)?(e.exit("data"),u(E)):(e.consume(E),E===92?f:d)}function f(E){return E===92||E===124?(e.consume(E),d):d(E)}function m(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(E):(e.enter("tableDelimiterRow"),a=!1,Ft(E)?Pt(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):p(E))}function p(E){return E===45||E===58?w(E):E===124?(a=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),y):A(E)}function y(E){return Ft(E)?Pt(e,w,"whitespace")(E):w(E)}function w(E){return E===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),v):E===45?(i+=1,v(E)):E===null||tt(E)?k(E):A(E)}function v(E){return E===45?(e.enter("tableDelimiterFiller"),g(E)):A(E)}function g(E){return E===45?(e.consume(E),g):E===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(E))}function x(E){return Ft(E)?Pt(e,k,"whitespace")(E):k(E)}function k(E){return E===124?p(E):E===null||tt(E)?!a||s!==i?A(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):A(E)}function A(E){return n(E)}function T(E){return e.enter("tableRow"),C(E)}function C(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),C):E===null||tt(E)?(e.exit("tableRow"),t(E)):Ft(E)?Pt(e,C,"whitespace")(E):(e.enter("data"),j(E))}function j(E){return E===null||E===124||In(E)?(e.exit("data"),C(E)):(e.consume(E),E===92?z:j)}function z(E){return E===92||E===124?(e.consume(E),j):j(E)}}function eX(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,c,u,d;const f=new YY;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(o=!1,l!==0&&(u8(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],a=[0,n+1,0,0],o&&(o=!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,a[2]===0&&(i[1]!==0&&(a[0]=a[1],d=Hm(f,t,i,s,void 0,d),i=[0,0,0,0]),a[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],d=Hm(f,t,i,s,void 0,d)),i=a,a=[i[1],n,0,0])):p.type==="tableHead"?(o=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,i[1]!==0?(a[0]=a[1],d=Hm(f,t,i,s,n,d)):a[1]!==0&&(d=Hm(f,t,a,s,n,d)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&u8(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=QY(t.events,n))}return e}function Hm(e,t,n,r,s,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(i.end=Object.assign({},td(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=td(t.events,n[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=td(t.events,n[2]),u=td(t.events,n[3]),d={type:o,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({},td(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function u8(e,t,n,r,s){const i=[],a=td(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function td(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const tX={name:"tasklistCheck",tokenize:rX};function nX(){return{text:{91:tX}}}function rX(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 In(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return tt(l)?t(l):Ft(l)?e.check({tokenize:sX},t,n)(l):n(l)}}function sX(e,t,n){return Pt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function iX(e){return uN([NY(),PY(),KY(e),JY(),nX()])}const aX={};function d8(e){const t=this,n=e||aX,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(iX(n)),i.push(CY()),a.push(AY(n))}function oX(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};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 a(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 o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function lX(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,a,o,l){const c=i.value||"",u=o.createTracker(l),d="$".repeat(Math.max(LN(c,"$")+1,2)),f=o.enter("mathFlow");let m=u.move(d);if(i.meta){const p=o.enter("mathFlowMeta");m+=u.move(o.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,a,o){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<o.unsafe.length;){const f=o.unsafe[d];if(!f.atBreak)continue;const m=o.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 cX={tokenize:uX,concrete:!0,name:"mathFlow"},h8={tokenize:dX,partial:!0};function uX(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 a=0;return o;function o(g){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(g)}function l(g){return g===36?(e.consume(g),a++,l):a<2?n(g):(e.exit("mathFlowFenceSequence"),Pt(e,c,"whitespace")(g))}function c(g){return g===null||tt(g)?d(g):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(g))}function u(g){return g===null||tt(g)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(g)):g===36?n(g):(e.consume(g),u)}function d(g){return e.exit("mathFlowFence"),r.interrupt?t(g):e.attempt(h8,f,w)(g)}function f(g){return e.attempt({tokenize:v,partial:!0},w,m)(g)}function m(g){return(i?Pt(e,p,"linePrefix",i+1):p)(g)}function p(g){return g===null?w(g):tt(g)?e.attempt(h8,f,w)(g):(e.enter("mathFlowValue"),y(g))}function y(g){return g===null||tt(g)?(e.exit("mathFlowValue"),p(g)):(e.consume(g),y)}function w(g){return e.exit("mathFlow"),t(g)}function v(g,x,k){let A=0;return Pt(g,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function T(z){return g.enter("mathFlowFence"),g.enter("mathFlowFenceSequence"),C(z)}function C(z){return z===36?(A++,g.consume(z),C):A<a?k(z):(g.exit("mathFlowFenceSequence"),Pt(g,j,"whitespace")(z))}function j(z){return z===null||tt(z)?(g.exit("mathFlowFence"),x(z)):k(z)}}}function dX(e,t,n){const r=this;return s;function s(a){return a===null?t(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function hX(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:fX,previous:mX,name:"mathText"};function r(s,i,a){let o=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),o++,d):o<2&&!n?a(y):(s.exit("mathTextSequence"),f(y))}function f(y){return y===null?a(y):y===36?(c=s.enter("mathTextSequence"),l=0,p(y)):y===32?(s.enter("space"),s.consume(y),s.exit("space"),f):tt(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||tt(y)?(s.exit("mathTextData"),f(y)):(s.consume(y),m)}function p(y){return y===36?(s.consume(y),l++,p):l===o?(s.exit("mathTextSequence"),s.exit("mathText"),i(y)):(c.type="mathTextData",m(y))}}}function fX(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 mX(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function pX(e){return{flow:{36:cX},text:{36:hX(e)}}}class Se extends Error{constructor(t,n){var r="KaTeX parse error: "+t,s,i,a=n&&n.loc;if(a&&a.start<=a.end){var o=a.lexer.input;s=a.start,i=a.end,s===o.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var l=o.slice(s,i).replace(/[^]/g,"$&̲"),c;s>15?c="…"+o.slice(s-15,s):c=o.slice(0,s);var u;i+15<o.length?u=o.slice(i,i+15)+"…":u=o.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,Se.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var gX=/([A-Z])/g,yX=e=>e.replace(gX,"-$1").toLowerCase(),bX={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},vX=/[&><"']/g,fs=e=>String(e).replace(vX,t=>bX[t]),Wp=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?Wp(e.body[0]):e:e.type==="font"?Wp(e.body):e,xX=new Set(["mathord","textord","atom"]),Wo=e=>xX.has(Wp(e).type),wX=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"},Kg={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 _X(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 kX(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return _X(t)}function SX(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:kX(r)}class C3{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(Kg)){var r=Kg[n];r&&SX(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 Se("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=wX(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class dl{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 Ia[TX[this.id]]}sub(){return Ia[CX[this.id]]}fracNum(){return Ia[AX[this.id]]}fracDen(){return Ia[EX[this.id]]}cramp(){return Ia[MX[this.id]]}text(){return Ia[NX[this.id]]}isTight(){return this.size>=2}}var A3=0,Yg=1,Md=2,jo=3,g0=4,Pi=5,Xd=6,Cs=7,Ia=[new dl(A3,0,!1),new dl(Yg,0,!0),new dl(Md,1,!1),new dl(jo,1,!0),new dl(g0,2,!1),new dl(Pi,2,!0),new dl(Xd,3,!1),new dl(Cs,3,!0)],TX=[g0,Pi,g0,Pi,Xd,Cs,Xd,Cs],CX=[Pi,Pi,Pi,Pi,Cs,Cs,Cs,Cs],AX=[Md,jo,g0,Pi,Xd,Cs,Xd,Cs],EX=[jo,jo,Pi,Pi,Cs,Cs,Cs,Cs],MX=[Yg,Yg,jo,jo,Pi,Pi,Cs,Cs],NX=[A3,Yg,Md,jo,Md,jo,Md,jo],Ct={DISPLAY:Ia[A3],TEXT:Ia[Md],SCRIPT:Ia[g0],SCRIPTSCRIPT:Ia[Xd]},ix=[{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 IX(e){for(var t=0;t<ix.length;t++)for(var n=ix[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 Gp=[];ix.forEach(e=>e.blocks.forEach(t=>Gp.push(...t)));function nI(e){for(var t=0;t<Gp.length;t+=2)if(e>=Gp[t]&&e<=Gp[t+1])return!0;return!1}var Nr=e=>e+" "+e,Ku=80,RX=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"},jX=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"},DX=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"},OX=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"},LX=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"},BX=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},zX=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"},$X=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=RX(n,Ku);break;case"sqrtSize1":s=jX(n,Ku);break;case"sqrtSize2":s=DX(n,Ku);break;case"sqrtSize3":s=OX(n,Ku);break;case"sqrtSize4":s=LX(n,Ku);break;case"sqrtTall":s=zX(n,Ku,r)}return s},PX=function(t,n){switch(t){case"⎜":return Nr("M291 0 H417 V"+n+" H291z");case"∣":return Nr("M145 0 H188 V"+n+" H145z");case"∥":return Nr("M145 0 H188 V"+n+" H145z")+Nr("M367 0 H410 V"+n+" H367z");case"⎟":return Nr("M457 0 H583 V"+n+" H457z");case"⎢":return Nr("M319 0 H403 V"+n+" H319z");case"⎥":return Nr("M263 0 H347 V"+n+" H263z");case"⎪":return Nr("M384 0 H504 V"+n+" H384z");case"⏐":return Nr("M312 0 H355 V"+n+" H312z");case"‖":return Nr("M257 0 H300 V"+n+" H257z")+Nr("M478 0 H521 V"+n+" H478z");default:return""}},f8={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:Nr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Nr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Nr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Nr("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:Nr("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:Nr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Nr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Nr("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`},qX=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 UX(e){return"toText"in e}class _h{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(UX(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var ax={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},HX={ex:!0,em:!0,mu:!0},rI=function(t){return typeof t!="string"&&(t=t.unit),t in ax||t in HX||t==="ex"},er=function(t,n){var r;if(t.unit in ax)r=ax[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 Se("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},Ie=function(t){return+t.toFixed(4)+"em"},ec=function(t){return t.filter(n=>n).join(" ")},E3=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=yX(r)+":"+s+";")}return n},sI=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)}},iI=function(t){var n=document.createElement(t);n.className=ec(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},FX=/[\s"'>/=\x00-\x1f]/,aI=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+fs(ec(this.classes))+'"');var r=E3(this.style);r&&(n+=' style="'+fs(r)+'"');for(var s of Object.keys(this.attributes)){if(FX.test(s))throw new Se("Invalid attribute name '"+s+"'");n+=" "+s+'="'+fs(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class kh{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,sI.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return iI.call(this,"span")}toMarkup(){return aI.call(this,"span")}}class cy{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,sI.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 iI.call(this,"a")}toMarkup(){return aI.call(this,"a")}}class VX{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="'+fs(this.src)+'"'+(' alt="'+fs(this.alt)+'"'),n=E3(this.style);return n&&(t+=' style="'+fs(n)+'"'),t+="'/>",t}}var WX={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class wi{constructor(t,n,r,s,i,a,o,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=a||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var c=IX(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=WX[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=Ie(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=ec(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+=fs(ec(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+Ie(this.italic)+";"),r+=E3(this.style),r&&(t=!0,n+=' style="'+fs(r)+'"');var s=fs(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class Uo{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+'="'+fs(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class tc{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",f8[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+fs(this.alternate)+'"/>':'<path d="'+fs(f8[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+'="'+fs(this.attributes[n])+'"';return t+="/>",t}}function GX(e){if(e instanceof wi)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function KX(e){if(e instanceof kh)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var YX=e=>e instanceof kh||e instanceof cy||e instanceof _h,za={"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]}},Fm={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]},m8={Å:"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 oI(e,t){za[e]=t}function M3(e,t,n){if(!za[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=za[t][r];if(!s&&e[0]in m8&&(r=m8[e[0]].charCodeAt(0),s=za[t][r]),!s&&n==="text"&&nI(r)&&(s=za[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var Cv={};function XX(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Cv[t]){var n=Cv[t]={cssEmPerMu:Fm.quad[t]/18};for(var r in Fm)Fm.hasOwnProperty(r)&&(n[r]=Fm[r][t])}return Cv[t]}var Yn={math:{},text:{}};function _(e,t,n,r,s,i){Yn[e][s]={font:t,group:n,replace:r},i&&r&&(Yn[e][r]=Yn[e][s])}var S="math",ge="text",N="main",U="ams",Xn="accent-token",We="bin",Ns="close",Sh="inner",dt="mathord",Sr="op-token",_i="open",em="punct",F="rel",Go="spacing",X="textord";_(S,N,F,"≡","\\equiv",!0);_(S,N,F,"≺","\\prec",!0);_(S,N,F,"≻","\\succ",!0);_(S,N,F,"∼","\\sim",!0);_(S,N,F,"⊥","\\perp");_(S,N,F,"⪯","\\preceq",!0);_(S,N,F,"⪰","\\succeq",!0);_(S,N,F,"≃","\\simeq",!0);_(S,N,F,"∣","\\mid",!0);_(S,N,F,"≪","\\ll",!0);_(S,N,F,"≫","\\gg",!0);_(S,N,F,"≍","\\asymp",!0);_(S,N,F,"∥","\\parallel");_(S,N,F,"⋈","\\bowtie",!0);_(S,N,F,"⌣","\\smile",!0);_(S,N,F,"⊑","\\sqsubseteq",!0);_(S,N,F,"⊒","\\sqsupseteq",!0);_(S,N,F,"≐","\\doteq",!0);_(S,N,F,"⌢","\\frown",!0);_(S,N,F,"∋","\\ni",!0);_(S,N,F,"∝","\\propto",!0);_(S,N,F,"⊢","\\vdash",!0);_(S,N,F,"⊣","\\dashv",!0);_(S,N,F,"∋","\\owns");_(S,N,em,".","\\ldotp");_(S,N,em,"⋅","\\cdotp");_(S,N,em,"⋅","·");_(ge,N,X,"⋅","·");_(S,N,X,"#","\\#");_(ge,N,X,"#","\\#");_(S,N,X,"&","\\&");_(ge,N,X,"&","\\&");_(S,N,X,"ℵ","\\aleph",!0);_(S,N,X,"∀","\\forall",!0);_(S,N,X,"ℏ","\\hbar",!0);_(S,N,X,"∃","\\exists",!0);_(S,N,X,"∇","\\nabla",!0);_(S,N,X,"♭","\\flat",!0);_(S,N,X,"ℓ","\\ell",!0);_(S,N,X,"♮","\\natural",!0);_(S,N,X,"♣","\\clubsuit",!0);_(S,N,X,"℘","\\wp",!0);_(S,N,X,"♯","\\sharp",!0);_(S,N,X,"♢","\\diamondsuit",!0);_(S,N,X,"ℜ","\\Re",!0);_(S,N,X,"♡","\\heartsuit",!0);_(S,N,X,"ℑ","\\Im",!0);_(S,N,X,"♠","\\spadesuit",!0);_(S,N,X,"§","\\S",!0);_(ge,N,X,"§","\\S");_(S,N,X,"¶","\\P",!0);_(ge,N,X,"¶","\\P");_(S,N,X,"†","\\dag");_(ge,N,X,"†","\\dag");_(ge,N,X,"†","\\textdagger");_(S,N,X,"‡","\\ddag");_(ge,N,X,"‡","\\ddag");_(ge,N,X,"‡","\\textdaggerdbl");_(S,N,Ns,"⎱","\\rmoustache",!0);_(S,N,_i,"⎰","\\lmoustache",!0);_(S,N,Ns,"⟯","\\rgroup",!0);_(S,N,_i,"⟮","\\lgroup",!0);_(S,N,We,"∓","\\mp",!0);_(S,N,We,"⊖","\\ominus",!0);_(S,N,We,"⊎","\\uplus",!0);_(S,N,We,"⊓","\\sqcap",!0);_(S,N,We,"∗","\\ast");_(S,N,We,"⊔","\\sqcup",!0);_(S,N,We,"◯","\\bigcirc",!0);_(S,N,We,"∙","\\bullet",!0);_(S,N,We,"‡","\\ddagger");_(S,N,We,"≀","\\wr",!0);_(S,N,We,"⨿","\\amalg");_(S,N,We,"&","\\And");_(S,N,F,"⟵","\\longleftarrow",!0);_(S,N,F,"⇐","\\Leftarrow",!0);_(S,N,F,"⟸","\\Longleftarrow",!0);_(S,N,F,"⟶","\\longrightarrow",!0);_(S,N,F,"⇒","\\Rightarrow",!0);_(S,N,F,"⟹","\\Longrightarrow",!0);_(S,N,F,"↔","\\leftrightarrow",!0);_(S,N,F,"⟷","\\longleftrightarrow",!0);_(S,N,F,"⇔","\\Leftrightarrow",!0);_(S,N,F,"⟺","\\Longleftrightarrow",!0);_(S,N,F,"↦","\\mapsto",!0);_(S,N,F,"⟼","\\longmapsto",!0);_(S,N,F,"↗","\\nearrow",!0);_(S,N,F,"↩","\\hookleftarrow",!0);_(S,N,F,"↪","\\hookrightarrow",!0);_(S,N,F,"↘","\\searrow",!0);_(S,N,F,"↼","\\leftharpoonup",!0);_(S,N,F,"⇀","\\rightharpoonup",!0);_(S,N,F,"↙","\\swarrow",!0);_(S,N,F,"↽","\\leftharpoondown",!0);_(S,N,F,"⇁","\\rightharpoondown",!0);_(S,N,F,"↖","\\nwarrow",!0);_(S,N,F,"⇌","\\rightleftharpoons",!0);_(S,U,F,"≮","\\nless",!0);_(S,U,F,"","\\@nleqslant");_(S,U,F,"","\\@nleqq");_(S,U,F,"⪇","\\lneq",!0);_(S,U,F,"≨","\\lneqq",!0);_(S,U,F,"","\\@lvertneqq");_(S,U,F,"⋦","\\lnsim",!0);_(S,U,F,"⪉","\\lnapprox",!0);_(S,U,F,"⊀","\\nprec",!0);_(S,U,F,"⋠","\\npreceq",!0);_(S,U,F,"⋨","\\precnsim",!0);_(S,U,F,"⪹","\\precnapprox",!0);_(S,U,F,"≁","\\nsim",!0);_(S,U,F,"","\\@nshortmid");_(S,U,F,"∤","\\nmid",!0);_(S,U,F,"⊬","\\nvdash",!0);_(S,U,F,"⊭","\\nvDash",!0);_(S,U,F,"⋪","\\ntriangleleft");_(S,U,F,"⋬","\\ntrianglelefteq",!0);_(S,U,F,"⊊","\\subsetneq",!0);_(S,U,F,"","\\@varsubsetneq");_(S,U,F,"⫋","\\subsetneqq",!0);_(S,U,F,"","\\@varsubsetneqq");_(S,U,F,"≯","\\ngtr",!0);_(S,U,F,"","\\@ngeqslant");_(S,U,F,"","\\@ngeqq");_(S,U,F,"⪈","\\gneq",!0);_(S,U,F,"≩","\\gneqq",!0);_(S,U,F,"","\\@gvertneqq");_(S,U,F,"⋧","\\gnsim",!0);_(S,U,F,"⪊","\\gnapprox",!0);_(S,U,F,"⊁","\\nsucc",!0);_(S,U,F,"⋡","\\nsucceq",!0);_(S,U,F,"⋩","\\succnsim",!0);_(S,U,F,"⪺","\\succnapprox",!0);_(S,U,F,"≆","\\ncong",!0);_(S,U,F,"","\\@nshortparallel");_(S,U,F,"∦","\\nparallel",!0);_(S,U,F,"⊯","\\nVDash",!0);_(S,U,F,"⋫","\\ntriangleright");_(S,U,F,"⋭","\\ntrianglerighteq",!0);_(S,U,F,"","\\@nsupseteqq");_(S,U,F,"⊋","\\supsetneq",!0);_(S,U,F,"","\\@varsupsetneq");_(S,U,F,"⫌","\\supsetneqq",!0);_(S,U,F,"","\\@varsupsetneqq");_(S,U,F,"⊮","\\nVdash",!0);_(S,U,F,"⪵","\\precneqq",!0);_(S,U,F,"⪶","\\succneqq",!0);_(S,U,F,"","\\@nsubseteqq");_(S,U,We,"⊴","\\unlhd");_(S,U,We,"⊵","\\unrhd");_(S,U,F,"↚","\\nleftarrow",!0);_(S,U,F,"↛","\\nrightarrow",!0);_(S,U,F,"⇍","\\nLeftarrow",!0);_(S,U,F,"⇏","\\nRightarrow",!0);_(S,U,F,"↮","\\nleftrightarrow",!0);_(S,U,F,"⇎","\\nLeftrightarrow",!0);_(S,U,F,"△","\\vartriangle");_(S,U,X,"ℏ","\\hslash");_(S,U,X,"▽","\\triangledown");_(S,U,X,"◊","\\lozenge");_(S,U,X,"Ⓢ","\\circledS");_(S,U,X,"®","\\circledR");_(ge,U,X,"®","\\circledR");_(S,U,X,"∡","\\measuredangle",!0);_(S,U,X,"∄","\\nexists");_(S,U,X,"℧","\\mho");_(S,U,X,"Ⅎ","\\Finv",!0);_(S,U,X,"⅁","\\Game",!0);_(S,U,X,"‵","\\backprime");_(S,U,X,"▲","\\blacktriangle");_(S,U,X,"▼","\\blacktriangledown");_(S,U,X,"■","\\blacksquare");_(S,U,X,"⧫","\\blacklozenge");_(S,U,X,"★","\\bigstar");_(S,U,X,"∢","\\sphericalangle",!0);_(S,U,X,"∁","\\complement",!0);_(S,U,X,"ð","\\eth",!0);_(ge,N,X,"ð","ð");_(S,U,X,"╱","\\diagup");_(S,U,X,"╲","\\diagdown");_(S,U,X,"□","\\square");_(S,U,X,"□","\\Box");_(S,U,X,"◊","\\Diamond");_(S,U,X,"¥","\\yen",!0);_(ge,U,X,"¥","\\yen",!0);_(S,U,X,"✓","\\checkmark",!0);_(ge,U,X,"✓","\\checkmark");_(S,U,X,"ℶ","\\beth",!0);_(S,U,X,"ℸ","\\daleth",!0);_(S,U,X,"ℷ","\\gimel",!0);_(S,U,X,"ϝ","\\digamma",!0);_(S,U,X,"ϰ","\\varkappa");_(S,U,_i,"┌","\\@ulcorner",!0);_(S,U,Ns,"┐","\\@urcorner",!0);_(S,U,_i,"└","\\@llcorner",!0);_(S,U,Ns,"┘","\\@lrcorner",!0);_(S,U,F,"≦","\\leqq",!0);_(S,U,F,"⩽","\\leqslant",!0);_(S,U,F,"⪕","\\eqslantless",!0);_(S,U,F,"≲","\\lesssim",!0);_(S,U,F,"⪅","\\lessapprox",!0);_(S,U,F,"≊","\\approxeq",!0);_(S,U,We,"⋖","\\lessdot");_(S,U,F,"⋘","\\lll",!0);_(S,U,F,"≶","\\lessgtr",!0);_(S,U,F,"⋚","\\lesseqgtr",!0);_(S,U,F,"⪋","\\lesseqqgtr",!0);_(S,U,F,"≑","\\doteqdot");_(S,U,F,"≓","\\risingdotseq",!0);_(S,U,F,"≒","\\fallingdotseq",!0);_(S,U,F,"∽","\\backsim",!0);_(S,U,F,"⋍","\\backsimeq",!0);_(S,U,F,"⫅","\\subseteqq",!0);_(S,U,F,"⋐","\\Subset",!0);_(S,U,F,"⊏","\\sqsubset",!0);_(S,U,F,"≼","\\preccurlyeq",!0);_(S,U,F,"⋞","\\curlyeqprec",!0);_(S,U,F,"≾","\\precsim",!0);_(S,U,F,"⪷","\\precapprox",!0);_(S,U,F,"⊲","\\vartriangleleft");_(S,U,F,"⊴","\\trianglelefteq");_(S,U,F,"⊨","\\vDash",!0);_(S,U,F,"⊪","\\Vvdash",!0);_(S,U,F,"⌣","\\smallsmile");_(S,U,F,"⌢","\\smallfrown");_(S,U,F,"≏","\\bumpeq",!0);_(S,U,F,"≎","\\Bumpeq",!0);_(S,U,F,"≧","\\geqq",!0);_(S,U,F,"⩾","\\geqslant",!0);_(S,U,F,"⪖","\\eqslantgtr",!0);_(S,U,F,"≳","\\gtrsim",!0);_(S,U,F,"⪆","\\gtrapprox",!0);_(S,U,We,"⋗","\\gtrdot");_(S,U,F,"⋙","\\ggg",!0);_(S,U,F,"≷","\\gtrless",!0);_(S,U,F,"⋛","\\gtreqless",!0);_(S,U,F,"⪌","\\gtreqqless",!0);_(S,U,F,"≖","\\eqcirc",!0);_(S,U,F,"≗","\\circeq",!0);_(S,U,F,"≜","\\triangleq",!0);_(S,U,F,"∼","\\thicksim");_(S,U,F,"≈","\\thickapprox");_(S,U,F,"⫆","\\supseteqq",!0);_(S,U,F,"⋑","\\Supset",!0);_(S,U,F,"⊐","\\sqsupset",!0);_(S,U,F,"≽","\\succcurlyeq",!0);_(S,U,F,"⋟","\\curlyeqsucc",!0);_(S,U,F,"≿","\\succsim",!0);_(S,U,F,"⪸","\\succapprox",!0);_(S,U,F,"⊳","\\vartriangleright");_(S,U,F,"⊵","\\trianglerighteq");_(S,U,F,"⊩","\\Vdash",!0);_(S,U,F,"∣","\\shortmid");_(S,U,F,"∥","\\shortparallel");_(S,U,F,"≬","\\between",!0);_(S,U,F,"⋔","\\pitchfork",!0);_(S,U,F,"∝","\\varpropto");_(S,U,F,"◀","\\blacktriangleleft");_(S,U,F,"∴","\\therefore",!0);_(S,U,F,"∍","\\backepsilon");_(S,U,F,"▶","\\blacktriangleright");_(S,U,F,"∵","\\because",!0);_(S,U,F,"⋘","\\llless");_(S,U,F,"⋙","\\gggtr");_(S,U,We,"⊲","\\lhd");_(S,U,We,"⊳","\\rhd");_(S,U,F,"≂","\\eqsim",!0);_(S,N,F,"⋈","\\Join");_(S,U,F,"≑","\\Doteq",!0);_(S,U,We,"∔","\\dotplus",!0);_(S,U,We,"∖","\\smallsetminus");_(S,U,We,"⋒","\\Cap",!0);_(S,U,We,"⋓","\\Cup",!0);_(S,U,We,"⩞","\\doublebarwedge",!0);_(S,U,We,"⊟","\\boxminus",!0);_(S,U,We,"⊞","\\boxplus",!0);_(S,U,We,"⋇","\\divideontimes",!0);_(S,U,We,"⋉","\\ltimes",!0);_(S,U,We,"⋊","\\rtimes",!0);_(S,U,We,"⋋","\\leftthreetimes",!0);_(S,U,We,"⋌","\\rightthreetimes",!0);_(S,U,We,"⋏","\\curlywedge",!0);_(S,U,We,"⋎","\\curlyvee",!0);_(S,U,We,"⊝","\\circleddash",!0);_(S,U,We,"⊛","\\circledast",!0);_(S,U,We,"⋅","\\centerdot");_(S,U,We,"⊺","\\intercal",!0);_(S,U,We,"⋒","\\doublecap");_(S,U,We,"⋓","\\doublecup");_(S,U,We,"⊠","\\boxtimes",!0);_(S,U,F,"⇢","\\dashrightarrow",!0);_(S,U,F,"⇠","\\dashleftarrow",!0);_(S,U,F,"⇇","\\leftleftarrows",!0);_(S,U,F,"⇆","\\leftrightarrows",!0);_(S,U,F,"⇚","\\Lleftarrow",!0);_(S,U,F,"↞","\\twoheadleftarrow",!0);_(S,U,F,"↢","\\leftarrowtail",!0);_(S,U,F,"↫","\\looparrowleft",!0);_(S,U,F,"⇋","\\leftrightharpoons",!0);_(S,U,F,"↶","\\curvearrowleft",!0);_(S,U,F,"↺","\\circlearrowleft",!0);_(S,U,F,"↰","\\Lsh",!0);_(S,U,F,"⇈","\\upuparrows",!0);_(S,U,F,"↿","\\upharpoonleft",!0);_(S,U,F,"⇃","\\downharpoonleft",!0);_(S,N,F,"⊶","\\origof",!0);_(S,N,F,"⊷","\\imageof",!0);_(S,U,F,"⊸","\\multimap",!0);_(S,U,F,"↭","\\leftrightsquigarrow",!0);_(S,U,F,"⇉","\\rightrightarrows",!0);_(S,U,F,"⇄","\\rightleftarrows",!0);_(S,U,F,"↠","\\twoheadrightarrow",!0);_(S,U,F,"↣","\\rightarrowtail",!0);_(S,U,F,"↬","\\looparrowright",!0);_(S,U,F,"↷","\\curvearrowright",!0);_(S,U,F,"↻","\\circlearrowright",!0);_(S,U,F,"↱","\\Rsh",!0);_(S,U,F,"⇊","\\downdownarrows",!0);_(S,U,F,"↾","\\upharpoonright",!0);_(S,U,F,"⇂","\\downharpoonright",!0);_(S,U,F,"⇝","\\rightsquigarrow",!0);_(S,U,F,"⇝","\\leadsto");_(S,U,F,"⇛","\\Rrightarrow",!0);_(S,U,F,"↾","\\restriction");_(S,N,X,"‘","`");_(S,N,X,"$","\\$");_(ge,N,X,"$","\\$");_(ge,N,X,"$","\\textdollar");_(S,N,X,"%","\\%");_(ge,N,X,"%","\\%");_(S,N,X,"_","\\_");_(ge,N,X,"_","\\_");_(ge,N,X,"_","\\textunderscore");_(S,N,X,"∠","\\angle",!0);_(S,N,X,"∞","\\infty",!0);_(S,N,X,"′","\\prime");_(S,N,X,"△","\\triangle");_(S,N,X,"Γ","\\Gamma",!0);_(S,N,X,"Δ","\\Delta",!0);_(S,N,X,"Θ","\\Theta",!0);_(S,N,X,"Λ","\\Lambda",!0);_(S,N,X,"Ξ","\\Xi",!0);_(S,N,X,"Π","\\Pi",!0);_(S,N,X,"Σ","\\Sigma",!0);_(S,N,X,"Υ","\\Upsilon",!0);_(S,N,X,"Φ","\\Phi",!0);_(S,N,X,"Ψ","\\Psi",!0);_(S,N,X,"Ω","\\Omega",!0);_(S,N,X,"A","Α");_(S,N,X,"B","Β");_(S,N,X,"E","Ε");_(S,N,X,"Z","Ζ");_(S,N,X,"H","Η");_(S,N,X,"I","Ι");_(S,N,X,"K","Κ");_(S,N,X,"M","Μ");_(S,N,X,"N","Ν");_(S,N,X,"O","Ο");_(S,N,X,"P","Ρ");_(S,N,X,"T","Τ");_(S,N,X,"X","Χ");_(S,N,X,"¬","\\neg",!0);_(S,N,X,"¬","\\lnot");_(S,N,X,"⊤","\\top");_(S,N,X,"⊥","\\bot");_(S,N,X,"∅","\\emptyset");_(S,U,X,"∅","\\varnothing");_(S,N,dt,"α","\\alpha",!0);_(S,N,dt,"β","\\beta",!0);_(S,N,dt,"γ","\\gamma",!0);_(S,N,dt,"δ","\\delta",!0);_(S,N,dt,"ϵ","\\epsilon",!0);_(S,N,dt,"ζ","\\zeta",!0);_(S,N,dt,"η","\\eta",!0);_(S,N,dt,"θ","\\theta",!0);_(S,N,dt,"ι","\\iota",!0);_(S,N,dt,"κ","\\kappa",!0);_(S,N,dt,"λ","\\lambda",!0);_(S,N,dt,"μ","\\mu",!0);_(S,N,dt,"ν","\\nu",!0);_(S,N,dt,"ξ","\\xi",!0);_(S,N,dt,"ο","\\omicron",!0);_(S,N,dt,"π","\\pi",!0);_(S,N,dt,"ρ","\\rho",!0);_(S,N,dt,"σ","\\sigma",!0);_(S,N,dt,"τ","\\tau",!0);_(S,N,dt,"υ","\\upsilon",!0);_(S,N,dt,"ϕ","\\phi",!0);_(S,N,dt,"χ","\\chi",!0);_(S,N,dt,"ψ","\\psi",!0);_(S,N,dt,"ω","\\omega",!0);_(S,N,dt,"ε","\\varepsilon",!0);_(S,N,dt,"ϑ","\\vartheta",!0);_(S,N,dt,"ϖ","\\varpi",!0);_(S,N,dt,"ϱ","\\varrho",!0);_(S,N,dt,"ς","\\varsigma",!0);_(S,N,dt,"φ","\\varphi",!0);_(S,N,We,"∗","*",!0);_(S,N,We,"+","+");_(S,N,We,"−","-",!0);_(S,N,We,"⋅","\\cdot",!0);_(S,N,We,"∘","\\circ",!0);_(S,N,We,"÷","\\div",!0);_(S,N,We,"±","\\pm",!0);_(S,N,We,"×","\\times",!0);_(S,N,We,"∩","\\cap",!0);_(S,N,We,"∪","\\cup",!0);_(S,N,We,"∖","\\setminus",!0);_(S,N,We,"∧","\\land");_(S,N,We,"∨","\\lor");_(S,N,We,"∧","\\wedge",!0);_(S,N,We,"∨","\\vee",!0);_(S,N,X,"√","\\surd");_(S,N,_i,"⟨","\\langle",!0);_(S,N,_i,"∣","\\lvert");_(S,N,_i,"∥","\\lVert");_(S,N,Ns,"?","?");_(S,N,Ns,"!","!");_(S,N,Ns,"⟩","\\rangle",!0);_(S,N,Ns,"∣","\\rvert");_(S,N,Ns,"∥","\\rVert");_(S,N,F,"=","=");_(S,N,F,":",":");_(S,N,F,"≈","\\approx",!0);_(S,N,F,"≅","\\cong",!0);_(S,N,F,"≥","\\ge");_(S,N,F,"≥","\\geq",!0);_(S,N,F,"←","\\gets");_(S,N,F,">","\\gt",!0);_(S,N,F,"∈","\\in",!0);_(S,N,F,"","\\@not");_(S,N,F,"⊂","\\subset",!0);_(S,N,F,"⊃","\\supset",!0);_(S,N,F,"⊆","\\subseteq",!0);_(S,N,F,"⊇","\\supseteq",!0);_(S,U,F,"⊈","\\nsubseteq",!0);_(S,U,F,"⊉","\\nsupseteq",!0);_(S,N,F,"⊨","\\models");_(S,N,F,"←","\\leftarrow",!0);_(S,N,F,"≤","\\le");_(S,N,F,"≤","\\leq",!0);_(S,N,F,"<","\\lt",!0);_(S,N,F,"→","\\rightarrow",!0);_(S,N,F,"→","\\to");_(S,U,F,"≱","\\ngeq",!0);_(S,U,F,"≰","\\nleq",!0);_(S,N,Go," ","\\ ");_(S,N,Go," ","\\space");_(S,N,Go," ","\\nobreakspace");_(ge,N,Go," ","\\ ");_(ge,N,Go," "," ");_(ge,N,Go," ","\\space");_(ge,N,Go," ","\\nobreakspace");_(S,N,Go,"","\\nobreak");_(S,N,Go,"","\\allowbreak");_(S,N,em,",",",");_(S,N,em,";",";");_(S,U,We,"⊼","\\barwedge",!0);_(S,U,We,"⊻","\\veebar",!0);_(S,N,We,"⊙","\\odot",!0);_(S,N,We,"⊕","\\oplus",!0);_(S,N,We,"⊗","\\otimes",!0);_(S,N,X,"∂","\\partial",!0);_(S,N,We,"⊘","\\oslash",!0);_(S,U,We,"⊚","\\circledcirc",!0);_(S,U,We,"⊡","\\boxdot",!0);_(S,N,We,"△","\\bigtriangleup");_(S,N,We,"▽","\\bigtriangledown");_(S,N,We,"†","\\dagger");_(S,N,We,"⋄","\\diamond");_(S,N,We,"⋆","\\star");_(S,N,We,"◃","\\triangleleft");_(S,N,We,"▹","\\triangleright");_(S,N,_i,"{","\\{");_(ge,N,X,"{","\\{");_(ge,N,X,"{","\\textbraceleft");_(S,N,Ns,"}","\\}");_(ge,N,X,"}","\\}");_(ge,N,X,"}","\\textbraceright");_(S,N,_i,"{","\\lbrace");_(S,N,Ns,"}","\\rbrace");_(S,N,_i,"[","\\lbrack",!0);_(ge,N,X,"[","\\lbrack",!0);_(S,N,Ns,"]","\\rbrack",!0);_(ge,N,X,"]","\\rbrack",!0);_(S,N,_i,"(","\\lparen",!0);_(S,N,Ns,")","\\rparen",!0);_(ge,N,X,"<","\\textless",!0);_(ge,N,X,">","\\textgreater",!0);_(S,N,_i,"⌊","\\lfloor",!0);_(S,N,Ns,"⌋","\\rfloor",!0);_(S,N,_i,"⌈","\\lceil",!0);_(S,N,Ns,"⌉","\\rceil",!0);_(S,N,X,"\\","\\backslash");_(S,N,X,"∣","|");_(S,N,X,"∣","\\vert");_(ge,N,X,"|","\\textbar",!0);_(S,N,X,"∥","\\|");_(S,N,X,"∥","\\Vert");_(ge,N,X,"∥","\\textbardbl");_(ge,N,X,"~","\\textasciitilde");_(ge,N,X,"\\","\\textbackslash");_(ge,N,X,"^","\\textasciicircum");_(S,N,F,"↑","\\uparrow",!0);_(S,N,F,"⇑","\\Uparrow",!0);_(S,N,F,"↓","\\downarrow",!0);_(S,N,F,"⇓","\\Downarrow",!0);_(S,N,F,"↕","\\updownarrow",!0);_(S,N,F,"⇕","\\Updownarrow",!0);_(S,N,Sr,"∐","\\coprod");_(S,N,Sr,"⋁","\\bigvee");_(S,N,Sr,"⋀","\\bigwedge");_(S,N,Sr,"⨄","\\biguplus");_(S,N,Sr,"⋂","\\bigcap");_(S,N,Sr,"⋃","\\bigcup");_(S,N,Sr,"∫","\\int");_(S,N,Sr,"∫","\\intop");_(S,N,Sr,"∬","\\iint");_(S,N,Sr,"∭","\\iiint");_(S,N,Sr,"∏","\\prod");_(S,N,Sr,"∑","\\sum");_(S,N,Sr,"⨂","\\bigotimes");_(S,N,Sr,"⨁","\\bigoplus");_(S,N,Sr,"⨀","\\bigodot");_(S,N,Sr,"∮","\\oint");_(S,N,Sr,"∯","\\oiint");_(S,N,Sr,"∰","\\oiiint");_(S,N,Sr,"⨆","\\bigsqcup");_(S,N,Sr,"∫","\\smallint");_(ge,N,Sh,"…","\\textellipsis");_(S,N,Sh,"…","\\mathellipsis");_(ge,N,Sh,"…","\\ldots",!0);_(S,N,Sh,"…","\\ldots",!0);_(S,N,Sh,"⋯","\\@cdots",!0);_(S,N,Sh,"⋱","\\ddots",!0);_(S,N,X,"⋮","\\varvdots");_(ge,N,X,"⋮","\\varvdots");_(S,N,Xn,"ˊ","\\acute");_(S,N,Xn,"ˋ","\\grave");_(S,N,Xn,"¨","\\ddot");_(S,N,Xn,"~","\\tilde");_(S,N,Xn,"ˉ","\\bar");_(S,N,Xn,"˘","\\breve");_(S,N,Xn,"ˇ","\\check");_(S,N,Xn,"^","\\hat");_(S,N,Xn,"⃗","\\vec");_(S,N,Xn,"˙","\\dot");_(S,N,Xn,"˚","\\mathring");_(S,N,dt,"","\\@imath");_(S,N,dt,"","\\@jmath");_(S,N,X,"ı","ı");_(S,N,X,"ȷ","ȷ");_(ge,N,X,"ı","\\i",!0);_(ge,N,X,"ȷ","\\j",!0);_(ge,N,X,"ß","\\ss",!0);_(ge,N,X,"æ","\\ae",!0);_(ge,N,X,"œ","\\oe",!0);_(ge,N,X,"ø","\\o",!0);_(ge,N,X,"Æ","\\AE",!0);_(ge,N,X,"Œ","\\OE",!0);_(ge,N,X,"Ø","\\O",!0);_(ge,N,Xn,"ˊ","\\'");_(ge,N,Xn,"ˋ","\\`");_(ge,N,Xn,"ˆ","\\^");_(ge,N,Xn,"˜","\\~");_(ge,N,Xn,"ˉ","\\=");_(ge,N,Xn,"˘","\\u");_(ge,N,Xn,"˙","\\.");_(ge,N,Xn,"¸","\\c");_(ge,N,Xn,"˚","\\r");_(ge,N,Xn,"ˇ","\\v");_(ge,N,Xn,"¨",'\\"');_(ge,N,Xn,"˝","\\H");_(ge,N,Xn,"◯","\\textcircled");var lI={"--":!0,"---":!0,"``":!0,"''":!0};_(ge,N,X,"–","--",!0);_(ge,N,X,"–","\\textendash");_(ge,N,X,"—","---",!0);_(ge,N,X,"—","\\textemdash");_(ge,N,X,"‘","`",!0);_(ge,N,X,"‘","\\textquoteleft");_(ge,N,X,"’","'",!0);_(ge,N,X,"’","\\textquoteright");_(ge,N,X,"“","``",!0);_(ge,N,X,"“","\\textquotedblleft");_(ge,N,X,"”","''",!0);_(ge,N,X,"”","\\textquotedblright");_(S,N,X,"°","\\degree",!0);_(ge,N,X,"°","\\degree");_(ge,N,X,"°","\\textdegree",!0);_(S,N,X,"£","\\pounds");_(S,N,X,"£","\\mathsterling",!0);_(ge,N,X,"£","\\pounds");_(ge,N,X,"£","\\textsterling",!0);_(S,U,X,"✠","\\maltese");_(ge,U,X,"✠","\\maltese");var p8='0123456789/@."';for(var Av=0;Av<p8.length;Av++){var g8=p8.charAt(Av);_(S,N,X,g8,g8)}var y8='0123456789!@*()-=+";:?/.,';for(var Ev=0;Ev<y8.length;Ev++){var b8=y8.charAt(Ev);_(ge,N,X,b8,b8)}var Xg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Mv=0;Mv<Xg.length;Mv++){var Vm=Xg.charAt(Mv);_(S,N,dt,Vm,Vm),_(ge,N,X,Vm,Vm)}_(S,U,X,"C","ℂ");_(ge,U,X,"C","ℂ");_(S,U,X,"H","ℍ");_(ge,U,X,"H","ℍ");_(S,U,X,"N","ℕ");_(ge,U,X,"N","ℕ");_(S,U,X,"P","ℙ");_(ge,U,X,"P","ℙ");_(S,U,X,"Q","ℚ");_(ge,U,X,"Q","ℚ");_(S,U,X,"R","ℝ");_(ge,U,X,"R","ℝ");_(S,U,X,"Z","ℤ");_(ge,U,X,"Z","ℤ");_(S,N,dt,"h","ℎ");_(ge,N,dt,"h","ℎ");var vt;for(var ys=0;ys<Xg.length;ys++){var nr=Xg.charAt(ys);vt=String.fromCharCode(55349,56320+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56372+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56424+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56580+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56684+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56736+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56788+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56840+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56944+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),ys<26&&(vt=String.fromCharCode(55349,56632+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt),vt=String.fromCharCode(55349,56476+ys),_(S,N,dt,nr,vt),_(ge,N,X,nr,vt))}vt="𝕜";_(S,N,dt,"k",vt);_(ge,N,X,"k",vt);for(var Ic=0;Ic<10;Ic++){var hl=Ic.toString();vt=String.fromCharCode(55349,57294+Ic),_(S,N,dt,hl,vt),_(ge,N,X,hl,vt),vt=String.fromCharCode(55349,57314+Ic),_(S,N,dt,hl,vt),_(ge,N,X,hl,vt),vt=String.fromCharCode(55349,57324+Ic),_(S,N,dt,hl,vt),_(ge,N,X,hl,vt),vt=String.fromCharCode(55349,57334+Ic),_(S,N,dt,hl,vt),_(ge,N,X,hl,vt)}var lx="ÐÞþ";for(var Nv=0;Nv<lx.length;Nv++){var Wm=lx.charAt(Nv);_(S,N,dt,Wm,Wm),_(ge,N,X,Wm,Wm)}var cx={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},v8={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},x8={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},QX={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},Wc={mathClass:"",textClass:"",font:""},w8={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},_8={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},k8={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},ux={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},dx={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},S8={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},hx={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},T8=[cx,cx,v8,v8,x8,x8,QX,Wc,Wc,Wc,w8,w8,_8,_8,k8,k8,ux,ux,dx,dx,S8,S8,Wc,Wc,hx,hx],JX=[cx,Wc,ux,dx,hx],ZX=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 T8[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return JX[i]}else{if(r===120485||r===120486)return T8[0];if(120486<r&&r<120782)return Wc;throw new Se("Unsupported character: "+e)}},uy=function(t,n,r){if(Yn[r][t]){var s=Yn[r][t].replace;s&&(t=s)}return{value:t,metrics:M3(t,n,r)}},xs=function(t,n,r,s,i){var a=uy(t,n,r),o=a.metrics;t=a.value;var l;if(o){var c=o.italic;(r==="text"||s&&s.font==="mathit")&&(c=0),l=new wi(t,o.height,o.depth,c,o.skew,o.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+r+"'")),l=new wi(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},N3=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&uy(t,"Main-Bold",n).metrics?xs(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||Yn[n][t].font==="main"?xs(t,"Main-Regular",n,r,s):xs(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},eQ=function(t,n,r){return r!=="textord"&&uy(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},dy=function(t,n,r){var s=t.mode,i=t.text,a=["mord"],{font:o,fontFamily:l,fontWeight:c,fontShape:u}=n,d=s==="math"||s==="text"&&!!o,f=d?o:l,m="",p="";if(i.charCodeAt(0)===55349){var y=ZX(i);m=y.font,p=y[s+"Class"]}if(m)return xs(i,m,s,n,a.concat(p));if(f){var w,v;if(f==="boldsymbol"){var g=eQ(i,s,r);w=g.fontName,v=[g.fontClass]}else d?(w=fx[o].fontName,v=[o]):(w=Gm(l,c,u),v=[l,c,u]);if(uy(i,w,s).metrics)return xs(i,w,s,n,a.concat(v));if(lI.hasOwnProperty(i)&&w.slice(0,10)==="Typewriter"){for(var x=[],k=0;k<i.length;k++)x.push(xs(i[k],w,s,n,a.concat(v)));return Ko(x)}}if(r==="mathord")return xs(i,"Math-Italic",s,n,a.concat(["mathnormal"]));if(r==="textord"){var A=Yn[s][i]&&Yn[s][i].font;if(A==="ams"){var T=Gm("amsrm",c,u);return xs(i,T,s,n,a.concat("amsrm",c,u))}else if(A==="main"||!A){var C=Gm("textrm",c,u);return xs(i,C,s,n,a.concat(c,u))}else{var j=Gm(A,c,u);return xs(i,j,s,n,a.concat(j,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},tQ=(e,t)=>{if(ec(e.classes)!==ec(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},cI=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof wi&&r instanceof wi&&tQ(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},I3=function(t){for(var n=0,r=0,s=0,i=0;i<t.children.length;i++){var a=t.children[i];a.height>n&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}t.height=n,t.depth=r,t.maxFontSize=s},ve=function(t,n,r,s){var i=new kh(t,n,r,s);return I3(i),i},nc=(e,t,n,r)=>new kh(e,t,n,r),Qd=function(t,n,r){var s=ve([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ie(s.height),s.maxFontSize=1,s},nQ=function(t,n,r,s){var i=new cy(t,n,r,s);return I3(i),i},Ko=function(t){var n=new _h(t);return I3(n),n},Jd=function(t,n){return t instanceof _h?ve([],[t],n):t},rQ=function(t){if(t.positionType==="individualShift"){for(var n=t.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a<n.length;a++){var o=-n[a].shift-i-n[a].elem.depth,l=o-(n[a-1].elem.height+n[a-1].elem.depth);i=i+o,r.push({type:"kern",size:l}),r.push(n[a])}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}},un=function(t,n){for(var{children:r,depth:s}=rQ(t),i=0,a=0;a<r.length;a++){var o=r[a];if(o.type==="elem"){var l=o.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=ve(["pstrut"],[]);c.style.height=Ie(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,v=y.wrapperClasses||[],g=y.wrapperStyle||{},x=ve(v,[c,w],void 0,g);x.style.top=Ie(-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 k=ve(["vlist"],u);k.style.height=Ie(f);var A;if(d<0){var T=ve([],[]),C=ve(["vlist"],[T]);C.style.height=Ie(-d);var j=ve(["vlist-s"],[new wi("​")]);A=[ve(["vlist-r"],[k,j]),ve(["vlist-r"],[C])]}else A=[ve(["vlist-r"],[k])];var z=ve(["vlist-t"],A);return A.length===2&&z.classes.push("vlist-t2"),z.height=f,z.depth=-d,z},uI=(e,t)=>{var n=ve(["mspace"],[],t),r=er(e,t);return n.style.marginRight=Ie(r),n},Gm=(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},fx={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"}},dI={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},hI=function(t,n){var[r,s,i]=dI[t],a=new tc(r),o=new Uo([a],{width:Ie(s),height:Ie(i),style:"width:"+Ie(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=nc(["overlay"],[o],n);return l.height=i,l.style.height=Ie(i),l.style.width=Ie(s),l},Jn={number:3,unit:"mu"},Rc={number:4,unit:"mu"},uo={number:5,unit:"mu"},sQ={mord:{mop:Jn,mbin:Rc,mrel:uo,minner:Jn},mop:{mord:Jn,mop:Jn,mrel:uo,minner:Jn},mbin:{mord:Rc,mop:Rc,mopen:Rc,minner:Rc},mrel:{mord:uo,mop:uo,mopen:uo,minner:uo},mopen:{},mclose:{mop:Jn,mbin:Rc,mrel:uo,minner:Jn},mpunct:{mord:Jn,mop:Jn,mrel:uo,mopen:Jn,mclose:Jn,mpunct:Jn,minner:Jn},minner:{mord:Jn,mop:Jn,mbin:Rc,mrel:uo,mopen:Jn,mpunct:Jn,minner:Jn}},iQ={mord:{mop:Jn},mop:{mord:Jn,mop:Jn},mbin:{},mrel:{},mopen:{},mclose:{mop:Jn},mpunct:{},minner:{mop:Jn}},fI={},Qg={},Jg={};function qe(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=e,o={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)fI[n[l]]=o;t&&(i&&(Qg[t]=i),a&&(Jg[t]=a))}function Du(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;qe({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var Zg=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},_r=function(t){return t.type==="ordgroup"?t.body:[t]},aQ=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),oQ=new Set(["rightmost","mrel","mclose","mpunct"]),lQ={display:Ct.DISPLAY,text:Ct.TEXT,script:Ct.SCRIPT,scriptscript:Ct.SCRIPTSCRIPT},cQ={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Br=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],a=0;a<t.length;a++){var o=hn(t[a],n);if(o instanceof _h){var l=o.children;i.push(...l)}else i.push(o)}if(cI(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(lQ[u.style]))}var d=ve([s[0]||"leftmost"],[],n),f=ve([s[1]||"rightmost"],[],n),m=r==="root";return mx(i,(p,y)=>{var w=y.classes[0],v=p.classes[0];w==="mbin"&&oQ.has(v)?y.classes[0]="mord":v==="mbin"&&aQ.has(w)&&(p.classes[0]="mord")},{node:d},f,m),mx(i,(p,y)=>{var w,v,g=gx(y),x=gx(p),k=g&&x?p.hasClass("mtight")?(w=iQ[g])==null?void 0:w[x]:(v=sQ[g])==null?void 0:v[x]:null;if(k)return uI(k,c)},{node:d},f,m),i},mx=function(t,n,r,s,i){s&&t.push(s);for(var a=0;a<t.length;a++){var o=t[a],l=mI(o);if(l){mx(l.children,n,r,null,i);continue}var c=!o.hasClass("mspace");if(c){var u=n(o,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),a++))}c?r.node=o:i&&o.hasClass("newline")&&(r.node=ve(["leftmost"])),r.insertAfter=(d=>f=>{t.splice(d+1,0,f),a++})(a)}s&&t.pop()},mI=function(t){return t instanceof _h||t instanceof cy||t instanceof kh&&t.hasClass("enclosing")?t:null},px=function(t,n){var r=mI(t);if(r){var s=r.children;if(s.length){if(n==="right")return px(s[s.length-1],"right");if(n==="left")return px(s[0],"left")}}return t},gx=function(t,n){if(!t)return null;n&&(t=px(t,n));var r=t.classes[0];return cQ[r]||null},y0=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return ve(n.concat(r))},hn=function(t,n,r){if(!t)return ve();if(Qg[t.type]){var s=Qg[t.type](t,n);if(r&&n.size!==r.size){s=ve(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Se("Got group of unknown type: '"+t.type+"'")};function Km(e,t){var n=ve(["base"],e,t),r=ve(["strut"]);return r.style.height=Ie(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ie(-n.depth)),n.children.unshift(r),n}function yx(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=Br(e,t,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o<r.length;o++)if(a.push(r[o]),r[o].hasClass("mbin")||r[o].hasClass("mrel")||r[o].hasClass("allowbreak")){for(var l=!1;o<r.length-1&&r[o+1].hasClass("mspace")&&!r[o+1].hasClass("newline");)o++,a.push(r[o]),r[o].hasClass("nobreak")&&(l=!0);l||(i.push(Km(a,t)),a=[])}else r[o].hasClass("newline")&&(a.pop(),a.length>0&&(i.push(Km(a,t)),a=[]),i.push(r[o]));a.length>0&&i.push(Km(a,t));var c;n?(c=Km(Br(n,t,!0),t),c.classes=["tag"],i.push(c)):s&&i.push(s);var u=ve(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=Ie(u.height+u.depth),u.depth&&(d.style.verticalAlign=Ie(-u.depth))}return u}function pI(e){return new _h(e)}class Ae{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=ec(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof kr&&this.children[r+1]instanceof kr){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof kr;)s+=this.children[++r].toText();t.appendChild(new kr(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+=fs(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+fs(ec(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 kr=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return fs(this.toText())}toText(){return this.text}};class gI{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",Ie(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ie(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var uQ=new Set(["\\imath","\\jmath"]),dQ=new Set(["mrow","mtable"]),Yi=function(t,n,r){return Yn[n][t]&&Yn[n][t].replace&&t.charCodeAt(0)!==55349&&!(lI.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=Yn[n][t].replace),new kr(t)},R3=function(t){return t.length===1?t[0]:new Ae("mrow",t)},hQ={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"},j3=(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=hQ[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(uQ.has(i))return null;if(Yn[r][i]){var a=Yn[r][i].replace;a&&(i=a)}var o=fx[n].fontName;return M3(i,o,r)?fx[n].variant:null};function Iv(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof kr&&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 kr&&n.text===","}else return!1}var ki=function(t,n,r){if(t.length===1){var s=Rn(t[0],n);return r&&s instanceof Ae&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o<t.length;o++){var l=Rn(t[o],n);if(l instanceof Ae&&a instanceof Ae){if(l.type==="mtext"&&a.type==="mtext"&&l.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...l.children);continue}else if(l.type==="mn"&&a.type==="mn"){a.children.push(...l.children);continue}else if(Iv(l)&&a.type==="mn"){a.children.push(...l.children);continue}else if(l.type==="mn"&&Iv(a))l.children=[...a.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(a.type==="mn"||Iv(a))){var c=l.children[0];c instanceof Ae&&c.type==="mn"&&(c.children=[...a.children,...c.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var u=a.children[0];if(u instanceof kr&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof kr&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),a=l}return i},rc=function(t,n,r){return R3(ki(t,n,r))},Rn=function(t,n){if(!t)return new Ae("mrow");if(Jg[t.type])return Jg[t.type](t,n);throw new Se("Got group of unknown type: '"+t.type+"'")};function C8(e,t,n,r,s){var i=ki(e,n),a;i.length===1&&i[0]instanceof Ae&&dQ.has(i[0].type)?a=i[0]:a=new Ae("mrow",i);var o=new Ae("annotation",[new kr(t)]);o.setAttribute("encoding","application/x-tex");var l=new Ae("semantics",[a,o]),c=new Ae("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=s?"katex":"katex-mathml";return ve([u],[c])}var fQ=[[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]],A8=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],E8=function(t,n){return n.size<2?t:fQ[t-1][n.size-1]};class vo{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||vo.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=A8[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 vo(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:E8(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:A8[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=E8(vo.BASESIZE,t);return this.size===n&&this.textSize===vo.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!==vo.BASESIZE?["sizing","reset-size"+this.size,"size"+vo.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=XX(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}vo.BASESIZE=6;var yI=function(t){return new vo({style:t.displayMode?Ct.DISPLAY:Ct.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},bI=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=ve(r,[t])}return t},mQ=function(t,n,r){var s=yI(r),i;if(r.output==="mathml")return C8(t,n,s,r.displayMode,!0);if(r.output==="html"){var a=yx(t,s);i=ve(["katex"],[a])}else{var o=C8(t,n,s,r.displayMode,!1),l=yx(t,s);i=ve(["katex"],[o,l])}return bI(i,r)},pQ=function(t,n,r){var s=yI(r),i=yx(t,s),a=ve(["katex"],[i]);return bI(a,r)},gQ={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":"="},hy=function(t){var n=new Ae("mo",[new kr(gQ[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},yQ={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]},bQ=new Set(["widehat","widecheck","widetilde","utilde"]),fy=function(t,n){function r(){var o=4e5,l=t.label.slice(1);if(bQ.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,o=2364,f=.42,d=l+"4"):(u=312,o=2340,f=.34,d="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][m],u=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],d=l+m):(o=[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 tc(d),y=new Uo([p],{width:"100%",height:Ie(f),viewBox:"0 0 "+o+" "+u,preserveAspectRatio:"none"});return{span:nc([],[y],n),minWidth:0,height:f}}else{var w=[],v=yQ[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[g,x,k]=v,A=k/1e3,T=g.length,C,j;if(T===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');C=["hide-tail"],j=[v[3]]}else if(T===2)C=["halfarrow-left","halfarrow-right"],j=["xMinYMin","xMaxYMin"];else if(T===3)C=["brace-left","brace-center","brace-right"],j=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+T+" children.");for(var z=0;z<T;z++){var E=new tc(g[z]),P=new Uo([E],{width:"400em",height:Ie(A),viewBox:"0 0 "+o+" "+k,preserveAspectRatio:j[z]+" slice"}),D=nc([C[z]],[P],n);if(T===1)return{span:D,minWidth:x,height:A};D.style.height=Ie(A),w.push(D)}return{span:ve(["stretchy"],w,n),minWidth:x,height:A}}}var{span:s,minWidth:i,height:a}=r();return s.height=a,s.style.height=Ie(a),i>0&&(s.style.minWidth=Ie(i)),s},vQ=function(t,n,r,s,i){var a,o=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=ve(["stretchy",n],[],i),n==="fbox"){var l=i.color&&i.getColor();l&&(a.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 Uo(c,{width:"100%",height:Ie(o)});a=nc([],[u],i)}return a.height=o,a.style.height=Ie(o),a},xQ={bin:1,close:1,inner:1,open:1,punct:1,rel:1},wQ={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function _Q(e){return e in xQ}function Lt(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 my(e){var t=py(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 py(e){return e&&(e.type==="atom"||wQ.hasOwnProperty(e.type))?e:null}var vI=e=>{if(e instanceof wi)return e;if(YX(e)&&e.children.length===1)return vI(e.children[0])},D3=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=Lt(e.base,"accent"),n=r.base,e.base=n,s=KX(hn(e,t)),e.base=r):(r=Lt(e,"accent"),n=r.base);var i=hn(n,t.havingCrampedStyle()),a=r.isShifty&&Wo(n),o=0;if(a){var l,c;o=(l=(c=vI(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=fy(r,t),f=un({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Ie(2*o)+")",marginLeft:Ie(2*o)}:void 0}]});else{var m,p;r.label==="\\vec"?(m=hI("vec",t),p=dI.vec[1]):(m=dy({mode:r.mode,text:r.label},t,"textord"),m=GX(m),m.italic=0,p=m.width,u&&(d+=m.depth)),f=ve(["accent-body"],[m]);var y=r.label==="\\textcircled";y&&(f.classes.push("accent-full"),d=i.height);var w=o;y||(w-=p/2),f.style.left=Ie(w),r.label==="\\textcircled"&&(f.style.top=".2em"),f=un({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:f}]})}var v=ve(["mord","accent"],[f],t);return s?(s.children[0]=v,s.height=Math.max(v.height,s.height),s.classes[0]="mord",s):v},xI=(e,t)=>{var n=e.isStretchy?hy(e.label):new Ae("mo",[Yi(e.label,e.mode)]),r=new Ae("mover",[Rn(e.base,t),n]);return r.setAttribute("accent","true"),r},kQ=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));qe({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=Zg(t[0]),r=!kQ.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:D3,mathmlBuilder:xI});qe({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:D3,mathmlBuilder:xI});qe({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=hn(e.base,t),r=fy(e,t),s=e.label==="\\utilde"?.12:0,i=un({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return ve(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=hy(e.label),r=new Ae("munder",[Rn(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var Ym=e=>{var t=new Ae("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};qe({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=Jd(hn(e.body,r,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;e.below&&(r=t.havingStyle(n.sub()),a=Jd(hn(e.below,r,t),t),a.classes.push(i+"-arrow-pad"));var o=fy(e,t),l=-t.fontMetrics().axisHeight+.5*o.height,c=-t.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(c-=s.depth);var u;if(a){var d=-t.fontMetrics().axisHeight+a.height+.5*o.height+.111;u=un({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:a,shift:d}]})}else u=un({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return ve(["mrel","x-arrow"],[u],t)},mathmlBuilder(e,t){var n=hy(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=Ym(Rn(e.body,t));if(e.below){var i=Ym(Rn(e.below,t));r=new Ae("munderover",[n,i,s])}else r=new Ae("mover",[n,s])}else if(e.below){var a=Ym(Rn(e.below,t));r=new Ae("munder",[n,a])}else r=Ym(),r=new Ae("mover",[n,r]);return r}});function wI(e,t){var n=Br(e.body,t,!0);return ve([e.mclass],n,t)}function _I(e,t){var n,r=ki(e.body,t);return e.mclass==="minner"?n=new Ae("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new Ae("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new Ae("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}qe({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:_r(s),isCharacterBox:Wo(s)}},htmlBuilder:wI,mathmlBuilder:_I});var gy=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"};qe({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:gy(t[0]),body:_r(t[1]),isCharacterBox:Wo(t[1])}}});qe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:r}=e,s=t[1],i=t[0],a;r!=="\\stackrel"?a=gy(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:_r(s)},l={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[l],isCharacterBox:Wo(l)}},htmlBuilder:wI,mathmlBuilder:_I});qe({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:gy(t[0]),body:_r(t[0])}},htmlBuilder(e,t){var n=Br(e.body,t,!0),r=ve([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=ki(e.body,t),r=new Ae("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var SQ={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},M8=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),N8=e=>e.type==="textord"&&e.text==="@",TQ=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function CQ(e,t,n){var r=SQ[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"},a=n.callFunction("\\Big",[i],[]),o=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[s,a,o]};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 AQ(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 Se("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var a=t[i],o=M8(),l=0;l<a.length;l++)if(!N8(a[l]))o.body.push(a[l]);else{r.push(o),l+=1;var c=my(a[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<a.length;m++){if(TQ(a[m],c)){f=!1,l=m;break}if(N8(a[m]))throw new Se("Missing a "+c+" character to complete a CD arrow.",a[m]);u[d].body.push(a[m])}if(f)throw new Se("Missing a "+c+" character to complete a CD arrow.",a[l])}else throw new Se('Expected one of "<>AV=|." after @',a[l]);var p=CQ(c,u,e),y={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(y),o=M8()}i%2===0?r.push(o):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([])}}qe({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=Jd(hn(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=Ie(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Ae("mrow",[Rn(e.label,t)]);return n=new Ae("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ae("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});qe({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=Jd(hn(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Ae("mrow",[Rn(e.fragment,t)])}});qe({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=Lt(t[0],"ordgroup"),s=r.body,i="",a=0;a<s.length;a++){var o=Lt(s[a],"textord");i+=o.text}var l=parseInt(i),c;if(isNaN(l))throw new Se("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new Se("\\@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 kI=(e,t)=>{var n=Br(e.body,t.withColor(e.color),!1);return Ko(n)},SI=(e,t)=>{var n=ki(e.body,t.withColor(e.color)),r=new Ae("mstyle",n);return r.setAttribute("mathcolor",e.color),r};qe({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=Lt(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:_r(s)}},htmlBuilder:kI,mathmlBuilder:SI});qe({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=Lt(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:kI,mathmlBuilder:SI});qe({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&&Lt(s,"size").value}},htmlBuilder(e,t){var n=ve(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Ie(er(e.size,t)))),n},mathmlBuilder(e,t){var n=new Ae("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Ie(er(e.size,t)))),n}});var bx={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},TI=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Se("Expected a control sequence",e);return t},EQ=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},CI=(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)};qe({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(bx[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=bx[r.text]),Lt(t.parseFunction(),"internal");throw new Se("Invalid token after macro prefix",r)}});qe({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 Se("Expected a control sequence",r);for(var i=0,a,o=[[]];t.gullet.future().text!=="{";)if(r=t.gullet.popToken(),r.text==="#"){if(t.gullet.future().text==="{"){a=t.gullet.future(),o[i].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Se('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Se('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new Se("Expected a macro definition");o[i].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return a&&l.unshift(a),(n==="\\edef"||n==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(s,{tokens:l,numArgs:i,delimiters:o},n===bx[n]),{type:"internal",mode:t.mode}}});qe({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=TI(t.gullet.popToken());t.gullet.consumeSpaces();var s=EQ(t);return CI(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});qe({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=TI(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return CI(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var yf=function(t,n,r){var s=Yn.math[t]&&Yn.math[t].replace,i=M3(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},O3=function(t,n,r,s){var i=r.havingBaseStyle(n),a=ve(s.concat(i.sizingClasses(r)),[t],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},AI=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=Ie(i),t.height-=i,t.depth+=i},MQ=function(t,n,r,s,i,a){var o=xs(t,"Main-Regular",i,s),l=O3(o,n,s,a);return AI(l,s,n),l},NQ=function(t,n,r,s){return xs(t,"Size"+n+"-Regular",r,s)},EI=function(t,n,r,s,i,a){var o=NQ(t,n,i,s),l=O3(ve(["delimsizing","size"+n],[o],s),Ct.TEXT,s,a);return r&&AI(l,s,Ct.TEXT),l},Rv=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=ve(["delimsizinginner",s],[ve([],[xs(t,n,r)])]);return{type:"elem",elem:i}},jv=function(t,n,r){var s=za["Size4-Regular"][t.charCodeAt(0)]?za["Size4-Regular"][t.charCodeAt(0)][4]:za["Size1-Regular"][t.charCodeAt(0)][4],i=new tc("inner",PX(t,Math.round(1e3*n))),a=new Uo([i],{width:Ie(s),height:Ie(n),style:"width:"+Ie(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=nc([],[a],r);return o.height=n,o.style.height=Ie(n),o.style.width=Ie(s),{type:"elem",elem:o}},vx=.008,Xm={type:"kern",size:-1*vx},IQ=new Set(["|","\\lvert","\\rvert","\\vert"]),RQ=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),MI=function(t,n,r,s,i,a){var o,l,c,u,d="",f=0;o=c=u=t,l=null;var m="Size1-Regular";t==="\\uparrow"?c=u="⏐":t==="\\Uparrow"?c=u="‖":t==="\\downarrow"?o=c="⏐":t==="\\Downarrow"?o=c="‖":t==="\\updownarrow"?(o="\\uparrow",c="⏐",u="\\downarrow"):t==="\\Updownarrow"?(o="\\Uparrow",c="‖",u="\\Downarrow"):IQ.has(t)?(c="∣",d="vert",f=333):RQ.has(t)?(c="∥",d="doublevert",f=556):t==="["||t==="\\lbrack"?(o="⎡",c="⎢",u="⎣",m="Size4-Regular",d="lbrack",f=667):t==="]"||t==="\\rbrack"?(o="⎤",c="⎥",u="⎦",m="Size4-Regular",d="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=o="⎢",u="⎣",m="Size4-Regular",d="lfloor",f=667):t==="\\lceil"||t==="⌈"?(o="⎡",c=u="⎢",m="Size4-Regular",d="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=o="⎥",u="⎦",m="Size4-Regular",d="rfloor",f=667):t==="\\rceil"||t==="⌉"?(o="⎤",c=u="⎥",m="Size4-Regular",d="rceil",f=667):t==="("||t==="\\lparen"?(o="⎛",c="⎜",u="⎝",m="Size4-Regular",d="lparen",f=875):t===")"||t==="\\rparen"?(o="⎞",c="⎟",u="⎠",m="Size4-Regular",d="rparen",f=875):t==="\\{"||t==="\\lbrace"?(o="⎧",l="⎨",u="⎩",c="⎪",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o="⎫",l="⎬",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(o="⎧",u="⎩",c="⎪",m="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(o="⎫",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(o="⎧",u="⎭",c="⎪",m="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(o="⎫",u="⎩",c="⎪",m="Size4-Regular");var p=yf(o,m,i),y=p.height+p.depth,w=yf(c,m,i),v=w.height+w.depth,g=yf(u,m,i),x=g.height+g.depth,k=0,A=1;if(l!==null){var T=yf(l,m,i);k=T.height+T.depth,A=2}var C=y+x+k,j=Math.max(0,Math.ceil((n-C)/(A*v))),z=C+j*A*v,E=s.fontMetrics().axisHeight;r&&(E*=s.sizeMultiplier);var P=z/2-E,D=[];if(d.length>0){var H=z-y-x,W=Math.round(z*1e3),J=qX(d,Math.round(H*1e3)),Y=new tc(d,J),Z=Ie(f/1e3),Q=Ie(W/1e3),L=new Uo([Y],{width:Z,height:Q,viewBox:"0 0 "+f+" "+W}),R=nc([],[L],s);R.height=W/1e3,R.style.width=Z,R.style.height=Q,D.push({type:"elem",elem:R})}else{if(D.push(Rv(u,m,i)),D.push(Xm),l===null){var $=z-y-x+2*vx;D.push(jv(c,$,s))}else{var I=(z-y-x-k)/2+2*vx;D.push(jv(c,I,s)),D.push(Xm),D.push(Rv(l,m,i)),D.push(Xm),D.push(jv(c,I,s))}D.push(Xm),D.push(Rv(o,m,i))}var M=s.havingBaseStyle(Ct.TEXT),G=un({positionType:"bottom",positionData:P,children:D});return O3(ve(["delimsizing","mult"],[G],M),Ct.TEXT,s,a)},Dv=80,Ov=.08,Lv=function(t,n,r,s,i){var a=$X(t,s,r),o=new tc(t,a),l=new Uo([o],{width:"400em",height:Ie(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return nc(["hide-tail"],[l],i)},jQ=function(t,n){var r=n.havingBaseSizing(),s=DI("\\surd",t*r.sizeMultiplier,jI,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,l,c,u,d;return s.type==="small"?(u=1e3+1e3*a+Dv,t<1?i=1:t<1.4&&(i=.7),l=(1+a+Ov)/i,c=(1+a)/i,o=Lv("sqrtMain",l,u,a,n),o.style.minWidth="0.853em",d=.833/i):s.type==="large"?(u=(1e3+Dv)*Hf[s.size],c=(Hf[s.size]+a)/i,l=(Hf[s.size]+a+Ov)/i,o=Lv("sqrtSize"+s.size,l,u,a,n),o.style.minWidth="1.02em",d=1/i):(l=t+a+Ov,c=t+a,u=Math.floor(1e3*t+a)+Dv,o=Lv("sqrtTall",l,u,a,n),o.style.minWidth="0.742em",d=1.056),o.height=c,o.style.height=Ie(l),{span:o,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},NI=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),DQ=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),II=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Hf=[0,1.2,1.8,2.4,3],RI=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),NI.has(t)||II.has(t))return EI(t,n,!1,r,s,i);if(DQ.has(t))return MI(t,Hf[n],!1,r,s,i);throw new Se("Illegal delimiter: '"+t+"'")},OQ=[{type:"small",style:Ct.SCRIPTSCRIPT},{type:"small",style:Ct.SCRIPT},{type:"small",style:Ct.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],LQ=[{type:"small",style:Ct.SCRIPTSCRIPT},{type:"small",style:Ct.SCRIPT},{type:"small",style:Ct.TEXT},{type:"stack"}],jI=[{type:"small",style:Ct.SCRIPTSCRIPT},{type:"small",style:Ct.SCRIPT},{type:"small",style:Ct.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],BQ=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.")},DI=function(t,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;a<r.length;a++){var o=r[a];if(o.type==="stack")break;var l=yf(t,BQ(o),"math"),c=l.height+l.depth;if(o.type==="small"){var u=s.havingBaseStyle(o.style);c*=u.sizeMultiplier}if(c>n)return o}return r[r.length-1]},xx=function(t,n,r,s,i,a){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var o;II.has(t)?o=OQ:NI.has(t)?o=jI:o=LQ;var l=DI(t,n,o,s);return l.type==="small"?MQ(t,l.style,r,s,i,a):l.type==="large"?EI(t,l.size,r,s,i,a):MI(t,n,r,s,i,a)},Bv=function(t,n,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,c=5/s.fontMetrics().ptPerEm,u=Math.max(n-o,r+o),d=Math.max(u/500*l,2*u-c);return xx(t,d,!0,s,i,a)},I8={"\\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}},zQ=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 R8(e){return"isMiddle"in e}function yy(e,t){var n=py(e);if(n&&zQ.has(n.text))return n;throw n?new Se("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Se("Invalid delimiter type '"+e.type+"'",e)}qe({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=yy(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:I8[e.funcName].size,mclass:I8[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?ve([e.mclass]):RI(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Yi(e.delim,e.mode));var n=new Ae("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ie(Hf[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function j8(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}qe({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 Se("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:yy(t[0],e).text,color:n}}});qe({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=yy(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Lt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{j8(e);for(var n=Br(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a<n.length;a++){var o=n[a];R8(o)?i=!0:(r=Math.max(n[a].height,r),s=Math.max(n[a].depth,s))}r*=t.sizeMultiplier,s*=t.sizeMultiplier;var l;if(e.left==="."?l=y0(t,["mopen"]):l=Bv(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(R8(u)){var d=u.isMiddle;n[c]=Bv(d.delim,r,s,d.options,e.mode,[])}}var f;if(e.right===".")f=y0(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=Bv(e.right,r,s,m,e.mode,["mclose"])}return n.push(f),ve(["minner"],n,t)},mathmlBuilder:(e,t)=>{j8(e);var n=ki(e.body,t);if(e.left!=="."){var r=new Ae("mo",[Yi(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new Ae("mo",[Yi(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return R3(n)}});qe({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=yy(t[0],e);if(!e.parser.leftrightDepth)throw new Se("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=y0(t,[]):(n=RI(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Yi("|","text"):Yi(e.delim,e.mode),r=new Ae("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var by=(e,t)=>{var n=Jd(hn(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,a,o=Wo(e.body);if(r==="sout")i=ve(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,a=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=er({number:.6,unit:"pt"},t),c=er({number:.35,unit:"ex"},t),u=t.havingBaseSizing();s=s/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=Ie(d/2+l);var f=Math.floor(1e3*d*s),m=BX(f),p=new Uo([new tc("phase",m)],{width:"400em",height:Ie(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=nc(["hide-tail"],[p],t),i.style.height=Ie(d),a=n.depth+l+c}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,w,v=0;/box/.test(r)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(r==="colorbox"?0:v),w=y):r==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*v,w=Math.max(0,.25-n.depth)):(y=o?.2:0,w=y),i=vQ(n,r,y,w,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ie(v)):r==="angl"&&v!==.049&&(i.style.borderTopWidth=Ie(v),i.style.borderRightWidth=Ie(v)),a=n.depth+w,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var g;if(e.backgroundColor)g=un({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(r)?["svg-align"]:[];g=un({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:x}]})}return/cancel/.test(r)&&(g.height=n.height,g.depth=n.depth),/cancel/.test(r)&&!o?ve(["mord","cancel-lap"],[g],t):ve(["mord"],[g],t)},vy=(e,t)=>{var n,r=new Ae(e.label.includes("colorbox")?"mpadded":"menclose",[Rn(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: "+Ie(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};qe({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Lt(t[0],"color-token").color,a=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:by,mathmlBuilder:vy});qe({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Lt(t[0],"color-token").color,a=Lt(t[1],"color-token").color,o=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:by,mathmlBuilder:vy});qe({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]}}});qe({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:by,mathmlBuilder:vy});qe({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:by,mathmlBuilder:vy});qe({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 OI={};function Xa(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=e,o={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<n.length;++l)OI[n[l]]=o;i&&(Qg[t]=i),a&&(Jg[t]=a)}var LI={};function B(e,t){LI[e]=t}class Hs{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 Hs(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class bi{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 bi(n,Hs.range(this,t))}}function D8(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 xy=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Se("{"+e.envName+"} can be used only in display mode.")},$Q=new Set(["gather","gather*"]);function L3(e){if(!e.includes("ed"))return!e.includes("*")}function pc(e,t,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:f}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!a){var m=e.gullet.expandMacroAsText("\\arraystretch");if(m==null)a=1;else if(a=parseFloat(m),!a||a<0)throw new Se("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],y=[p],w=[],v=[],g=l!=null?[]:void 0;function x(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){g&&(e.gullet.macros.get("\\df@tag")?(g.push(e.subparse([new bi("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):g.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),v.push(D8(e));;){var A=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var T={type:"ordgroup",mode:e.mode,body:A};n&&(T={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[T]}),p.push(T);var C=e.fetch().text;if(C==="&"){if(d&&p.length===d){if(c||o)throw new Se("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(C==="\\end"){k(),p.length===1&&T.type==="styling"&&T.body.length===1&&T.body[0].type==="ordgroup"&&T.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),v.length<y.length+1&&v.push([]);break}else if(C==="\\\\"){e.consume();var j=void 0;e.gullet.future().text!==" "&&(j=e.parseSizeGroup(!0)),w.push(j?j.value:null),k(),v.push(D8(e)),p=[],y.push(p),x()}else throw new Se("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:s,arraystretch:a,body:y,cols:i,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:o,tags:g,leqno:f}}function B3(e){return e.slice(0,1)==="d"?"display":"text"}var Qa=function(t,n){var r,s,i=t.body.length,a=t.hLinesBeforeRow,o=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(Ct.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var p=t.colSeparationType==="CD"?er({number:3,unit:"ex"},n):12*d,y=3*d,w=t.arraystretch*p,v=.7*w,g=.3*w,x=0;function k(re){for(var ae=0;ae<re.length;++ae)ae>0&&(x+=.25),c.push({pos:x,isDashed:re[ae]})}for(k(a[0]),r=0;r<t.body.length;++r){var A=t.body[r],T=v,C=g;o<A.length&&(o=A.length);var j={cells:new Array(A.length),height:0,depth:0,pos:0};for(s=0;s<A.length;++s){var z=hn(A[s],n);C<z.depth&&(C=z.depth),T<z.height&&(T=z.height),j.cells[s]=z}var E=t.rowGaps[r],P=0;E&&(P=er(E,n),P>0&&(P+=g,C<P&&(C=P),P=0)),t.addJot&&r<t.body.length-1&&(C+=y),j.height=T,j.depth=C,x+=T,j.pos=x,x+=C+P,l[r]=j,k(a[r+1])}var D=x/2+n.fontMetrics().axisHeight,H=t.cols||[],W=[],J,Y,Z=[];if(t.tags&&t.tags.some(re=>re))for(r=0;r<i;++r){var Q=l[r],L=Q.pos-D,R=t.tags[r],$=void 0;R===!0?$=ve(["eqn-num"],[],n):R===!1?$=ve([],[],n):$=ve([],Br(R,n,!0),n),$.depth=Q.depth,$.height=Q.height,Z.push({type:"elem",elem:$,shift:L})}for(s=0,Y=0;s<o||Y<H.length;++s,++Y){for(var I,M=H[Y],G=!0;((ne=M)==null?void 0:ne.type)==="separator";){var ne;if(G||(J=ve(["arraycolsep"],[]),J.style.width=Ie(n.fontMetrics().doubleRuleSep),W.push(J)),M.separator==="|"||M.separator===":"){var fe=M.separator==="|"?"solid":"dashed",Pe=ve(["vertical-separator"],[],n);Pe.style.height=Ie(x),Pe.style.borderRightWidth=Ie(u),Pe.style.borderRightStyle=fe,Pe.style.margin="0 "+Ie(-u/2);var oe=x-D;oe&&(Pe.style.verticalAlign=Ie(-oe)),W.push(Pe)}else throw new Se("Invalid separator type: "+M.separator);Y++,M=H[Y],G=!1}if(!(s>=o)){var Xe=void 0;if(s>0||t.hskipBeforeAndAfter){var ht,At;Xe=(ht=(At=M)==null?void 0:At.pregap)!=null?ht:f,Xe!==0&&(J=ve(["arraycolsep"],[]),J.style.width=Ie(Xe),W.push(J))}var zt=[];for(r=0;r<i;++r){var Vt=l[r],gt=Vt.cells[s];if(gt){var Le=Vt.pos-D;gt.depth=Vt.depth,gt.height=Vt.height,zt.push({type:"elem",elem:gt,shift:Le})}}var qt=un({positionType:"individualShift",children:zt}),tn=ve(["col-align-"+(((I=M)==null?void 0:I.align)||"c")],[qt]);if(W.push(tn),s<o-1||t.hskipBeforeAndAfter){var Mt,Kt;Xe=(Mt=(Kt=M)==null?void 0:Kt.postgap)!=null?Mt:f,Xe!==0&&(J=ve(["arraycolsep"],[]),J.style.width=Ie(Xe),W.push(J))}}}var $t=ve(["mtable"],W);if(c.length>0){for(var gn=Qd("hline",n,u),Xt=Qd("hdashline",n,u),Be=[{type:"elem",elem:$t,shift:0}];c.length>0;){var Qe=c.pop(),st=Qe.pos-D;Qe.isDashed?Be.push({type:"elem",elem:Xt,shift:st}):Be.push({type:"elem",elem:gn,shift:st})}$t=un({positionType:"individualShift",children:Be})}if(Z.length===0)return ve(["mord"],[$t],n);var te=un({positionType:"individualShift",children:Z}),ue=ve(["tag"],[te],n);return Ko([$t,ue])},PQ={c:"center ",l:"left ",r:"right "},Ja=function(t,n){for(var r=[],s=new Ae("mtd",[],["mtr-glue"]),i=new Ae("mtd",[],["mml-eqn-num"]),a=0;a<t.body.length;a++){for(var o=t.body[a],l=[],c=0;c<o.length;c++)l.push(new Ae("mtd",[Rn(o[c],n)]));t.tags&&t.tags[a]&&(l.unshift(s),l.push(s),t.leqno?l.unshift(i):l.push(i)),r.push(new Ae("mtr",l))}var u=new Ae("mtable",r),d=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);u.setAttribute("rowspacing",Ie(d));var f="",m="";if(t.cols&&t.cols.length>0){var p=t.cols,y="",w=!1,v=0,g=p.length;p[0].type==="separator"&&(f+="top ",v=1),p[p.length-1].type==="separator"&&(f+="bottom ",g-=1);for(var x=v;x<g;x++){var k=p[x];k.type==="align"?(m+=PQ[k.align],w&&(y+="none "),w=!0):k.type==="separator"&&w&&(y+=k.separator==="|"?"solid ":"dashed ",w=!1)}u.setAttribute("columnalign",m.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var A=t.cols||[],T="",C=1;C<A.length;C++)T+=C%2?"0em ":"1em ";u.setAttribute("columnspacing",T.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 j="",z=t.hLinesBeforeRow;f+=z[0].length>0?"left ":"",f+=z[z.length-1].length>0?"right ":"";for(var E=1;E<z.length-1;E++)j+=z[E].length===0?"none ":z[E][0]?"dashed ":"solid ";return/[sd]/.test(j)&&u.setAttribute("rowlines",j.trim()),f!==""&&(u=new Ae("menclose",[u]),u.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(u=new Ae("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},BI=function(t,n){t.envName.includes("ed")||xy(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",a=pc(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:L3(t.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),o=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=Lt(n[0].body[d],"textord");u+=f.text}o=Number(u),l=o*2}var m=!l;a.body.forEach(function(v){for(var g=1;g<v.length;g+=2){var x=Lt(v[g],"styling"),k=Lt(x.body[0],"ordgroup");k.body.unshift(c)}if(m)l<v.length&&(l=v.length);else{var A=v.length/2;if(o<A)throw new Se("Too many math in a row: "+("expected "+o+", but got "+A),v[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 a.colSeparationType=m?"align":"alignat",a};Xa({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=py(t[0]),r=n?[t[0]]:Lt(t[0],"ordgroup").body,s=r.map(function(a){var o=my(a),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Se("Unknown column alignment: "+l,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return pc(e.parser,i,B3(e.envName))},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({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 Se("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=pc(e.parser,r,B3(e.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=pc(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=py(t[0]),r=n?[t[0]]:Lt(t[0],"ordgroup").body,s=r.map(function(o){var l=my(o),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Se("Unknown column alignment: "+c,o)});if(s.length>1)throw new Se("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},a=pc(e.parser,i,"script");if(a.body.length>0&&a.body[0].length>1)throw new Se("{subarray} can contain only one column");return a},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({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=pc(e.parser,t,B3(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:BI,htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){$Q.has(e.envName)&&xy(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:L3(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return pc(e.parser,t,"display")},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:BI,htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){xy(e);var t={autoTag:L3(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return pc(e.parser,t,"display")},htmlBuilder:Qa,mathmlBuilder:Ja});Xa({type:"array",names:["CD"],props:{numArgs:0},handler(e){return xy(e),AQ(e.parser)},htmlBuilder:Qa,mathmlBuilder:Ja});B("\\nonumber","\\gdef\\@eqnsw{0}");B("\\notag","\\nonumber");qe({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Se(e.funcName+" valid only within array environment")}});var O8=OI;qe({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 Se("Invalid environment name",s);for(var i="",a=0;a<s.body.length;++a)i+=Lt(s.body[a],"textord").text;if(r==="\\begin"){if(!O8.hasOwnProperty(i))throw new Se("No such environment: "+i,s);var o=O8[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",o),u={mode:n.mode,envName:i,parser:n},d=o.handler(u,l,c);n.expect("\\end",!1);var f=n.nextToken,m=Lt(n.parseFunction(),"environment");if(m.name!==i)throw new Se("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return d}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var zI=(e,t)=>{var n=e.font,r=t.withFont(n);return hn(e.body,r)},$I=(e,t)=>{var n=e.font,r=t.withFont(n);return Rn(e.body,r)},L8={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};qe({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=Zg(t[0]),i=r;return i in L8&&(i=L8[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:zI,mathmlBuilder:$I});qe({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:gy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Wo(r)}}});qe({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,a=n.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:zI,mathmlBuilder:$I});var qQ=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var a=hn(e.numer,i,t);if(e.continued){var o=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;a.height=a.height<o?o:a.height,a.depth=a.depth<l?l:a.depth}i=t.havingStyle(s);var c=hn(e.denom,i,t),u,d,f;e.hasBarLine?(e.barSize?(d=er(e.barSize,t),u=Qd("frac-line",t,d)):u=Qd("frac-line",t),d=u.height,f=u.height):(u=null,d=0,f=t.fontMetrics().defaultRuleThickness);var m,p,y;n.size===Ct.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 g=t.fontMetrics().axisHeight;m-a.depth-(g+.5*d)<p&&(m+=p-(m-a.depth-(g+.5*d))),g-.5*d-(c.height-y)<p&&(y+=p-(g-.5*d-(c.height-y)));var x=-(g-.5*d);w=un({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:x},{type:"elem",elem:a,shift:-m}]})}else{var v=m-a.depth-(c.height-y);v<p&&(m+=.5*(p-v),y+=.5*(p-v)),w=un({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:a,shift:-m}]})}i=t.havingStyle(n),w.height*=i.sizeMultiplier/t.sizeMultiplier,w.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===Ct.DISPLAY.size?k=t.fontMetrics().delim1:n.size===Ct.SCRIPTSCRIPT.size?k=t.havingStyle(Ct.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var A,T;return e.leftDelim==null?A=y0(t,["mopen"]):A=xx(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?T=ve([]):e.rightDelim==null?T=y0(t,["mclose"]):T=xx(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),ve(["mord"].concat(i.sizingClasses(t)),[A,ve(["mfrac"],[w]),T],t)},UQ=(e,t)=>{var n=new Ae("mfrac",[Rn(e.numer,t),Rn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=er(e.barSize,t);n.setAttribute("linethickness",Ie(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Ae("mo",[new kr(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var a=new Ae("mo",[new kr(e.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),s.push(a)}return R3(s)}return n},PI=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};qe({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],a,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",l=")";break;case"\\\\bracefrac":a=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":a=!1,o="[",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"),PI({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:c,hasBarLine:a,leftDelim:o,rightDelim:l,barSize:null},u)},htmlBuilder:qQ,mathmlBuilder:UQ});qe({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 B8=["display","text","script","scriptscript"],z8=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};qe({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=Zg(t[0]),a=i.type==="atom"&&i.family==="open"?z8(i.text):null,o=Zg(t[1]),l=o.type==="atom"&&o.family==="close"?z8(o.text):null,c=Lt(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=Lt(m.body[0],"textord");f=B8[Number(p.text)]}}else m=Lt(m,"textord"),f=B8[Number(m.text)];return PI({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:u,barSize:d,leftDelim:a,rightDelim:l},f)}});qe({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:Lt(t[0],"size").value,token:s}}});qe({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=Lt(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var a=t[2],o=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null}}});var qI=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?hn(e.sup,t.havingStyle(n.sup()),t):hn(e.sub,t.havingStyle(n.sub()),t),s=Lt(e.base,"horizBrace")):s=Lt(e,"horizBrace");var i=hn(s.base,t.havingBaseStyle(Ct.DISPLAY)),a=fy(s,t),o;if(s.isOver?o=un({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a,wrapperClasses:["svg-align"]}]}):o=un({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=ve(["minner",s.isOver?"mover":"munder"],[o],t);s.isOver?o=un({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=un({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return ve(["minner",s.isOver?"mover":"munder"],[o],t)},HQ=(e,t)=>{var n=hy(e.label);return new Ae(e.isOver?"mover":"munder",[Rn(e.base,t),n])};qe({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:qI,mathmlBuilder:HQ});qe({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=Lt(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:_r(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Br(e.body,t,!1);return nQ(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=rc(e.body,t);return n instanceof Ae||(n=new Ae("mrow",[n])),n.setAttribute("href",e.href),n}});qe({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=Lt(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 a=r[i];a==="~"&&(a="\\textasciitilde"),s.push({type:"textord",mode:"text",text:a})}var o={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:_r(o)}}});qe({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:_r(t[0])}},htmlBuilder(e,t){var n=Br(e.body,t.withFont(""),!1);return Ko(n)},mathmlBuilder(e,t){return new Ae("mrow",ki(e.body,t.withFont("")))}});qe({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=Lt(t[0],"raw").string,a=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,o={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 Se("\\htmlData key/value '"+d+"' missing equals sign");var m=d.slice(0,f),p=d.slice(f+1);l["data-"+m.trim()]=p}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(o)?{type:"html",mode:n.mode,attributes:l,body:_r(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=Br(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=ve(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)=>rc(e.body,t)});qe({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:_r(t[0]),mathml:_r(t[1])}},htmlBuilder:(e,t)=>{var n=Br(e.html,t,!1);return Ko(n)},mathmlBuilder:(e,t)=>rc(e.mathml,t)});var zv=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 Se("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!rI(r))throw new Se("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};qe({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"},a={number:0,unit:"em"},o="";if(n[0])for(var l=Lt(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":o=f;break;case"width":s=zv(f);break;case"height":i=zv(f);break;case"totalheight":a=zv(f);break;default:throw new Se("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var m=Lt(t[0],"url").url;return o===""&&(o=m,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:r.mode,alt:o,width:s,height:i,totalheight:a,src:m}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=er(e.height,t),r=0;e.totalheight.number>0&&(r=er(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=er(e.width,t));var i={height:Ie(n+r)};s>0&&(i.width=Ie(s)),r>0&&(i.verticalAlign=Ie(-r));var a=new VX(e.src,e.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(e,t)=>{var n=new Ae("mglyph",[]);n.setAttribute("alt",e.alt);var r=er(e.height,t),s=0;if(e.totalheight.number>0&&(s=er(e.totalheight,t)-r,n.setAttribute("valign",Ie(-s))),n.setAttribute("height",Ie(r+s)),e.width.number>0){var i=er(e.width,t);n.setAttribute("width",Ie(i))}return n.setAttribute("src",e.src),n}});qe({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=Lt(t[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||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")):a&&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 uI(e.dimension,t)},mathmlBuilder(e,t){var n=er(e.dimension,t);return new gI(n)}});qe({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=ve([],[hn(e.body,t)]),n=ve(["inner"],[n],t)):n=ve(["inner"],[hn(e.body,t)]);var r=ve(["fix"],[]),s=ve([e.alignment],[n,r],t),i=ve(["strut"]);return i.style.height=Ie(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ie(-s.depth)),s.children.unshift(i),s=ve(["thinbox"],[s],t),ve(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Ae("mpadded",[Rn(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}});qe({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==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:a}}});qe({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Se("Mismatched "+e.funcName)}});var $8=(e,t)=>{switch(t.style.size){case Ct.DISPLAY.size:return e.display;case Ct.TEXT.size:return e.text;case Ct.SCRIPT.size:return e.script;case Ct.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};qe({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:_r(t[0]),text:_r(t[1]),script:_r(t[2]),scriptscript:_r(t[3])}},htmlBuilder:(e,t)=>{var n=$8(e,t),r=Br(n,t,!1);return Ko(r)},mathmlBuilder:(e,t)=>{var n=$8(e,t);return rc(n,t)}});var UI=(e,t,n,r,s,i,a)=>{e=ve([],[e]);var o=n&&Wo(n),l,c;if(t){var u=hn(t,r.havingStyle(s.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=hn(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+a;f=un({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ie(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ie(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=e.height-a;f=un({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ie(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+a;f=un({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ie(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var w=[f];if(l&&i!==0&&!o){var v=ve(["mspace"],[],r);v.style.marginRight=Ie(i),w.unshift(v)}return ve(["mop","op-limits"],w,r)},HI=new Set(["\\smallint"]),Th=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Lt(e.base,"op"),s=!0):i=Lt(e,"op");var a=t.style,o=!1;a.size===Ct.DISPLAY.size&&i.symbol&&!HI.has(i.name)&&(o=!0);var l,c;if(i.symbol){var u=o?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=xs(i.name,u,"math",t,["mop","op-symbol",o?"large-op":"small-op"]),c=l.italic,d.length>0){var f=hI(d+"Size"+(o?"2":"1"),t);l=un({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:o?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var m=Br(i.body,t,!0);m.length===1&&m[0]instanceof wi?(l=m[0],l.classes[0]="mop"):l=ve(["mop"],m,t)}else{for(var p=[],y=1;y<i.name.length;y++)p.push(N3(i.name[y],i.mode,t));l=ve(["mop"],p,t)}var w=0,v=0;if((l instanceof wi||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var g;w=(l.height-l.depth)/2-t.fontMetrics().axisHeight,v=(g=l.italic)!=null?g:0}return s?UI(l,n,r,t,a,v,w):(w&&(l.style.position="relative",l.style.top=Ie(w)),l)},tm=(e,t)=>{var n;if(e.symbol)n=new Ae("mo",[Yi(e.name,e.mode)]),HI.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Ae("mo",ki(e.body,t));else{n=new Ae("mi",[new kr(e.name.slice(1))]);var r=new Ae("mo",[Yi("⁡","text")]);e.parentIsSupSub?n=new Ae("mrow",[n,r]):n=pI([n,r])}return n},FQ={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};qe({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=FQ[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Th,mathmlBuilder:tm});qe({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:_r(r)}},htmlBuilder:Th,mathmlBuilder:tm});var VQ={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};qe({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:Th,mathmlBuilder:tm});qe({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:Th,mathmlBuilder:tm});qe({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=VQ[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Th,mathmlBuilder:tm});var FI=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Lt(e.base,"operatorname"),s=!0):i=Lt(e,"operatorname");var a;if(i.body.length>0){for(var o=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=Br(o,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof wi&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}a=ve(["mop"],l,t)}else a=ve(["mop"],[],t);return s?UI(a,n,r,t,t.style,0,0):a},WQ=(e,t)=>{for(var n=ki(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof gI))if(i instanceof Ae)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var a=i.children[0];i.children.length===1&&a instanceof kr?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var o=n.map(u=>u.toText()).join("");n=[new kr(o)]}var l=new Ae("mi",n);l.setAttribute("mathvariant","normal");var c=new Ae("mo",[Yi("⁡","text")]);return e.parentIsSupSub?new Ae("mrow",[l,c]):pI([l,c])};qe({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:_r(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:FI,mathmlBuilder:WQ});B("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Du({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?Ko(Br(e.body,t,!1)):ve(["mord"],Br(e.body,t,!0),t)},mathmlBuilder(e,t){return rc(e.body,t,!0)}});qe({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=hn(e.body,t.havingCrampedStyle()),r=Qd("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=un({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return ve(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Ae("mo",[new kr("‾")]);n.setAttribute("stretchy","true");var r=new Ae("mover",[Rn(e.body,t),n]);return r.setAttribute("accent","true"),r}});qe({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:_r(r)}},htmlBuilder:(e,t)=>{var n=Br(e.body,t.withPhantom(),!1);return Ko(n)},mathmlBuilder:(e,t)=>{var n=ki(e.body,t);return new Ae("mphantom",n)}});B("\\hphantom","\\smash{\\phantom{#1}}");qe({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=ve(["inner"],[hn(e.body,t.withPhantom())]),r=ve(["fix"],[]);return ve(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=ki(_r(e.body),t),r=new Ae("mphantom",n),s=new Ae("mpadded",[r]);return s.setAttribute("width","0px"),s}});qe({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=Lt(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=hn(e.body,t),r=er(e.dy,t);return un({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ae("mpadded",[Rn(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});qe({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});qe({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=Lt(t[0],"size"),a=Lt(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&Lt(s,"size").value,width:i.value,height:a.value}},htmlBuilder(e,t){var n=ve(["mord","rule"],[],t),r=er(e.width,t),s=er(e.height,t),i=e.shift?er(e.shift,t):0;return n.style.borderRightWidth=Ie(r),n.style.borderTopWidth=Ie(s),n.style.bottom=Ie(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=er(e.width,t),r=er(e.height,t),s=e.shift?er(e.shift,t):0,i=t.color&&t.getColor()||"black",a=new Ae("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Ie(n)),a.setAttribute("height",Ie(r));var o=new Ae("mpadded",[a]);return s>=0?o.setAttribute("height",Ie(s)):(o.setAttribute("height",Ie(s)),o.setAttribute("depth",Ie(-s))),o.setAttribute("voffset",Ie(s)),o}});function VI(e,t,n){for(var r=Br(e,t,!1),s=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var a=r[i].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[a+1]==="reset-size"+t.size&&(r[i].classes[a+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return Ko(r)}var P8=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],GQ=(e,t)=>{var n=t.havingSize(e.size);return VI(e.body,n,t)};qe({type:"sizing",names:P8,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:P8.indexOf(r)+1,body:i}},htmlBuilder:GQ,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=ki(e.body,n),s=new Ae("mstyle",r);return s.setAttribute("mathsize",Ie(n.sizeMultiplier)),s}});qe({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,s=!1,i=!1,a=n[0]&&Lt(n[0],"ordgroup");if(a)for(var o,l=0;l<a.body.length;++l){var c=a.body[l];if(o=my(c).text,o==="t")s=!0;else if(o==="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=ve([],[hn(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 ve(["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=un({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return ve(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Ae("mpadded",[Rn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});qe({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=hn(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Jd(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<Ct.TEXT.id&&(i=t.fontMetrics().xHeight);var a=s+i/4,o=n.height+n.depth+a+s,{span:l,ruleWidth:c,advanceWidth:u}=jQ(o,t),d=l.height-c;d>n.height+n.depth+a&&(a=(a+d-n.height-n.depth)/2);var f=l.height-n.height-a-c;n.style.paddingLeft=Ie(u);var m=un({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(Ct.SCRIPTSCRIPT),y=hn(e.index,p,t),w=.6*(m.height-m.depth),v=un({positionType:"shift",positionData:-w,children:[{type:"elem",elem:y}]}),g=ve(["root"],[v]);return ve(["mord","sqrt"],[g,m],t)}else return ve(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new Ae("mroot",[Rn(n,t),Rn(r,t)]):new Ae("msqrt",[Rn(n,t)])}});var wx={display:Ct.DISPLAY,text:Ct.TEXT,script:Ct.SCRIPT,scriptscript:Ct.SCRIPTSCRIPT};function KQ(e){return e in wx}qe({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),a=r.slice(1,r.length-5);if(!KQ(a))throw new Error("Unknown style: "+a);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(e,t){var n=wx[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),VI(e.body,r,t)},mathmlBuilder(e,t){var n=wx[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=ki(e.body,r),i=new Ae("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[e.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var YQ=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Ct.DISPLAY.size||r.alwaysHandleSupSub);return s?Th:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Ct.DISPLAY.size||r.limits);return i?FI:null}else{if(r.type==="accent")return Wo(r.base)?D3:null;if(r.type==="horizBrace"){var a=!t.sub;return a===r.isOver?qI:null}else return null}else return null};Du({type:"supsub",htmlBuilder(e,t){var n=YQ(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,a=hn(r,t),o,l,c=t.fontMetrics(),u=0,d=0,f=r&&Wo(r);if(s){var m=t.havingStyle(t.style.sup());o=hn(s,m,t),f||(u=a.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var p=t.havingStyle(t.style.sub());l=hn(i,p,t),f||(d=a.depth+p.fontMetrics().subDrop*p.sizeMultiplier/t.sizeMultiplier)}var y;t.style===Ct.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var w=t.sizeMultiplier,v=Ie(.5/c.ptPerEm/w),g=null;if(l){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(a instanceof wi||x){var k;g=Ie(-((k=a.italic)!=null?k:0))}}var A;if(o&&l){u=Math.max(u,y,o.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var T=c.defaultRuleThickness,C=4*T;if(u-o.depth-(l.height-d)<C){d=C-(u-o.depth)+l.height;var j=.8*c.xHeight-(u-o.depth);j>0&&(u+=j,d-=j)}var z=[{type:"elem",elem:l,shift:d,marginRight:v,marginLeft:g},{type:"elem",elem:o,shift:-u,marginRight:v}];A=un({positionType:"individualShift",children:z})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var E=[{type:"elem",elem:l,marginLeft:g,marginRight:v}];A=un({positionType:"shift",positionData:d,children:E})}else if(o)u=Math.max(u,y,o.depth+.25*c.xHeight),A=un({positionType:"shift",positionData:-u,children:[{type:"elem",elem:o,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var P=gx(a,"right")||"mord";return ve([P],[a,ve(["msupsub"],[A])],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=[Rn(e.base,t)];e.sub&&i.push(Rn(e.sub,t)),e.sup&&i.push(Rn(e.sup,t));var a;if(n)a=r?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===Ct.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===Ct.DISPLAY||c.limits)?a="munderover":a="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Ct.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Ct.DISPLAY)?a="munder":a="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===Ct.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===Ct.DISPLAY)?a="mover":a="msup"}return new Ae(a,i)}});Du({type:"atom",htmlBuilder(e,t){return N3(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Ae("mo",[Yi(e.text,e.mode)]);if(e.family==="bin"){var r=j3(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 WI={mi:"italic",mn:"normal",mtext:"normal"};Du({type:"mathord",htmlBuilder(e,t){return dy(e,t,"mathord")},mathmlBuilder(e,t){var n=new Ae("mi",[Yi(e.text,e.mode,t)]),r=j3(e,t)||"italic";return r!==WI[n.type]&&n.setAttribute("mathvariant",r),n}});Du({type:"textord",htmlBuilder(e,t){return dy(e,t,"textord")},mathmlBuilder(e,t){var n=Yi(e.text,e.mode,t),r=j3(e,t)||"normal",s;return e.mode==="text"?s=new Ae("mtext",[n]):/[0-9]/.test(e.text)?s=new Ae("mn",[n]):e.text==="\\prime"?s=new Ae("mo",[n]):s=new Ae("mi",[n]),r!==WI[s.type]&&s.setAttribute("mathvariant",r),s}});var $v={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Pv={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Du({type:"spacing",htmlBuilder(e,t){if(Pv.hasOwnProperty(e.text)){var n=Pv[e.text].className||"";if(e.mode==="text"){var r=dy(e,t,"textord");return r.classes.push(n),r}else return ve(["mspace",n],[N3(e.text,e.mode,t)],t)}else{if($v.hasOwnProperty(e.text))return ve(["mspace",$v[e.text]],[],t);throw new Se('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(Pv.hasOwnProperty(e.text))n=new Ae("mtext",[new kr(" ")]);else{if($v.hasOwnProperty(e.text))return new Ae("mspace");throw new Se('Unknown type of space "'+e.text+'"')}return n}});var q8=()=>{var e=new Ae("mtd",[]);return e.setAttribute("width","50%"),e};Du({type:"tag",mathmlBuilder(e,t){var n=new Ae("mtable",[new Ae("mtr",[q8(),new Ae("mtd",[rc(e.body,t)]),q8(),new Ae("mtd",[rc(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var U8={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},H8={"\\textbf":"textbf","\\textmd":"textmd"},XQ={"\\textit":"textit","\\textup":"textup"},F8=(e,t)=>{var n=e.font;if(n){if(U8[n])return t.withTextFontFamily(U8[n]);if(H8[n])return t.withTextFontWeight(H8[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(XQ[n])};qe({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:_r(s),font:r}},htmlBuilder(e,t){var n=F8(e,t),r=Br(e.body,n,!0);return ve(["mord","text"],r,n)},mathmlBuilder(e,t){var n=F8(e,t);return rc(e.body,n)}});qe({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=hn(e.body,t),r=Qd("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=un({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return ve(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Ae("mo",[new kr("‾")]);n.setAttribute("stretchy","true");var r=new Ae("munder",[Rn(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});qe({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=hn(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return un({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ae("mpadded",[Rn(e.body,t)],["vcenter"]);return new Ae("mrow",[n])}});qe({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Se("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=V8(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var a=n[i];a==="~"&&(a="\\textasciitilde"),r.push(xs(a,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return ve(["mord","text"].concat(s.sizingClasses(t)),cI(r),s)},mathmlBuilder(e,t){var n=new kr(V8(e)),r=new Ae("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var V8=e=>e.body.replace(/ /g,e.star?"␣":" "),Rl=fI,GI=`[ \r
	]`,QQ="\\\\[a-zA-Z@]+",JQ="\\\\[^\uD800-\uDFFF]",ZQ="("+QQ+")"+GI+"*",eJ=`\\\\(
|[ \r	]+
?)[ \r	]*`,_x="[̀-ͯ]",tJ=new RegExp(_x+"+$"),nJ="("+GI+"+)|"+(eJ+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(_x+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(_x+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+ZQ)+("|"+JQ+")");class W8{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(nJ,"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 bi("EOF",new Hs(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new Se("Unexpected character: '"+t[n]+"'",new bi(t[n],new Hs(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 bi(s,new Hs(this,n,this.tokenRegex.lastIndex))}}class rJ{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 Se("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 sJ=LI;B("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});B("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});B("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});B("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});B("\\@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}});B("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");B("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var G8={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};B("\\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 Se("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=G8[t.text],r==null||r>=n)throw new Se("Invalid base-"+n+" digit "+t.text);for(var s;(s=G8[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var z3=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new Se("\\newcommand's first argument must be a macro name");var i=s[0].text,a=e.isDefined(i);if(a&&!t)throw new Se("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new Se("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=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 Se("Invalid number of arguments: "+l);o=parseInt(l),s=e.consumeArg().tokens}return a&&r||e.macros.set(i,{tokens:s,numArgs:o}),""};B("\\newcommand",e=>z3(e,!1,!0,!1));B("\\renewcommand",e=>z3(e,!0,!1,!1));B("\\providecommand",e=>z3(e,!0,!0,!0));B("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});B("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});B("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Rl[n],Yn.math[n],Yn.text[n]),""});B("\\bgroup","{");B("\\egroup","}");B("~","\\nobreakspace");B("\\lq","`");B("\\rq","'");B("\\aa","\\r a");B("\\AA","\\r A");B("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");B("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");B("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");B("ℬ","\\mathscr{B}");B("ℰ","\\mathscr{E}");B("ℱ","\\mathscr{F}");B("ℋ","\\mathscr{H}");B("ℐ","\\mathscr{I}");B("ℒ","\\mathscr{L}");B("ℳ","\\mathscr{M}");B("ℛ","\\mathscr{R}");B("ℭ","\\mathfrak{C}");B("ℌ","\\mathfrak{H}");B("ℨ","\\mathfrak{Z}");B("\\Bbbk","\\Bbb{k}");B("\\llap","\\mathllap{\\textrm{#1}}");B("\\rlap","\\mathrlap{\\textrm{#1}}");B("\\clap","\\mathclap{\\textrm{#1}}");B("\\mathstrut","\\vphantom{(}");B("\\underbar","\\underline{\\text{#1}}");B("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');B("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");B("\\ne","\\neq");B("≠","\\neq");B("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");B("∉","\\notin");B("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");B("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");B("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");B("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");B("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");B("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");B("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");B("⟂","\\perp");B("‼","\\mathclose{!\\mkern-0.8mu!}");B("∌","\\notni");B("⌜","\\ulcorner");B("⌝","\\urcorner");B("⌞","\\llcorner");B("⌟","\\lrcorner");B("©","\\copyright");B("®","\\textregistered");B("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');B("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');B("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');B("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');B("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");B("⋮","\\vdots");B("\\varGamma","\\mathit{\\Gamma}");B("\\varDelta","\\mathit{\\Delta}");B("\\varTheta","\\mathit{\\Theta}");B("\\varLambda","\\mathit{\\Lambda}");B("\\varXi","\\mathit{\\Xi}");B("\\varPi","\\mathit{\\Pi}");B("\\varSigma","\\mathit{\\Sigma}");B("\\varUpsilon","\\mathit{\\Upsilon}");B("\\varPhi","\\mathit{\\Phi}");B("\\varPsi","\\mathit{\\Psi}");B("\\varOmega","\\mathit{\\Omega}");B("\\substack","\\begin{subarray}{c}#1\\end{subarray}");B("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");B("\\boxed","\\fbox{$\\displaystyle{#1}$}");B("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");B("\\implies","\\DOTSB\\;\\Longrightarrow\\;");B("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");B("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");B("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var K8={",":"\\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"},iJ=new Set(["bin","rel"]);B("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in K8?t=K8[n]:(n.slice(0,4)==="\\not"||n in Yn.math&&iJ.has(Yn.math[n].group))&&(t="\\dotsb"),t});var $3={")":!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};B("\\dotso",function(e){var t=e.future().text;return t in $3?"\\ldots\\,":"\\ldots"});B("\\dotsc",function(e){var t=e.future().text;return t in $3&&t!==","?"\\ldots\\,":"\\ldots"});B("\\cdots",function(e){var t=e.future().text;return t in $3?"\\@cdots\\,":"\\@cdots"});B("\\dotsb","\\cdots");B("\\dotsm","\\cdots");B("\\dotsi","\\!\\cdots");B("\\dotsx","\\ldots\\,");B("\\DOTSI","\\relax");B("\\DOTSB","\\relax");B("\\DOTSX","\\relax");B("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");B("\\,","\\tmspace+{3mu}{.1667em}");B("\\thinspace","\\,");B("\\>","\\mskip{4mu}");B("\\:","\\tmspace+{4mu}{.2222em}");B("\\medspace","\\:");B("\\;","\\tmspace+{5mu}{.2777em}");B("\\thickspace","\\;");B("\\!","\\tmspace-{3mu}{.1667em}");B("\\negthinspace","\\!");B("\\negmedspace","\\tmspace-{4mu}{.2222em}");B("\\negthickspace","\\tmspace-{5mu}{.277em}");B("\\enspace","\\kern.5em ");B("\\enskip","\\hskip.5em\\relax");B("\\quad","\\hskip1em\\relax");B("\\qquad","\\hskip2em\\relax");B("\\tag","\\@ifstar\\tag@literal\\tag@paren");B("\\tag@paren","\\tag@literal{({#1})}");B("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Se("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});B("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");B("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");B("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");B("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");B("\\newline","\\\\\\relax");B("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var KI=Ie(za["Main-Regular"][84][1]-.7*za["Main-Regular"][65][1]);B("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+KI+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");B("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+KI+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");B("\\hspace","\\@ifstar\\@hspacer\\@hspace");B("\\@hspace","\\hskip #1\\relax");B("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");B("\\ordinarycolon",":");B("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");B("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');B("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');B("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');B("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');B("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');B("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');B("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');B("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');B("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');B("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');B("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');B("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');B("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');B("∷","\\dblcolon");B("∹","\\eqcolon");B("≔","\\coloneqq");B("≕","\\eqqcolon");B("⩴","\\Coloneqq");B("\\ratio","\\vcentcolon");B("\\coloncolon","\\dblcolon");B("\\colonequals","\\coloneqq");B("\\coloncolonequals","\\Coloneqq");B("\\equalscolon","\\eqqcolon");B("\\equalscoloncolon","\\Eqqcolon");B("\\colonminus","\\coloneq");B("\\coloncolonminus","\\Coloneq");B("\\minuscolon","\\eqcolon");B("\\minuscoloncolon","\\Eqcolon");B("\\coloncolonapprox","\\Colonapprox");B("\\coloncolonsim","\\Colonsim");B("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");B("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");B("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");B("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");B("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");B("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");B("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");B("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");B("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");B("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");B("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");B("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");B("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");B("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");B("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");B("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");B("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");B("\\nleqq","\\html@mathml{\\@nleqq}{≰}");B("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");B("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");B("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");B("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");B("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");B("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");B("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");B("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");B("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");B("\\imath","\\html@mathml{\\@imath}{ı}");B("\\jmath","\\html@mathml{\\@jmath}{ȷ}");B("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");B("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");B("⟦","\\llbracket");B("⟧","\\rrbracket");B("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");B("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");B("⦃","\\lBrace");B("⦄","\\rBrace");B("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");B("⦵","\\minuso");B("\\darr","\\downarrow");B("\\dArr","\\Downarrow");B("\\Darr","\\Downarrow");B("\\lang","\\langle");B("\\rang","\\rangle");B("\\uarr","\\uparrow");B("\\uArr","\\Uparrow");B("\\Uarr","\\Uparrow");B("\\N","\\mathbb{N}");B("\\R","\\mathbb{R}");B("\\Z","\\mathbb{Z}");B("\\alef","\\aleph");B("\\alefsym","\\aleph");B("\\Alpha","\\mathrm{A}");B("\\Beta","\\mathrm{B}");B("\\bull","\\bullet");B("\\Chi","\\mathrm{X}");B("\\clubs","\\clubsuit");B("\\cnums","\\mathbb{C}");B("\\Complex","\\mathbb{C}");B("\\Dagger","\\ddagger");B("\\diamonds","\\diamondsuit");B("\\empty","\\emptyset");B("\\Epsilon","\\mathrm{E}");B("\\Eta","\\mathrm{H}");B("\\exist","\\exists");B("\\harr","\\leftrightarrow");B("\\hArr","\\Leftrightarrow");B("\\Harr","\\Leftrightarrow");B("\\hearts","\\heartsuit");B("\\image","\\Im");B("\\infin","\\infty");B("\\Iota","\\mathrm{I}");B("\\isin","\\in");B("\\Kappa","\\mathrm{K}");B("\\larr","\\leftarrow");B("\\lArr","\\Leftarrow");B("\\Larr","\\Leftarrow");B("\\lrarr","\\leftrightarrow");B("\\lrArr","\\Leftrightarrow");B("\\Lrarr","\\Leftrightarrow");B("\\Mu","\\mathrm{M}");B("\\natnums","\\mathbb{N}");B("\\Nu","\\mathrm{N}");B("\\Omicron","\\mathrm{O}");B("\\plusmn","\\pm");B("\\rarr","\\rightarrow");B("\\rArr","\\Rightarrow");B("\\Rarr","\\Rightarrow");B("\\real","\\Re");B("\\reals","\\mathbb{R}");B("\\Reals","\\mathbb{R}");B("\\Rho","\\mathrm{P}");B("\\sdot","\\cdot");B("\\sect","\\S");B("\\spades","\\spadesuit");B("\\sub","\\subset");B("\\sube","\\subseteq");B("\\supe","\\supseteq");B("\\Tau","\\mathrm{T}");B("\\thetasym","\\vartheta");B("\\weierp","\\wp");B("\\Zeta","\\mathrm{Z}");B("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");B("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");B("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");B("\\bra","\\mathinner{\\langle{#1}|}");B("\\ket","\\mathinner{|{#1}\\rangle}");B("\\braket","\\mathinner{\\langle{#1}\\rangle}");B("\\Bra","\\left\\langle#1\\right|");B("\\Ket","\\left|#1\\right\\rangle");var YI=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,s=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.macros.get("|"),o=t.macros.get("\\|");t.macros.beginGroup();var l=d=>f=>{e&&(f.macros.set("|",a),s.length&&f.macros.set("\\|",o));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}};B("\\bra@ket",YI(!1));B("\\bra@set",YI(!0));B("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");B("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");B("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");B("\\angln","{\\angl n}");B("\\blue","\\textcolor{##6495ed}{#1}");B("\\orange","\\textcolor{##ffa500}{#1}");B("\\pink","\\textcolor{##ff00af}{#1}");B("\\red","\\textcolor{##df0030}{#1}");B("\\green","\\textcolor{##28ae7b}{#1}");B("\\gray","\\textcolor{gray}{#1}");B("\\purple","\\textcolor{##9d38bd}{#1}");B("\\blueA","\\textcolor{##ccfaff}{#1}");B("\\blueB","\\textcolor{##80f6ff}{#1}");B("\\blueC","\\textcolor{##63d9ea}{#1}");B("\\blueD","\\textcolor{##11accd}{#1}");B("\\blueE","\\textcolor{##0c7f99}{#1}");B("\\tealA","\\textcolor{##94fff5}{#1}");B("\\tealB","\\textcolor{##26edd5}{#1}");B("\\tealC","\\textcolor{##01d1c1}{#1}");B("\\tealD","\\textcolor{##01a995}{#1}");B("\\tealE","\\textcolor{##208170}{#1}");B("\\greenA","\\textcolor{##b6ffb0}{#1}");B("\\greenB","\\textcolor{##8af281}{#1}");B("\\greenC","\\textcolor{##74cf70}{#1}");B("\\greenD","\\textcolor{##1fab54}{#1}");B("\\greenE","\\textcolor{##0d923f}{#1}");B("\\goldA","\\textcolor{##ffd0a9}{#1}");B("\\goldB","\\textcolor{##ffbb71}{#1}");B("\\goldC","\\textcolor{##ff9c39}{#1}");B("\\goldD","\\textcolor{##e07d10}{#1}");B("\\goldE","\\textcolor{##a75a05}{#1}");B("\\redA","\\textcolor{##fca9a9}{#1}");B("\\redB","\\textcolor{##ff8482}{#1}");B("\\redC","\\textcolor{##f9685d}{#1}");B("\\redD","\\textcolor{##e84d39}{#1}");B("\\redE","\\textcolor{##bc2612}{#1}");B("\\maroonA","\\textcolor{##ffbde0}{#1}");B("\\maroonB","\\textcolor{##ff92c6}{#1}");B("\\maroonC","\\textcolor{##ed5fa6}{#1}");B("\\maroonD","\\textcolor{##ca337c}{#1}");B("\\maroonE","\\textcolor{##9e034e}{#1}");B("\\purpleA","\\textcolor{##ddd7ff}{#1}");B("\\purpleB","\\textcolor{##c6b9fc}{#1}");B("\\purpleC","\\textcolor{##aa87ff}{#1}");B("\\purpleD","\\textcolor{##7854ab}{#1}");B("\\purpleE","\\textcolor{##543b78}{#1}");B("\\mintA","\\textcolor{##f5f9e8}{#1}");B("\\mintB","\\textcolor{##edf2df}{#1}");B("\\mintC","\\textcolor{##e0e5cc}{#1}");B("\\grayA","\\textcolor{##f6f7f7}{#1}");B("\\grayB","\\textcolor{##f0f1f2}{#1}");B("\\grayC","\\textcolor{##e3e5e6}{#1}");B("\\grayD","\\textcolor{##d6d8da}{#1}");B("\\grayE","\\textcolor{##babec2}{#1}");B("\\grayF","\\textcolor{##888d93}{#1}");B("\\grayG","\\textcolor{##626569}{#1}");B("\\grayH","\\textcolor{##3b3e40}{#1}");B("\\grayI","\\textcolor{##21242c}{#1}");B("\\kaBlue","\\textcolor{##314453}{#1}");B("\\kaGreen","\\textcolor{##71B307}{#1}");var XI={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class aJ{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 rJ(sJ,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new W8(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 bi("EOF",r.loc)),this.pushTokens(s),new bi("",Hs.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,a=0,o=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Se("Extra }",i)}else if(i.text==="EOF")throw new Se("Unexpected end of input in a macro argument, expected '"+(t&&r?t[o]:"}")+"'",i);if(t&&r)if((a===0||a===1&&t[o]==="{")&&i.text===t[o]){if(++o,o===t.length){n.splice(-o,o);break}}else o=0}while(a!==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 Se("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 Se("Use of the macro doesn't match its definition",i)}}for(var a=[],o=0;o<t;o++)a.push(this.consumeArg(n&&n[o+1]).tokens);return a}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new Se("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 Se("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var l=i[o];if(l.text==="#"){if(o===0)throw new Se("Incomplete placeholder at end of macro body",l);if(l=i[--o],l.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(l.text))i.splice(o,2,...a[+l.text-1]);else throw new Se("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 bi(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 a=s.replace(/##/g,"");a.includes("#"+(i+1));)++i;for(var o=new W8(s,this.settings),l=[],c=o.lex();c.text!=="EOF";)l.push(c),c=o.lex();l.reverse();var u={tokens:l,numArgs:i};return u}return s}isDefined(t){return this.macros.has(t)||Rl.hasOwnProperty(t)||Yn.math.hasOwnProperty(t)||Yn.text.hasOwnProperty(t)||XI.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Rl.hasOwnProperty(t)&&!Rl[t].primitive}}var Y8=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Qm=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),qv={"́":{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"}},X8={á:"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 QI=class JI{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 aJ(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 Se("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 bi("}")),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(JI.endOfExpression.has(s.text)||n&&s.text===n||t&&Rl[s.text]&&Rl[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 Se("only one infix operator per group",i.token);n=s,r=i.replaceWith}}if(n!==-1&&r){var a,o,l=t.slice(0,n),c=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?a=l[0]:a={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?o=c[0]:o={type:"ordgroup",mode:this.mode,body:c};var u;return r==="\\\\abovefrac"?u=this.callFunction(r,[a,t[n],o],[]):u=this.callFunction(r,[a,o],[]),[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 Se("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 a=i.text==="\\limits";n.limits=a,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new Se("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new Se("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new Se("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new Se("Double superscript",i);var o={type:"textord",mode:this.mode,text:"\\prime"},l=[o];for(this.consume();this.fetch().text==="'";)l.push(o),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(Qm[i.text]){var c=Y8.test(i.text),u=[];for(u.push(new bi(Qm[i.text])),this.consume();;){var d=this.fetch().text;if(!Qm[d]||Y8.test(d)!==c)break;u.unshift(new bi(Qm[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=Rl[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Se("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new Se("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new Se("Can't use function '"+s+"' in math mode",r);var{args:a,optArgs:o}=this.parseArguments(s,i);return this.callFunction(s,a,o,r,t)}callFunction(t,n,r,s,i){var a={funcName:t,parser:this,token:s,breakOnTokenText:i},o=Rl[t];if(o&&o.handler)return o.handler(a,n,r);throw new Se("No function handler for "+t)}parseArguments(t,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],a=0;a<r;a++){var o=n.argTypes&&n.argTypes[a],l=a<n.numOptionalArgs;("primitive"in n&&n.primitive&&o==null||n.type==="sqrt"&&a===1&&i[0]==null)&&(o="primitive");var c=this.parseGroupOfType("argument to '"+t+"'",o,l);if(l)i.push(c);else if(c!=null)s.push(c);else throw new Se("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 Se("A primitive argument cannot be optional");var a=this.parseGroup(t);if(a==null)throw new Se("Expected group as "+t,this.fetch());return a}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Se("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="",a;(a=this.fetch()).text!=="EOF"&&t.test(i+a.text);)s=a,i+=s.text,this.consume();if(i==="")throw new Se("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 Se("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 Se("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!rI(i))throw new Se("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 a={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),a}parseGroup(t,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var a=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,a),l=this.fetch();this.expect(a),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Hs.range(r,l),body:o,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!XI.hasOwnProperty(s)){if(this.settings.throwOnError)throw new Se("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,a=t[r+1];if(!(!a||a.type!=="textord")){if(i==="-"&&a.text==="-"){var o=t[r+2];r+1<n&&o&&o.type==="textord"&&o.text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:Hs.range(s,o),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:Hs.range(s,a),text:"--"}),n-=1)}(i==="'"||i==="`")&&a.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:Hs.range(s,a),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 Se(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}X8.hasOwnProperty(n[0])&&!Yn[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=X8[n[0]]+n.slice(1));var i=tJ.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var a;if(Yn[this.mode][n]){this.settings.strict&&this.mode==="math"&&lx.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var o=Yn[this.mode][n].group,l=Hs.range(t),c;_Q(o)?c={type:"atom",mode:this.mode,family:o,loc:l,text:n}:c={type:o,mode:this.mode,loc:l,text:n},a=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(nI(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)),a={type:"textord",mode:"text",loc:Hs.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(!qv[d])throw new Se("Unknown accent ' "+d+"'",t);var f=qv[d][this.mode]||qv[d].text;if(!f)throw new Se("Accent "+d+" unsupported in "+this.mode+" mode",t);a={type:"accent",mode:this.mode,loc:Hs.range(t),label:f,isStretchy:!1,isShifty:!0,base:a}}return a}};QI.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var P3=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new QI(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 Se("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new bi("\\df@tag")])}]}return s},q3=function(t,n,r){n.textContent="";var s=wy(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."),q3=function(){throw new Se("KaTeX doesn't work in quirks mode.")});var ZI=function(t,n){var r=wy(t,n).toMarkup();return r},eR=function(t,n){var r=new C3(n);return P3(t,r)},tR=function(t,n,r){if(r.throwOnError||!(t instanceof Se))throw t;var s=ve(["katex-error"],[new wi(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},wy=function(t,n){var r=new C3(n);try{var s=P3(t,r);return mQ(s,t,r)}catch(i){return tR(i,t,r)}},nR=function(t,n){var r=new C3(n);try{var s=P3(t,r);return pQ(s,t,r)}catch(i){return tR(i,t,r)}},rR="0.16.47",sR={Span:kh,Anchor:cy,SymbolNode:wi,SvgNode:Uo,PathNode:tc,LineNode:ox},kx={version:rR,render:q3,renderToString:ZI,ParseError:Se,SETTINGS_SCHEMA:Kg,__parse:eR,__renderToDomTree:wy,__renderToHTMLTree:nR,__setFontMetrics:oI,__defineSymbol:_,__defineFunction:qe,__defineMacro:B,__domTree:sR};const Pke=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Se,SETTINGS_SCHEMA:Kg,__defineFunction:qe,__defineMacro:B,__defineSymbol:_,__domTree:sR,__parse:eR,__renderToDomTree:wy,__renderToHTMLTree:nR,__setFontMetrics:oI,default:kx,get render(){return q3},renderToString:ZI,version:rR},Symbol.toStringTag,{value:"Module"})),oJ={};function Q8(e){const t=this,n=e||oJ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(pX(n)),i.push(oX()),a.push(lX(n))}const J8=/[#.]/g;function lJ(e,t){const n=e||"",r={};let s=0,i,a;for(;s<n.length;){J8.lastIndex=s;const o=J8.exec(n),l=n.slice(s,o?o.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:a=l,s+=l.length),o&&(i=o[0],s++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}function iR(e,t,n){const r=n?hJ(n):void 0;function s(i,a,...o){let l;if(i==null){l={type:"root",children:[]};const c=a;o.unshift(c)}else{l=lJ(i,t);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,cJ(a))o.unshift(a);else for(const[d,f]of Object.entries(a))uJ(e,l.properties,d,f)}for(const c of o)Sx(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function cJ(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 a of i)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function uJ(e,t,n,r){const s=a3(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=vS(r):s.commaSeparated?i=mS(r):s.commaOrSpaceSeparated?i=vS(mS(r).join(" ")):i=Z8(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?dJ(r):String(r);if(Array.isArray(i)){const a=[];for(const o of i)a.push(Z8(s,s.property,o));i=a}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function Sx(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)Sx(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Sx(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function Z8(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||f0(n)===f0(t)))return!0}return n}function dJ(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function hJ(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const fJ=["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"],mJ=iR(o3,"div"),pJ=iR(xh,"g",fJ),Uv={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function gJ(e,t){return aR(e,{})||{type:"root",children:[]}}function aR(e,t){const n=yJ(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function yJ(e,t){switch(e.nodeType){case 1:return wJ(e,t);case 3:return vJ(e);case 8:return xJ(e);case 9:return e7(e,t);case 10:return bJ();case 11:return e7(e,t);default:return}}function e7(e,t){return{type:"root",children:oR(e,t)}}function bJ(){return{type:"doctype"}}function vJ(e){return{type:"text",value:e.nodeValue||""}}function xJ(e){return{type:"comment",value:e.nodeValue||""}}function wJ(e,t){const n=e.namespaceURI,r=n===Uv.svg?pJ:mJ,s=n===Uv.html?e.tagName.toLowerCase():e.tagName,i=n===Uv.html&&s==="template"?e.content:e,a=e.getAttributeNames(),o={};let l=-1;for(;++l<a.length;)o[a[l]]=e.getAttribute(a[l])||"";return r(s,o,oR(i,t))}function oR(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=aR(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function _J(e,t){const n=kJ(e);return gJ(n)}function kJ(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const t7=function(e,t,n){const r=J0(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]},Ou=function(e){if(e==null)return CJ;if(typeof e=="string")return TJ(e);if(typeof e=="object")return SJ(e);if(typeof e=="function")return U3(e);throw new Error("Expected function, string, or array as `test`")};function SJ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ou(e[n]);return U3(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function TJ(e){return U3(t);function t(n){return n.tagName===e}}function U3(e){return t;function t(n,r,s){return!!(AJ(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function CJ(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function AJ(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const n7=/\n/g,r7=/[\t ]+/g,Tx=Ou("br"),s7=Ou(OJ),EJ=Ou("p"),i7=Ou("tr"),MJ=Ou(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",DJ,LJ]),lR=Ou(["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 NJ(e,t){const n=t||{},r="children"in e?e.children:[],s=lR(e),i=dR(e,{whitespace:n.whitespace||"normal"}),a=[];(e.type==="text"||e.type==="comment")&&a.push(...uR(e,{breakBefore:!0,breakAfter:!0}));let o=-1;for(;++o<r.length;)a.push(...cR(r[o],e,{whitespace:i,breakBefore:o?void 0:s,breakAfter:o<r.length-1?Tx(r[o+1]):s}));const l=[];let c;for(o=-1;++o<a.length;){const u=a[o];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 cR(e,t,n){return e.type==="element"?IJ(e,t,n):e.type==="text"?n.whitespace==="normal"?uR(e,n):RJ(e):[]}function IJ(e,t,n){const r=dR(e,n),s=e.children||[];let i=-1,a=[];if(MJ(e))return a;let o,l;for(Tx(e)||i7(e)&&t7(t,e,i7)?l=`
`:EJ(e)?(o=2,l=2):lR(e)&&(o=1,l=1);++i<s.length;)a=a.concat(cR(s[i],e,{whitespace:r,breakBefore:i?void 0:o,breakAfter:i<s.length-1?Tx(s[i+1]):l}));return s7(e)&&t7(t,e,s7)&&a.push("	"),o&&a.unshift(o),l&&a.push(l),a}function uR(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){n7.lastIndex=i;const l=n7.exec(n),c=l&&"index"in l?l.index:n.length;r.push(jJ(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 a=-1,o;for(;++a<r.length;)r[a].charCodeAt(r[a].length-1)===8203||a<r.length-1&&r[a+1].charCodeAt(0)===8203?(s.push(r[a]),o=void 0):r[a]?(typeof o=="number"&&s.push(o),s.push(r[a]),o=0):(a===0||a===r.length-1)&&s.push(0);return s}function RJ(e){return[String(e.value)]}function jJ(e,t,n){const r=[];let s=0,i;for(;s<e.length;){r7.lastIndex=s;const a=r7.exec(e);i=a?a.index:e.length,!s&&!i&&a&&!t&&r.push(""),s!==i&&r.push(e.slice(s,i)),s=a?i+a[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function dR(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 DJ(e){return!!(e.properties||{}).hidden}function OJ(e){return e.tagName==="td"||e.tagName==="th"}function LJ(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const BJ={},zJ=[];function a7(e){const t=e||BJ;return function(n,r){x3(n,"element",function(s,i){const a=Array.isArray(s.properties.className)?s.properties.className:zJ,o=a.includes("language-math"),l=a.includes("math-display"),c=a.includes("math-inline");let u=l;if(!o&&!l&&!c)return;let d=i[i.length-1],f=s;if(s.tagName==="code"&&o&&d&&d.type==="element"&&d.tagName==="pre"&&(f=d,d=i[i.length-2],u=!0),!d)return;const m=NJ(f,{whitespace:"pre"});let p;try{p=kx.renderToString(m,{...t,displayMode:u,throwOnError:!0})}catch(w){const v=w,g=v.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:v,place:s.position,ruleId:g,source:"rehype-katex"});try{p=kx.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=_J(p).children);const y=d.children.indexOf(f);return d.children.splice(y,1,...p),MN})}}const hR=[{id:"abap",name:"ABAP",import:()=>q(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>q(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>q(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>q(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>q(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>q(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>q(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>q(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>q(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>q(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>q(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>q(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>q(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>q(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>q(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>q(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>q(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>q(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>q(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>q(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>q(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>q(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>q(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>q(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>q(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>q(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>q(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>q(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>q(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>q(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>q(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>q(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>q(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>q(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>q(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>q(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>q(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>q(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>q(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>q(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>q(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>q(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>q(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>q(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>q(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>q(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>q(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>q(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>q(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>q(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>q(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>q(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>q(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>q(()=>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:()=>q(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>q(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>q(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>q(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>q(()=>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:()=>q(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>q(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>q(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>q(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>q(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>q(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>q(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>q(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>q(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>q(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>q(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>q(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>q(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>q(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>q(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>q(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>q(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>q(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>q(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>q(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>q(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>q(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>q(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>q(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>q(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>q(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>q(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>q(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>q(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>q(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>q(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>q(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>q(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>q(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>q(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>q(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>q(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>q(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>q(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>q(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>q(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>q(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>q(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>q(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>q(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>q(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>q(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>q(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>q(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>q(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>q(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>q(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>q(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>q(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>q(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>q(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>q(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>q(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>q(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>q(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>q(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>q(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>q(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>q(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>q(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>q(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>q(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>q(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>q(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>q(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>q(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>q(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>q(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>q(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>q(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>q(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>q(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>q(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>q(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>q(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>q(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>q(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>q(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>q(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>q(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>q(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>q(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>q(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>q(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>q(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>q(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>q(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>q(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>q(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>q(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>q(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>q(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>q(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>q(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>q(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>q(()=>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:()=>q(()=>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:()=>q(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>q(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>q(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>q(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>q(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>q(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>q(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>q(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>q(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>q(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>q(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>q(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>q(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>q(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>q(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>q(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>q(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>q(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>q(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>q(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>q(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>q(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>q(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>q(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>q(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>q(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>q(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>q(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>q(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>q(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>q(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>q(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>q(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>q(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>q(()=>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:()=>q(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>q(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>q(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>q(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>q(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>q(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>q(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>q(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>q(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>q(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>q(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>q(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>q(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>q(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>q(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>q(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>q(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>q(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>q(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>q(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>q(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>q(()=>import("./zig-BVz_zdnA.js"),[])}],$J=Object.fromEntries(hR.map(e=>[e.id,e.import])),PJ=Object.fromEntries(hR.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),qJ={...$J,...PJ},UJ=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>q(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>q(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>q(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>q(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>q(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>q(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>q(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>q(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>q(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>q(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>q(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>q(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>q(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>q(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>q(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>q(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>q(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>q(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>q(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>q(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>q(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>q(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>q(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>q(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>q(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>q(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>q(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>q(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>q(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>q(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>q(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>q(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>q(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>q(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>q(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>q(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>q(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>q(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>q(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>q(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>q(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>q(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>q(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>q(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>q(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>q(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>q(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>q(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>q(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>q(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>q(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>q(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>q(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>q(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],HJ=Object.fromEntries(UJ.map(e=>[e.id,e.import]));let Do=class extends Error{constructor(t){super(t),this.name="ShikiError"}},H3=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function FJ(){return 2147483648}function VJ(){return typeof performance<"u"?performance.now():Date.now()}const WJ=(e,t)=>e+(t-e%t)%t;async function GJ(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 a(m){try{return t.grow(m-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function o(m){const p=r.HEAPU8.length;m=m>>>0;const y=FJ();if(m>y)return!1;for(let w=1;w<=4;w*=2){let v=p*(1+.2/w);v=Math.min(v,m+100663296);const g=Math.min(y,WJ(Math.max(m,v),65536));if(a(g))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 v=p;for(;m[v]&&!(v>=w);)++v;if(v-p>16&&m.buffer&&l)return l.decode(m.subarray(p,v));let g="";for(;p<v;){let x=m[p++];if(!(x&128)){g+=String.fromCharCode(x);continue}const k=m[p++]&63;if((x&224)===192){g+=String.fromCharCode((x&31)<<6|k);continue}const A=m[p++]&63;if((x&240)===224?x=(x&15)<<12|k<<6|A:x=(x&7)<<18|k<<12|A<<6|m[p++]&63,x<65536)g+=String.fromCharCode(x);else{const T=x-65536;g+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return g}function u(m,p){return m?c(r.HEAPU8,m,p):""}const d={emscripten_get_now:VJ,emscripten_memcpy_big:i,emscripten_resize_heap:o,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 KJ=Object.defineProperty,YJ=(e,t,n)=>t in e?KJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rr=(e,t,n)=>(YJ(e,typeof t!="symbol"?t+"":t,n),n);let Pr=null;function XJ(e){throw new H3(e.UTF8ToString(e.getLastOnigError()))}class _y{constructor(t){Rr(this,"utf16Length"),Rr(this,"utf8Length"),Rr(this,"utf16Value"),Rr(this,"utf8Value"),Rr(this,"utf16OffsetToUtf8"),Rr(this,"utf8OffsetToUtf16");const n=t.length,r=_y._utf8ByteLength(t),s=r!==n,i=s?new Uint32Array(n+1):null;s&&(i[n]=r);const a=s?new Uint32Array(r+1):null;s&&(a[r]=n);const o=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?a[l+0]=c:d<=2047?(a[l+0]=c,a[l+1]=c):d<=65535?(a[l+0]=c,a[l+1]=c,a[l+2]=c):(a[l+0]=c,a[l+1]=c,a[l+2]=c,a[l+3]=c)),d<=127?o[l++]=d:d<=2047?(o[l++]=192|(d&1984)>>>6,o[l++]=128|(d&63)>>>0):d<=65535?(o[l++]=224|(d&61440)>>>12,o[l++]=128|(d&4032)>>>6,o[l++]=128|(d&63)>>>0):(o[l++]=240|(d&1835008)>>>18,o[l++]=128|(d&258048)>>>12,o[l++]=128|(d&4032)>>>6,o[l++]=128|(d&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=o,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=a}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const i=t.charCodeAt(r);let a=i,o=!1;if(i>=55296&&i<=56319&&r+1<s){const l=t.charCodeAt(r+1);l>=56320&&l<=57343&&(a=(i-55296<<10)+65536|l-56320,o=!0)}a<=127?n+=1:a<=2047?n+=2:a<=65535?n+=3:n+=4,o&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Ca=class{constructor(e){if(Rr(this,"id",++Ca.LAST_ID),Rr(this,"_onigBinding"),Rr(this,"content"),Rr(this,"utf16Length"),Rr(this,"utf8Length"),Rr(this,"utf16OffsetToUtf8"),Rr(this,"utf8OffsetToUtf16"),Rr(this,"ptr"),!Pr)throw new H3("Must invoke loadWasm first.");this._onigBinding=Pr,this.content=e;const t=new _y(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Ca._sharedPtrInUse?(Ca._sharedPtr||(Ca._sharedPtr=Pr.omalloc(1e4)),Ca._sharedPtrInUse=!0,Pr.HEAPU8.set(t.utf8Value,Ca._sharedPtr),this.ptr=Ca._sharedPtr):this.ptr=t.createString(Pr)}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===Ca._sharedPtr?Ca._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let nm=Ca;Rr(nm,"LAST_ID",0);Rr(nm,"_sharedPtr",0);Rr(nm,"_sharedPtrInUse",!1);class QJ{constructor(t){if(Rr(this,"_onigBinding"),Rr(this,"_ptr"),!Pr)throw new H3("Must invoke loadWasm first.");const n=[],r=[];for(let o=0,l=t.length;o<l;o++){const c=new _y(t[o]);n[o]=c.createString(Pr),r[o]=c.utf8Length}const s=Pr.omalloc(4*t.length);Pr.HEAPU32.set(n,s/4);const i=Pr.omalloc(4*t.length);Pr.HEAPU32.set(r,i/4);const a=Pr.createOnigScanner(s,i,t.length);for(let o=0,l=t.length;o<l;o++)Pr.ofree(n[o]);Pr.ofree(i),Pr.ofree(s),a===0&&XJ(Pr),this._onigBinding=Pr,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new nm(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,a=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(a===0)return null;const o=i.HEAPU32;let l=a/4;const c=o[l++],u=o[l++],d=[];for(let f=0;f<u;f++){const m=t.convertUtf8OffsetToUtf16(o[l++]),p=t.convertUtf8OffsetToUtf16(o[l++]);d[f]={start:m,end:p,length:p-m}}return{index:c,captureIndices:d}}}function JJ(e){return typeof e.instantiator=="function"}function ZJ(e){return typeof e.default=="function"}function eZ(e){return typeof e.data<"u"}function tZ(e){return typeof Response<"u"&&e instanceof Response}function nZ(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 Jm;function rZ(e){if(Jm)return Jm;async function t(){Pr=await GJ(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),JJ(r)?r=await r.instantiator(n):ZJ(r)?r=await r.default(n):(eZ(r)&&(r=r.data),tZ(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await sZ(r)(n):r=await iZ(r)(n):nZ(r)?r=await Hv(r)(n):r instanceof WebAssembly.Module?r=await Hv(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Hv(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Jm=t(),Jm}function Hv(e){return t=>WebAssembly.instantiate(e,t)}function sZ(e){return t=>WebAssembly.instantiateStreaming(e,t)}function iZ(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let aZ;function oZ(){return aZ}async function fR(e){return e&&await rZ(e),{createScanner(t){return new QJ(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new nm(t)}}}function lZ(e){return F3(e)}function F3(e){return Array.isArray(e)?cZ(e):e instanceof RegExp?e:typeof e=="object"?uZ(e):e}function cZ(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=F3(e[n]);return t}function uZ(e){let t={};for(let n in e)t[n]=F3(e[n]);return t}function mR(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function pR(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?pR(e.substring(0,e.length-1)):e.substr(~t+1)}var Fv=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Zm=class{static hasCaptures(e){return e===null?!1:(Fv.lastIndex=0,Fv.test(e))}static replaceCaptures(e,t,n){return e.replace(Fv,(r,s,i,a)=>{let o=n[parseInt(s||i,10)];if(o){let l=t.substring(o.start,o.end);for(;l[0]===".";)l=l.substring(1);switch(a){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function gR(e,t){return e<t?-1:e>t?1:0}function yR(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=gR(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function o7(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 bR(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var vR=class{constructor(e){se(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}},e1=class{constructor(e,t,n){se(this,"_cachedMatchRoot",new vR(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(fZ(e),t)}static createFromParsedTheme(e,t){return pZ(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=>dZ(e.parent,s.parentScopes));return r?new xR(r.fontStyle,r.foreground,r.background):null}},Vv=class Kp{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Kp(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Kp(n,t[r]);return n}push(t){return new Kp(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 dZ(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&&!hZ(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function hZ(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var xR=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function fZ(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 a=t[s];if(!a.settings)continue;let o;if(typeof a.scope=="string"){let d=a.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),o=d.split(",")}else Array.isArray(a.scope)?o=a.scope:o=[""];let l=-1;if(typeof a.settings.fontStyle=="string"){l=0;let d=a.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 a.settings.foreground=="string"&&o7(a.settings.foreground)&&(c=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&o7(a.settings.background)&&(u=a.settings.background);for(let d=0,f=o.length;d<f;d++){let p=o[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 mZ(y,w,s,l,c,u)}}return n}var mZ=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}},Ao=(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))(Ao||{});function pZ(e,t){e.sort((l,c)=>{let u=gR(l.scope,c.scope);return u!==0||(u=yR(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 gZ(t),a=new xR(n,i.getId(r),i.getId(s)),o=new bZ(new Cx(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let u=e[l];o.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new e1(i,a,o)}var gZ=class{constructor(e){se(this,"_isFrozen");se(this,"_lastColorId");se(this,"_id2color");se(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)}},yZ=Object.freeze([]),Cx=class wR{constructor(t,n,r,s,i){se(this,"scopeDepth");se(this,"parentScopes");se(this,"fontStyle");se(this,"foreground");se(this,"background");this.scopeDepth=t,this.parentScopes=n||yZ,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new wR(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)}},bZ=class Ax{constructor(t,n=[],r={}){se(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(Ax._cmpBySpecificity),n}insert(t,n,r,s,i,a){if(n===""){this._doInsertHere(t,r,s,i,a);return}let o=n.indexOf("."),l,c;o===-1?(l=n,c=""):(l=n.substring(0,o),c=n.substring(o+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Ax(this._mainRule.clone(),Cx.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(t+1,c,r,s,i,a)}_doInsertHere(t,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(t,r,s,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let l=this._rulesWithParentScopes[a];if(yR(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 Cx(t,n,r,s,i))}},Zd=class Mi{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Mi.getLanguageId(t),r=Mi.getTokenType(t),s=Mi.getFontStyle(t),i=Mi.getForeground(t),a=Mi.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:a})}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,a,o){let l=Mi.getLanguageId(t),c=Mi.getTokenType(t),u=Mi.containsBalancedBrackets(t)?1:0,d=Mi.getFontStyle(t),f=Mi.getForeground(t),m=Mi.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),i!==-1&&(d=i),a!==0&&(f=a),o!==0&&(m=o),(l<<0|c<<8|u<<10|d<<11|f<<15|m<<24)>>>0}};function t1(e,t){const n=[],r=vZ(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=a();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=o();return s===")"&&(s=r.next()),l}if(l7(s)){const l=[];do l.push(s),s=r.next();while(l7(s));return c=>t(l,c)}return null}function a(){const l=[];let c=i();for(;c;)l.push(c),c=i();return u=>l.every(d=>d(u))}function o(){const l=[];let c=a();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=a()}return u=>l.some(d=>d(u))}}function l7(e){return!!e&&!!e.match(/[\w\.:]+/)}function vZ(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 _R(e){typeof e.dispose=="function"&&e.dispose()}var b0=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},xZ=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},wZ=class{constructor(){se(this,"_references",[]);se(this,"_seenReferenceKeys",new Set);se(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))}},_Z=class{constructor(e,t){se(this,"seenFullScopeRequests",new Set);se(this,"seenPartialScopeRequests",new Set);se(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new b0(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new wZ;for(const n of e)kZ(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof b0){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 kZ(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 b0?Yp({baseGrammar:i,selfGrammar:s},r):Ex(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const a=n.injections(e.scopeName);if(a)for(const o of a)r.add(new b0(o))}function Ex(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];n1([r],t,n)}}function Yp(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&n1(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&n1(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function n1(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?mR({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&n1(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const a=kR(i);switch(a.kind){case 0:Yp({...t,selfGrammar:t.baseGrammar},n);break;case 1:Yp(t,n);break;case 2:Ex(a.ruleName,{...t,repository:s},n);break;case 3:case 4:const o=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(o){const l={baseGrammar:t.baseGrammar,selfGrammar:o,repository:s};a.kind===4?Ex(a.ruleName,l,n):Yp(l,n)}else a.kind===4?n.add(new xZ(a.scopeName,a.ruleName)):n.add(new b0(a.scopeName));break}}}var SZ=class{constructor(){se(this,"kind",0)}},TZ=class{constructor(){se(this,"kind",1)}},CZ=class{constructor(e){se(this,"kind",2);this.ruleName=e}},AZ=class{constructor(e){se(this,"kind",3);this.scopeName=e}},EZ=class{constructor(e,t){se(this,"kind",4);this.scopeName=e,this.ruleName=t}};function kR(e){if(e==="$base")return new SZ;if(e==="$self")return new TZ;const t=e.indexOf("#");if(t===-1)return new AZ(e);if(t===0)return new CZ(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new EZ(n,r)}}var MZ=/\\(\d+)/,c7=/\\(\d+)/g,NZ=-1,SR=-2;var rm=class{constructor(t,n,r,s){se(this,"$location");se(this,"id");se(this,"_nameIsCapturing");se(this,"_name");se(this,"_contentNameIsCapturing");se(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=Zm.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=Zm.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${pR(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:Zm.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Zm.replaceCaptures(this._contentName,t,n)}},IZ=class extends rm{constructor(t,n,r,s,i){super(t,n,r,s);se(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!")}},RZ=class extends rm{constructor(t,n,r,s,i){super(t,n,r,null);se(this,"_match");se(this,"captures");se(this,"_cachedCompiledPatterns");this._match=new v0(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}},u7=class extends rm{constructor(t,n,r,s,i){super(t,n,r,s);se(this,"hasMissingPatterns");se(this,"patterns");se(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}},Mx=class extends rm{constructor(t,n,r,s,i,a,o,l,c,u){super(t,n,r,s);se(this,"_begin");se(this,"beginCaptures");se(this,"_end");se(this,"endHasBackReferences");se(this,"endCaptures");se(this,"applyEndPatternLast");se(this,"hasMissingPatterns");se(this,"patterns");se(this,"_cachedCompiledPatterns");this._begin=new v0(i,this.id),this.beginCaptures=a,this._end=new v0(o||"",-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}},r1=class extends rm{constructor(t,n,r,s,i,a,o,l,c){super(t,n,r,s);se(this,"_begin");se(this,"beginCaptures");se(this,"whileCaptures");se(this,"_while");se(this,"whileHasBackReferences");se(this,"hasMissingPatterns");se(this,"patterns");se(this,"_cachedCompiledPatterns");se(this,"_cachedCompiledWhilePatterns");this._begin=new v0(i,this.id),this.beginCaptures=a,this.whileCaptures=l,this._while=new v0(o,SR),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}},TR=class os{static createCaptureRule(t,n,r,s,i){return t.registerRule(a=>new IZ(n,a,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new RZ(t.$vscodeTextmateLocation,t.id,t.name,t.match,os._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=mR({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new u7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,os._compilePatterns(i,n,r))}return t.while?new r1(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,os._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,os._compileCaptures(t.whileCaptures||t.captures,n,r),os._compilePatterns(t.patterns,n,r)):new Mx(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,os._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,os._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,os._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let i=0;for(const a in t){if(a==="$vscodeTextmateLocation")continue;const o=parseInt(a,10);o>i&&(i=o)}for(let a=0;a<=i;a++)s[a]=null;for(const a in t){if(a==="$vscodeTextmateLocation")continue;const o=parseInt(a,10);let l=0;t[a].patterns&&(l=os.getCompiledRuleId(t[a],n,r)),s[o]=os.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,l)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,a=t.length;i<a;i++){const o=t[i];let l=-1;if(o.include){const c=kR(o.include);switch(c.kind){case 0:case 1:l=os.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=os.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=os.getCompiledRuleId(p,n,m.repository))}else l=os.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=os.getCompiledRuleId(o,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof u7||c instanceof Mx||c instanceof r1)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},v0=class CR{constructor(t,n){se(this,"source");se(this,"ruleId");se(this,"hasAnchor");se(this,"hasBackReferences");se(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let s=0,i=[],a=!1;for(let o=0;o<r;o++)if(t.charAt(o)==="\\"&&o+1<r){const c=t.charAt(o+1);c==="z"?(i.push(t.substring(s,o)),i.push("$(?!\\n)(?<!\\n)"),s=o+2):(c==="A"||c==="G")&&(a=!0),o++}this.hasAnchor=a,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=MZ.test(this.source):this.hasBackReferences=!1}clone(){return new CR(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 c7.lastIndex=0,this.source.replace(c7,(s,i)=>bR(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,a,o,l;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),t[i]=o,n[i]=o,r[i]=o,s[i]=o,o==="\\"&&i+1<a&&(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(){se(this,"_items");se(this,"_hasAnchors");se(this,"_cached");se(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 d7(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 d7(e,r,this._items.map(s=>s.ruleId))}},d7=class{constructor(e,t,n){se(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}},Wv=class{constructor(e,t){this.languageId=e,this.tokenType=t}},_o,jZ=(_o=class{constructor(t,n){se(this,"_defaultAttributes");se(this,"_embeddedLanguagesMatcher");se(this,"_getBasicScopeAttributes",new vR(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new Wv(n,r)}));this._defaultAttributes=new Wv(t,8),this._embeddedLanguagesMatcher=new DZ(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?_o._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(_o.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!")}},se(_o,"_NULL_SCOPE_METADATA",new Wv(0,0)),se(_o,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),_o),DZ=class{constructor(e){se(this,"values");se(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>bR(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])}},h7=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function AR(e,t,n,r,s,i,a,o){const l=t.content.length;let c=!1,u=-1;if(a){const m=OZ(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(o!==0&&Date.now()-d>o)return new h7(s,!0);f()}return new h7(s,!1);function f(){const m=LZ(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===NZ){const v=s.getRule(e);i.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),bf(e,t,n,s,i,v.endCaptures,p),i.produce(s,p[0].end);const g=s;if(s=s.parent,u=g.getAnchorPos(),!w&&g.getEnterPos()===r){s=g,i.produce(s,l),c=!0;return}}else{const v=e.getRule(y);i.produce(s,p[0].start);const g=s,x=v.getName(t.content,p),k=s.contentNameScopesList.pushAttributed(x,e);if(s=s.push(y,r,u,p[0].end===l,null,k,k),v instanceof Mx){const A=v;bf(e,t,n,s,i,A.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const T=A.getContentName(t.content,p),C=k.pushAttributed(T,e);if(s=s.withContentNameScopesList(C),A.endHasBackReferences&&(s=s.withEndRule(A.getEndWithResolvedBackReferences(t.content,p))),!w&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(v instanceof r1){const A=v;bf(e,t,n,s,i,A.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const T=A.getContentName(t.content,p),C=k.pushAttributed(T,e);if(s=s.withContentNameScopesList(C),A.whileHasBackReferences&&(s=s.withEndRule(A.getWhileWithResolvedBackReferences(t.content,p))),!w&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(bf(e,t,n,s,i,v.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 OZ(e,t,n,r,s,i){let a=s.beginRuleCapturedEOL?0:-1;const o=[];for(let l=s;l;l=l.pop()){const c=l.getRule(e);c instanceof r1&&o.push({rule:c,stack:l})}for(let l=o.pop();l;l=o.pop()){const{ruleScanner:c,findOptions:u}=$Z(l.rule,e,l.stack.endRule,n,r===a),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==SR){s=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(i.produce(l.stack,d.captureIndices[0].start),bf(e,t,n,l.stack,i,l.rule.whileCaptures,d.captureIndices),i.produce(l.stack,d.captureIndices[0].end),a=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:a,isFirstLine:n}}function LZ(e,t,n,r,s,i){const a=BZ(e,t,n,r,s,i),o=e.getInjections();if(o.length===0)return a;const l=zZ(o,e,t,n,r,s,i);if(!l)return a;if(!a)return l;const c=a.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:a}function BZ(e,t,n,r,s,i){const a=s.getRule(e),{ruleScanner:o,findOptions:l}=ER(a,e,s.endRule,n,r===i),c=o.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function zZ(e,t,n,r,s,i,a){let o=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:v}=ER(y,t,null,r,s===a),g=w.findNextMatchSync(n,s,v);if(!g)continue;const x=g.captureIndices[0].start;if(!(x>=o)&&(o=x,l=g.captureIndices,c=g.ruleId,u=p.priority,o===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function ER(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function $Z(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function bf(e,t,n,r,s,i,a){if(i.length===0)return;const o=t.content,l=Math.min(i.length,a.length),c=[],u=a[0].end;for(let d=0;d<l;d++){const f=i[d];if(f===null)continue;const m=a[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(o,a),w=r.contentNameScopesList.pushAttributed(y,e),v=f.getContentName(o,a),g=w.pushAttributed(v,e),x=r.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,w,g),k=e.createOnigString(o.substring(0,m.end));AR(e,k,n&&m.start===0,m.start,x,s,!1,0),_R(k);continue}const p=f.getName(o,a);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new PZ(w,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var PZ=class{constructor(e,t){se(this,"scopes");se(this,"endPos");this.scopes=e,this.endPos=t}};function qZ(e,t,n,r,s,i,a,o){return new HZ(e,t,n,r,s,i,a,o)}function f7(e,t,n,r,s){const i=t1(t,s1),a=TR.getCompiledRuleId(n,r,s.repository);for(const o of i)e.push({debugSelector:t,matcher:o.matcher,ruleId:a,grammar:s,priority:o.priority})}function s1(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(UZ(t[s],r))return n=s+1,!0;return!1})}function UZ(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 HZ=class{constructor(e,t,n,r,s,i,a,o){se(this,"_rootId");se(this,"_lastRuleId");se(this,"_ruleId2desc");se(this,"_includedGrammars");se(this,"_grammarRepository");se(this,"_grammar");se(this,"_injections");se(this,"_basicScopeAttributesProvider");se(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=o,this._basicScopeAttributesProvider=new jZ(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=m7(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=t1(l,s1);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 a in s)f7(t,a,s[a],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(a=>{const o=this.getExternalGrammar(a);if(o){const l=o.injectionSelector;l&&f7(t,l,o,this,o)}})}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]=m7(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=TR.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===Nx.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=Zd.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=Ff.createRootAndLookUpScopeName(f,d,this):m=Ff.createRoot("unknown",d),t=new Nx(null,this._rootId,-1,-1,!1,null,m,m)}else s=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),a=i.content.length,o=new VZ(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=AR(this,i,s,0,t,o,!0,r);return _R(i),{lineLength:a,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function m7(e,t){return e=lZ(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 Ff=class Aa{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=Vv.push(s,i.scopeNames),r=new Aa(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new Aa(null,new Vv(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new Vv(null,t),a=r.themeProvider.themeMatch(i),o=Aa.mergeAttributes(n,s,a);return new Aa(null,i,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Aa.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,a=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,a=r.backgroundId),Zd.set(t,n.languageId,n.tokenType,null,s,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Aa._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=Aa._pushAttributed(s,i,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),a=r.themeProvider.themeMatch(i),o=Aa.mergeAttributes(t.tokenAttributes,s,a);return new Aa(t,i,o)}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}},Li,Nx=(Li=class{constructor(t,n,r,s,i,a,o,l){se(this,"_stackElementBrand");se(this,"_enterPos");se(this,"_anchorPos");se(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}equals(t){return t===null?!1:Li._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Ff.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(){Li._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,a,o){return new Li(this,t,n,r,s,i,a,o)}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 Li(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=Ff.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Li(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ff.fromExtension(r,n.contentNameScopesList))}},se(Li,"NULL",new Li(null,0,0,0,!1,null,null,null)),Li),FZ=class{constructor(e,t){se(this,"balancedBracketScopes");se(this,"unbalancedBracketScopes");se(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):t1(n,s1).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>t1(n,s1).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}},VZ=class{constructor(e,t,n,r){se(this,"_emitBinaryTokens");se(this,"_lineText");se(this,"_tokens");se(this,"_binaryTokens");se(this,"_lastTokenEndIndex");se(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 a=(e==null?void 0:e.getScopeNames())??[];for(const o of this._tokenTypeOverrides)o.matcher(a)&&(s=Zd.set(s,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(a))}if(i&&(s=Zd.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}},WZ=class{constructor(e,t){se(this,"_grammars",new Map);se(this,"_rawGrammars",new Map);se(this,"_injectionGrammars",new Map);se(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,qZ(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},GZ=class{constructor(t){se(this,"_options");se(this,"_syncRegistry");se(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new WZ(e1.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(e1.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 FZ(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const a=new _Z(this._syncRegistry,t);for(;a.Q.length>0;)a.Q.map(o=>this._loadSingleGrammar(o.scopeName)),a.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=Nx.NULL;const KZ=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],YZ=/["&'<>`]/g,XZ=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,QZ=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,JZ=/[|\\{}()[\]^$+*?.]/g,p7=new WeakMap;function ZZ(e,t){if(e=e.replace(t.subset?eee(t.subset):YZ,r),t.subset||t.escapeOnly)return e;return e.replace(XZ,n).replace(QZ,r);function n(s,i,a){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,a.charCodeAt(i+2),t)}function r(s,i,a){return t.format(s.charCodeAt(0),a.charCodeAt(i+1),t)}}function eee(e){let t=p7.get(e);return t||(t=tee(e),p7.set(e,t)),t}function tee(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(JZ,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const nee=/[\dA-Fa-f]/;function ree(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!nee.test(String.fromCharCode(t))?r:r+";"}const see=/\d/;function iee(e,t,n){const r="&#"+String(e);return n&&t&&!see.test(String.fromCharCode(t))?r:r+";"}const aee=["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"],Gv={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:"€"},oee=["cent","copy","divide","gt","lt","not","para","times"],MR={}.hasOwnProperty,Rx={};let ep;for(ep in Gv)MR.call(Gv,ep)&&(Rx[Gv[ep]]=ep);const lee=/[^\dA-Za-z]/;function cee(e,t,n,r){const s=String.fromCharCode(e);if(MR.call(Rx,s)){const i=Rx[s],a="&"+i;return n&&aee.includes(i)&&!oee.includes(i)&&(!r||t&&t!==61&&lee.test(String.fromCharCode(t)))?a:a+";"}return""}function uee(e,t,n){let r=ree(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=cee(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=iee(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Nd(e,t){return ZZ(e,Object.assign({format:uee},t))}const dee=/^>|^->|<!--|-->|--!>|<!-$/g,hee=[">"],fee=["<",">"];function mee(e,t,n,r){return r.settings.bogusComments?"<?"+Nd(e.value,Object.assign({},r.settings.characterReferences,{subset:hee}))+">":"<!--"+e.value.replace(dee,s)+"-->";function s(i){return Nd(i,Object.assign({},r.settings.characterReferences,{subset:fee}))}}function pee(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const zr=IR(1),NR=IR(-1),gee=[];function IR(e){return t;function t(n,r,s){const i=n?n.children:gee;let a=(r||0)+e,o=i[a];if(!s)for(;o&&ry(o);)a+=e,o=i[a];return o}}const yee={}.hasOwnProperty;function RR(e){return t;function t(n,r,s){return yee.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const V3=RR({body:vee,caption:Kv,colgroup:Kv,dd:kee,dt:_ee,head:Kv,html:bee,li:wee,optgroup:See,option:Tee,p:xee,rp:g7,rt:g7,tbody:Aee,td:y7,tfoot:Eee,th:y7,thead:Cee,tr:Mee});function Kv(e,t,n){const r=zr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&ry(r.value.charAt(0)))}function bee(e,t,n){const r=zr(n,t);return!r||r.type!=="comment"}function vee(e,t,n){const r=zr(n,t);return!r||r.type!=="comment"}function xee(e,t,n){const r=zr(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 wee(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function _ee(e,t,n){const r=zr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function kee(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function g7(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function See(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Tee(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Cee(e,t,n){const r=zr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Aee(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Eee(e,t,n){return!zr(n,t)}function Mee(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function y7(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Nee=RR({body:jee,colgroup:Dee,head:Ree,html:Iee,tbody:Oee});function Iee(e){const t=zr(e,-1);return!t||t.type!=="comment"}function Ree(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 jee(e){const t=zr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&ry(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Dee(e,t,n){const r=NR(n,t),s=zr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&V3(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Oee(e,t,n){const r=NR(n,t),s=zr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&V3(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const tp={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 Lee(e,t,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let a=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const o=[];let l;s.space==="html"&&e.tagName==="svg"&&(r.schema=xh);const c=Bee(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(a=!1),(c||!i||!Nee(e,t,n))&&(o.push("<",e.tagName,c?" "+c:""),a&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(u),!a&&(!i||!V3(e,t,n))&&o.push("</"+e.tagName+">"),o.join("")}function Bee(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=zee(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 zee(e,t,n){const r=a3(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let a=e.quote,o;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=Nd(r.attribute,Object.assign({},e.settings.characterReferences,{subset:tp.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?KM:nN)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(o=Nd(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:tp.unquoted[s][i]}))),o!==n&&(e.settings.quoteSmart&&Wg(n,a)>Wg(n,e.alternative)&&(a=e.alternative),o=a+Nd(n,Object.assign({},e.settings.characterReferences,{subset:(a==="'"?tp.single:tp.double)[s][i],attribute:!0}))+a),l+(o&&"="+o))}const $ee=["<","&"];function jR(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Nd(e.value,Object.assign({},r.settings.characterReferences,{subset:$ee}))}function Pee(e,t,n,r){return r.settings.allowDangerousHtml?e.value:jR(e,t,n,r)}function qee(e,t,n,r){return r.all(e)}const Uee=BK("type",{invalid:Hee,unknown:Fee,handlers:{comment:mee,doctype:pee,element:Lee,raw:Pee,root:qee,text:jR}});function Hee(e){throw new Error("Expected node, not `"+e+"`")}function Fee(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const Vee={},Wee={},Gee=[];function Kee(e,t){const n=Vee,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Yee,all:Xee,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||KZ,characterReferences:n.characterReferences||Wee,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?xh:o3,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Yee(e,t,n){return Uee(e,t,n,this)}function Xee(e){const t=[],n=e&&e.children||Gee;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Qee(e){return Array.isArray(e)?e:[e]}function ky(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let a=0;a<n.length;a+=2){const o=t?n[a]+(n[a+1]||""):n[a];s.push([o,r]),r+=n[a].length,r+=((i=n[a+1])==null?void 0:i.length)||0}return s}function W3(e){return!e||["plaintext","txt","text","plain"].includes(e)}function DR(e){return e==="ansi"||W3(e)}function G3(e){return e==="none"}function OR(e){return G3(e)}function LR(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 Jee(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 Zee(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(a=>s.offset<a&&a<s.offset+s.content.length).map(a=>a-s.offset).sort((a,o)=>a-o);return i.length?Jee(s,i):s})):e}async function BR(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function i1(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 Qc(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function zR(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Ao.Italic&&(t["font-style"]="italic"),e.fontStyle&Ao.Bold&&(t["font-weight"]="bold"),e.fontStyle&Ao.Underline&&(t["text-decoration"]="underline")),t}function ete(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function tte(e){const t=ky(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,a=0;for(const o of t){if(i<o.length)break;i-=o.length,a++}return{line:a,character:i}}function r(s,i){let a=0;for(let o=0;o<s;o++)a+=t[o].length;return a+=i,a}return{lines:t,indexToPos:n,posToIndex:r}}class _s extends Error{constructor(t){super(t),this.name="ShikiError"}}const $R=new WeakMap;function Sy(e,t){$R.set(e,t)}function w0(e){return $R.get(e)}class Ch{constructor(...t){se(this,"_stacks",{});se(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 Ch(Object.fromEntries(Qee(n).map(r=>[r,Ix])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return b7(this._stacks[this.theme])}getScopes(t=this.theme){return b7(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function b7(e){const t=[],n=new Set;function r(s){var a;if(n.has(s))return;n.add(s);const i=(a=s==null?void 0:s.nameScopesList)==null?void 0:a.scopeName;i&&t.push(i),s.parent&&r(s.parent)}return r(e),t}function nte(e,t){if(!(e instanceof Ch))throw new _s("Invalid grammar state");return e.getInternalStack(t)}function rte(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new _s(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...s.indexToPos(a),offset:a}}else{const o=s.lines[a.line];if(o===void 0)throw new _s(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);if(a.character<0||a.character>o.length)throw new _s(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${o.length}`);return{...a,offset:s.posToIndex(a.line,a.character)}}};const s=tte(n.source),i=(n.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));ste(i),e.set(n.meta,{decorations:i,converter:s,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var a;if(!((a=this.options.decorations)!=null&&a.length))return;const s=t(this).decorations.flatMap(o=>[o.start.offset,o.end.offset]);return Zee(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 _s(`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="",v=-1,g=-1;if(f===0&&(v=0),m===0&&(g=0),m===Number.POSITIVE_INFINITY&&(g=y.children.length),v===-1||g===-1)for(let k=0;k<y.children.length;k++)w+=PR(y.children[k]),v===-1&&w.length===f&&(v=k+1),g===-1&&w.length===m&&(g=k+1);if(v===-1)throw new _s(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(g===-1)throw new _s(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const x=y.children.slice(v,g);if(!p.alwaysWrap&&x.length===y.children.length)o(y,p,"line");else if(!p.alwaysWrap&&x.length===1&&x[0].type==="element")o(x[0],p,"token");else{const k={type:"element",tagName:"span",properties:{},children:x};o(k,p,"wrapper"),y.children.splice(v,x.length,k)}}function a(d,f){s[d]=o(s[d],f,"line")}function o(d,f,m){var w;const p=f.properties||{},y=f.transform||(v=>v);return d.tagName=f.tagName||"span",d.properties={...d.properties,...p,class:d.properties.class},(w=f.properties)!=null&&w.class&&LR(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(()=>a(p,d));i(m.line,0,m.character,d)}}l.forEach(d=>d())}}}function ste(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new _s(`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,a=n.start.offset<s.end.offset&&s.end.offset<n.end.offset,o=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||a||o||l){if(a&&a||o&&l)continue;throw new _s(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function PR(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(PR).join(""):""}const ite=[rte()];function a1(e){return[...e.transformers||[],...ite]}var Jc=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Yv={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function ate(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 v7(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(a=>Number.parseInt(a));i.length===3&&!i.some(a=>Number.isNaN(a))&&(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 ote(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)Yv[s]&&t.push({type:"setDecoration",value:Yv[s]});else if(s<=29){const i=Yv[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Jc[s-30]}});else if(s===38){const[i,a]=v7(e,n);a&&t.push({type:"setForegroundColor",value:a}),n+=i}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Jc[s-40]}});else if(s===48){const[i,a]=v7(e,n);a&&t.push({type:"setBackgroundColor",value:a}),n+=i}else s===49?t.push({type:"resetBackgroundColor"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Jc[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Jc[s-100+8]}})}return t}function lte(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const a=ate(r,i),o=a.sequence?r.substring(i,a.startPosition):r.substring(i);if(o.length>0&&s.push({value:o,foreground:e,background:t,decorations:new Set(n)}),a.sequence){const l=ote(a.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=a.position}while(i<r.length);return s}}}var cte={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 ute(e=cte){function t(o){return e[o]}function n(o){return`#${o.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<Jc.length;c++)r.push(t(Jc[c]));let o=[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([o[c],o[u],o[d]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(o){return s()[o]}function a(o){switch(o.type){case"named":return t(o.name);case"rgb":return n(o.rgb);case"table":return i(o.index)}}return{value:a}}function dte(e,t,n){const r=i1(e,n),s=ky(t),i=ute(Object.fromEntries(Jc.map(o=>{var l;return[o,(l=e.colors)==null?void 0:l[`terminal.ansi${o[0].toUpperCase()}${o.substring(1)}`]]}))),a=lte();return s.map(o=>a.parse(o[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=Qc(c,r),u=Qc(u,r),l.decorations.has("dim")&&(c=hte(c));let d=Ao.None;return l.decorations.has("bold")&&(d|=Ao.Bold),l.decorations.has("italic")&&(d|=Ao.Italic),l.decorations.has("underline")&&(d|=Ao.Underline),{content:l.value,offset:o[1],color:c,bgColor:u,fontStyle:d}}))}function hte(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 K3(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(W3(r)||G3(s))return ky(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:a}=e.setTheme(s);if(r==="ansi")return dte(i,t,n);const o=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new Do(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Do(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return mte(t,o,i,a,n)}function fte(...e){if(e.length===2)return w0(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(W3(s)||G3(i))throw new Do("Plain language does not have grammar state");if(s==="ansi")throw new Do("ANSI language does not have grammar state");const{theme:a,colorMap:o}=t.setTheme(i),l=t.getLanguage(s);return new Ch(o1(n,l,a,o,r).stateStack,l.name,a.name)}function mte(e,t,n,r,s){const i=o1(e,t,n,r,s),a=new Ch(o1(e,t,n,r,s).stateStack,t.name,n.name);return Sy(i.tokens,a),i.tokens}function o1(e,t,n,r,s){const i=i1(n,s),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:o=500}=s,l=ky(e);let c=s.grammarState?nte(s.grammarState,n.name)??Ix:s.grammarContextCode!=null?o1(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(a>0&&p.length>=a){u=[],d.push([{content:p,offset:y,color:"",fontStyle:0}]);continue}let w,v,g;s.includeExplanation&&(w=t.tokenizeLine(p,c),v=w.tokens,g=0);const x=t.tokenizeLine2(p,c,o),k=x.tokens.length/2;for(let A=0;A<k;A++){const T=x.tokens[2*A],C=A+1<k?x.tokens[2*A+2]:p.length;if(T===C)continue;const j=x.tokens[2*A+1],z=Qc(r[Zd.getForeground(j)],i),E=Zd.getFontStyle(j),P={content:p.substring(T,C),offset:y+T,color:z,fontStyle:E};if(s.includeExplanation){const D=[];if(s.includeExplanation!=="scopeName")for(const W of n.settings){let J;switch(typeof W.scope){case"string":J=W.scope.split(/,/).map(Y=>Y.trim());break;case"object":J=W.scope;break;default:continue}D.push({settings:W,selectors:J.map(Y=>Y.split(/ /))})}P.explanation=[];let H=0;for(;T+H<C;){const W=v[g],J=p.substring(W.startIndex,W.endIndex);H+=J.length,P.explanation.push({content:J,scopes:s.includeExplanation==="scopeName"?pte(W.scopes):gte(D,W.scopes)}),g+=1}}u.push(P)}d.push(u),u=[],c=x.ruleStack}return{tokens:d,stateStack:c}}function pte(e){return e.map(t=>({scopeName:t}))}function gte(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:bte(e,i,t.slice(0,r))}}return n}function x7(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function yte(e,t,n){if(!x7(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)x7(e[r],n[s])&&(r-=1),s-=1;return r===-1}function bte(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const a of s)if(yte(a,t,n)){r.push(i);break}return r}function qR(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=K3(e,t,{...n,theme:l.theme}),u=w0(c),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:d}}),i=vte(...s.map(l=>l.tokens)),a=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:v,...g}=m[c][d];f.variants[r[p].color]=g}),f})),o=s[0].state?new Ch(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 o&&Sy(a,o),a}function vte(...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 a=s.map(()=>0),o=s.map(l=>l[0]);for(;o.every(l=>l);){const l=Math.min(...o.map(c=>c.content.length));for(let c=0;c<n;c++){const u=o[c];u.content.length===l?(i[c].push(u),a[c]+=1,o[c]=s[c][a[c]]):(i[c].push({...u,content:u.content.slice(0,l)}),o[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return t}function l1(e,t,n){let r,s,i,a,o,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,v)=>w.color===c?-1:v.color===c?1:0);if(d.length===0)throw new Do("`themes` option must not be empty");const f=qR(e,t,n);if(l=w0(f),c&&!d.find(w=>w.color===c))throw new Do(`\`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(v=>xte(v,p,u,c))),l&&Sy(i,l);const y=d.map(w=>i1(w.theme,n));s=d.map((w,v)=>(v===0&&c?"":`${u+w.color}:`)+(Qc(m[v].fg,y[v])||"inherit")).join(";"),r=d.map((w,v)=>(v===0&&c?"":`${u+w.color}-bg:`)+(Qc(m[v].bg,y[v])||"inherit")).join(";"),a=`shiki-themes ${m.map(w=>w.name).join(" ")}`,o=c?void 0:[s,r].join(";")}else if("theme"in n){const c=i1(n.theme,n);i=K3(e,t,n);const u=e.getTheme(n.theme);r=Qc(u.bg,c),s=Qc(u.fg,c),a=u.name,l=w0(i)}else throw new Do("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:a,rootStyle:o,grammarState:l}}function xte(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>zR(e.variants[l])),a=new Set(i.flatMap(l=>Object.keys(l))),o={};return i.forEach((l,c)=>{for(const u of a){const d=l[u]||"inherit";if(c===0&&r)o[u]=d;else{const f=u==="color"?"":u==="background-color"?"-bg":`-${u}`,m=n+t[c]+(u==="color"?"":f);o[m]=d}}}),s.htmlStyle=o,s}function c1(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>c1(e,s,i),codeToTokens:(s,i)=>l1(e,s,i)}){var m,p;let s=t;for(const y of a1(n))s=((m=y.preprocess)==null?void 0:m.call(r,s,n))||s;let{tokens:i,fg:a,bg:o,themeName:l,rootStyle:c,grammarState:u}=l1(e,s,n);const{mergeWhitespaces:d=!0}=n;d===!0?i=_te(i):d==="never"&&(i=kte(i));const f={...r,get source(){return s}};for(const y of a1(n))i=((p=y.tokens)==null?void 0:p.call(f,i))||i;return wte(i,{...n,fg:a,bg:o,themeName:l,rootStyle:c},f,u)}function wte(e,t,n,r=w0(e)){var p,y,w;const s=a1(t),i=[],a={type:"root",children:[]},{structure:o="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(([v])=>!v.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const d=[],f={...n,structure:o,addClassToHast:LR,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return c},get code(){return u},get lines(){return d}};if(e.forEach((v,g)=>{var A,T;g&&(o==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):o==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const C of v){let j={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};C.htmlStyle;const z=ete(C.htmlStyle||zR(C));z&&(j.properties.style=z);for(const E of s)j=((A=E==null?void 0:E.span)==null?void 0:A.call(f,j,g+1,k,x,C))||j;o==="inline"?a.children.push(j):o==="classic"&&x.children.push(j),k+=C.content.length}if(o==="classic"){for(const C of s)x=((T=C==null?void 0:C.line)==null?void 0:T.call(f,x,g+1))||x;d.push(x),i.push(x)}}),o==="classic"){for(const v of s)u=((p=v==null?void 0:v.code)==null?void 0:p.call(f,u))||u;c.children.push(u);for(const v of s)c=((y=v==null?void 0:v.pre)==null?void 0:y.call(f,c))||c;a.children.push(c)}let m=a;for(const v of s)m=((w=v==null?void 0:v.root)==null?void 0:w.call(f,m))||m;return r&&Sy(m,r),m}function _te(e){return e.map(t=>{const n=[];let r="",s=0;return t.forEach((i,a)=>{const l=!(i.fontStyle&&i.fontStyle&Ao.Underline);l&&i.content.match(/^\s+$/)&&t[a+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 kte(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,a]=r;if(!s&&!a)return n;const o=[{...n,offset:n.offset+s.length,content:i}];return s&&o.unshift({content:s,offset:n.offset}),a&&o.push({content:a,offset:n.offset+s.length+i.length}),o}))}function Ste(e,t,n){var i;const r={meta:{},options:n,codeToHast:(a,o)=>c1(e,a,o),codeToTokens:(a,o)=>l1(e,a,o)};let s=Kee(c1(e,t,n,r));for(const a of a1(n))s=((i=a.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const w7={light:"#333333",dark:"#bbbbbb"},_7={light:"#fffffe",dark:"#1e1e1e"},k7="__shiki_resolved";function Y3(e){var o,l,c,u,d;if(e!=null&&e[k7])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;(o=f==null?void 0:f.settings)!=null&&o.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"?w7.light:w7.dark),n||(n=t.type==="light"?_7.light:_7.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 a(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}`]?a(f):(i.set(f,m),m)}t.settings=t.settings.map(f=>{var w,v;const m=((w=f.settings)==null?void 0:w.foreground)&&!f.settings.foreground.startsWith("#"),p=((v=f.settings)==null?void 0:v.background)&&!f.settings.background.startsWith("#");if(!m&&!p)return f;const y={...f,settings:{...f.settings}};if(m){const g=a(f.settings.foreground);t.colorReplacements[g]=f.settings.foreground,y.settings.foreground=g}if(p){const g=a(f.settings.background);t.colorReplacements[g]=f.settings.background,y.settings.background=g}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=a(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,k7,{enumerable:!1,writable:!1,value:!0}),t}async function UR(e){return Array.from(new Set((await Promise.all(e.filter(t=>!DR(t)).map(async t=>await BR(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function HR(e){return(await Promise.all(e.map(async n=>OR(n)?null:Y3(await BR(n))))).filter(n=>!!n)}class Tte extends GZ{constructor(n,r,s,i={}){super(n);se(this,"_resolvedThemes",new Map);se(this,"_resolvedGrammars",new Map);se(this,"_langMap",new Map);se(this,"_langGraph",new Map);se(this,"_textmateThemeCache",new WeakMap);se(this,"_loadedThemesCache",null);se(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=s,this._alias=i,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=Y3(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=e1.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 _s(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var a,o,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,(o=(a=this._syncRegistry)==null?void 0:a._injectionGrammars)==null||o.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,a])=>!a);if(s.length){const i=r.filter(([a,o])=>{var l;return o&&((l=o.embeddedLangs)==null?void 0:l.some(c=>s.map(([u])=>u).includes(c)))}).filter(a=>!s.includes(a));throw new _s(`Missing languages ${s.map(([a])=>`\`${a}\``).join(", ")}, required by ${i.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[i,a]of r)this._resolver.addLanguage(a);for(const[i,a]of r)this.loadLanguage(a)}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 Cte{constructor(t,n){se(this,"_langs",new Map);se(this,"_scopeToLang",new Map);se(this,"_injections",new Map);se(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 ef=0;function Ate(e){ef+=1,e.warnings!==!1&&ef>=10&&ef%10===0&&console.warn(`[Shiki] ${ef} 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 _s("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Y3),s=new Cte(e.engine,n),i=new Tte(s,r,n,e.langAlias);let a;function o(g){w();const x=i.getGrammar(typeof g=="string"?g:g.name);if(!x)throw new _s(`Language \`${g}\` not found, you may need to load it first`);return x}function l(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const x=i.getTheme(g);if(!x)throw new _s(`Theme \`${g}\` not found, you may need to load it first`);return x}function c(g){w();const x=l(g);a!==g&&(i.setTheme(x),a=g);const k=i.getColorMap();return{theme:x,colorMap:k}}function u(){return w(),i.getLoadedThemes()}function d(){return w(),i.getLoadedLanguages()}function f(...g){w(),i.loadLanguages(g.flat(1))}async function m(...g){return f(await UR(g))}function p(...g){w();for(const x of g.flat(1))i.loadTheme(x)}async function y(...g){return w(),p(await HR(g))}function w(){if(t)throw new _s("Shiki instance has been disposed")}function v(){t||(t=!0,i.dispose(),ef-=1)}return{setTheme:c,getTheme:l,getLanguage:o,getLoadedThemes:u,getLoadedLanguages:d,loadLanguage:m,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:v,[Symbol.dispose]:v}}async function Ete(e={}){e.loadWasm;const[t,n,r]=await Promise.all([HR(e.themes||[]),UR(e.langs||[]),e.engine||fR(e.loadWasm||oZ())]);return Ate({...e,themes:t,langs:n,engine:r})}async function Mte(e={}){const t=await Ete(e);return{getLastGrammarState:(...n)=>fte(t,...n),codeToTokensBase:(n,r)=>K3(t,n,r),codeToTokensWithThemes:(n,r)=>qR(t,n,r),codeToTokens:(n,r)=>l1(t,n,r),codeToHast:(n,r)=>c1(t,n,r),codeToHtml:(n,r)=>Ste(t,n,r),...t,getInternalContext:()=>t}}function Nte(e,t,n){let r,s,i;{const o=e;r=o.langs,s=o.themes,i=o.engine}async function a(o){function l(m){if(typeof m=="string"){if(DR(m))return[];const p=r[m];if(!p)throw new Do(`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(OR(m))return"none";if(typeof m=="string"){const p=s[m];if(!p)throw new Do(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}const u=(o.themes??[]).map(m=>c(m)),d=(o.langs??[]).map(m=>l(m)),f=await Mte({engine:o.engine??i(),...o,themes:u,langs:d});return{...f,loadLanguage(...m){return f.loadLanguage(...m.map(l))},loadTheme(...m){return f.loadTheme(...m.map(c))}}}return a}function Ite(e){let t;async function n(r={}){if(t){const s=await t;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return t=e({...r,themes:r.themes||[],langs:r.langs||[]}),t}return n}function Rte(e){const t=Ite(e);return{getSingletonHighlighter(n){return t(n)},async codeToHtml(n,r){return(await t({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHtml(n,r)},async codeToHast(n,r){return(await t({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHast(n,r)},async codeToTokens(n,r){return(await t({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToTokens(n,r)},async codeToTokensBase(n,r){return(await t({langs:[r.lang],themes:[r.theme]})).codeToTokensBase(n,r)},async codeToTokensWithThemes(n,r){return(await t({langs:[r.lang],themes:Object.values(r.themes).filter(Boolean)})).codeToTokensWithThemes(n,r)},async getLastGrammarState(n,r){return(await t({langs:[r.lang],themes:[r.theme]})).getLastGrammarState(n,r)}}}const jte=Nte({langs:qJ,themes:HJ,engine:()=>fR(q(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:Dte}=Rte(jte),Ote="_content_1a6dp_1",Lte="_inlineCode_1a6dp_58",Bte="_link_1a6dp_67",zte="_tableWrapper_1a6dp_76",$te="_table_1a6dp_76",Pte="_image_1a6dp_99",qte="_codeBlock_1a6dp_105",Ute="_codeBlockHeader_1a6dp_114",Hte="_codeBlockLang_1a6dp_123",Fte="_codeBlockCopy_1a6dp_129",Vte="_codeBlockContent_1a6dp_145",Wte="_codeBlockPlain_1a6dp_162",Gte="_mermaidBlock_1a6dp_177",Kte="_mermaidInline_1a6dp_189",Yte="_mermaidLoading_1a6dp_208",Xte="_mermaidActions_1a6dp_215",ln={content:Ote,inlineCode:Lte,link:Bte,tableWrapper:zte,table:$te,image:Pte,codeBlock:qte,codeBlockHeader:Ute,codeBlockLang:Hte,codeBlockCopy:Fte,codeBlockContent:Vte,codeBlockPlain:Wte,mermaidBlock:Gte,mermaidInline:Kte,mermaidLoading:Yte,mermaidActions:Xte},Qte=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","ruby","php","swift","kotlin","scala","shell","bash","zsh","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"]),FR=/^(https?:|mailto:)/i,Jte=/^data:image\/(png|jpeg|gif|webp);base64,/i;function Zte(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:FR.test(t):!1}function VR(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||Jte.test(t)?!0:FR.test(t):!1}const ene=128,Gc=new Map;function tne(e,t,n){const r=`${t}\0${n}\0${e}`,s=Gc.get(r);return s!==void 0?Promise.resolve(s):Dte(e,{lang:t,theme:n}).then(i=>{if(Gc.size>=ene){const a=Gc.keys().next().value;a!==void 0&&Gc.delete(a)}return Gc.set(r,i),i})}let S7,nne=0;function rne({code:e}){const{t}=nt(),n=r3(),[r,s]=b.useState(null),[i,a]=b.useState(null),[o,l]=b.useState("diagram"),[c,u]=b.useState(!1),d=n==="light"?"default":"dark";b.useEffect(()=>{let m=!1;s(null),a(null);const p=setTimeout(()=>{q(()=>import("./mermaid.core-ByoxnWut.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const w=y.default;S7!==d&&(w.initialize({startOnLoad:!1,theme:d,securityLevel:"strict",suppressErrorRendering:!0}),S7=d);try{const v=`mermaid-${++nne}`,{svg:g}=await w.render(v,e.trim());m||s(g)}catch(v){m||a(v instanceof Error?v.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:ln.codeBlock,children:[h.jsx("div",{className:ln.codeBlockHeader,children:h.jsx("span",{className:ln.codeBlockLang,children:"mermaid (error)"})}),h.jsx("pre",{className:`${ln.codeBlockContent} ${ln.codeBlockPlain}`,children:h.jsx("code",{children:e})})]}):h.jsxs("div",{className:ln.codeBlock,children:[h.jsxs("div",{className:ln.codeBlockHeader,children:[h.jsx("span",{className:ln.codeBlockLang,children:"mermaid"}),h.jsxs("span",{className:ln.mermaidActions,children:[h.jsx("button",{className:ln.codeBlockCopy,onClick:()=>l(o==="diagram"?"code":"diagram"),children:t(o==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),h.jsx("button",{className:ln.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),o==="code"?h.jsx("pre",{className:`${ln.codeBlockContent} ${ln.codeBlockPlain}`,children:h.jsx("code",{children:e})}):r?h.jsx("div",{className:`${ln.mermaidBlock} ${ln.mermaidInline}`,dangerouslySetInnerHTML:{__html:r}}):h.jsx("div",{className:`${ln.mermaidBlock} ${ln.mermaidLoading} ${ln.mermaidInline}`,children:h.jsx("span",{children:t("mermaid.rendering")})})]})}function sne({className:e,children:t,deferMermaid:n}){const{t:r}=nt(),s=r3(),[i,a]=b.useState(null),[o,l]=b.useState(!1),c=e==null?void 0:e.match(/language-(\w+)/),u=(c==null?void 0:c[1])||"",d=String(t).replace(/\n$/,""),f=Qte.has(u)?u:"text",m=s==="light"?"github-light-default":"github-dark-default";b.useEffect(()=>{if(u==="mermaid"||f==="text"){a(null);return}const y=`${f}\0${m}\0${d}`;if(Gc.has(y)){a(Gc.get(y));return}let w=!1;a(null);const v=setTimeout(()=>{tne(d,f,m).then(g=>{w||a(g)}).catch(()=>{w||a(null)})},120);return()=>{w=!0,clearTimeout(v)}},[d,u,f,m]);const p=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return u==="mermaid"&&!n?h.jsx(rne,{code:d}):h.jsxs("div",{className:ln.codeBlock,children:[h.jsxs("div",{className:ln.codeBlockHeader,children:[h.jsx("span",{className:ln.codeBlockLang,children:u||"text"}),h.jsx("button",{className:ln.codeBlockCopy,onClick:p,children:r(o?"code.copied":"code.copy")})]}),i?h.jsx("div",{className:ln.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):h.jsx("pre",{className:`${ln.codeBlockContent} ${ln.codeBlockPlain}`,children:h.jsx("code",{children:d})})]})}function ine({children:e}){return h.jsx("code",{className:ln.inlineCode,children:e})}function WR(e){return{code({className:t,children:n}){return(t==null?void 0:t.startsWith("language-"))||typeof n=="string"&&n.includes(`
`)?h.jsx(sne,{className:t,deferMermaid:e,children:String(n)}):h.jsx(ine,{children:n})},pre({children:t}){return h.jsx(h.Fragment,{children:t})},a({href:t,children:n}){const r=Zte(t)?t:void 0;return h.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:ln.link,children:n})},table({children:t}){return h.jsx("div",{className:ln.tableWrapper,children:h.jsx("table",{className:ln.table,children:t})})},img({src:t,alt:n}){const r=VR(t)?t:void 0;return h.jsx("img",{src:r,alt:n||"",className:ln.image})}}}const ane=WR(),one=WR(!0),sm=b.memo(function({content:t,source:n,deferMermaid:r}){const{markdown:s}=Ru();if(!t)return null;const i=n?s:void 0,a=n&&(i!=null&&i.transformMarkdown)?i.transformMarkdown(t,{source:n}):t,o=r?one:ane,l=i!=null&&i.components?{...o,...i.components}:o,c=i!=null&&i.remarkPlugins?[d8,Q8,...i.remarkPlugins]:[d8,Q8],u=i!=null&&i.rehypePlugins?[a7,...i.rehypePlugins]:[a7];return h.jsx("div",{className:n!=="thinking"?ln.content:void 0,"data-markdown-source":n,children:h.jsx(KG,{remarkPlugins:c,rehypePlugins:u,components:l,children:a})})}),lne="_chatMessageRow_1hhre_41",cne="_chatBubble_1hhre_47",une="_chatContent_1hhre_60",dne="_chatContentCollapsed_1hhre_65",hne="_toggleButton_1hhre_70",fne="_toggleIcon_1hhre_91",mne="_toggleIconExpanded_1hhre_98",pne="_chatImages_1hhre_102",gne="_chatImageThumb_1hhre_109",ho={chatMessageRow:lne,chatBubble:cne,chatContent:une,chatContentCollapsed:dne,toggleButton:hne,toggleIcon:fne,toggleIconExpanded:mne,chatImages:pne,chatImageThumb:gne},yne=b.memo(function({content:t,images:n}){const{t:r}=nt(),s=b.useRef(null),[i,a]=b.useState(!1),[o,l]=b.useState(!1),c=b.useCallback(()=>{const u=s.current;u&&l(u.scrollHeight>400)},[]);return b.useLayoutEffect(()=>{a(!1),c()},[t,n==null?void 0:n.length,c]),b.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:ho.chatMessageRow,children:h.jsxs("div",{className:ho.chatBubble,children:[h.jsxs("div",{ref:s,className:`${ho.chatContent} ${o&&!i?ho.chatContentCollapsed:""}`,children:[n&&n.length>0&&h.jsx("div",{className:ho.chatImages,children:n.map((u,d)=>{const f=u.data.startsWith("data:")?u.data:`data:${u.mimeType};base64,${u.data}`;return VR(f)?h.jsx("img",{src:f,alt:`User uploaded image ${d+1}`,className:ho.chatImageThumb,onLoad:c},d):null})}),t]}),o&&h.jsxs("button",{type:"button",className:ho.toggleButton,onClick:()=>a(u=>!u),children:[h.jsx("span",{children:r(i?"userMessage.showLess":"userMessage.showMore")}),h.jsx("svg",{className:`${ho.toggleIcon} ${i?ho.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"})})]})]})})}),bne="_message_1jadi_1",vne="_messageFooter_1jadi_7",xne="_copyButton_1jadi_23",wne="_footerTime_1jadi_49",_ne="_thinking_1jadi_61",kne="_thinkingBody_1jadi_73",Sne="_thinkingSummary_1jadi_104",Tne="_thinkingSummaryIcon_1jadi_127",Cne="_thinkingSummaryText_1jadi_147",Ane="_thinkingSummaryTextActive_1jadi_157",Ene="_thinkingChevronRight_1jadi_184",Mne="_thinkingChevronDown_1jadi_185",Nne="_thinkingExpandedWrap_1jadi_212",Ine="_thinkingExpandedClip_1jadi_216",Rne="_thinkingExpandedCollapsed_1jadi_224",jne="_thinkingExpandedInner_1jadi_228",Dne="_content_1jadi_276",One="_contentBody_1jadi_281",sr={message:bne,messageFooter:vne,copyButton:xne,footerTime:wne,thinking:_ne,thinkingBody:kne,thinkingSummary:Sne,thinkingSummaryIcon:Tne,thinkingSummaryText:Cne,thinkingSummaryTextActive:Ane,thinkingChevronRight:Ene,thinkingChevronDown:Mne,thinkingExpandedWrap:Nne,thinkingExpandedClip:Ine,thinkingExpandedCollapsed:Rne,thinkingExpandedInner:jne,content:Dne,contentBody:One},Lne=b.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:a=!1}){const{t:o}=nt(),[l,c]=b.useState(!1),u=!!t&&!n&&i,d=b.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:sr.message,children:[t&&h.jsx("div",{className:sr.content,children:h.jsx("div",{className:sr.contentBody,children:h.jsx(sm,{content:t,source:"assistant",deferMermaid:n})})}),u&&h.jsxs("div",{className:sr.messageFooter,children:[h.jsx("button",{type:"button",className:sr.copyButton,title:o("assistant.copy"),"aria-label":o("assistant.copy"),onClick:d,children:l?h.jsx(zne,{}):h.jsx(Bne,{})}),a&&s&&h.jsx("button",{type:"button",className:sr.copyButton,title:o("assistant.branch"),"aria-label":o("assistant.branch"),onClick:s,children:h.jsx($ne,{})}),r!==void 0&&h.jsx("span",{className:sr.footerTime,"aria-hidden":"true",children:Kd(r)})]})]})});function Bne(){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 zne(){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 $ne(){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 Pne=b.memo(function({content:t,isStreaming:n,timestamp:r}){const{t:s}=nt(),i=b.useContext(Mh),[a,o]=b.useState(!1),l=qne({isStreaming:n}),c=l==="thinking.running",u=b.useRef(r??Date.now()),d=b.useRef(c),[f,m]=b.useState(()=>Date.now()),[p,y]=b.useState(null);b.useEffect(()=>{if(!t||!c)return;m(Date.now());const g=setInterval(()=>m(Date.now()),1e3);return()=>clearInterval(g)},[t,c]),b.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?Une((c?f:p)-u.current):"",v=b.useCallback(()=>{o(g=>!g)},[]);return h.jsx("div",{className:sr.message,children:t&&!i&&h.jsx("div",{className:sr.thinking,children:h.jsxs("div",{className:sr.thinkingBody,children:[h.jsxs("button",{type:"button",className:sr.thinkingSummary,onClick:v,"aria-expanded":a,title:s(a?"thinking.collapse":"thinking.expand"),children:[h.jsx("span",{className:sr.thinkingSummaryIcon,"aria-hidden":"true",children:h.jsx(Hne,{})}),h.jsx("span",{className:c?`${sr.thinkingSummaryText} ${sr.thinkingSummaryTextActive}`:sr.thinkingSummaryText,children:s(l,{duration:c?w:""})}),h.jsx("span",{className:a?sr.thinkingChevronDown:sr.thinkingChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:a?sr.thinkingExpandedClip:`${sr.thinkingExpandedClip} ${sr.thinkingExpandedCollapsed}`,children:h.jsx("div",{className:sr.thinkingExpandedInner,children:h.jsx("div",{className:sr.thinkingExpandedWrap,children:h.jsx(sm,{content:t,source:"thinking",deferMermaid:n})})})})]})})})});function qne({isStreaming:e}){return e?"thinking.running":"thinking.done"}function Une(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 Hne(){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 Fne="_panel_pwh4v_1",Vne="_title_pwh4v_16",Wne="_metaLine_pwh4v_22",Gne="_progress_pwh4v_32",Kne="_spacer_pwh4v_38",Yne="_row_pwh4v_42",Xne="_detailRow_pwh4v_43",Qne="_subDetailRow_pwh4v_44",Jne="_symbol_pwh4v_65",Zne="_label_pwh4v_69",ere="_value_pwh4v_73",tre="_detailName_pwh4v_80",nre="_sectionTitle_pwh4v_88",rre="_detailSection_pwh4v_94",sre="_skillBlock_pwh4v_100",ire="_hint_pwh4v_105",are="_detailCommand_pwh4v_111",ore="_bodyLoaded_pwh4v_132",lre="_accent_pwh4v_137",cre="_secondary_pwh4v_141",ure="_warning_pwh4v_145",dre="_error_pwh4v_149",hre="_success_pwh4v_153",pt={panel:Fne,title:Vne,metaLine:Wne,progress:Gne,spacer:Kne,row:Yne,detailRow:Xne,subDetailRow:Qne,symbol:Jne,label:Zne,value:ere,detailName:tre,sectionTitle:nre,detailSection:rre,skillBlock:sre,hint:ire,detailCommand:are,bodyLoaded:ore,accent:lre,secondary:cre,warning:ure,error:dre,success:hre},jx="web-shell:context-usage:v1:",ml="█",GR="▒",KR="░",YR=30;function fre(e){return`${jx}${JSON.stringify(e)}`}function mre(e){if(!e.startsWith(jx))return null;try{const t=JSON.parse(e.slice(jx.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function XR(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function eh(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function pre(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function gre(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function yre({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),a=e>80?pt.error:e>60?pt.warning:pt.accent;return h.jsxs("div",{className:pt.progress,"aria-hidden":"true",children:[h.jsx("span",{className:a,children:ml.repeat(Math.max(0,r))}),h.jsx("span",{className:pt.secondary,children:KR.repeat(Math.max(0,i))}),h.jsx("span",{className:pt.warning,children:GR.repeat(Math.max(0,s))})]})}function fo({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=pt.secondary,isOverLimit:a}){return h.jsxs("div",{className:pt.row,children:[h.jsx("span",{className:`${pt.symbol} ${i}`,children:e}),h.jsx("span",{className:pt.label,children:t}),h.jsxs("span",{className:a?pt.error:pt.value,children:[eh(n)," ",r," (",pre(n,s),"%)"]})]})}const Xv="/context detail";function bre({hint:e,onShowDetail:t}){const n=t?e.indexOf(Xv):-1;return n<0?h.jsx("div",{className:pt.hint,children:e}):h.jsxs("div",{className:pt.hint,children:[e.slice(0,n),h.jsx("button",{type:"button",className:pt.detailCommand,onClick:t,children:Xv}),e.slice(n+Xv.length)]})}function vre({name:e,tokens:t,tokenLabel:n}){return h.jsxs("div",{className:pt.detailRow,children:[h.jsxs("span",{className:pt.secondary,children:["└"," "]}),h.jsx("span",{className:pt.detailName,title:e,children:XR(e,YR)}),h.jsxs("span",{className:pt.value,children:[eh(t)," ",n]})]})}function Qv({title:e,items:t,getName:n,tokenLabel:r}){const s=gre(t);return s.length===0?null:h.jsxs("section",{className:pt.detailSection,children:[h.jsx("div",{className:pt.sectionTitle,children:e}),s.map(i=>h.jsx(vre,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function xre({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:pt.detailSection,children:[h.jsx("div",{className:pt.sectionTitle,children:t.skills}),n.map(r=>h.jsxs("div",{className:pt.skillBlock,children:[h.jsxs("div",{className:pt.detailRow,children:[h.jsxs("span",{className:pt.secondary,children:["└"," "]}),h.jsxs("span",{className:pt.detailName,title:r.name,children:[XR(r.name,YR),r.loaded&&h.jsxs("span",{className:pt.success,children:[" ",t.active]})]}),h.jsxs("span",{className:pt.value,children:[eh(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&h.jsxs("div",{className:pt.subDetailRow,children:[h.jsxs("span",{className:pt.secondary,children:["  └"," "]}),h.jsx("span",{className:pt.bodyLoaded,children:t.bodyLoaded}),h.jsxs("span",{className:pt.success,children:["+",eh(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function wre({status:e,onShowDetail:t}){const{t:n}=nt(),{usage:r}=e,{breakdown:s,contextWindowSize:i}=r,a=i>0?r.totalTokens/i*100:0,o=a>100,l=i>0?s.autocompactBuffer/i*100:0;return h.jsxs("div",{className:pt.panel,children:[h.jsx("div",{className:pt.title,children:n("contextUsage.title")}),r.isEstimated?h.jsx(h.Fragment,{children:h.jsxs("div",{className:pt.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",eh(i)," ",n("contextUsage.tokens")]})]})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:pt.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",eh(i)," ",n("contextUsage.tokens")]})]}),o&&h.jsx("div",{className:pt.error,children:n("contextUsage.overLimit")})]}),h.jsx(yre,{usedPercentage:Math.min(a,100),bufferPercentage:l}),h.jsx("div",{className:pt.spacer}),h.jsx(fo,{symbol:ml,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:o?pt.error:pt.accent,isOverLimit:o}),h.jsx(fo,{symbol:KR,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),h.jsx(fo,{symbol:GR,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.warning}),h.jsx("div",{className:pt.spacer}),h.jsx("div",{className:pt.sectionTitle,children:n("contextUsage.usageByCategory")}),h.jsx(fo,{symbol:ml,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.accent}),h.jsx(fo,{symbol:ml,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.accent}),s.mcpTools>0&&h.jsx(fo,{symbol:ml,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.accent}),h.jsx(fo,{symbol:ml,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.accent}),h.jsx(fo,{symbol:ml,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.accent}),!r.isEstimated&&h.jsx(fo,{symbol:ml,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:pt.accent}),r.showDetails?h.jsxs(h.Fragment,{children:[h.jsx(Qv,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(Qv,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(Qv,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),h.jsx(xre,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):h.jsx(bre,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const _re={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 QR(e){if(!e.trim())return"Tool";const t=_re[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function gc(e,t){const n=QR(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 Lu(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Fr(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const Dx=2e3;function JR(e,t){const n=Sre(e,t);if(n)return Fr(n,Dx);const r=Tre(e,t);return r?Fr(r,Dx):""}function Ha(e){var t;if(!e.content)return Lx(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return Lx(e.rawOutput)}function kre(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const a=T7((Lx(e.rawOutput)??"").trim());if(a)return a}const n=Ha(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(o=>o.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${r.filter(o=>o.trim()).length} item(s)`;if(sc(t)){if(s>3)return`${s} lines of output`;const a=r[0]||"";return Fr(a,80)}if(t==="grep_search"||t==="grep"||t==="search"){const a=T7(n.trim());return a||`${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 a=r[0]||"";return Fr(a,80)}if(t==="websearch"||t==="web_search"){const a=r.filter(o=>o.trim()).length;return a>1?`${a} result(s)`:r[0]||""}if(Lu(t))return"";const i=r[0]||"";return Fr(i,80)}function Sre(e,t){if(!e.title)return null;const n=QR(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 a=r.slice(i.length);if(/^(:\s*|\s+)/.test(a))return C7(a.replace(/^:\s*|\s+/,""),t)}return C7(r,t)}function T7(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function Tre(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 ${yd(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," ")})`),Fr(s,Dx)}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):yd(String(n.file_path),t);if(n.url){const s=String(n.url),i=typeof n.prompt=="string"?n.prompt:void 0,a=i?`${s} — "${Fr(i,40)}"`:s;return Fr(a,80)}if(n.path)return yd(String(n.path),t);if(n.query)return Fr(String(n.query),60);if(r==="list_directory"||r==="listfiles"){const s=n.path||n.directory||"";return yd(String(s),t)}return n.description?String(n.description):""}function sc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function Va(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>Va(r,t)))??!1}function C7(e,t){const n=e.trim();return ZR(Ox(n))?yd(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>yd(r,t))}function yd(e,t){const n=Ox(e),r=t?Ox(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":ZR(n)?Cre(n):n}function Ox(e){return e.replace(/\\/g,"/")}function ZR(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Cre(e){return e.replace(/\/+$/,"").split("/").pop()||e}function Ty(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function X3(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 _0(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=X3(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function Q3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const Are="general-purpose";function J3(e){var r;const t=Ty(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":Are}function Z3(e){var i,a;if(e.title){const o=e.title.indexOf(": ");if(o>0)return e.title.slice(o+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=Ty(e.rawOutput),r=n==null?void 0:n.taskDescription;if(typeof r=="string"&&r.trim())return r.trim();const s=(a=e.args)==null?void 0:a.prompt;return typeof s=="string"&&s.trim()?s.trim().split(`
`)[0]??"":""}function ej(e,t){var i,a;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=gc(r.toolName??"",t);if(r.title){const o=r.title.indexOf(": ");s+=" "+(o>0?r.title.slice(o+2):r.title)}else(i=r.args)!=null&&i.command?s+=" "+String(r.args.command):(a=r.args)!=null&&a.file_path&&(s+=" "+String(r.args.file_path));return Fr(s,50)}function Lx(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 Ere="_panel_1s42b_1",Mre="_title_1s42b_17",Nre="_sectionTitle_1s42b_23",Ire="_spacer_1s42b_29",Rre="_pivotRow_1s42b_35",jre="_metricCell_1s42b_41",Dre="_metricCellSection_1s42b_48",Ore="_metricCellSub_1s42b_56",Lre="_modelCell_1s42b_64",Bre="_modelCellHeader_1s42b_71",zre="_divider_1s42b_79",$re="_kvRow_1s42b_87",Pre="_kvSubRow_1s42b_94",qre="_kvLabel_1s42b_102",Ure="_kvValue_1s42b_106",Hre="_tableRow_1s42b_115",Fre="_tableNameCol_1s42b_121",Vre="_tableToolCol_1s42b_129",Wre="_tableNumCol_1s42b_137",Gre="_success_1s42b_147",Kre="_error_1s42b_151",Yre="_secondary_1s42b_155",Xre="_warning_1s42b_159",Ne={panel:Ere,title:Mre,sectionTitle:Nre,spacer:Ire,pivotRow:Rre,metricCell:jre,metricCellSection:Dre,metricCellSub:Ore,modelCell:Lre,modelCellHeader:Bre,divider:zre,kvRow:$re,kvSubRow:Pre,kvLabel:qre,kvValue:Ure,tableRow:Hre,tableNameCol:Fre,tableToolCol:Vre,tableNumCol:Wre,success:Gre,error:Kre,secondary:Yre,warning:Xre},Bx="web-shell:session-stats:v1:";function Qre(e,t="overview"){return`${Bx}${JSON.stringify({_view:t,...e})}`}function Jre(e){if(!e.startsWith(Bx))return null;try{const t=JSON.parse(e.slice(Bx.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 Gl(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 Kc({label:e,children:t}){return h.jsxs("div",{className:Ne.kvRow,children:[h.jsx("span",{className:Ne.kvLabel,children:e}),h.jsx("span",{className:Ne.kvValue,children:t})]})}function Vf({label:e,children:t}){return h.jsxs("div",{className:Ne.kvSubRow,children:[h.jsxs("span",{className:Ne.secondary,children:["»"," ",e]}),h.jsx("span",{className:Ne.kvValue,children:t})]})}function tj(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const r=t.split("::"),s=r[0],i=r[1],a=i?`${s} (${i})`:s;return{key:t,label:a,metrics:n}})}function Zre(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function ese(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function tse(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function xa({metric:e,values:t,variant:n="normal"}){const r=n==="section"?Ne.metricCellSection:n==="sub"?Ne.metricCellSub:Ne.metricCell;return h.jsxs("div",{className:Ne.pivotRow,children:[h.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>h.jsx("span",{className:Ne.modelCell,children:s},i))]})}function nse({status:e}){const{t}=nt(),{models:n,tools:r,files:s}=e,i=Object.values(n).reduce((y,w)=>y+w.api.totalLatencyMs,0),a=r.totalDurationMs,o=i+a,l=o>0?i/o*100:0,c=o>0?a/o*100:0,u=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,d=tj(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:Ne.panel,children:[h.jsx("div",{className:Ne.title,children:t("stats.title")}),h.jsx("div",{className:Ne.sectionTitle,children:t("stats.overview")}),h.jsx(Kc,{label:t("stats.duration"),children:Gl(e.durationMs)}),h.jsx(Kc,{label:t("stats.prompts"),children:e.promptCount}),h.jsx(Kc,{label:t("stats.toolCalls"),children:h.jsxs("span",{children:[r.totalCalls," ",h.jsx("span",{className:Ne.secondary,children:"("}),h.jsxs("span",{className:Ne.success,children:["✓",r.totalSuccess]})," ",h.jsxs("span",{className:Ne.error,children:["✗",r.totalFail]}),h.jsx("span",{className:Ne.secondary,children:")"})]})}),h.jsx(Kc,{label:t("stats.successRate"),children:h.jsxs("span",{className:u>=90?Ne.success:u>=70?Ne.warning:Ne.error,children:[u.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&h.jsx(Kc,{label:t("stats.codeChanges"),children:h.jsxs("span",{children:[h.jsxs("span",{className:Ne.success,children:["+",s.totalLinesAdded]})," ",h.jsxs("span",{className:Ne.error,children:["-",s.totalLinesRemoved]})]})}),h.jsx("div",{className:Ne.spacer}),h.jsx("div",{className:Ne.sectionTitle,children:t("stats.performance")}),h.jsxs(Vf,{label:t("stats.apiTime"),children:[Gl(i)," ",h.jsxs("span",{className:Ne.secondary,children:["(",l.toFixed(1),"%)"]})]}),h.jsxs(Vf,{label:t("stats.toolTime"),children:[Gl(a)," ",h.jsxs("span",{className:Ne.secondary,children:["(",c.toFixed(1),"%)"]})]}),d.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ne.spacer}),h.jsx("div",{className:Ne.sectionTitle,children:t("stats.modelUsage")}),h.jsx("div",{className:Ne.spacer}),h.jsxs("div",{className:Ne.tableRow,children:[h.jsx("span",{className:Ne.tableNameCol,children:t("stats.modelUsage")}),h.jsx("span",{className:Ne.tableNumCol,children:t("stats.reqs")}),h.jsx("span",{className:Ne.tableNumCol,children:t("stats.inputTokens")}),h.jsx("span",{className:Ne.tableNumCol,children:t("stats.outputTokens")})]}),h.jsx("div",{className:Ne.divider}),d.map(y=>h.jsxs("div",{className:Ne.tableRow,children:[h.jsx("span",{className:Ne.tableNameCol,children:y.label}),h.jsx("span",{className:Ne.tableNumCol,children:y.metrics.api.totalRequests}),h.jsx("span",{className:`${Ne.tableNumCol} ${Ne.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),h.jsx("span",{className:`${Ne.tableNumCol} ${Ne.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),p>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ne.spacer}),h.jsxs("div",{children:[h.jsx("span",{className:Ne.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",p.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),h.jsxs("div",{className:Ne.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function rse({status:e}){const{t}=nt(),n=tj(e.models);if(n.length===0)return h.jsxs("div",{className:Ne.panel,children:[h.jsx("div",{className:Ne.title,children:t("stats.modelStats")}),h.jsx("div",{children:t("stats.noApiCalls")})]});const r=n.some(a=>a.metrics.tokens.cached>0),s=n.some(a=>a.metrics.tokens.thoughts>0),i=a=>n.map(o=>a(o.metrics));return h.jsxs("div",{className:Ne.panel,children:[h.jsx("div",{className:Ne.title,children:t("stats.modelStats")}),h.jsx("div",{className:Ne.spacer}),h.jsxs("div",{className:Ne.pivotRow,children:[h.jsx("span",{className:Ne.metricCellSection,children:t("stats.metric")}),n.map(a=>h.jsx("span",{className:Ne.modelCellHeader,children:a.label},a.key))]}),h.jsx("div",{className:Ne.divider}),h.jsx(xa,{metric:t("stats.api"),values:[],variant:"section"}),h.jsx(xa,{metric:t("stats.requests"),values:i(a=>a.api.totalRequests.toLocaleString())}),h.jsx(xa,{metric:t("stats.errors"),values:i(a=>{const o=Zre(a);return h.jsxs("span",{className:a.api.totalErrors>0?Ne.error:void 0,children:[a.api.totalErrors.toLocaleString()," (",o.toFixed(1),"%)"]})})}),h.jsx(xa,{metric:t("stats.avgLatency"),values:i(a=>Gl(ese(a)))}),h.jsx("div",{className:Ne.spacer}),h.jsx(xa,{metric:t("stats.tokens"),values:[],variant:"section"}),h.jsx(xa,{metric:t("stats.total"),values:i(a=>h.jsx("span",{className:Ne.warning,children:a.tokens.total.toLocaleString()}))}),h.jsx(xa,{metric:t("stats.prompt"),values:i(a=>a.tokens.prompt.toLocaleString()),variant:"sub"}),r&&h.jsx(xa,{metric:t("stats.cached"),values:i(a=>h.jsxs("span",{className:Ne.success,children:[a.tokens.cached.toLocaleString()," (",tse(a).toFixed(1),"%)"]})),variant:"sub"}),s&&h.jsx(xa,{metric:t("stats.thoughts"),values:i(a=>a.tokens.thoughts.toLocaleString()),variant:"sub"}),h.jsx(xa,{metric:t("stats.output"),values:i(a=>a.tokens.candidates.toLocaleString()),variant:"sub"})]})}function sse(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 ise({status:e}){const{t}=nt(),n=sse(e.tools.byName);if(n.length===0)return h.jsxs("div",{className:Ne.panel,children:[h.jsx("div",{className:Ne.title,children:t("stats.toolStats")}),h.jsx("div",{children:t("stats.noToolCalls")})]});const r=Object.values(e.tools.byName).reduce((a,o)=>{var l,c,u;return a.accept+=((l=o.decisions)==null?void 0:l.accept)??0,a.reject+=((c=o.decisions)==null?void 0:c.reject)??0,a.modify+=((u=o.decisions)==null?void 0:u.modify)??0,a},{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:Ne.panel,children:[h.jsx("div",{className:Ne.title,children:t("stats.toolStats")}),h.jsx("div",{className:Ne.spacer}),h.jsxs("div",{className:Ne.tableRow,children:[h.jsx("span",{className:Ne.tableToolCol,children:t("stats.toolName")}),h.jsx("span",{className:Ne.tableNumCol,children:t("stats.calls")}),h.jsx("span",{className:Ne.tableNumCol,children:t("stats.successRate")}),h.jsx("span",{className:Ne.tableNumCol,children:t("stats.avgDuration")})]}),h.jsx("div",{className:Ne.divider}),n.map(a=>{const o=a.stats.count>0?a.stats.success/a.stats.count*100:0,l=a.stats.count>0?a.stats.durationMs/a.stats.count:0;return h.jsxs("div",{className:Ne.tableRow,children:[h.jsx("span",{className:`${Ne.tableToolCol} ${Ne.metricCell}`,children:gc(a.name,t)}),h.jsx("span",{className:Ne.tableNumCol,children:a.stats.count}),h.jsxs("span",{className:`${Ne.tableNumCol} ${o>=90?Ne.success:o>=70?Ne.warning:Ne.error}`,children:[o.toFixed(1),"%"]}),h.jsx("span",{className:Ne.tableNumCol,children:Gl(l)})]},a.name)}),h.jsx("div",{className:Ne.spacer}),h.jsx("div",{className:Ne.sectionTitle,children:t("stats.decisionSummary")}),h.jsx(Kc,{label:t("stats.totalReviewed"),children:s}),h.jsx(Vf,{label:t("stats.accepted"),children:h.jsx("span",{className:Ne.success,children:r.accept})}),h.jsx(Vf,{label:t("stats.rejected"),children:h.jsx("span",{className:Ne.error,children:r.reject})}),h.jsx(Vf,{label:t("stats.modified"),children:h.jsx("span",{className:Ne.warning,children:r.modify})}),h.jsx("div",{className:Ne.divider}),h.jsx(Kc,{label:t("stats.agreementRate"),children:h.jsx("span",{className:s>0?i>=90?Ne.success:i>=70?Ne.warning:Ne.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function ase({view:e,status:t}){switch(e){case"model":return h.jsx(rse,{status:t});case"tools":return h.jsx(ise,{status:t});default:return h.jsx(nse,{status:t})}}function Cy(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 ose="_panel_1hmam_1",lse="_title_1hmam_17",cse="_row_1hmam_23",use="_rowGap_1hmam_31",dse="_label_1hmam_35",hse="_value_1hmam_41",fse="_accent_1hmam_46",Zc={panel:ose,title:lse,row:cse,rowGap:use,label:dse,value:hse,accent:fse},{serialize:mse,parse:pse}=Cy("web-shell:status:v1:");function na({label:e,children:t,gap:n}){return h.jsxs("div",{className:`${Zc.row}${n?` ${Zc.rowGap}`:""}`,children:[h.jsx("span",{className:Zc.label,children:e}),h.jsx("span",{className:Zc.value,children:t})]})}function gse({info:e}){const{t}=nt();return h.jsxs("div",{className:Zc.panel,children:[h.jsx("div",{className:Zc.title,children:t("about.title")}),e.cliVersion&&h.jsx(na,{label:t("about.qwenCode"),children:h.jsx("span",{className:Zc.accent,children:e.cliVersion})}),e.runtime&&h.jsx(na,{label:t("about.runtime"),children:e.runtime}),e.platform&&h.jsx(na,{label:t("about.platform"),children:e.platform}),e.auth&&h.jsx(na,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&h.jsx(na,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&h.jsx(na,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&h.jsx(na,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&h.jsx(na,{label:t("about.sessionId"),children:e.sessionId}),h.jsx(na,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),h.jsx(na,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&h.jsx(na,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function u1(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function yse(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function nj(e,t,n=50){const r=b.useRef(e);b.useEffect(()=>{r.current=e},[e]),b.useEffect(()=>{const s=a=>{a.defaultPrevented||u1(a.target)&&!yse(a.target)||r.current(a)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}const bse="_panel_1jjvb_1",vse="_title_1jjvb_13",xse="_header_1jjvb_18",wse="_startup_1jjvb_24",_se="_note_1jjvb_28",kse="_secondary_1jjvb_29",Sse="_row_1jjvb_39",Tse="_selected_1jjvb_48",Cse="_disabled_1jjvb_52",Ase="_pointer_1jjvb_56",Ese="_nameCell_1jjvb_62",Mse="_truncate_1jjvb_69",Nse="_separator_1jjvb_75",Ise="_sectionTitle_1jjvb_79",Rse="_groupTitle_1jjvb_80",jse="_success_1jjvb_84",Dse="_warning_1jjvb_88",Ose="_error_1jjvb_92",Lse="_group_1jjvb_80",Bse="_list_1jjvb_102",zse="_description_1jjvb_108",$se="_schema_1jjvb_113",Pse="_shortcuts_1jjvb_131",qse="_detail_1jjvb_137",Use="_serverFields_1jjvb_143",Hse="_serverField_1jjvb_143",Fse="_serverFieldLabel_1jjvb_156",Vse="_detailBlock_1jjvb_160",Wse="_parameters_1jjvb_161",Gse="_invalidBlock_1jjvb_162",Kse="_parameterRow_1jjvb_172",Yse="_actionMessage_1jjvb_177",Xse="_oauthPage_1jjvb_183",Qse="_scrollHint_1jjvb_189",He={panel:bse,title:vse,header:xse,startup:wse,note:_se,secondary:kse,row:Sse,selected:Tse,disabled:Cse,pointer:Ase,nameCell:Ese,truncate:Mse,separator:Nse,sectionTitle:Ise,groupTitle:Rse,success:jse,warning:Dse,error:Ose,group:Lse,list:Bse,description:zse,schema:$se,shortcuts:Pse,detail:qse,serverFields:Use,serverField:Hse,serverFieldLabel:Fse,detailBlock:Vse,parameters:Wse,invalidBlock:Gse,parameterRow:Kse,actionMessage:Yse,oauthPage:Xse,scrollHint:Qse},k0="web-shell:mcp-panel-active",jc=10,{parse:Jse}=Cy("web-shell:mcp-status:v1:");function rj(e){const t=Jse(e);return!t||!t.status?null:t}function np(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:He.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:He.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:He.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:He.error}}}function sj(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 Zse(e){const t=sj(e);return t?JSON.stringify(t,null,2):""}function eie(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function tie(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function nie(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 Jv(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 A7(e,t){window.dispatchEvent(new CustomEvent(k0,{detail:{id:e,active:t}}))}function E7(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 rp(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function rie(e,t){return e?t("mcp.required"):""}function sie(e,t){const n=sj(e),r=n==null?void 0:n.properties,s=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(a=>typeof a=="string")):new Set;if(!r||typeof r!="object"){const a=Zse(e);return a?h.jsx("pre",{className:He.schema,children:a}):null}const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:He.parameters,children:[h.jsx("div",{className:He.sectionTitle,children:t("mcp.parameters")}),i.map(([a,o])=>{const l=o&&typeof o=="object"?o:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:He.parameterRow,children:`• ${a}${rie(s.has(a),t)}: ${c}${u?` - ${u}`:""}`},a)})]})}function iie({message:e}){var $;const{t}=nt(),n=zM({autoLoad:!1}),[r,s]=b.useState(e.status),[i,a]=b.useState(e.toolsByServer),[o,l]=b.useState(null),[c,u]=b.useState(!1),d=b.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,m]=b.useState(!0),[p,y]=b.useState("servers"),[w,v]=b.useState(0),[g,x]=b.useState(0),[k,A]=b.useState(0),T=b.useMemo(()=>r.servers??[],[r.servers]),C=T[w]??null,j=b.useMemo(()=>{var I;return C?((I=i[C.name])==null?void 0:I.tools)??[]:[]},[C,i]),z=j[k]??null,E=b.useMemo(()=>j.length<=jc||k<jc-1?0:Math.min(k-jc+1,j.length-jc),[k,j.length]),P=b.useMemo(()=>j.slice(E,E+jc),[j,E]),D=T.filter(I=>!I.disabled&&I.mcpStatus==="connecting").length,H=b.useMemo(()=>{const I=[];for(const M of T){const G=eie(M,t),ne=I.find(fe=>fe.label===G);ne?ne.servers.push(M):I.push({label:G,servers:[M]})}return I},[T,t]),W=b.useMemo(()=>T.length===0?20:Math.min(Math.max(...T.map(I=>I.name.length))+2,35),[T]),J=b.useMemo(()=>j.length===0?30:Math.min(Math.max(...j.map(I=>I.name.length))+2,50),[j]),Y=b.useMemo(()=>{if(!C)return[];const I=[];return!C.disabled&&j.length>0&&I.push({id:"view-tools",label:t("mcp.action.tools")}),!C.disabled&&C.mcpStatus==="disconnected"&&I.push({id:"reconnect",label:t("mcp.action.reconnect")}),I.push({id:C.disabled?"enable":"disable",label:C.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),C.disabled||(I.push({id:"authenticate",label:C.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),C.hasOAuthTokens&&I.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),I},[C,j.length,t]),Z=b.useCallback(async()=>{var M;const I=await n.reload();if(I){s(I);const G=((M=I.servers)==null?void 0:M.find(ne=>ne.name===(C==null?void 0:C.name)))??null;if(G){const ne=await n.loadTools(G.name);a(fe=>({...fe,[G.name]:ne}))}}},[n,C==null?void 0:C.name]),Q=b.useCallback(async I=>{if(!(!C||I.disabled||c)){if(I.id==="view-tools"){y("tools"),A(0),l(null);return}u(!0),I.id==="authenticate"&&y("oauth"),l(I.id==="authenticate"?rp(C.name,t):t("mcp.action.running",{action:I.label}));try{let M=null;if(I.id==="reconnect")await n.restartServer(C.name);else{const G=await n.manageServer(C.name,I.id),ne=[...G.messages??[],...G.authUrl?[G.authUrl]:[]].join(`
`);ne&&(M=I.id==="authenticate"?rp(C.name,t,ne):ne)}await Z(),l(M??t("mcp.action.done",{action:I.label}))}catch(M){l(I.id==="authenticate"?rp(C.name,t,E7(M)):t("mcp.action.failed",{error:E7(M)}))}finally{u(!1)}}},[c,n,Z,C,t]);if(b.useEffect(()=>{const I=d.current;return A7(I,f),()=>A7(I,!1)},[f]),b.useEffect(()=>{const I=M=>{const G=M.detail;G!=null&&G.active&&G.id&&G.id!==d.current&&m(!1)};return window.addEventListener(k0,I),()=>window.removeEventListener(k0,I)},[]),nj(I=>{if(f){if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),p==="servers"?m(!1):p==="server"?(y("servers"),x(0),l(null)):p==="oauth"?(y("server"),l(null)):p==="tools"?(y("server"),A(0)):y("tools");return}if(I.key==="ArrowUp"||I.key==="ArrowDown"){I.preventDefault(),I.stopPropagation();const M=I.key==="ArrowUp"?-1:1;p==="servers"?(v(G=>Math.min(Math.max(G+M,0),T.length-1)),x(0)):p==="server"?x(G=>Math.min(Math.max(G+M,0),Y.length-1)):p==="tools"&&A(G=>Math.min(Math.max(G+M,0),j.length-1));return}if(I.key==="Enter")if(I.preventDefault(),I.stopPropagation(),p==="servers"&&T.length>0)y("server"),x(0);else if(p==="server"&&Y.length>0){const M=Y[g];M&&Q(M)}else p==="tools"&&j.length>0&&y("tool")}},[f,g,j.length,Y,Q,T.length,p]),!f)return null;if(T.length===0)return h.jsxs("div",{className:He.panel,"data-keyboard-scope":!0,children:[h.jsxs("div",{className:He.header,children:[h.jsx("div",{className:He.title,children:t("mcp.manageServers")}),h.jsx("div",{className:He.secondary,children:t("mcp.servers",{count:0})})]}),h.jsx("div",{className:He.secondary,children:t("mcp.empty")}),h.jsx("div",{className:He.shortcuts,children:t("mcp.shortcut.close")})]});const L=p==="servers"?t("mcp.manageServers"):p==="server"?(C==null?void 0:C.name)??t("mcp.manageServers"):p==="oauth"?t("mcp.oauth.title"):p==="tools"?t("mcp.toolsForServer",{name:(C==null?void 0:C.name)??"Server"}):(z==null?void 0:z.name)??t("mcp.toolDetail"),R=p==="servers"?t("mcp.servers",{count:T.length}):p==="server"||p==="oauth"?"":p==="tools"?t(j.length===1?"mcp.toolCount":"mcp.toolsCount",{count:j.length}):(z==null?void 0:z.serverToolName)??(C==null?void 0:C.name)??"";return h.jsxs("div",{className:He.panel,"data-keyboard-scope":!0,children:[D>0&&h.jsxs("div",{children:[h.jsx("div",{className:He.startup,children:t("mcp.starting",{count:D})}),h.jsx("div",{className:He.note,children:t("mcp.startingNote")})]}),h.jsxs("div",{className:He.header,children:[h.jsx("div",{className:He.title,children:L}),R&&h.jsx("div",{className:He.secondary,children:R})]}),p==="servers"&&h.jsx("div",{className:He.list,children:H.map(I=>{let M=0;for(const G of H){if(G===I)break;M+=G.servers.length}return h.jsxs("div",{className:He.group,children:[h.jsx("div",{className:He.groupTitle,children:I.label}),I.servers.map((G,ne)=>{const fe=M+ne,Pe=fe===w,oe=np(G,t);return h.jsxs("div",{className:Pe?`${He.row} ${He.selected}`:He.row,onClick:()=>{v(fe),y("server"),x(0)},onMouseEnter:()=>v(fe),children:[h.jsx("span",{className:He.pointer,children:Pe?"❯":""}),h.jsx("span",{className:He.nameCell,style:{width:`${W}ch`},children:G.name}),h.jsx("span",{className:He.separator,children:"·"}),h.jsxs("span",{className:oe.className,children:[oe.icon," ",oe.text]})]},G.name)})]},I.label)})}),p==="server"&&C&&h.jsxs("div",{className:He.detail,children:[h.jsxs("div",{className:He.serverFields,children:[h.jsxs("div",{className:He.serverField,children:[h.jsxs("span",{className:He.serverFieldLabel,children:[t("mcp.status"),":"]}),h.jsxs("span",{className:np(C,t).className,children:[np(C,t).icon," ",np(C,t).text]})]}),h.jsxs("div",{className:He.serverField,children:[h.jsxs("span",{className:He.serverFieldLabel,children:[t("mcp.source"),":"]}),h.jsx("span",{children:tie(C,t)})]}),h.jsxs("div",{className:He.serverField,children:[h.jsxs("span",{className:He.serverFieldLabel,children:[t("mcp.command"),":"]}),h.jsx("span",{className:He.truncate,children:nie(C,t)})]}),(($=C.config)==null?void 0:$.cwd)&&h.jsxs("div",{className:He.serverField,children:[h.jsxs("span",{className:He.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),h.jsx("span",{className:He.truncate,children:C.config.cwd})]}),!C.disabled&&h.jsxs("div",{className:He.serverField,children:[h.jsxs("span",{className:He.serverFieldLabel,children:[t("mcp.tools"),":"]}),h.jsx("span",{children:t(j.length===1?"mcp.toolCount":"mcp.toolsCount",{count:j.length})})]})]}),h.jsx("div",{className:He.list,children:Y.map((I,M)=>{const G=M===g,ne=[He.row,G?He.selected:"",I.disabled?He.disabled:""].filter(Boolean).join(" ");return h.jsxs("div",{className:ne,onClick:()=>{x(M),Q(I)},children:[h.jsx("span",{className:He.pointer,children:G?"❯":""}),h.jsx("span",{children:I.label})]},I.id)})}),o&&h.jsx("pre",{className:He.actionMessage,children:o})]}),p==="oauth"&&h.jsx("div",{className:He.oauthPage,children:h.jsx("pre",{className:He.actionMessage,children:o??(C?rp(C.name,t):t("mcp.status.unknown"))})}),p==="tools"&&h.jsx("div",{className:He.list,children:j.length===0?h.jsx("div",{className:He.secondary,children:t("mcp.emptyTools")}):P.map((I,M)=>{const G=E+M,ne=G===k,fe=Jv(I,t);return h.jsxs("div",{className:ne?`${He.row} ${He.selected}`:He.row,onClick:()=>{A(G),y("tool")},onMouseEnter:()=>A(G),children:[h.jsx("span",{className:He.pointer,children:ne?"❯":""}),h.jsx("span",{className:He.nameCell,style:{width:`${J}ch`},children:I.name}),I.isValid?fe?h.jsx("span",{className:He.secondary,children:fe}):null:h.jsx("span",{className:He.warning,children:t("mcp.invalidReason",{reason:I.invalidReason||t("mcp.status.unknown")})})]},I.name)})}),p==="tools"&&j.length>jc&&h.jsxs("div",{className:He.scrollHint,children:[E>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:j.length}),E+jc<j.length?" ↓":""]}),p==="tool"&&z&&h.jsxs("div",{className:He.detail,children:[!z.isValid&&h.jsxs("div",{className:He.invalidBlock,children:[h.jsx("div",{className:He.sectionTitle,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",z.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:He.secondary,children:t("mcp.invalidToolHelp")})]}),z.description&&h.jsxs("div",{className:He.detailBlock,children:[h.jsx("div",{className:He.sectionTitle,children:t("mcp.description")}),h.jsx("div",{className:He.description,children:z.description.trim()})]}),Jv(z,t)&&h.jsxs("div",{className:He.detailBlock,children:[h.jsx("span",{className:He.sectionTitle,children:t("mcp.annotations")})," ",h.jsx("span",{children:Jv(z,t)})]}),sie(z,t)]}),h.jsx("div",{className:He.shortcuts,children:t(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function zx(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 aie="_panel_285sp_1",oie="_embeddedPanel_285sp_12",lie="_title_285sp_19",cie="_sectionTitle_285sp_24",uie="_overflowHint_285sp_28",die="_header_285sp_33",hie="_secondary_285sp_39",fie="_row_285sp_43",mie="_selected_285sp_51",pie="_pointer_285sp_55",gie="_nameCell_285sp_61",yie="_status_285sp_70",bie="_chevronCell_285sp_76",vie="_chevron_285sp_76",xie="_chevronExpanded_285sp_93",wie="_separator_285sp_103",_ie="_list_285sp_107",kie="_task_285sp_113",Sie="_taskExpanded_285sp_119",Tie="_success_285sp_124",Cie="_warning_285sp_128",Aie="_error_285sp_132",Eie="_detail_285sp_136",Mie="_detailTop_285sp_145",Nie="_detailTopMain_285sp_152",Iie="_inlineDetail_285sp_192",Rie="_taskIcon_285sp_208",jie="_detailField_285sp_237",Die="_detailFieldLabel_285sp_244",Oie="_detailContent_285sp_250",Lie="_compactSummary_285sp_257",Bie="_actionBar_285sp_266",zie="_actionHint_285sp_275",$ie="_actionButton_285sp_280",Pie="_dangerButton_285sp_300",qie="_shortcuts_285sp_304",Uie="_confirmHint_285sp_310",Hie="_statusBadge_285sp_314",Fie="_activityCurrent_285sp_320",Vie="_activityPast_285sp_327",Wie="_promptContent_285sp_334",Re={panel:aie,embeddedPanel:oie,title:lie,sectionTitle:cie,overflowHint:uie,header:die,secondary:hie,row:fie,selected:mie,pointer:pie,nameCell:gie,status:yie,chevronCell:bie,chevron:vie,chevronExpanded:xie,separator:wie,list:_ie,task:kie,taskExpanded:Sie,success:Tie,warning:Cie,error:Aie,detail:Eie,detailTop:Mie,detailTopMain:Nie,inlineDetail:Iie,taskIcon:Rie,detailField:jie,detailFieldLabel:Die,detailContent:Oie,compactSummary:Lie,actionBar:Bie,actionHint:zie,actionButton:$ie,dangerButton:Pie,shortcuts:qie,confirmHint:Uie,statusBadge:Hie,activityCurrent:Fie,activityPast:Vie,promptContent:Wie},th="web-shell:tasks-panel-active",Gie=3e3,M7=8,{parse:Kie}=Cy("web-shell:tasks-status:v1:");function Yie(e){const t=Kie(e);return!t||!t.snapshot?null:t}function N7(e,t){window.dispatchEvent(new CustomEvent(th,{detail:{id:e,active:t}}))}function I7(e){return e.status==="running"||e.status==="paused"}function Zv(e){return[...e].sort((t,n)=>{const r=I7(t),s=I7(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function R7(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ij(e){switch(e){case"running":return Re.success;case"paused":return Re.warning;case"completed":return Re.success;case"failed":return Re.error;case"cancelled":return Re.warning;default:return""}}function Xie(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 Qie(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function Jie({expanded:e}){return h.jsx("svg",{className:`${Re.chevron} ${e?Re.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 Zie(e){switch(e.kind){case"agent":return e.isBackgrounded?e.label:`[blocking] ${e.label}`;case"shell":return`[shell] ${e.command}`;case"monitor":return`[monitor] ${e.description}`}}function eae(e,t){if(e.length<=M7)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,M7-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 tae(e,t,n){const r=gc(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"";return s?`${r}(${s})`:r}function aj({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r}){const{t:s}=nt(),i=J_(),[a,o]=b.useState(()=>Zv(e.snapshot.tasks)),[l,c]=b.useState(!0),[u,d]=b.useState("list"),[f,m]=b.useState(0),[p,y]=b.useState(null),[w,v]=b.useState(!1),[g,x]=b.useState(!1),[k,A]=b.useState(null),T=b.useRef(`tasks-${Math.random().toString(36).slice(2)}`),C=b.useRef(!1),j=b.useRef(null),z=a.length===0?0:Math.min(f,a.length-1),E=a[z]??null;b.useEffect(()=>{if(!l)return;const I=setInterval(()=>{C.current||(C.current=!0,i.getTasks().then(M=>{o(Zv(M.tasks)),x(!1)}).catch(M=>{console.warn("[web-shell] failed to refresh tasks:",M),x(!0)}).finally(()=>{C.current=!1}))},Gie);return()=>clearInterval(I)},[l,i]),b.useEffect(()=>{a.length===0&&f!==0&&m(0),f>=a.length&&a.length>0&&m(a.length-1)},[a.length,f]),b.useEffect(()=>{if(!l||u!=="detail"){j.current=null;return}if(!E){j.current=null,d("list");return}const $=j.current;if(!$||$.taskId!==E.id){j.current={taskId:E.id,status:E.status};return}$.status==="running"&&E.status!=="running"&&(y(null),d("list"))},[l,u,E]),b.useEffect(()=>{if(!n)return;const $=T.current;return N7($,l),()=>N7($,!1)},[l,n]),b.useEffect(()=>{if(!n)return;const $=I=>{const M=I.detail;M!=null&&M.active&&M.id&&M.id!==T.current&&c(!1)};return window.addEventListener(th,$),()=>window.removeEventListener(th,$)},[n]),b.useEffect(()=>{l||r==null||r()},[l,r]);const P=b.useCallback(async $=>{if(w)return;const I=$.status==="running",M=$.kind==="agent"&&$.status==="paused";if(!I&&!M)return;if($.kind==="agent"&&!$.isBackgrounded&&p!==$.id){y($.id);return}y(null),v(!0);try{if(!(await i.cancelTask($.id,$.kind)).cancelled){A(s("tasks.alreadyStopped"));return}const fe=await i.getTasks();o(Zv(fe.tasks)),A(null)}catch(ne){console.warn("[web-shell] failed to cancel task:",ne),A(s("tasks.cancelFailed"))}finally{v(!1)}},[i,w,p,s]);if(nj($=>{if(l){if($.key==="Escape"){if($.preventDefault(),$.stopPropagation(),p){y(null);return}u==="detail"?d("list"):c(!1);return}if($.key==="ArrowLeft"){$.preventDefault(),$.stopPropagation(),u==="detail"?(y(null),d("list")):c(!1);return}if(($.key==="ArrowUp"||$.key==="ArrowDown")&&u==="list"){if($.preventDefault(),$.stopPropagation(),a.length===0)return;const I=$.key==="ArrowUp"?-1:1;m(M=>Math.min(Math.max(M+I,0),a.length-1)),y(null);return}if($.key==="Enter"){$.preventDefault(),$.stopPropagation(),u==="list"&&E?d("detail"):u==="detail"&&c(!1);return}if($.key===" "&&u==="detail"){$.preventDefault(),$.stopPropagation(),c(!1);return}if($.key==="x"&&!$.ctrlKey&&!$.metaKey){$.preventDefault(),$.stopPropagation(),E&&P(E);return}}},[l,u,a.length,E,P,p]),!l)return null;const D=p!==null&&E!==null&&p===E.id,H=[];D?(H.push(s("tasks.confirmStop")),H.push(s("tasks.shortcut.cancelConfirm"))):(H.push(s("tasks.shortcut.select")),H.push(s("tasks.shortcut.view")),(E==null?void 0:E.status)==="running"?H.push(s("tasks.shortcut.stop")):(E==null?void 0:E.kind)==="agent"&&(E==null?void 0:E.status)==="paused"&&H.push(s("tasks.shortcut.abandon")),H.push(s("tasks.shortcut.listClose")));const W=[];if(D?(W.push(s("tasks.confirmStop")),W.push(s("tasks.shortcut.cancelConfirm"))):(W.push(s("tasks.shortcut.detailBack")),W.push(s("tasks.shortcut.detailClose")),(E==null?void 0:E.status)==="running"?W.push(s("tasks.shortcut.stop")):(E==null?void 0:E.kind)==="agent"&&(E==null?void 0:E.status)==="paused"&&W.push(s("tasks.shortcut.abandon"))),a.length===0)return h.jsxs("div",{className:t?`${Re.panel} ${Re.embeddedPanel}`:Re.panel,"data-keyboard-scope":!0,children:[(g||k||!t)&&h.jsxs("div",{className:Re.header,children:[!t&&h.jsx("div",{className:Re.title,children:s("tasks.title")}),g&&h.jsx("div",{className:Re.warning,children:s("tasks.refreshStale")}),k&&h.jsx("div",{className:Re.error,children:k})]}),h.jsx("div",{children:h.jsx("div",{className:Re.secondary,children:s("tasks.empty")})}),!t&&h.jsx("div",{className:Re.shortcuts,children:s("tasks.shortcut.close")})]});const{visible:J,windowStart:Y,hiddenAbove:Z,hiddenBelow:Q}=eae(a,z),L=t?a:J,R=t?0:Y;return h.jsxs("div",{className:t?`${Re.panel} ${Re.embeddedPanel}`:Re.panel,"data-keyboard-scope":!0,children:[(t||u==="list")&&(g||k||!t)&&h.jsxs("div",{className:Re.header,children:[!t&&h.jsx("div",{className:Re.title,children:s("tasks.title")}),g&&h.jsx("div",{className:Re.warning,children:s("tasks.refreshStale")}),k&&h.jsx("div",{className:Re.error,children:k})]}),(t||u==="list")&&h.jsxs("div",{className:Re.list,children:[!t&&h.jsxs("div",{className:Re.sectionTitle,children:[s("tasks.title")," ",h.jsxs("span",{className:Re.secondary,children:["(",a.length,")"]})]}),!t&&Z>0&&h.jsx("div",{className:Re.overflowHint,children:s("tasks.moreAbove",{count:Z})}),L.map(($,I)=>{const M=R+I,G=M===z,ne=ij($.status),fe=Xie($.status,s),Pe=t&&G&&u==="detail",oe=t?Pe:G;return h.jsxs("div",{className:`${Re.task} ${Pe?Re.taskExpanded:""}`,children:[h.jsxs("div",{className:oe?`${Re.row} ${Re.selected}`:Re.row,onClick:()=>{m(M),d(t&&Pe?"list":"detail")},onMouseEnter:()=>{t||m(M)},children:[h.jsx("span",{className:Re.pointer,children:oe?"❯":""}),t&&h.jsx("span",{className:Re.taskIcon,"aria-hidden":"true"}),h.jsx("span",{className:Re.nameCell,children:Zie($)}),h.jsx("span",{className:`${Re.status} ${ne}`,children:fe}),h.jsx("span",{className:Re.chevronCell,children:h.jsx(Jie,{expanded:Pe})})]}),Pe&&h.jsx("div",{className:Re.inlineDetail,children:h.jsx(j7,{task:$,t:s,hideHeader:!0,busy:w,showCancelConfirm:p===$.id,onCancel:()=>void P($),onCancelConfirmDismiss:()=>y(null)})})]},$.id)}),!t&&Q>0&&h.jsx("div",{className:Re.overflowHint,children:s("tasks.moreBelow",{count:Q})})]}),!t&&u==="detail"&&E&&h.jsxs(h.Fragment,{children:[k&&h.jsx("div",{className:Re.error,children:k}),h.jsx(j7,{task:E,t:s,busy:w,showCancelConfirm:p===E.id,onCancel:()=>void P(E),onCancelConfirmDismiss:()=>y(null)})]}),!t&&h.jsx("div",{className:D?`${Re.shortcuts} ${Re.confirmHint}`:Re.shortcuts,children:(u==="list"?H:W).join(" · ")})]})}function nae(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 j7({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:a}){var g,x;const o=Qie(e.status),l=ij(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=[zx(e.runtimeMs)],p=[{label:t("tasks.detail.runtime"),value:zx(e.runtimeMs)}];e.kind==="agent"&&((g=e.stats)!=null&&g.totalTokens)&&(m.push(t("tasks.detail.tokens",{count:R7(e.stats.totalTokens)})),p.push({label:t("tasks.detail.tokenCount"),value:R7(e.stats.totalTokens)})),e.kind==="agent"&&((x=e.stats)==null?void 0:x.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 y=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],w=u&&i?h.jsx("div",{className:Re.actionBar,children:s?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Re.actionHint,children:t("tasks.action.confirmHint")}),h.jsx("button",{type:"button",className:`${Re.actionButton} ${Re.dangerButton}`,disabled:r,onClick:i,children:f}),h.jsx("button",{type:"button",className:Re.actionButton,onClick:a,children:t("common.cancel")})]}):h.jsx("button",{type:"button",className:`${Re.actionButton} ${Re.dangerButton}`,disabled:r,onClick:i,children:d})}):null,v=n?p.length>0?h.jsx("div",{className:Re.compactSummary,children:p.map(k=>`${k.label} ${k.value}`).join(" · ")}):null:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Re.title,children:nae(e,t)}),h.jsxs("div",{className:Re.statusBadge,children:[o&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:l,children:[o," ",t(`tasks.${e.status}`)]}),h.jsx("span",{className:Re.separator,children:"·"})]}),h.jsx("span",{className:Re.secondary,children:m.join(" · ")})]})]});return h.jsxs("div",{className:Re.detail,children:[(v||w)&&h.jsxs("div",{className:Re.detailTop,children:[v&&h.jsx("div",{className:Re.detailTopMain,children:v}),w]}),e.kind==="shell"&&h.jsxs(h.Fragment,{children:[h.jsx(tf,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&h.jsx(tf,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&h.jsx(tf,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&h.jsx(tf,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&h.jsxs("div",{className:Re.detailField,children:[h.jsx("div",{className:Re.detailFieldLabel,children:t("tasks.detail.progress")}),h.jsx("div",{className:Re.detailContent,children:e.recentActivities.slice(-5).map((k,A,T)=>{const C=A===T.length-1,j=tae(k.name,k.description,t);return h.jsxs("div",{className:C?Re.activityCurrent:Re.activityPast,children:[C?"> ":"  ",j]},`${k.at}-${A}`)})})]}),e.kind==="agent"&&e.prompt&&h.jsxs("div",{className:Re.detailField,children:[h.jsx("div",{className:Re.detailFieldLabel,children:t("tasks.detail.prompt")}),h.jsx("div",{className:Re.promptContent,children:y.slice(0,5).map((k,A,T)=>h.jsx("div",{children:A===T.length-1&&y.length>5?`${k}…`:k||" "},A))})]}),e.kind==="agent"&&e.outputFile&&h.jsx(tf,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&h.jsxs("div",{className:Re.detailField,children:[h.jsx("div",{className:`${Re.detailFieldLabel} ${Re.error}`,children:t("tasks.detail.resumeBlocked")}),h.jsx("div",{className:Re.error,children:e.resumeBlockedReason})]}),e.error&&h.jsxs("div",{className:Re.detailField,children:[h.jsx("div",{className:`${Re.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?Re.warning:Re.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"?Re.warning:Re.error,children:e.error})]})]})}function tf({label:e,value:t}){return h.jsxs("div",{className:Re.detailField,children:[h.jsx("div",{className:Re.detailFieldLabel,children:e}),h.jsx("div",{className:Re.detailContent,children:t})]})}const rae="_message_1tc5o_1",sae="_prefix_1tc5o_10",iae="_body_1tc5o_15",aae="_title_1tc5o_20",oae="_muted_1tc5o_24",lae="_accent_1tc5o_28",cae="_success_1tc5o_32",uae="_error_1tc5o_36",dae="_warning_1tc5o_40",hae="_row_1tc5o_44",fae="_label_1tc5o_50",mae="_value_1tc5o_55",vs={message:rae,prefix:sae,body:iae,title:aae,muted:oae,accent:lae,success:cae,error:uae,warning:dae,row:hae,label:fae,value:mae},$x="web-shell-goal-status-active",{serialize:D7,parse:pae}=Cy(jq),gae=new Set(["set","achieved","cleared","failed","aborted","checking"]);function d1(e){const t=typeof e=="string"?pae(e):e;return yae(t)}function yae(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!gae.has(n)||typeof r!="string")return null;const s=e4(t.iterations),i=e4(t.durationMs),a=e4(t.setAt),o=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:r,...s!==void 0?{iterations:s}:{},...i!==void 0?{durationMs:i}:{},...a!==void 0?{setAt:a}:{},...o!==void 0?{lastReason:o}:{}}}function e4(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function bae(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function vae(e,t){switch(e.kind){case"checking":return{prefix:"○",title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:vs.muted};case"set":return{prefix:"◎",title:t("goal.set"),colorClass:vs.accent};case"achieved":return{prefix:"✓",title:t("goal.achieved"),colorClass:vs.success};case"cleared":return{prefix:"○",title:t("goal.cleared"),colorClass:vs.muted};case"failed":return{prefix:"✖",title:t("goal.failed"),colorClass:vs.error};case"aborted":return{prefix:"!",title:t("goal.aborted"),colorClass:vs.warning}}}function xae({status:e,activateFooter:t=!1}){var l;const{t:n}=nt();b.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent($x,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const r=vae(e,n),s=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&s.push(bae(e.iterations,n)),typeof e.durationMs=="number"&&s.push(zx(e.durationMs)));const i=s.length>0?` · ${s.join(" · ")}`:"",a=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((l=e.lastReason)==null?void 0:l.trim()),o=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return h.jsxs("div",{className:vs.message,children:[h.jsx("span",{className:`${vs.prefix} ${r.colorClass}`,children:r.prefix}),h.jsxs("div",{className:vs.body,children:[h.jsxs("div",{className:`${vs.title} ${r.colorClass}`,children:[r.title,i&&h.jsx("span",{className:vs.muted,children:i})]}),h.jsxs("div",{className:vs.row,children:[h.jsxs("span",{className:vs.label,children:[n("goal.label"),":"]}),h.jsx("span",{className:vs.value,children:e.condition})]}),a&&h.jsxs("div",{className:vs.muted,children:[o,": ",a]})]})]})}const wae="_message_12rlg_1",_ae="_flushMessage_12rlg_8",kae="_info_12rlg_26",Sae="_modelSwitch_12rlg_32",Tae="_error_12rlg_36",Cae="_warning_12rlg_42",Aae="_retryHint_12rlg_48",Eae="_retryButton_12rlg_55",ra={message:wae,flushMessage:_ae,info:kae,modelSwitch:Sae,error:Tae,warning:Cae,retryHint:Aae,retryButton:Eae},Mae=b.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:a=!1,showRetryHint:o=!1,onRetryClick:l}){const{t:c}=nt(),u=n==="info"?mre(t):null;if(u)return h.jsx("div",{className:ra.flushMessage,children:h.jsx(wre,{status:u,onShowDetail:i})});const d=n==="info"?Jre(t):null;if(d)return h.jsx("div",{className:ra.flushMessage,children:h.jsx(ase,{view:d.view,status:d.status})});const f=n==="info"?pse(t):null;if(f)return h.jsx("div",{className:ra.flushMessage,children:h.jsx(gse,{info:f})});const m=n==="info"?rj(t):null;if(m)return h.jsx("div",{className:ra.flushMessage,children:h.jsx(iie,{message:m})});const p=n==="info"?Yie(t):null;if(p)return h.jsx("div",{className:ra.flushMessage,children:h.jsx(aj,{message:p})});const y=n==="info"?d1(r==="goal"?s:t):null;if(y)return h.jsx("div",{className:ra.flushMessage,children:h.jsx(xae,{status:y,activateFooter:a})});const w=n==="info"&&t.startsWith("● authType:");return h.jsxs("div",{className:`${ra.message} ${ra[n]} ${w?ra.modelSwitch:""}`,children:[w?h.jsx("pre",{children:t}):n==="info"?h.jsx(sm,{content:t}):h.jsx("pre",{children:t}),o&&l&&h.jsx("div",{className:ra.retryHint,children:h.jsx("button",{type:"button",className:ra.retryButton,onClick:l,children:c("retry.hint")})})]})}),Nae="_group_1y1j0_1",Iae="_line_1y1j0_14",Rae="_chatGroupWrap_1y1j0_19",jae="_chatSummary_1y1j0_23",Dae="_chatSummaryIcon_1y1j0_46",Oae="_chatSummaryToolIcon_1y1j0_60",Lae="_chatSummaryText_1y1j0_66",Bae="_chatSummaryTextActive_1y1j0_76",zae="_chatChevronRight_1y1j0_103",$ae="_chatChevronDown_1y1j0_104",Pae="_chatSummaryContentClip_1y1j0_131",qae="_chatSummaryContentCollapsed_1y1j0_139",Uae="_chatSummaryContentInner_1y1j0_143",Hae="_lineMain_1y1j0_148",Fae="_icon_1y1j0_155",Vae="_iconDone_1y1j0_160",Wae="_iconError_1y1j0_164",Gae="_iconPending_1y1j0_168",Kae="_iconSpin_1y1j0_172",Yae="_lineName_1y1j0_184",Xae="_lineArg_1y1j0_191",Qae="_lineElapsed_1y1j0_201",Jae="_lineExpandable_1y1j0_208",Zae="_agentSummary_1y1j0_223",eoe="_lineOutput_1y1j0_232",toe="_lineFullArg_1y1j0_244",noe="_lineDetail_1y1j0_256",roe="_expandedBash_1y1j0_259",soe="_expandedRead_1y1j0_260",ioe="_expandedOutput_1y1j0_264",aoe="_expandedEdit_1y1j0_277",ooe="_expandBtn_1y1j0_291",loe="_todoProgress_1y1j0_310",coe="_todoBody_1y1j0_317",uoe="_compactGroup_1y1j0_321",doe="_compactHeader_1y1j0_328",hoe="_compactCount_1y1j0_335",foe="_compactHint_1y1j0_341",Oe={group:Nae,line:Iae,chatGroupWrap:Rae,chatSummary:jae,chatSummaryIcon:Dae,chatSummaryToolIcon:Oae,chatSummaryText:Lae,chatSummaryTextActive:Bae,chatChevronRight:zae,chatChevronDown:$ae,chatSummaryContentClip:Pae,chatSummaryContentCollapsed:qae,chatSummaryContentInner:Uae,lineMain:Hae,icon:Fae,iconDone:Vae,iconError:Wae,iconPending:Gae,iconSpin:Kae,lineName:Yae,lineArg:Xae,lineElapsed:Qae,lineExpandable:Jae,agentSummary:Zae,lineOutput:eoe,lineFullArg:toe,lineDetail:noe,expandedBash:roe,expandedRead:soe,expandedOutput:ioe,expandedEdit:aoe,expandBtn:ooe,todoProgress:loe,todoBody:coe,compactGroup:uoe,compactHeader:doe,compactCount:hoe,compactHint:foe};function Eo({status:e}){switch(e){case"completed":case"success":return h.jsx("span",{className:`${Oe.icon} ${Oe.iconDone}`,children:"✓"});case"failed":case"error":case"cancelled":case"canceled":return h.jsx("span",{className:`${Oe.icon} ${Oe.iconError}`,children:"✗"});case"in_progress":case"running":return h.jsx("span",{className:`${Oe.icon} ${Oe.iconSpin}`,children:"⟳"});default:return h.jsx("span",{className:`${Oe.icon} ${Oe.iconPending}`,children:"○"})}}function im(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 oj(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 lj(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 moe="_panel_q9u5t_1",poe="_header_q9u5t_12",goe="_desc_q9u5t_24",yoe="_toggle_q9u5t_33",boe="_meta_q9u5t_39",voe="_body_q9u5t_45",xoe="_content_q9u5t_56",woe="_stream_q9u5t_71",_oe="_streamCollapsed_q9u5t_81",koe="_scrollWindow_q9u5t_88",Soe="_expandToggle_q9u5t_93",Toe="_tabBar_q9u5t_108",Coe="_tab_q9u5t_108",Aoe="_tabActive_q9u5t_130",Eoe="_tools_q9u5t_135",Moe="_toolTimeRow_q9u5t_152",Noe="_toolTimeTip_q9u5t_156",Gn={panel:moe,header:poe,desc:goe,toggle:yoe,meta:boe,body:voe,content:xoe,stream:woe,streamCollapsed:_oe,scrollWindow:koe,expandToggle:Soe,tabBar:Toe,tab:Coe,tabActive:Aoe,tools:Eoe,toolTimeRow:Moe,toolTimeTip:Noe};function cj(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Ioe({timestamp:e,children:t}){return e===void 0?h.jsx(h.Fragment,{children:t}):h.jsxs("div",{className:Gn.toolTimeRow,children:[t,h.jsx("span",{className:Gn.toolTimeTip,"aria-hidden":"true",children:Kd(e)})]})}const Roe=b.memo(function({tool:t}){const n=t.subTools||t.subContent?h.jsx(e5,{tool:t}):h.jsx(Ux,{tool:t});return h.jsx(Ioe,{timestamp:t.startTime,children:n})});function joe({tc:e}){const{t}=nt(),n=e.description||"";return h.jsx("div",{className:Oe.line,children:h.jsxs("div",{className:Oe.lineMain,children:[h.jsx(Eo,{status:e.status}),h.jsx("span",{className:Oe.lineName,children:gc(e.name,t)}),n&&h.jsx("span",{className:Oe.lineArg,children:Fr(n,70)})]})})}function Doe(e){var t;if(e.rawOutput&&cj(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 Ooe({text:e}){const{compactThinking:t}=Ru(),{t:n}=nt(),[r,s]=b.useState(!1),[i,a]=b.useState(!1),o=b.useRef(null),l=t&&!r;return b.useEffect(()=>{const c=o.current;!c||!l||(a(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,e]),b.useEffect(()=>{const c=o.current;if(!c||!l)return;const u=()=>a(c.scrollHeight>c.clientHeight),d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[l]),h.jsxs("div",{children:[h.jsx("pre",{ref:o,className:l?`${Gn.stream} ${Gn.streamCollapsed}`:Gn.stream,children:e}),t&&(i||r)&&h.jsx("button",{className:Gn.expandToggle,onClick:()=>s(c=>!c),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function Loe({content:e}){const{compactThinking:t}=Ru();return h.jsx("div",{className:t?Gn.scrollWindow:void 0,children:h.jsx(sm,{content:e,source:"assistant"})})}function O7({pinTail:e,itemCount:t,children:n}){const{compactThinking:r}=Ru(),s=b.useRef(null);return b.useEffect(()=>{const i=s.current;!i||!r||(i.scrollTop=e?i.scrollHeight:0)},[r,e,t]),h.jsx("div",{ref:s,className:r?`${Gn.tools} ${Gn.scrollWindow}`:Gn.tools,children:n})}function e5({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var T,C,j,z;const s=e.status==="completed"||e.status==="failed",i=_0(e),[a,o]=b.useState(t??!1),[l,c]=b.useState("result"),u=cj(e.rawOutput)?e.rawOutput:null,d=((T=e.subTools)==null?void 0:T.length)||((C=u==null?void 0:u.toolCalls)==null?void 0:C.length)||0,f=Z3(e),m=J3(e),p=im(e.startTime,e.endTime)||oj((j=u==null?void 0:u.executionSummary)==null?void 0:j.totalDurationMs),y=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(z=u==null?void 0:u.executionSummary)==null?void 0:z.totalTokens,w=y?Q3(y):"",v=s?Doe(e):"",g=b.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),x=!!(e.subContent||v),k=!!(e.subTools&&e.subTools.length>0||g&&g.length>0),A=x&&k;return h.jsxs("div",{className:r?void 0:Gn.panel,children:[!n&&h.jsxs("div",{className:Gn.header,onClick:()=>o(!a),children:[h.jsx(Eo,{status:i}),h.jsxs("span",{className:Oe.lineName,children:[m,":"]}),f&&h.jsx("span",{className:Gn.desc,children:Fr(f,50)}),s&&d>0&&h.jsxs("span",{className:Gn.meta,children:["· ",d," tools"]}),p&&h.jsxs("span",{className:Gn.meta,children:["· ",p]}),w&&h.jsxs("span",{className:Gn.meta,children:["· ",w]}),!s&&h.jsx("span",{className:Gn.toggle,children:a?"▼":"▶"})]}),(a||n)&&h.jsxs("div",{className:Gn.body,children:[A&&h.jsxs("div",{className:Gn.tabBar,children:[h.jsx("button",{className:`${Gn.tab} ${l==="result"?Gn.tabActive:""}`,onClick:()=>c("result"),children:"Result"}),h.jsxs("button",{className:`${Gn.tab} ${l==="tools"?Gn.tabActive:""}`,onClick:()=>c("tools"),children:["Tools (",d,")"]})]}),(!A||l==="result")&&x&&h.jsx("div",{className:Gn.content,children:s?h.jsx(Loe,{content:e.subContent||v}):e.subContent&&h.jsx(Ooe,{text:e.subContent})}),(!A||l==="tools")&&h.jsxs(h.Fragment,{children:[e.subTools&&e.subTools.length>0&&h.jsx(O7,{pinTail:!s,itemCount:e.subTools.length,children:e.subTools.map(E=>h.jsx(Roe,{tool:E},E.callId))}),g&&g.length>0&&h.jsx(O7,{pinTail:!s,itemCount:g.length,children:g.map(E=>h.jsx(joe,{tc:E},E.callId))})]})]})]})}const Boe="_view_f1xgr_1",zoe="_stats_f1xgr_9",$oe="_statAdd_f1xgr_18",Poe="_statDel_f1xgr_22",qoe="_lines_f1xgr_26",Uoe="_line_f1xgr_26",Hoe="_lineAdd_f1xgr_38",Foe="_lineDel_f1xgr_42",Voe="_lineHeader_f1xgr_46",Woe="_lineContext_f1xgr_52",Goe="_lineNo_f1xgr_56",Koe="_marker_f1xgr_66",Yoe="_content_f1xgr_81",wa={view:Boe,stats:zoe,statAdd:$oe,statDel:Poe,lines:qoe,line:Uoe,lineAdd:Hoe,lineDel:Foe,lineHeader:Voe,lineContext:Woe,lineNo:Goe,marker:Koe,content:Yoe};function Xoe(e){let t=0,n=0;const r=[];let s=0,i=0;for(const a of e.split(`
`))if(a.startsWith("@@")){const o=a.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);o&&(s=parseInt(o[1],10),i=parseInt(o[2],10)),r.push({type:"header",content:a})}else a.startsWith("+")&&!a.startsWith("+++ ")?(t++,r.push({type:"add",content:a.slice(1),newLine:i}),i++):a.startsWith("-")&&!a.startsWith("--- ")?(n++,r.push({type:"del",content:a.slice(1),oldLine:s}),s++):(r.push({type:"context",content:a.startsWith(" ")?a.slice(1):a,oldLine:s,newLine:i}),s++,i++);return{lines:r,additions:t,deletions:n}}const Qoe=b.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=Xoe(t);return h.jsxs("div",{className:wa.view,children:[h.jsxs("div",{className:wa.stats,children:[r>0&&h.jsxs("span",{className:wa.statAdd,children:["+",r]}),s>0&&h.jsxs("span",{className:wa.statDel,children:["-",s]})]}),h.jsx("div",{className:wa.lines,children:n.map((i,a)=>h.jsxs("div",{className:`${wa.line} ${wa[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[h.jsx("span",{className:wa.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),h.jsx("span",{className:wa.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),h.jsx("span",{className:wa.content,children:i.content})]},a))})]})}),Joe="_approval_tz0zz_1",Zoe="_floating_tz0zz_10",ele="_header_tz0zz_21",tle="_icon_tz0zz_31",nle="_name_tz0zz_37",rle="_desc_tz0zz_46",sle="_content_tz0zz_55",ile="_code_tz0zz_69",ale="_codeBlock_tz0zz_77",ole="_question_tz0zz_87",lle="_options_tz0zz_92",cle="_option_tz0zz_92",ule="_optionActive_tz0zz_110",dle="_pointer_tz0zz_115",hle="_num_tz0zz_121",fle="_label_tz0zz_126",Gr={approval:Joe,floating:Zoe,header:ele,icon:tle,name:nle,desc:rle,content:sle,code:ile,codeBlock:ale,question:ole,options:lle,option:cle,optionActive:ule,pointer:dle,num:hle,label:fle};function mle(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 ple(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function gle(e){return e.kind==="bash"||e.kind==="exec"||e.kind==="shell"}function yle(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 L7(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 B7(e){return e.kind==="allow_once"?0:e.kind==="allow_always"&&e.id==="proceed_always_project"?1:e.kind==="allow_always"&&e.id==="proceed_always_user"?2:e.kind==="allow_always"?3:e.kind==="reject_once"||e.kind==="reject_always"?4:5}function sp(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=B7(t.option)-B7(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function ble(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")return"approval.option.allowAllEdits"}}function jl({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=nt(),s=b.useMemo(()=>sp(e.options),[e.options]),[i,a]=b.useState(()=>L7(sp(e.options))),o=b.useRef(e);o.current=e;const l=b.useRef(i),c=b.useRef(!1),u=b.useRef(!1);b.useEffect(()=>{const x=L7(sp(o.current.options));c.current=!1,u.current=!1,l.current=x,a(x)},[e.id]);const{toolName:d,description:f}=mle(e.title),m=ple(e),p=b.useCallback(x=>{c.current||(c.current=!0,t(o.current.id,x))},[t]),y=b.useCallback(x=>{if(x.defaultPrevented||u1(x.target))return;const k=o.current,A=sp(k.options),T=A.length;if(x.key==="ArrowUp"||x.key==="k")x.preventDefault(),u.current=!0,a(C=>{const j=(C-1+T)%T;return l.current=j,j});else if(x.key==="ArrowDown"||x.key==="j")x.preventDefault(),u.current=!0,a(C=>{const j=(C+1)%T;return l.current=j,j});else if(x.key==="Enter"){if(x.preventDefault(),!u.current){u.current=!0;return}const C=A[l.current];C&&p(C.id)}else if(x.key==="Escape"){x.preventDefault();const C=k.options.find(j=>j.kind==="reject_once"||j.kind==="reject_always");C&&p(C.id)}else if(x.key>="1"&&x.key<="9"){const C=parseInt(x.key)-1;C<T&&(x.preventDefault(),u.current=!0,p(A[C].id))}},[p]);b.useEffect(()=>{const x=setTimeout(()=>{window.addEventListener("keydown",y)},250);return()=>{clearTimeout(x),window.removeEventListener("keydown",y)}},[y]);const w=gle(e),v=z$(e.toolName),g=yle(e);return h.jsxs("div",{className:n==="floating"?`${Gr.approval} ${Gr.floating}`:Gr.approval,children:[h.jsxs("div",{className:Gr.header,children:[h.jsx("span",{className:Gr.icon,children:"?"}),h.jsx("span",{className:Gr.name,children:d}),f&&h.jsx("span",{className:Gr.desc,children:f})]}),w&&g?h.jsx("div",{className:Gr.code,children:h.jsx("pre",{className:Gr.codeBlock,children:g})}):m&&m!==e.title?h.jsx("pre",{className:Gr.content,children:m}):null,h.jsx("div",{className:Gr.question,children:v?r("approval.launchAgentQuestion"):w?r("approval.execQuestion",{tool:d}):r("approval.changeQuestion")}),h.jsx("div",{className:Gr.options,children:s.map((x,k)=>{const A=k===i,T=ble(x),C=T?r(T):x.label;return h.jsxs("div",{className:`${Gr.option} ${A?Gr.optionActive:""}`,onClick:()=>p(x.id),children:[h.jsx("span",{className:Gr.pointer,children:A?"›":" "}),h.jsxs("span",{className:Gr.num,children:[k+1,"."]}),h.jsx("span",{className:Gr.label,children:C})]},x.id)})})]})}const z7={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 vle(e){const t=[];let n,r=!1,s=!1,i=0;const a=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let o;for(;(o=a.exec(e))!==null;){o.index>i&&t.push({text:e.slice(i,o.index),color:n,bold:r,dim:s}),i=o.index+o[0].length;const l=o[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=z7[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function xle(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Ah(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function t4(e){const t=e.flatMap((n,r)=>{const s=f1(n),i=ip(s,"content");return i?[{id:ip(s,"id")??`plan-${r}`,content:i,status:Rle(ip(s,"status")),priority:jle(ip(s,"priority"))}]:[]});return t.length>0?t:void 0}function t5(e){if(!Ah(e.toolName)&&e.kind!=="other")return;const t=P7(e.args);if(t)return t4(t);const n=f1(e.rawOutput),r=P7(n);if(r)return t4(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?t4(s):void 0}function wle(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function h1(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const $7={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function _le(e){let t=[],n=null,r=null,s=!1;for(const a of e){if(a.role==="user"){s=!0;continue}if(a.role==="plan"){t=a.todos,n=a.id,r=null,s=!1;continue}if(a.role==="tool_group")for(const o of a.tools){const l=t5(o);l&&(t=l,n=a.id,r=o.callId,s=!1)}}if(t.length===0)return $7;const i=!wle(t);return i&&s?$7:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function n5(e){return JSON.stringify([e.id,e.content])}function Ay(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=t5(n);r&&t.push({key:n.callId,todos:r,stats:Cle(n)})}return t}return[]}function kle(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of Ay(r)){const a=[];for(const o of i){const l=n5(o),c=n.get(l);o.status==="in_progress"&&c!=="in_progress"?a.push({kind:"started",id:o.id,content:o.content}):o.status==="completed"&&c!=="completed"&&c!==void 0&&a.push({kind:"completed",id:o.id,content:o.content}),n.set(l,o.status)}t.set(s,{events:a})}return t}function Sle(e){const t=[];for(const n of e)for(const{key:r,todos:s}of Ay(n))t.push(JSON.stringify([r,s.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function Tle(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const r of n.tools)!Ah(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 Ay(n))t.push(JSON.stringify([r,n.timestamp,s.map(a=>[a.id,a.status,a.content]),i]))}return t.join(`
`)}function Cle(e){var a;const t=f1((a=f1(e.rawOutput))==null?void 0:a.stats);if(!t)return;const n=o=>{const l=t[o];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 Ale(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools){if(Ah(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 Ele(e,t,n){let r=0,s=e.length;for(;r<s;){const a=r+s>>>1;e[a].start<t?r=a+1:s=a}let i=0;for(let a=r;a<e.length&&e[a].start<=n;a++)i+=e[a].end-e[a].start;return i}function Mle(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 Nle(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 Ile(e){var o;const t=new Map,n=new Map,r=new Map,s=new Set,i=Ale(e),a=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 Ay(l))for(const f of u){const m=n5(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&&(a(m).startTs=c));else if(f.status==="completed"&&p!=="completed"&&p!==void 0){const y=r.get(m),w=y&&d?Mle(y,d):void 0,v=(o=t.get(m))==null?void 0:o.startTs,g=v!==void 0&&c!==void 0?Ele(i,v,c):void 0,x=Nle(w,g);if(c!==void 0||x){const k=a(m);c!==void 0&&(k.endTs=c),x&&(k.resources=x)}}f.status==="completed"&&s.add(m),n.set(m,f.status)}}return t}function P7(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function Rle(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function jle(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function f1(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function ip(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const Xp=new Set;let nf=null,uj=Date.now();function Dle(){uj=Date.now();for(const e of Xp)e()}function Ole(e){return Xp.add(e),nf||(nf=setInterval(Dle,1e3)),()=>{Xp.delete(e),Xp.size===0&&nf&&(clearInterval(nf),nf=null)}}function r5(e){const[t,n]=b.useState(()=>Date.now());return b.useEffect(()=>{if(e)return n(Date.now()),Ole(()=>n(uj))},[e]),t}const Lle="_list_wqkzx_1",Ble="_summary_wqkzx_2",zle="_row_wqkzx_8",$le="_num_wqkzx_16",Ple="_icon_wqkzx_23",qle="_text_wqkzx_29",Ule="_inProgress_wqkzx_43",Hle="_completed_wqkzx_48",Fle="_item_wqkzx_62",Vle="_rowButton_wqkzx_69",Wle="_detailChevron_wqkzx_82",Gle="_detail_wqkzx_82",Kle="_detailSection_wqkzx_100",Yle="_detailSectionTitle_wqkzx_106",Xle="_detailRows_wqkzx_114",Qle="_detailLabel_wqkzx_122",Jle="_detailValue_wqkzx_126",Zle="_detailDuration_wqkzx_132",ece="_detailHint_wqkzx_136",Jt={list:Lle,summary:Ble,row:zle,num:$le,icon:Ple,text:qle,inProgress:Ule,completed:Hle,item:Fle,rowButton:Vle,detailChevron:Wle,detail:Gle,detailSection:Kle,detailSectionTitle:Yle,detailRows:Xle,detailLabel:Qle,detailValue:Jle,detailDuration:Zle,detailHint:ece};function Px(e){switch(e){case"completed":return Jt.completed;case"in_progress":return Jt.inProgress;case"pending":return""}}function dj({todos:e,events:t}){const{t:n}=nt();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return h.jsx("div",{className:Jt.summary,children:h.jsxs("div",{className:`${Jt.row} ${Jt.completed}`,children:[h.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:"✓"}),h.jsx("span",{className:Jt.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:Jt.summary,children:h.jsxs("div",{className:`${Jt.row} ${Px(s.status)}`,children:[h.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:h1(s.status)}),h.jsx("span",{className:Jt.text,children:s.content})]})}):null}return h.jsx("div",{className:Jt.summary,children:t.map(r=>h.jsxs("div",{className:`${Jt.row} ${r.kind==="completed"?Jt.completed:Jt.inProgress}`,children:[h.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:h1(r.kind==="completed"?"completed":"in_progress")}),h.jsx("span",{className:Jt.text,children:r.content})]},`${r.kind}-${r.id}`))})}function Dc({label:e,value:t,suffix:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Jt.detailLabel,children:e}),h.jsxs("span",{className:Jt.detailValue,children:[t,n]})]})}function n4({title:e,children:t}){return h.jsxs("div",{className:Jt.detailSection,children:[h.jsx("div",{className:Jt.detailSectionTitle,children:e}),h.jsx("div",{className:Jt.detailRows,children:t})]})}function tce({detail:e}){const{t}=nt(),{startTs:n,endTs:r,resources:s}=e,i=n!==void 0||r!==void 0,a=(s==null?void 0:s.inputTokens)!==void 0,o=(s==null?void 0:s.apiTimeMs)!==void 0||(s==null?void 0:s.toolTimeMs)!==void 0;return h.jsxs("div",{className:Jt.detail,children:[i&&h.jsxs(n4,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&h.jsx(Dc,{label:t("todo.detail.start"),value:Kd(n)}),r!==void 0&&h.jsx(Dc,{label:t("todo.detail.end"),value:Kd(r),suffix:n!==void 0?h.jsxs("span",{className:Jt.detailDuration,children:[" ","(",Gl(r-n),")"]}):void 0})]}),a&&h.jsxs(n4,{title:t("todo.detail.sectionTokens"),children:[h.jsx(Dc,{label:t("todo.detail.input"),value:((s==null?void 0:s.inputTokens)??0).toLocaleString()}),h.jsx(Dc,{label:t("todo.detail.output"),value:((s==null?void 0:s.outputTokens)??0).toLocaleString()}),h.jsx(Dc,{label:t("todo.detail.cached"),value:((s==null?void 0:s.cachedTokens)??0).toLocaleString()})]}),o&&h.jsxs(n4,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&h.jsx(Dc,{label:t("todo.detail.api"),value:Gl(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&h.jsx(Dc,{label:t("todo.detail.tool"),value:Gl(s.toolTimeMs)})]}),!s&&h.jsx("div",{className:Jt.detailHint,children:t("todo.detail.noResources")})]})}function nce(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function hj({todos:e,numbered:t=!1}){const{t:n}=nt(),r=b.useContext(JO),[s,i]=b.useState(()=>new Set),a=`${String(e.length).length+1}ch`,o=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsx("div",{className:Jt.list,children:e.map((l,c)=>{const u=l.id||String(c),d=r.get(n5(l)),f=nce(d),m=f&&s.has(u),p=h.jsxs(h.Fragment,{children:[t&&h.jsxs("span",{className:Jt.num,style:{minWidth:a},children:[c+1,"."]}),h.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:h1(l.status)}),h.jsx("span",{className:Jt.text,children:l.content}),f&&h.jsx("span",{className:Jt.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return h.jsxs("div",{className:Jt.item,children:[f?h.jsx("button",{type:"button",className:`${Jt.row} ${Jt.rowButton} ${Px(l.status)}`,onClick:y=>{y.stopPropagation(),o(u)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:p}):h.jsx("div",{className:`${Jt.row} ${Px(l.status)}`,children:p}),m&&d&&h.jsx(tce,{detail:d})]},u)})})}const fj=5;function rce(e){const t=e.toolName.toLowerCase();if(Lu(e.toolName))return!!Ha(e);if(t==="write_file"||t==="writefile")return!!mce(e)||q7(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(sc(t)){const n=Ha(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(t==="edit"||t==="write"||t==="editfile")return q7(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Ha(e);return!!n&&n.split(`
`).length>3}return!1}function sce(e){const t=e.toolName.toLowerCase();return sc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||Lu(e.toolName)}function ice(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!mj(e)}function q7(e){return ice(e)||!!Ha(e)}function ace(e){if(e.content){const t=e.content.find(n=>n.type==="diff");if(t&&t.type==="diff")return cce(t.oldText||"",t.newText||"")}return mj(e)}function mj(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(oce(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function oce(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const lce=25e4;function cce(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>lce){const u=n.map(f=>f?`-${f}`:"-"),d=r.map(f=>f?`+${f}`:"+");return[...u,...d].join(`
`)}const a=Array.from({length:s+1},()=>Array(i+1).fill(0));for(let u=1;u<=s;u++)for(let d=1;d<=i;d++)a[u][d]=n[u-1]===r[d-1]?a[u-1][d-1]+1:Math.max(a[u-1][d],a[u][d-1]);const o=[];let l=s,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(o.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||a[l][c-1]>=a[l-1][c])?(o.push(`+${r[c-1]}`),c--):(o.push(`-${n[l-1]}`),l--);return o.reverse().join(`
`)}const r4=150,U7=25,uce=60;function dce(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:fj)||0))}function H7(e,t){return e.length<=t?e:e.slice(0,t)+" …"}function hce({tool:e,maxLines:t}){const{t:n}=nt(),[r,s]=b.useState(!1),i=b.useMemo(()=>Ha(e)||"",[e]),a=b.useMemo(()=>i.split(`
`),[i]),o=t>0&&a.length>t,l=Math.max(0,a.length-t),c=b.useMemo(()=>a.some(m=>m.length>r4),[a]),u=o||c,d=b.useMemo(()=>r?i:o?[`... first ${l} lines hidden ...`,...a.slice(-t).map(m=>H7(m,r4))].join(`
`):a.map(m=>H7(m,r4)).join(`
`),[l,o,a,t,i,r]),f=b.useMemo(()=>xle(d)?vle(d):null,[d]);return h.jsxs("div",{className:Oe.expandedBash,children:[h.jsx("pre",{className:Oe.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:Oe.expandBtn,onClick:()=>s(!r),"aria-expanded":r,children:r?n("tool.showLess"):o?n("tool.showAll",{count:a.length}):n("tool.showFullLines")})]})}function fce({tool:e}){const{t}=nt(),[n,r]=b.useState(!1),s=b.useMemo(()=>Ha(e)||"",[e]),i=b.useMemo(()=>s.split(`
`),[s]),a=i.length>U7,o=b.useMemo(()=>a&&!n?i.slice(0,U7).join(`
`):s,[s,a,i,n]);return h.jsxs("div",{className:Oe.expandedRead,children:[h.jsx("pre",{className:Oe.expandedOutput,children:o}),a&&h.jsx("button",{className:Oe.expandBtn,onClick:()=>r(!n),"aria-expanded":n,children:n?t("tool.showLess"):t("tool.linesTotal",{count:i.length})})]})}function F7({tool:e}){const t=b.useMemo(()=>ace(e),[e]),n=b.useMemo(()=>Ha(e)||"",[e]);return!t&&!n?null:h.jsx("div",{className:Oe.expandedEdit,children:t?h.jsx(Qoe,{diff:t}):h.jsx("pre",{className:Oe.expandedOutput,children:n})})}function mce(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=Ha(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 pce({tool:e,todos:t,expanded:n}){var i;const s=((i=b.useContext(P5).get(e.callId))==null?void 0:i.events)??[];return h.jsx("div",{className:Oe.todoBody,children:n?h.jsx(hj,{todos:t}):h.jsx(dj,{todos:t,events:s})})}function gce(e,t){var f,m;const n=Ty(e.rawOutput),r=X3(e),s=_0(e),i=J3(e),a=Z3(e),o=((f=e.subTools)==null?void 0:f.length)||((m=n==null?void 0:n.toolCalls)==null?void 0:m.length)||0,l=n==null?void 0:n.executionSummary,c=l&&typeof l.totalDurationMs=="number"?oj(l.totalDurationMs):im(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),u=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:l&&typeof l.totalTokens=="number"&&l.totalTokens>0?l.totalTokens:0,d=u>0?Q3(u):"";return{agentType:i,description:a,subToolCount:o,elapsed:c,tokens:d,status:s,reason:r}}function V7(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Lu(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||sc(t))}function yce({tool:e}){const t=Ha(e)||"";return h.jsx("pre",{className:Oe.expandedOutput,children:t})}function s5(e){const t=e.toolName.toLowerCase();return ny(e)?"agent":sc(t)?"shell":a5(t)?"fetch":Ah(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 bce({description:e,elapsed:t}){return h.jsxs(h.Fragment,{children:[e&&h.jsx("span",{className:Oe.lineArg,children:e}),t&&h.jsx("span",{className:Oe.lineElapsed,children:t})]})}function qx({info:e}){const{renderToolHeaderExtra:t}=Ru(),n=t==null?void 0:t(e);return n?h.jsx(h.Fragment,{children:n}):h.jsx(bce,{description:e.description,elapsed:e.elapsed})}function vce(e){return e.length>uce||e.includes(`
`)}function pj(e){return e==="in_progress"||e==="pending"||e==="running"}function i5(e){return e.find(t=>pj(t.status))??e[e.length-1]}function xce(e,t,n){if(gj(e)){const r=i5(e);return t("toolGroup.running",{name:gc(r.toolName,t),count:e.length,duration:n??""})}return t("toolGroup.summary",{count:e.length})}function gj(e){return e.some(t=>pj(t.status))}function wce(){return h.jsxs("svg",{className:Oe.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 yj(){return h.jsxs("svg",{className:Oe.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:"1.25",y:"1.25",width:"11.5",height:"11.5",rx:"3",stroke:"currentColor",strokeWidth:"1.4"}),h.jsx("path",{d:"M4.2 5.1 5.8 6.7 4.2 8.3",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"}),h.jsx("path",{d:"M7.1 8.4h2.4",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function _ce(){return h.jsxs("svg",{className:Oe.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 kce(){return h.jsxs("svg",{className:Oe.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 Sce(){return h.jsx("svg",{className:Oe.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 Tce(){return h.jsx("svg",{className:Oe.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 Cce({tool:e}){const t=s5(e);return t==="agent"?h.jsx(Tce,{}):t==="edit"||t==="write"?h.jsx(wce,{}):t==="fetch"?h.jsx(_ce,{}):t==="read"?h.jsx(kce,{}):t==="todo"?h.jsx(Sce,{}):h.jsx(yj,{})}function a5(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const Ace=_0;function Ece({tools:e,workspaceCwd:t}){const{t:n}=nt(),r=i5(e),s=gc(r.toolName,n),i=Ace(r),a=JR(r,t),o=sc(r.toolName)||a5(r.toolName)?"":im(r.startTime,r.endTime);return h.jsxs("div",{className:Oe.compactGroup,children:[h.jsxs("div",{className:Oe.compactHeader,children:[h.jsx(Eo,{status:i}),h.jsx("span",{className:Oe.lineName,children:s}),e.length>1&&h.jsxs("span",{className:Oe.compactCount,children:["× ",e.length]}),h.jsx(qx,{info:{kind:s5(r),tool:r,displayName:s,description:a,elapsed:o,workspaceCwd:t}})]}),h.jsx("div",{className:Oe.compactHint,children:n("compact.hint")})]})}function Mce(e,t){var s,i;if(((s=e.approval)==null?void 0:s.id)!==((i=t.approval)==null?void 0:i.id)||e.onConfirm!==t.onConfirm||e.workspaceCwd!==t.workspaceCwd||e.shellOutputMaxLines!==t.shellOutputMaxLines)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&&Nce(n.subTools,r.subTools)}function Nce(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 Ux=b.memo(function({tool:t,approval:n,onConfirm:r,workspaceCwd:s,shellOutputMaxLines:i=fj}){const{t:a}=nt(),o=b.useContext(Mh),[l,c]=b.useState(()=>!o&&V7(t)),u=b.useRef(!1);b.useEffect(()=>{c(o?!1:V7(t)),u.current=!1},[o,t.callId,t.toolName]);const d=ny(t),f=n&&n.toolCallId===t.callId,m=!f&&(n==null?void 0:n.toolCallId)&&d&&Va(t,n.toolCallId),p=d&&t.status==="in_progress",y=r5(p);if(b.useEffect(()=>{!d&&t.status==="completed"&&!u.current&&c(!1)},[d,t.status]),d){if(f&&r)return h.jsx("div",{className:Oe.line,children:h.jsx(jl,{request:n,onConfirm:r})});const H=gce(t,y),W=a("agent.label"),J=t.status==="completed"||t.status==="failed",Y=ej(t,a),Z=t.status==="pending"?"pending":"running",Q=[Y,Z,H.elapsed].filter(Boolean).join(" · "),L=l||!!m;return h.jsxs("div",{className:Oe.line,children:[h.jsxs("div",{className:Oe.lineMain,children:[h.jsx(Eo,{status:t.status}),h.jsx("span",{className:Oe.lineName,children:W}),h.jsx(qx,{info:{kind:"agent",tool:t,displayName:W,description:H.description?Fr(H.description,60):"",elapsed:"",workspaceCwd:s}})]}),!J&&h.jsxs("div",{className:`${Oe.agentSummary} ${Oe.lineExpandable}`,onClick:()=>c(!l),children:[h.jsx(Eo,{status:t.status}),h.jsxs("span",{className:Oe.lineName,children:[H.agentType,":"]}),h.jsx("span",{className:Oe.lineArg,children:Fr(H.description||H.agentType,50)}),Q&&h.jsxs("span",{className:Oe.lineElapsed,children:["· ",Q]})]}),J&&h.jsxs("div",{className:`${Oe.agentSummary} ${Oe.lineExpandable}`,onClick:()=>c(!l),children:[h.jsx(Eo,{status:H.status}),h.jsxs("span",{className:Oe.lineName,children:[H.agentType,":"]}),h.jsx("span",{className:Oe.lineArg,children:Fr(H.description,50)}),H.subToolCount>0&&h.jsxs("span",{className:Oe.lineElapsed,children:["· ",H.subToolCount," tools"]}),H.elapsed&&h.jsxs("span",{className:Oe.lineElapsed,children:["· ",H.elapsed]}),H.tokens&&h.jsxs("span",{className:Oe.lineElapsed,children:["· ",H.tokens]}),H.reason&&h.jsxs("span",{className:Oe.lineElapsed,children:["· ",Fr(H.reason,80)]})]}),f&&r&&h.jsx(jl,{request:n,onConfirm:r}),m&&r&&h.jsx(jl,{request:n,onConfirm:r}),L&&h.jsx("div",{className:Oe.lineDetail,children:h.jsx(e5,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0})})]})}const w=JR(t,s),v=kre(t),g=gc(t.toolName,a),x=sc(t.toolName)||a5(t.toolName)?"":im(t.startTime,t.endTime),k=t.toolName.toLowerCase(),A=Ah(k),T=A?t5(t):void 0,C=!!T&&T.length>0,j=T?T.filter(H=>H.status==="completed").length:0,z=!A&&vce(w),E=A?C:rce(t)||z,P=l&&z,D=sce(t);return f&&r?h.jsx("div",{className:Oe.line,children:h.jsx(jl,{request:n,onConfirm:r})}):h.jsxs("div",{className:Oe.line,children:[h.jsxs("div",{className:`${Oe.lineMain} ${E?Oe.lineExpandable:""}`,title:E?a(l?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":E?l:void 0,role:E?"button":void 0,tabIndex:E?0:void 0,onClick:E?()=>{u.current=!0,c(H=>!H)}:void 0,onKeyDown:E?H=>{H.key!=="Enter"&&H.key!==" "||(H.preventDefault(),u.current=!0,c(W=>!W))}:void 0,children:[h.jsx(Eo,{status:t.status}),h.jsx("span",{className:Oe.lineName,children:g}),A&&C&&h.jsxs("span",{className:Oe.todoProgress,children:[j,"/",T.length]}),h.jsx(qx,{info:{kind:s5(t),tool:t,displayName:g,description:A||P?"":w,elapsed:A?"":x,workspaceCwd:s}})]}),A&&C&&h.jsx(pce,{tool:t,todos:T,expanded:l}),A&&!C&&v&&h.jsx("div",{className:Oe.lineOutput,children:v}),P&&h.jsx("div",{className:Oe.lineFullArg,children:w}),!A&&v&&(!l||!D)&&h.jsx("div",{className:Oe.lineOutput,children:v}),!A&&l&&D&&h.jsxs("div",{className:Oe.lineDetail,children:[sc(k)&&h.jsx(hce,{tool:t,maxLines:i}),(k==="write_file"||k==="writefile")&&h.jsx(F7,{tool:t}),(k==="edit"||k==="write"||k==="editfile")&&h.jsx(F7,{tool:t}),(k==="read"||k==="read_file"||k==="readfile")&&h.jsx(fce,{tool:t}),Lu(t.toolName)&&h.jsx(yce,{tool:t})]})]})},Mce),Ice=b.memo(function({tools:t,pendingApproval:n,onConfirm:r,workspaceCwd:s,shellOutputMaxLines:i}){const{t:a}=nt(),o=b.useContext(Mh),[l,c]=b.useState(!1),u=gj(t),d=t.length>0?i5(t):void 0,f=t[0]??d,m=b.useRef(Date.now()),p=r5(u),y=(n==null?void 0:n.toolCallId)&&t.find(x=>x.callId===n.toolCallId),w=(n==null?void 0:n.toolCallId)&&t.some(x=>Va(x,n.toolCallId)),v=o&&!w,g=u?lj(p-m.current):void 0;return b.useEffect(()=>{u&&(m.current=Date.now())},[u,d==null?void 0:d.callId]),y&&t.length===1&&r?h.jsx(jl,{request:n,onConfirm:r}):v?h.jsx(Ece,{tools:t,workspaceCwd:s}):w?h.jsx("div",{className:Oe.group,children:t.map(x=>h.jsx(Ux,{tool:x,approval:n,onConfirm:r,workspaceCwd:s,shellOutputMaxLines:i},x.callId))}):h.jsxs("div",{className:Oe.chatGroupWrap,children:[h.jsxs("button",{type:"button",className:Oe.chatSummary,onClick:()=>c(x=>!x),"aria-expanded":l,title:a(l?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:Oe.chatSummaryIcon,"aria-hidden":"true",children:f?h.jsx(Cce,{tool:f}):h.jsx(yj,{})}),h.jsx("span",{className:u?`${Oe.chatSummaryText} ${Oe.chatSummaryTextActive}`:Oe.chatSummaryText,children:xce(t,a,g)}),h.jsx("span",{className:l?Oe.chatChevronDown:Oe.chatChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:l?Oe.chatSummaryContentClip:`${Oe.chatSummaryContentClip} ${Oe.chatSummaryContentCollapsed}`,children:h.jsx("div",{className:Oe.chatSummaryContentInner,children:h.jsx("div",{className:Oe.group,children:t.map(x=>h.jsx(Ux,{tool:x,approval:n,onConfirm:r,workspaceCwd:s,shellOutputMaxLines:i},x.callId))})})})]})}),Rce="_message_19jij_1",jce="_header_19jij_6",Dce="_chevron_19jij_20",Oce="_title_19jij_26",Lce="_progress_19jij_35",rf={message:Rce,header:jce,chevron:Dce,title:Oce,progress:Lce};function Bce({id:e,todos:t}){var s;const r=((s=b.useContext(P5).get(e))==null?void 0:s.events)??[];return h.jsx(dj,{todos:t,events:r})}const zce=b.memo(function({id:t,todos:n}){const{t:r}=nt(),[s,i]=b.useState(!1);if(n.length===0)return null;const a=n.length,o=n.filter(l=>l.status==="completed").length;return h.jsxs("div",{className:rf.message,children:[h.jsxs("button",{type:"button",className:rf.header,onClick:()=>i(l=>!l),"aria-expanded":s,title:r(s?"todo.collapse":"todo.expand"),children:[h.jsx("span",{className:rf.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),h.jsx("span",{className:rf.title,children:r("plan.title")}),h.jsxs("span",{className:rf.progress,children:[o,"/",a]})]}),s?h.jsx(hj,{todos:n,numbered:!0}):h.jsx(Bce,{id:t,todos:n})]})}),$ce="_message_1ahub_1",Pce="_content_1ahub_11",qce="_question_1ahub_17",Uce="_prefix_1ahub_24",Hce="_answer_1ahub_28",Fce="_pending_1ahub_32",Vce="_shortcuts_1ahub_36",Oc={message:$ce,content:Pce,question:qce,prefix:Uce,answer:Hce,pending:Fce,shortcuts:Vce},bj=b.memo(function({question:t,answer:n,isPending:r}){const{t:s}=nt();return h.jsxs("div",{className:Oc.message,children:[h.jsxs("div",{className:Oc.content,children:[h.jsxs("div",{className:Oc.question,children:[h.jsx("span",{className:Oc.prefix,children:"/btw "}),h.jsx("span",{children:t})]}),h.jsx("div",{className:Oc.answer,children:r?h.jsx("span",{className:Oc.pending,children:s("btw.answering")}):h.jsx(sm,{content:n})})]}),h.jsx("div",{className:Oc.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),Wce="_message_102cm_1",Gce="_compact_102cm_16",Kce="_header_102cm_21",Yce="_status_102cm_30",Xce="_name_102cm_35",Qce="_command_102cm_43",Jce="_output_102cm_52",Zce="_compactHint_102cm_63",mo={message:Wce,compact:Gce,header:Kce,status:Yce,name:Xce,command:Qce,output:Jce,compactHint:Zce},eue=b.memo(function({command:t,output:n}){const r=b.useContext(Mh),{t:s}=nt();return h.jsxs("div",{className:r?`${mo.message} ${mo.compact}`:mo.message,children:[h.jsxs("div",{className:mo.header,children:[h.jsx("span",{className:mo.status,children:"✓"}),h.jsx("span",{className:mo.name,children:s("shell.command")}),t&&h.jsx("span",{className:mo.command,children:t})]}),r?h.jsx("div",{className:mo.compactHint,children:s("compact.hint")}):n&&h.jsx("pre",{className:mo.output,children:n})]})}),tue="_progress_11zl8_1",nue="_spinner_11zl8_12",rue="_bar_11zl8_19",sue="_stage_11zl8_25",iue="_icon_11zl8_29",aue="_done_11zl8_35",oue="_error_11zl8_43",lue="_detail_11zl8_51",cue="_path_11zl8_56",$r={progress:tue,spinner:nue,bar:rue,stage:sue,icon:iue,done:aue,error:oue,detail:lue,path:cue},W7=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function uue({progress:e}){const{stage:t,progress:n,detail:r,isComplete:s,error:i}=e,[a,o]=b.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 b.useEffect(()=>{if(s||i)return;const f=setInterval(()=>{o(m=>(m+1)%W7.length)},120);return()=>clearInterval(f)},[s,i]),i?h.jsxs("div",{className:`${$r.progress} ${$r.error}`,children:[h.jsx("span",{className:$r.icon,children:"✕"}),h.jsx("span",{className:$r.stage,children:t}),h.jsx("div",{className:$r.detail,children:i})]}):s?h.jsxs("div",{className:`${$r.progress} ${$r.done}`,children:[h.jsx("span",{className:$r.icon,children:"✓"}),h.jsx("span",{className:$r.stage,children:t})]}):h.jsxs("div",{className:$r.progress,children:[h.jsx("span",{className:$r.spinner,children:W7[a]}),h.jsx("span",{className:$r.bar,children:d}),h.jsxs("span",{className:$r.stage,children:[t,r?` (${r})`:""]})]})}function due({path:e}){const{t}=nt();return h.jsxs("div",{className:`${$r.progress} ${$r.done}`,children:[h.jsx("span",{className:$r.icon,children:"✓"}),h.jsx("span",{className:$r.stage,children:t("insight.ready")}),h.jsx("span",{className:$r.path,children:e})]})}const hue=b.memo(function({message:t,pendingApproval:n,onConfirm:r,onShowContextDetail:s,workspaceCwd:i,isLatest:a=!1,showRetryHint:o=!1,onRetryClick:l,onBranchSession:c,showAssistantActions:u=!1,showAssistantBranch:d=!1,shellOutputMaxLines:f}){const m=(()=>{switch(t.role){case"user":return h.jsx(yne,{content:t.content,images:t.images});case"assistant":return h.jsx(Lne,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:c,showFooterActions:u,showBranchAction:d});case"thinking":return h.jsx(Pne,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp});case"tool_group":return h.jsx(Ice,{tools:t.tools,pendingApproval:n,onConfirm:r,workspaceCwd:i,shellOutputMaxLines:f});case"plan":return h.jsx(zce,{id:t.id,todos:t.todos});case"system":return h.jsx(Mae,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:s,isLatest:a,showRetryHint:o&&t.retryable===!0,onRetryClick:l});case"user_shell":return h.jsx(eue,{command:t.command,output:t.output});case"btw":return h.jsx(bj,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return h.jsx(uue,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return h.jsx(due,{path:t.path});case"insight_error":return h.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();return m===null?null:t.role==="assistant"?u?m:h.jsx(G2,{timestamp:t.timestamp,children:m}):h.jsx(G2,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:"Copy",children:m})},fue);function fue(e,t){var n,r;return((n=e.pendingApproval)==null?void 0:n.id)!==((r=t.pendingApproval)==null?void 0:r.id)||e.onConfirm!==t.onConfirm||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:mue(e.message,t.message)}function mue(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&&yue(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"&&pue(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>vj(n,t.tools[r]));default:return!1}}function pue(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 vj(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&&fl(e.args)===fl(t.args)&&fl(e.rawOutput)===fl(t.rawOutput)&&fl(e.locations)===fl(t.locations)&&fl(e.content)===fl(t.content)&&gue(e.subTools,t.subTools):!1}function gue(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>vj(n,t[r]))}const G7=new WeakMap;function yue(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 fl(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=G7.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return G7.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const bue="_wrap_3r44g_1",vue="_summary_3r44g_5",xue="_summaryIcon_3r44g_28",wue="_summaryToolIcon_3r44g_42",_ue="_summaryText_3r44g_48",kue="_summaryTextActive_3r44g_58",Sue="_summaryDot_3r44g_85",Tue="_chevronRight_3r44g_89",Cue="_chevronDown_3r44g_90",Aue="_group_3r44g_116",Eue="_list_3r44g_145",Mue="_row_3r44g_153",Nue="_rowStats_3r44g_167",Iue="_rowDesc_3r44g_175",Rue="_rowTool_3r44g_185",jue="_detail_3r44g_189",Yr={wrap:bue,summary:vue,summaryIcon:xue,summaryToolIcon:wue,summaryText:_ue,summaryTextActive:kue,summaryDot:Sue,chevronRight:Tue,chevronDown:Cue,group:Aue,list:Eue,row:Mue,rowStats:Nue,rowDesc:Iue,rowTool:Rue,detail:jue};function Due(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 Oue(e,t){const n=[],r=Ty(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?Due(s.totalDurationMs):im(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const a=r&&typeof r.tokenCount=="number"&&r.tokenCount>0?r.tokenCount:s&&typeof s.totalTokens=="number"&&s.totalTokens>0?s.totalTokens:0;a>0&&n.push(Q3(a));const o=X3(e);return o&&n.push(Fr(o,80)),n.join(" · ")}function Lue(){return h.jsx("svg",{className:Yr.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 Bue({agents:e,pendingApproval:t,onConfirm:n}){const{t:r}=nt(),[s,i]=b.useState(!1),[a,o]=b.useState(null),[l,c]=b.useState(()=>Date.now()),u=b.useRef(Date.now()),d=e.some(g=>g.status==="in_progress");b.useEffect(()=>{d&&(u.current=Date.now(),c(Date.now()))},[d]),b.useEffect(()=>{if(!d)return;const g=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(g)},[d]);const f=d?lj(l-u.current):"",m=e.filter(g=>g.status==="completed"||g.status==="failed").length,p=e.length,y=t!=null&&t.toolCallId?e.find(g=>Va(g,t.toolCallId)):void 0,w=s||!!y,v=e.some(g=>_0(g)==="failed")?"failed":d?"in_progress":"completed";return h.jsxs("div",{className:Yr.wrap,children:[h.jsxs("button",{type:"button",className:Yr.summary,onClick:()=>i(g=>!g),"aria-expanded":w,title:r(w?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:Yr.summaryIcon,"aria-hidden":"true",children:v==="failed"?h.jsx(Eo,{status:v}):h.jsx(Lue,{})}),h.jsxs("span",{className:d?`${Yr.summaryText} ${Yr.summaryTextActive}`:Yr.summaryText,children:[r("parallelAgents.title"),f&&h.jsxs(h.Fragment,{children:[" ",f]}),h.jsx("span",{className:Yr.summaryDot,children:"·"}),r("parallelAgents.done",{done:m,total:p})]}),h.jsx("span",{className:w?Yr.chevronDown:Yr.chevronRight,"aria-hidden":"true"})]}),w&&h.jsxs("div",{className:Yr.group,children:[h.jsx("div",{className:Yr.list,children:e.map(g=>{const x=J3(g),k=Z3(g),A=ej(g,r),T=Oue(g,l),C=_0(g),j=a===g.callId;return h.jsxs("div",{children:[h.jsxs("div",{className:Yr.row,onClick:()=>o(j?null:g.callId),children:[h.jsx(Eo,{status:C}),h.jsxs("span",{className:Yr.rowDesc,children:[Fr(k||x,50),A&&h.jsx("span",{className:Yr.rowTool,children:` (${A})`})]}),T&&h.jsx("span",{className:Yr.rowStats,children:T})]}),j&&h.jsx("div",{className:Yr.detail,children:h.jsx(e5,{tool:g,hideHeader:!0})})]},g.callId)})}),y&&t&&n&&h.jsx(jl,{request:t,onConfirm:n})]})]})}const zue="_question_11nwh_1",$ue="_floating_11nwh_9",Pue="_titleLine_11nwh_19",que="_icon_11nwh_26",Uue="_toolName_11nwh_32",Hue="_toolDesc_11nwh_37",Fue="_tabs_11nwh_41",Vue="_tab_11nwh_41",Wue="_tabActive_11nwh_61",Gue="_tabCheck_11nwh_67",Kue="_header_11nwh_75",Yue="_text_11nwh_82",Xue="_multiHint_11nwh_88",Que="_options_11nwh_93",Jue="_option_11nwh_93",Zue="_optionActive_11nwh_108",ede="_optionLabel_11nwh_108",tde="_optionSelected_11nwh_109",nde="_pointer_11nwh_117",rde="_checkbox_11nwh_124",sde="_optionNum_11nwh_136",ide="_optionContent_11nwh_142",ade="_optionPlaceholder_11nwh_152",ode="_optionDesc_11nwh_157",lde="_customInput_11nwh_163",cde="_submitTab_11nwh_179",ude="_summary_11nwh_183",dde="_summaryRow_11nwh_190",hde="_summaryLabel_11nwh_196",fde="_summaryValue_11nwh_201",mt={question:zue,floating:$ue,titleLine:Pue,icon:que,toolName:Uue,toolDesc:Hue,tabs:Fue,tab:Vue,tabActive:Wue,tabCheck:Gue,header:Kue,text:Yue,multiHint:Xue,options:Que,option:Jue,optionActive:Zue,optionLabel:ede,optionSelected:tde,pointer:nde,checkbox:rde,optionNum:sde,optionContent:ide,optionPlaceholder:ade,optionDesc:ode,customInput:lde,submitTab:cde,summary:ude,summaryRow:dde,summaryLabel:hde,summaryValue:fde};function xj({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=nt(),s=b.useMemo(()=>{var L;return Array.isArray((L=e.rawInput)==null?void 0:L.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,a]=b.useState(0),[o,l]=b.useState(0),[c,u]=b.useState({}),[d,f]=b.useState({}),[m,p]=b.useState({}),[y,w]=b.useState(!1),v=b.useRef(!1),g=s.length+1,x=i===s.length;b.useEffect(()=>{v.current=!1,a(0),l(0),u({}),f({}),p({}),w(!1)},[e.id]);const k=x?void 0:s[i],A=(k==null?void 0:k.multiSelect)??!1,T=x?2:((k==null?void 0:k.options.length)??0)+1,C=(k==null?void 0:k.options.length)??0,j=b.useCallback((L,R=c,$=d,I=m)=>{if(L===s.length)return 0;const M=s[L];if(!M)return 0;const G=M.options.length;if(M.multiSelect){const Pe=I[L]||[],oe=M.options.findIndex(Xe=>Pe.includes(Xe.label));return oe>=0?oe:$[L]?G:0}const ne=R[L],fe=M.options.findIndex(Pe=>Pe.label===ne);return fe>=0?fe:$[L]||ne?G:0},[c,d,s,m]),z=b.useCallback(()=>{const L={};for(let R=0;R<s.length;R++){const $=s[R];if($)if($.multiSelect){const I=m[R]||[],M=d[R],G=M?[...I,M]:I;L[String(R)]=G.join(", ")}else L[String(R)]=c[R]||d[R]||""}return L},[s,m,d,c]),E=b.useCallback(()=>{if(v.current)return;const L=e.options.find(R=>R.kind==="allow_once");L&&(v.current=!0,t(e.id,L.id,z()))},[z,e,t]),P=b.useCallback(()=>{if(v.current)return;const L=e.options.find(R=>R.kind==="reject_once"||R.kind==="reject_always");L&&(v.current=!0,t(e.id,L.id,void 0))},[e,t]),D=b.useCallback(L=>{g<=1||a(R=>{const $=(R+L+g)%g;return l(j($)),w(!1),$})},[j,g]),H=b.useCallback(L=>{L!==void 0&&f(R=>({...R,[i]:L})),w(!0)},[i]),W=b.useCallback(L=>{if(x){L===0?E():P();return}if(!k)return;if(L===k.options.length){H();return}const $=k.options[L].label;if(A){const I=m[i]||[],M=I.includes($)?I.filter(G=>G!==$):[...I,$];p({...m,[i]:M})}else{const I={...c,[i]:$};if(u(I),i<s.length-1){const M=i+1;a(M),l(j(M,I))}else a(s.length),l(j(s.length,I))}},[x,k,i,A,m,c,s,E,P,H,j]),J=b.useCallback(L=>{if(x||!k||!A)return;if(L===k.options.length){H();return}const R=k.options[L].label,$=m[i]||[],I=$.includes(R)?$.filter(M=>M!==R):[...$,R];p({...m,[i]:I})},[x,k,A,m,i,H]);b.useEffect(()=>{if(y)return;const L=$=>{$.preventDefault(),$.stopPropagation()},R=$=>{if(!$.defaultPrevented)if($.key==="ArrowDown"||$.key==="j")L($),l(I=>Math.min(I+1,T-1));else if($.key==="ArrowUp"||$.key==="k")L($),l(I=>Math.max(I-1,0));else if($.key==="ArrowRight")L($),D(1);else if($.key==="ArrowLeft")L($),D(-1);else if($.key===" ")L($),A?J(o):W(o);else if($.key==="Enter")if(L($),A)if(i<s.length-1){const I=i+1;a(I),l(j(I))}else a(s.length),l(j(s.length));else W(o);else if($.key==="Escape")L($),P();else if($.key>="1"&&$.key<="9"){const I=parseInt($.key)-1;I<T&&(L($),l(I),A?J(I):W(I))}else!x&&o===C&&$.key.length===1&&!$.metaKey&&!$.ctrlKey&&!$.altKey&&(L($),H($.key))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[y,T,o,C,A,x,i,s.length,W,J,P,D,H,j]);const Y=L=>{if(L.key==="Enter"){L.preventDefault(),L.stopPropagation();const R=d[i];if(R){if(!A){const $={...c,[i]:R};if(u($),i<s.length-1){const I=i+1;a(I),l(j(I,$)),w(!1);return}a(s.length),l(j(s.length,$)),w(!1);return}if(w(!1),i<s.length-1){const $=i+1;a($),l(j($))}else a(s.length),l(j(s.length))}}else L.key==="Escape"?(L.preventDefault(),L.stopPropagation(),w(!1)):L.key==="ArrowDown"?(L.preventDefault(),L.stopPropagation(),w(!1),l(R=>Math.min(R+1,T-1))):L.key==="ArrowUp"?(L.preventDefault(),L.stopPropagation(),w(!1),l(R=>Math.max(R-1,0))):L.key==="Tab"&&(L.preventDefault(),L.stopPropagation(),w(!1),D(L.shiftKey?-1:1))};if(s.length===0)return null;const Z=L=>{const R=s[L];return R?R.multiSelect?(m[L]||[]).length>0||!!d[L]:!!c[L]||!!d[L]:!1},Q=L=>{const R=s[L];if(!R)return"";if(R.multiSelect){const $=m[L]||[],I=d[L];return(I?[...$,I]:$).join(", ")}return c[L]||d[L]||""};return h.jsxs("div",{className:`${mt.question} ${n==="floating"?mt.floating:""}`,children:[h.jsxs("div",{className:mt.titleLine,children:[h.jsx("span",{className:mt.icon,children:"?"}),h.jsx("span",{className:mt.toolName,children:gc("ask_user_question",r)}),h.jsx("span",{className:mt.toolDesc,children:r("askUser.title",{count:s.length})})]}),h.jsxs("div",{className:mt.tabs,children:[s.map((L,R)=>h.jsxs("button",{className:`${mt.tab} ${R===i?mt.tabActive:""}`,onClick:()=>{a(R),l(j(R)),w(!1)},children:[L.header,Z(R)&&h.jsx("span",{className:mt.tabCheck,children:" ✓"})]},R)),h.jsx("button",{className:`${mt.tab} ${x?mt.tabActive:""}`,onClick:()=>{a(s.length),l(j(s.length)),w(!1)},children:r("askUser.submit")})]}),x?h.jsxs("div",{className:mt.submitTab,children:[h.jsx("div",{className:mt.header,children:r("askUser.confirmTitle")}),h.jsx("div",{className:mt.summary,children:s.map((L,R)=>h.jsxs("div",{className:mt.summaryRow,children:[h.jsxs("span",{className:mt.summaryLabel,children:[L.header,":"]}),h.jsx("span",{className:mt.summaryValue,children:Q(R)||"—"})]},R))}),h.jsx("div",{className:mt.text,children:r("askUser.confirmPrompt")}),h.jsxs("div",{className:mt.options,children:[h.jsxs("div",{className:`${mt.option} ${o===0?mt.optionActive:""}`,onClick:E,onMouseEnter:()=>l(0),children:[h.jsx("span",{className:mt.pointer,children:o===0?"›":" "}),h.jsx("span",{className:mt.optionNum,children:"1."}),h.jsx("span",{className:mt.optionLabel,children:r("askUser.submitAnswers")})]}),h.jsxs("div",{className:`${mt.option} ${o===1?mt.optionActive:""}`,onClick:P,onMouseEnter:()=>l(1),children:[h.jsx("span",{className:mt.pointer,children:o===1?"›":" "}),h.jsx("span",{className:mt.optionNum,children:"2."}),h.jsx("span",{className:mt.optionLabel,children:r("askUser.cancel")})]})]})]}):k?h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:mt.text,children:[k.question,A&&h.jsxs("span",{className:mt.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),h.jsxs("div",{className:mt.options,children:[k.options.map((L,R)=>{const $=R===o,I=A?(m[i]||[]).includes(L.label):c[i]===L.label;return h.jsxs("div",{className:`${mt.option} ${$?mt.optionActive:""} ${I?mt.optionSelected:""}`,onClick:()=>{l(R),A?J(R):W(R)},onMouseEnter:()=>l(R),children:[h.jsx("span",{className:mt.pointer,children:$?"›":" "}),A&&h.jsx("span",{className:mt.checkbox,children:I?"[✓]":"[ ]"}),h.jsxs("span",{className:mt.optionNum,children:[R+1,"."]}),h.jsxs("span",{className:mt.optionContent,children:[h.jsx("span",{className:mt.optionLabel,children:L.label}),L.description&&h.jsx("span",{className:mt.optionDesc,children:L.description})]})]},L.label)}),(()=>{const L=o===k.options.length,R=!!d[i];return h.jsxs("div",{className:`${mt.option} ${L?mt.optionActive:""} ${R?mt.optionSelected:""}`,onClick:()=>{l(k.options.length),H()},onMouseEnter:()=>l(k.options.length),children:[h.jsx("span",{className:mt.pointer,children:L?"›":" "}),A&&h.jsx("span",{className:mt.checkbox,children:R?"[✓]":"[ ]"}),h.jsxs("span",{className:mt.optionNum,children:[k.options.length+1,"."]}),y?h.jsx("input",{type:"text",className:mt.customInput,placeholder:r("askUser.typePlaceholder"),value:d[i]||"",onChange:$=>f({...d,[i]:$.target.value}),onKeyDown:Y,onBlur:()=>w(!1),autoFocus:!0}):h.jsx("span",{className:`${mt.optionLabel} ${d[i]?"":mt.optionPlaceholder}`,children:d[i]||r("askUser.typePlaceholder")})]})})()]})]}):null]})}const mde="_collapseRow_1lhy8_1",pde="_collapseRowClickable_1lhy8_14",gde="_collapseLabel_1lhy8_19",yde="_processedLabel_1lhy8_36",bde="_hiddenMetrics_1lhy8_43",vde="_summaryMetrics_1lhy8_47",xde="_collapseIcon_1lhy8_55",wde="_chevronRight_1lhy8_68",_de="_chevronDown_1lhy8_69",_a={collapseRow:mde,collapseRowClickable:pde,collapseLabel:gde,processedLabel:yde,hiddenMetrics:bde,summaryMetrics:vde,collapseIcon:xde,chevronRight:wde,chevronDown:_de},kde="_list_tjmdl_1",Sde="_rowFlash_tjmdl_33",Tde="_turnStatusRow_tjmdl_38",Cde="_turnAnswerRow_tjmdl_39",Ade="_turnContentRow_tjmdl_51",Ede="_turnContentClip_tjmdl_55",Mde="_turnContentCollapsed_tjmdl_63",Nde="_turnContentInner_tjmdl_67",Kl={list:kde,rowFlash:Sde,turnStatusRow:Tde,turnAnswerRow:Cde,turnContentRow:Ade,turnContentClip:Ede,turnContentCollapsed:Mde,turnContentInner:Nde};function K7(e){var t;return!((t=e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Lu(e.toolName):!0}function Ide(e,t){if(!(t!=null&&t.toolCallId))return!1;for(const n of e)if(n.role==="tool_group"&&n.tools.some(r=>Va(r,t.toolCallId)))return!0;return!1}function Y7(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="user")return n.id}return null}function X7(e){return e.role==="tool_group"&&e.tools.length===1&&ny(e.tools[0])}function s4(e){return e.role==="tool_group"&&e.tools.length===1&&UM(e.tools[0])}function Q7(e){return e.role==="thinking"}function J7(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Va(n,t.toolCallId)))}function Z7(e){return e.role==="thinking"}function Rde(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||J7(s,t)){Z7(s)||n.push(s),r++;continue}const i=[s];let a=r,o=r+1;for(;o<e.length;){const c=e[o];if(Z7(c)){o++;continue}if(c.role==="tool_group"&&!J7(c,t)){i.push(c),a=o,o++;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=a+1}return n}function jde(e){const t=[];let n=0;for(;n<e.length;){if(s4(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(s4(i)){r.push(i),s++;continue}if(Q7(i)){let a=s+1;for(;a<e.length&&Q7(e[a]);)a++;if(a<e.length&&s4(e[a])){s=a;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(X7(e[n])){const r=n;for(;n<e.length&&X7(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 eT(e){return e.type==="parallel_agents"?`group:${e.key}`:e.type==="turn_collapse"?`tc:${e.key}`:e.type==="turn_content"?`turn-content:${e.key}`:`msg:${e.key}`}function Dde(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function Ode(e,t,n){let r=t;for(let s=n;s>t;s--)if(wj(e[s])){r=s;break}for(let s=n;s>r;s--)if(Dde(e[s]))return s;return-1}function Hx(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=>Hx(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return Lde(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 Lde(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 wj(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(wj):e.message.role==="tool_group"||e.message.role==="plan"}function Bde(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 zde(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 $de(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function _j(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+_j(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function Pde(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const r=e[n];if(r.type==="message"&&r.message.role==="user")return r.message.id}return null}function qde(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(a=>Va(a,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(a=>Va(a,r)))return!0}return!1}function Ude(e,{overrides:t,isResponding:n,activeTurnStartedAt:r,pendingApprovalCallId:s,enabled:i}){if(!i||e.length===0)return e;const a=[];for(let l=0;l<e.length;l++){const c=e[l];c.type==="message"&&c.message.role==="user"&&a.push(l)}if(a.length===0)return e;const o=[];for(let l=0;l<a[0];l++)o.push(e[l]);for(let l=0;l<a.length;l++){const c=a[l],u=(l+1<a.length?a[l+1]:e.length)-1,d=e[c],f=d.message.id,m=d.message.timestamp,p=l===a.length-1&&n,y=qde(e,c,u,s),w=Ode(e,c,u);let v=0,g,x,k=0,A=0,T=0,C=0,j=0,z=!1;for(let $=c+1;$<=u;$++){const I=e[$];Hx(I,$===w)&&v++,C+=_j(I),I.type==="message"&&I.message.role==="thinking"&&j++;const G=Bde(I);G!==void 0&&(g=g===void 0?G:Math.max(g,G));const ne=zde(I);ne!==void 0&&(x=x===void 0?ne:Math.max(x,ne));const fe=$de(I);fe&&(k+=fe.inputTokens,A+=fe.outputTokens,T+=fe.cachedTokens??0,z=!0)}const E=p?r??m??Date.now():void 0,P=g??x,D=m!==void 0&&P!==void 0&&P>=m?P-m:void 0;if(y||v===0&&!(z||D!==void 0||E!==void 0)){for(let $=c;$<=u;$++)o.push(e[$]);continue}const J=!(v===0?!0:t.has(f)?t.get(f):p);let Y=0;const Z=$=>{$.length!==0&&o.push({type:"turn_content",key:`${f}-content-${Y++}`,turnId:f,collapsed:J,items:$})};o.push({type:"message",key:d.key,message:d.message});const Q={turnId:f,collapsed:J,hiddenCount:v,...D!==void 0?{elapsedMs:D}:{},...z?{inputTokens:k,outputTokens:A}:{},...T>0?{cachedTokens:T}:{},...C>0?{toolCallCount:C}:{},...j>0?{thinkingCount:j}:{},...E!==void 0?{liveStartedAt:E}:{}};if(o.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:Q}),!J){let $=[];for(let I=c+1;I<=u;I++){const M=e[I];I===w&&M.type==="message"&&M.message.role==="assistant"?(Z($),$=[],o.push({...M,turnCollapse:Q})):$.push(M)}Z($);continue}const L=[],R=[];for(let $=c+1;$<=u;$++){const I=e[$];if(!($===w&&p)){if($===w&&I.type==="message"&&I.message.role==="assistant"){R.push({...I,turnCollapse:Q});continue}if(Hx(I,$===w)){L.push(I);continue}R.push(I)}}Z(L),o.push(...R)}return o}function Qp(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=>Va(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>Va(i,n)))return r;if(s.type==="turn_content"&&Qp(s.items,t,n)>=0)return r}}return-1}const i4=0,Hde=120,a4=80,Fde=32,Vde=200,Wde=240,kj=200;function Gde(e,t=kj){return e>t}function Kde(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 o4(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Yde(e){return e!==void 0?Kde(e):""}function Xde(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${o4(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${o4(e.inputTokens)}${r} ↓${o4(e.outputTokens)}`}function tT(e,t){const n=[],r=Xde(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 Qde(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const Jde=b.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=nt(),s=t.hiddenCount>0,i=t.liveStartedAt,a=s||i!==void 0||Qde(t),o=r5(i!==void 0&&a),l=b.useRef(0);let c;i!==void 0&&a?(l.current=Math.max(l.current,Math.max(0,o-i)),c=l.current):a&&t.elapsedMs!==void 0?(l.current=0,c=t.elapsedMs):(l.current=0,c=void 0);const u=Yde(c),d=tT(t,r),f=tT(t,r),m=r(i!==void 0?"turn.processing":"turn.processed"),p=!!u&&a,y=!!d&&a,w=!!f&&a;if(!a)return null;const v=()=>{s&&n(t.turnId)};return h.jsxs("div",{className:s?`${_a.collapseRow} ${_a.collapseRowClickable}`:_a.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?g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),v())}:void 0,children:[h.jsxs("span",{className:_a.collapseLabel,children:[h.jsxs("span",{className:_a.processedLabel,children:[m,p&&` ${u}`]}),w&&h.jsx("span",{className:_a.summaryMetrics,children:f}),y&&h.jsx("span",{className:_a.hiddenMetrics,children:d})]}),s&&h.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:_a.collapseIcon,onClick:g=>{g.stopPropagation(),v()},children:h.jsx("span",{className:t.collapsed?_a.chevronRight:_a.chevronDown,"aria-hidden":"true"})})]})});function nT(e){if(e.type==="turn_collapse")return Kl.turnStatusRow;if(e.type==="turn_content")return Kl.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Kl.turnAnswerRow}const Zde=b.memo(function({collapsed:t,children:n}){const r=Sj(Kl.turnContentClip,t?Kl.turnContentCollapsed:void 0);return h.jsx("div",{className:r,"data-collapsed":t?"true":"false",children:h.jsx("div",{className:Kl.turnContentInner,children:n})})});function Sj(...e){return e.filter(Boolean).join(" ")||void 0}const ehe=b.forwardRef(function({messages:t,pendingApproval:n,onConfirm:r,onShowContextDetail:s,catchingUp:i,isResponding:a=!1,activeTurnStartedAt:o,welcomeHeader:l,workspaceCwd:c,tailContent:u,tailKey:d="tail",virtualScrollThreshold:f=kj,shellOutputMaxLines:m,autoScrollTailIntoView:p=!1,showRetryHint:y=!1,onRetryClick:w,onBranchSession:v,onFollowStateChange:g},x){const k=b.useContext(Mh),A=b.useMemo(()=>k?Rde(t,n):t,[k,t,n]),T=b.useMemo(()=>jde(A),[A]),C=b.useMemo(()=>{var re;if(a)return null;for(let ae=A.length-1;ae>=0;ae-=1){const pe=A[ae];if(pe&&(pe.role==="tool_group"||pe.role==="plan"))return null;if((pe==null?void 0:pe.role)==="assistant"&&!pe.isStreaming&&((re=pe.content)!=null&&re.trim()))return pe.id}return null},[a,A]),{collapseCompletedTurns:j}=Ru(),z=j??!0,[E,P]=b.useState(()=>new Map),D=b.useRef(!0),H=b.useRef(0),W=b.useRef(!1),J=b.useRef(0),Y=b.useRef(!0),Z=b.useRef(null),Q=b.useRef(i),L=b.useRef(i),R=b.useRef(!1);L.current=i;const $=b.useCallback(re=>{D.current=re,Y.current!==re&&(Y.current=re,g==null||g(re))},[g]),I=b.useCallback(re=>{$(!1),P(ae=>{const pe=new Map(ae);return pe.set(re,ae.has(re)?!ae.get(re):!0),pe})},[$]),M=b.useMemo(()=>Ude(T,{overrides:E,isResponding:a,activeTurnStartedAt:o,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:z}),[T,E,a,o,n==null?void 0:n.toolCallId,z]),G=b.useRef(null),ne=b.useMemo(()=>n?K7(n)?!0:!Ide(t,n):!1,[n,t]),fe=u!=null,Pe=!!l,oe=Pe?1:0,Xe=oe+M.length,ht=Xe+(ne?1:0),At=ht+(fe?1:0),zt=Gde(At,f),Vt=b.useCallback(()=>G.current,[]),gt=b.useCallback(re=>{if(Pe&&re===i4)return"slot:header";if(ne&&re===Xe)return n?`slot:approval:${n.id}`:"slot:approval";if(fe&&re===ht)return`slot:tail:${d}`;const ae=M[re-oe];return ae?eT(ae):`slot:row:${re}`},[Pe,ne,Xe,n,fe,ht,d,M,oe]),Le=b.useCallback((re="auto")=>{const ae=Vt();if(!ae||ae.scrollHeight<=ae.clientHeight)return;J.current+=1;const pe=J.current;W.current=!0,re==="smooth"?ae.scrollTo({top:ae.scrollHeight,behavior:re}):ae.scrollTop=ae.scrollHeight,H.current=Math.max(0,ae.scrollHeight-ae.clientHeight);const wt=()=>{J.current===pe&&(W.current=!1)};re==="smooth"?setTimeout(wt,350):requestAnimationFrame(wt)},[Vt]),qt=b.useCallback((re="smooth")=>{$(!0),Le(re)},[Le,$]),tn=rH({count:At,enabled:zt,getScrollElement:Vt,getItemKey:gt,estimateSize:re=>{if(Pe&&re===i4)return Hde;if(ne&&re===Xe)return Vde;if(fe&&re===ht)return Wde;const ae=M[re-oe];return(ae==null?void 0:ae.type)==="turn_collapse"?Fde:(ae==null?void 0:ae.type)==="turn_content"?Math.max(a4,ae.items.length*a4):a4},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Mt=tn.getVirtualItems(),Kt=tn.getTotalSize(),[$t,gn]=b.useState(null);b.useEffect(()=>{if(!$t)return;const re=setTimeout(()=>gn(null),1600);return()=>clearTimeout(re)},[$t]);const Xt=b.useCallback(re=>{var wt,Je;$(!1),J.current+=1;const ae=J.current;W.current=!0,zt?tn.scrollToIndex(re,{align:"center"}):(Je=(wt=G.current)==null?void 0:wt.querySelector(`[data-index="${re}"]`))==null||Je.scrollIntoView({block:"center"}),setTimeout(()=>{J.current===ae&&(W.current=!1)},150);const pe=gt(re);gn(null),requestAnimationFrame(()=>gn(pe))},[zt,tn,gt,$]),Be=b.useRef(null),Qe=b.useCallback((re,ae)=>{const pe=Qp(M,re,ae);if(pe>=0){const _t=M[pe];return(_t==null?void 0:_t.type)==="turn_content"&&_t.collapsed?(Be.current={messageId:re,callId:ae},P(fn=>{if(fn.get(_t.turnId)===!0)return fn;const Vn=new Map(fn);return Vn.set(_t.turnId,!0),Vn}),!0):(Be.current=null,Xt(pe+oe),!0)}const wt=Qp(T,re,ae);if(wt<0)return!1;const Je=Pde(T,wt);return Je?(Be.current={messageId:re,callId:ae},P(_t=>{if(_t.get(Je)===!0)return _t;const fn=new Map(_t);return fn.set(Je,!0),fn}),!0):!1},[M,T,oe,Xt]);b.useImperativeHandle(x,()=>({scrollToMessage:Qe,scrollToBottom:qt}),[Qe,qt]),b.useEffect(()=>{const re=Be.current;if(!re)return;const ae=Qp(M,re.messageId,re.callId);ae<0||(Be.current=null,Xt(ae+oe))},[M,oe,Xt]);const st=b.useCallback(()=>{const re=Vt();if(!re)return;if(W.current){H.current=re.scrollTop;return}const ae=H.current,pe=re.scrollTop;H.current=pe;const wt=re.scrollHeight-pe-re.clientHeight;pe<ae-1&&$(!1),wt<30&&$(!0)},[Vt,$]);b.useEffect(()=>{const re=Vt();if(re)return re.addEventListener("scroll",st,{passive:!0}),()=>re.removeEventListener("scroll",st)},[Vt,st]),b.useEffect(()=>{t.length===0&&($(!0),Be.current=null,P(re=>re.size?new Map:re))},[t.length,$]),b.useEffect(()=>{const re=G.current;if(!re)return;const ae=new ResizeObserver(()=>{L.current||D.current&&requestAnimationFrame(()=>{!L.current&&D.current&&Le()})});return ae.observe(re),()=>ae.disconnect()},[Le]),b.useEffect(()=>{const re=Y7(t);if(i){Z.current=re;return}re&&re!==Z.current&&($(!0),Be.current=null),Z.current=re},[t,i,$]),b.useEffect(()=>{Q.current&&!i&&($(!0),requestAnimationFrame(()=>Le())),Q.current=i},[i,Le,$]),b.useEffect(()=>{p&&fe&&!R.current&&($(!0),requestAnimationFrame(()=>{D.current&&Le()})),R.current=fe},[p,fe,Le,$]);const te=b.useCallback(re=>{const ae=(Je,_t)=>Je.type==="parallel_agents"?h.jsx(G2,{timestamp:Je.timestamp,children:h.jsx(Bue,{agents:Je.agents,pendingApproval:n,onConfirm:r})}):Je.type==="turn_collapse"?h.jsx(Jde,{turnCollapse:Je.turnCollapse,onToggleCollapse:I}):Je.type==="turn_content"?h.jsx(Zde,{collapsed:Je.collapsed,children:Je.items.map(fn=>h.jsx("div",{className:nT(fn),children:ae(fn,!1)},eT(fn)))}):h.jsx(hue,{message:Je.message,pendingApproval:n,onConfirm:r,onShowContextDetail:s,workspaceCwd:c,isLatest:_t,showRetryHint:y,onRetryClick:w,onBranchSession:v,showAssistantActions:Je.message.role==="assistant"&&Je.message.id===C,showAssistantBranch:Je.message.role==="assistant"&&Je.message.id===C,shellOutputMaxLines:m});if(Pe&&re===i4)return l;if(ne&&re===Xe)return n&&K7(n)?h.jsx(xj,{request:n,onConfirm:r}):n?h.jsx(jl,{request:n,onConfirm:r}):null;if(fe&&re===ht)return u;const pe=re-oe,wt=M[pe];return wt?ae(wt,pe===M.length-1):null},[Pe,l,fe,u,ht,ne,Xe,n,r,s,oe,M,C,c,y,w,v,m,I]),ue=b.useCallback((re,ae)=>Sj($t===re?Kl.rowFlash:void 0,ae?nT(ae):void 0),[$t]);return b.useLayoutEffect(()=>{if(!i&&!W.current&&D.current){const re=Y7(t),ae=re!==null&&re!==Z.current;Le(ae?"smooth":"auto")}},[Kt,t,At,i,Le]),h.jsx("div",{ref:G,className:Kl.list,children:zt?h.jsx("div",{style:{height:Kt,width:"100%",position:"relative"},children:Mt.map(re=>h.jsx("div",{"data-index":re.index,ref:tn.measureElement,className:ue(String(re.key),M[re.index-oe]),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${re.start}px)`},children:te(re.index)},re.key))}):Array.from({length:At},(re,ae)=>{const pe=gt(ae),wt=M[ae-oe];return h.jsx("div",{"data-index":ae,className:ue(pe,wt),children:te(ae)},pe)})})});/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function the(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 nhe(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||!the(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 Fx=[],Tj=[];(()=>{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?Tj:Fx).push(n=n+e[t])})();function rhe(e){if(e<768)return!1;for(let t=0,n=Fx.length;;){let r=t+n>>1;if(e<Fx[r])n=r;else if(e>=Tj[r])t=r+1;else return!0;if(t==n)return!1}}function rT(e){return e>=127462&&e<=127487}const sT=8205;function she(e,t,n=!0,r=!0){return(n?Cj:ihe)(e,t,r)}function Cj(e,t,n){if(t==e.length)return t;t&&Aj(e.charCodeAt(t))&&Ej(e.charCodeAt(t-1))&&t--;let r=l4(e,t);for(t+=iT(r);t<e.length;){let s=l4(e,t);if(r==sT||s==sT||n&&rhe(s))t+=iT(s),r=s;else if(rT(s)){let i=0,a=t-2;for(;a>=0&&rT(l4(e,a));)i++,a-=2;if(i%2==0)break;t+=2}else break}return t}function ihe(e,t,n){for(;t>0;){let r=Cj(e,t-2,n);if(r<t)return r;t--}return 0}function l4(e,t){let n=e.charCodeAt(t);if(!Ej(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Aj(r)?(n-55296<<10)+(r-56320)+65536:n}function Aj(e){return e>=56320&&e<57344}function Ej(e){return e>=55296&&e<56320}function iT(e){return e<65536?1:2}class en{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]=nh(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),Ra.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]=nh(this,t,n);let r=[];return this.decompose(t,n,r,0),Ra.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 Wf(this),i=new Wf(t);for(let a=n,o=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(o+=s.value.length,s.done||o>=r)return!0}}iter(t=1){return new Wf(this,t)}iterRange(t,n=this.length){return new Mj(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 Nj(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]?en.empty:t.length<=32?new ur(t):Ra.from(ur.split(t,[]))}}class ur extends en{constructor(t,n=ahe(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 a=this.text[i],o=s+a.length;if((n?r:o)>=t)return new ohe(s,o,r,a);s=o+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new ur(aT(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let a=r.pop(),o=Jp(i.text,a.text.slice(),0,i.length);if(o.length<=32)r.push(new ur(o,a.length+i.length));else{let l=o.length>>1;r.push(new ur(o.slice(0,l)),new ur(o.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof ur))return super.replace(t,n,r);[t,n]=nh(this,t,n);let s=Jp(this.text,Jp(r.text,aT(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new ur(s,i):Ra.from(ur.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=nh(this,t,n);let s="";for(let i=0,a=0;i<=n&&a<this.text.length;a++){let o=this.text[a],l=i+o.length;i>t&&a&&(s+=r),t<l&&n>i&&(s+=o.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 ur(r,s)),r=[],s=-1);return s>-1&&n.push(new ur(r,s)),n}}class Ra extends en{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 a=this.children[i],o=s+a.length,l=r+a.lines-1;if((n?l:o)>=t)return a.lineInner(t,n,r,s);s=o+1,r=l+1}}decompose(t,n,r,s){for(let i=0,a=0;a<=n&&i<this.children.length;i++){let o=this.children[i],l=a+o.length;if(t<=l&&n>=a){let c=s&((a<=t?1:0)|(l>=n?2:0));a>=t&&l<=n&&!c?r.push(o):o.decompose(t-a,n-a,r,c)}a=l+1}}replace(t,n,r){if([t,n]=nh(this,t,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let a=this.children[s],o=i+a.length;if(t>=i&&n<=o){let l=a.replace(t-i,n-i,r),c=this.lines-a.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new Ra(u,this.length-(n-t)+r.length)}return super.replace(i,o,l)}i=o+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
`){[t,n]=nh(this,t,n);let s="";for(let i=0,a=0;i<this.children.length&&a<=n;i++){let o=this.children[i],l=a+o.length;a>t&&i&&(s+=r),t<l&&n>a&&(s+=o.sliceString(t-a,n-a,r)),a=l+1}return s}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Ra))return 0;let r=0,[s,i,a,o]=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==a||i==o)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 ur(m,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,o=[],l=0,c=-1,u=[];function d(m){let p;if(m.lines>i&&m instanceof Ra)for(let y of m.children)d(y);else m.lines>a&&(l>a||!l)?(f(),o.push(m)):m instanceof ur&&l&&(p=u[u.length-1])instanceof ur&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new ur(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&&(o.push(u.length==1?u[0]:Ra.from(u,c)),c=-1,l=u.length=0)}for(let m of t)d(m);return f(),o.length==1?o[0]:new Ra(o,n)}}en.empty=new ur([""],0);function ahe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Jp(e,t,n=0,r=1e9){for(let s=0,i=0,a=!0;i<e.length&&s<=r;i++){let o=e[i],l=s+o.length;l>=n&&(l>r&&(o=o.slice(0,r-s)),s<n&&(o=o.slice(n-s)),a?(t[t.length-1]+=o,a=!1):t.push(o)),s=l+1}return t}function aT(e,t,n){return Jp(e,[""],t,n)}class Wf{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 ur?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],a=i>>1,o=s instanceof ur?s.text.length:s.children.length;if(a==(n>0?o: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 ur){let l=s.text[a+(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[a+(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 ur?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 Mj{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new Wf(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 Nj{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"&&(en.prototype[Symbol.iterator]=function(){return this.iter()},Wf.prototype[Symbol.iterator]=Mj.prototype[Symbol.iterator]=Nj.prototype[Symbol.iterator]=function(){return this});class ohe{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 nh(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function hs(e,t,n=!0,r=!0){return she(e,t,n,r)}function lhe(e){return e>=56320&&e<57344}function che(e){return e>=55296&&e<56320}function bl(e,t){let n=e.charCodeAt(t);if(!che(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return lhe(r)?(n-55296<<10)+(r-56320)+65536:n}function uhe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function nd(e){return e<65536?1:2}const Vx=/\r\n?|\n/;var ui=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(ui||(ui={}));class Fa{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++],a=this.sections[n++];a<0?(t(r,s,i),s+=i):s+=a,r+=i}}iterChangedRanges(t,n=!1){Wx(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 Fa(t)}composeDesc(t){return this.empty?t:t.empty?this:Ij(this,t)}mapDesc(t,n=!1){return t.empty?this:Gx(this,t,n)}mapPos(t,n=-1,r=ui.Simple){let s=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],l=this.sections[a++],c=s+o;if(l<0){if(c>t)return i+(t-s);i+=o}else{if(r!=ui.Simple&&c>=t&&(r==ui.TrackDel&&s<t&&c>t||r==ui.TrackBefore&&s<t||r==ui.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!o)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++],a=this.sections[r++],o=s+i;if(a>=0&&s<=n&&o>=t)return s<t&&o>n?"cover":!0;s=o}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 Fa(t)}static create(t){return new Fa(t)}}class jr extends Fa{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 Wx(this,(n,r,s,i,a)=>t=t.replace(s,s+(r-n),a),!1),t}mapDesc(t,n=!1){return Gx(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let a=n[s],o=n[s+1];if(o>=0){n[s]=o,n[s+1]=a;let l=s>>1;for(;r.length<l;)r.push(en.empty);r.push(a?t.slice(i,i+a):en.empty)}i+=a}return new jr(n,r)}compose(t){return this.empty?t:t.empty?this:Ij(this,t,!0)}map(t,n=!1){return t.empty?this:Gx(this,t,n,!0)}iterChanges(t,n=!1){Wx(this,t,n)}get desc(){return Fa.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new S0(this);e:for(let a=0,o=0;;){let l=a==t.length?1e9:t[a++];for(;o<l||o==l&&i.len==0;){if(i.done)break e;let u=Math.min(i.len,l-o);ls(s,u,-1);let d=i.ins==-1?-1:i.off==0?i.ins:0;ls(n,u,d),d>0&&Dl(r,n,i.text),i.forward(u),o+=u}let c=t[a++];for(;o<c;){if(i.done)break e;let u=Math.min(i.len,c-o);ls(n,u,-1),ls(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),o+=u}}return{changes:new jr(n,r),filtered:Fa.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=[],a=0,o=null;function l(u=!1){if(!u&&!s.length)return;a<n&&ls(s,n-a,-1);let d=new jr(s,i);o=o?o.compose(d.map(o)):d,s=[],i=[],a=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof jr){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),o=o?o.compose(u.map(o)):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"?en.of(m.split(r||Vx)):m:en.empty,y=p.length;if(d==f&&y==0)return;d<a&&l(),d>a&&ls(s,d-a,-1),ls(s,f-d,y),Dl(i,s,p),a=f}}return c(t),l(!o),o}static empty(t){return new jr(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((a,o)=>o&&typeof a!="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(en.empty);r[s]=en.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new jr(n,r)}static createSet(t,n){return new jr(t,n)}}function ls(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 Dl(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(en.empty);e.push(n)}}function Wx(e,t,n){let r=e.inserted;for(let s=0,i=0,a=0;a<e.sections.length;){let o=e.sections[a++],l=e.sections[a++];if(l<0)s+=o,i+=o;else{let c=s,u=i,d=en.empty;for(;c+=o,u+=l,l&&r&&(d=d.append(r[a-2>>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)o=e.sections[a++],l=e.sections[a++];t(s,c,i,u,d),s=c,i=u}}}function Gx(e,t,n,r=!1){let s=[],i=r?[]:null,a=new S0(e),o=new S0(t);for(let l=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let c=Math.min(a.len,o.len);ls(s,c,-1),a.forward(c),o.forward(c)}else if(o.ins>=0&&(a.ins<0||l==a.i||a.off==0&&(o.len<a.len||o.len==a.len&&!n))){let c=o.len;for(ls(s,o.ins,-1);c;){let u=Math.min(a.len,c);a.ins>=0&&l<a.i&&a.len<=u&&(ls(s,0,a.ins),i&&Dl(i,s,a.text),l=a.i),a.forward(u),c-=u}o.next()}else if(a.ins>=0){let c=0,u=a.len;for(;u;)if(o.ins==-1){let d=Math.min(u,o.len);c+=d,u-=d,o.forward(d)}else if(o.ins==0&&o.len<u)u-=o.len,o.next();else break;ls(s,c,l<a.i?a.ins:0),i&&l<a.i&&Dl(i,s,a.text),l=a.i,a.forward(a.len-u)}else{if(a.done&&o.done)return i?jr.createSet(s,i):Fa.create(s);throw new Error("Mismatched change set lengths")}}}function Ij(e,t,n=!1){let r=[],s=n?[]:null,i=new S0(e),a=new S0(t);for(let o=!1;;){if(i.done&&a.done)return s?jr.createSet(r,s):Fa.create(r);if(i.ins==0)ls(r,i.len,0,o),i.next();else if(a.len==0&&!a.done)ls(r,0,a.ins,o),s&&Dl(s,r,a.text),a.next();else{if(i.done||a.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,a.len),c=r.length;if(i.ins==-1){let u=a.ins==-1?-1:a.off?0:a.ins;ls(r,l,u,o),s&&u&&Dl(s,r,a.text)}else a.ins==-1?(ls(r,i.off?0:i.len,l,o),s&&Dl(s,r,i.textBit(l))):(ls(r,i.off?0:i.len,a.off?0:a.ins,o),s&&!a.off&&Dl(s,r,a.text));o=(i.ins>l||a.ins>=0&&a.len>l)&&(o||r.length>c),i.forward2(l),a.forward(l)}}}}class S0{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?en.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?en.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 eu{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 eu(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return ke.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return ke.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 ke.range(t.anchor,t.head)}static create(t,n,r){return new eu(t,n,r)}}class ke{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:ke.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 ke([this.main],0)}addRange(t,n=!0){return ke.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,ke.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 ke(t.ranges.map(n=>eu.fromJSON(n)),t.main)}static single(t,n=t){return new ke([ke.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 ke.normalized(t.slice(),n);r=i.to}return new ke(t,n)}static cursor(t,n=0,r,s){return eu.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 a=(r??16777215)<<6|(s==null?7:Math.min(6,s));return!i&&t!=n&&(i=n<t?1:-1),n<t?eu.create(n,t,48|a):eu.create(t,n,(i?i<0?8:16:0)|a)}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],a=t[s-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,l=Math.max(i.to,a.to);s<=n&&n--,t.splice(--s,2,i.anchor>i.head?ke.range(l,o):ke.range(o,l))}}return new ke(t,n)}}function Rj(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let o5=0;class ct{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=o5++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new ct(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:l5),!!t.static,t.enables)}of(t){return new Zp([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zp(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zp(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function l5(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class Zp{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=o5++}dynamicSlot(t){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=t[i]>>1,o=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[a]=r(d),1},update(d,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Kx(d,u)){let m=r(d);if(o?!oT(m,d.values[a],s):!s(m,d.values[a]))return d.values[a]=m,1}return 0},reconfigure:(d,f)=>{let m,p=f.config.address[i];if(p!=null){let y=p1(f,p);if(this.dependencies.every(w=>w instanceof ct?f.facet(w)===d.facet(w):w instanceof Za?f.field(w,!1)==d.field(w,!1):!0)||(o?oT(m=r(d),y,s):s(m=r(d),y)))return d.values[a]=y,0}else m=r(d);return d.values[a]=m,1}}}}function oT(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 Kx(e,t){let n=!1;for(let r of t)Gf(e,r)&1&&(n=!0);return n}function dhe(e,t,n){let r=n.map(l=>e[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),a=e[t.id]>>1;function o(l){let c=[];for(let u=0;u<r.length;u++){let d=p1(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)Gf(l,c);return l.values[a]=o(l),1},update(l,c){if(!Kx(l,i))return 0;let u=o(l);return t.compare(u,l.values[a])?0:(l.values[a]=u,1)},reconfigure(l,c){let u=Kx(l,r),d=c.config.facets[t.id],f=c.facet(t);if(d&&!u&&l5(n,d))return l.values[a]=f,0;let m=o(l);return t.compare(m,f)?(l.values[a]=f,0):(l.values[a]=m,1)}}}const ap=ct.define({static:!0});class Za{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 Za(o5++,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(ap).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],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(ap),a=s.facet(ap),o;return(o=i.find(l=>l.field==this))&&o!=a.find(l=>l.field==this)?(r.values[n]=o.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,ap.of({field:this,create:t})]}get extension(){return this}}const Yc={lowest:4,low:3,default:2,high:1,highest:0};function sf(e){return t=>new jj(t,e)}const Bu={highest:sf(Yc.highest),high:sf(Yc.high),default:sf(Yc.default),low:sf(Yc.low),lowest:sf(Yc.lowest)};class jj{constructor(t,n){this.inner=t,this.prec=n}}class zu{of(t){return new Yx(this,t)}reconfigure(t){return zu.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Yx{constructor(t,n){this.compartment=t,this.inner=n}}class m1{constructor(t,n,r,s,i,a){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,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),a=new Map;for(let f of hhe(t,n,a))f instanceof Za?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let o=Object.create(null),l=[],c=[];for(let f of s)o[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(o[p.id]=l.length<<1|1,l5(y,m))l.push(r.facet(p));else{let w=p.combine(m.map(v=>v.value));l.push(r&&p.compare(w,r.facet(p))?r.facet(p):w)}else{for(let w of m)w.type==0?(o[w.id]=l.length<<1|1,l.push(w.value)):(o[w.id]=c.length<<1,c.push(v=>w.dynamicSlot(v)));o[p.id]=c.length<<1,c.push(w=>dhe(w,p,m))}}let d=c.map(f=>f(o));return new m1(t,a,d,o,l,i)}}function hhe(e,t,n){let r=[[],[],[],[],[]],s=new Map;function i(a,o){let l=s.get(a);if(l!=null){if(l<=o)return;let c=r[l].indexOf(a);c>-1&&r[l].splice(c,1),a instanceof Yx&&n.delete(a.compartment)}if(s.set(a,o),Array.isArray(a))for(let c of a)i(c,o);else if(a instanceof Yx){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(a.compartment)||a.inner;n.set(a.compartment,c),i(c,o)}else if(a instanceof jj)i(a.inner,a.prec);else if(a instanceof Za)r[o].push(a),a.provides&&i(a.provides,o);else if(a instanceof Zp)r[o].push(a),a.facet.extensions&&i(a.facet.extensions,Yc.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,o)}}return i(e,Yc.default),r.reduce((a,o)=>a.concat(o))}function Gf(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 p1(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const Dj=ct.define(),Xx=ct.define({combine:e=>e.some(t=>t),static:!0}),Oj=ct.define({combine:e=>e.length?e[0]:void 0,static:!0}),Lj=ct.define(),Bj=ct.define(),zj=ct.define(),$j=ct.define({combine:e=>e.length?e[0]:!1});class Yo{constructor(t,n){this.type=t,this.value=n}static define(){return new fhe}}class fhe{of(t){return new Yo(this,t)}}class mhe{constructor(t){this.map=t}of(t){return new Cn(this,t)}}class Cn{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 Cn(this.type,n)}is(t){return this.type==t}static define(t={}){return new mhe(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}}Cn.reconfigure=Cn.define();Cn.appendConfig=Cn.define();class Or{constructor(t,n,r,s,i,a){this.startState=t,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&Rj(r,n.newLength),i.some(o=>o.type==Or.time)||(this.annotations=i.concat(Or.time.of(Date.now())))}static create(t,n,r,s,i,a){return new Or(t,n,r,s,i,a)}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(Or.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Or.time=Yo.define();Or.userEvent=Yo.define();Or.addToHistory=Yo.define();Or.remote=Yo.define();function phe(e,t){let n=[];for(let r=0,s=0;;){let i,a;if(r<e.length&&(s==t.length||t[s]>=e[r]))i=e[r++],a=e[r++];else if(s<t.length)i=t[s++],a=t[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,a):n[n.length-1]<a&&(n[n.length-1]=a)}}function Pj(e,t,n){var r;let s,i,a;return n?(s=t.changes,i=jr.empty(t.changes.length),a=e.changes.compose(t.changes)):(s=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(s)),{changes:a,selection:t.selection?t.selection.map(i):(r=e.selection)===null||r===void 0?void 0:r.map(s),effects:Cn.mapEffects(e.effects,s).concat(Cn.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Qx(e,t,n){let r=t.selection,s=Id(t.annotations);return t.userEvent&&(s=s.concat(Or.userEvent.of(t.userEvent))),{changes:t.changes instanceof jr?t.changes:jr.of(t.changes||[],n,e.facet(Oj)),selection:r&&(r instanceof ke?r:ke.single(r.anchor,r.head)),effects:Id(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function qj(e,t,n){let r=Qx(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 a=!!t[i].sequential;r=Pj(r,Qx(e,t[i],a?r.changes.newLength:e.doc.length),a)}let s=Or.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return yhe(n?ghe(s):s)}function ghe(e){let t=e.startState,n=!0;for(let s of t.facet(Lj)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:phe(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=jr.empty(t.doc.length);else{let a=e.changes.filter(n);s=a.changes,i=a.filtered.mapDesc(a.changes).invertedDesc}e=Or.create(t,s,e.selection&&e.selection.map(i),Cn.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Bj);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof Or?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Or?e=i[0]:e=qj(t,Id(i),!1)}return e}function yhe(e){let t=e.startState,n=t.facet(zj),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=Pj(r,Qx(t,i,e.changes.newLength),!0))}return r==e?e:Or.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const bhe=[];function Id(e){return e==null?bhe:Array.isArray(e)?e:[e]}var Mo=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Mo||(Mo={}));const vhe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Jx;try{Jx=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function xhe(e){if(Jx)return Jx.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||vhe.test(n)))return!0}return!1}function whe(e){return t=>{if(!/\S/.test(t))return Mo.Space;if(xhe(t))return Mo.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Mo.Word;return Mo.Other}}class pn{constructor(t,n,r,s,i,a){this.config=t,this.doc=n,this.selection=r,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Gf(this,o<<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 Gf(this,r),p1(this,r)}update(...t){return qj(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let o of t.effects)o.is(zu.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,c)=>s.set(c,l)),n=null),s.set(o.value.compartment,o.value.extension)):o.is(Cn.reconfigure)?(n=null,r=o.value):o.is(Cn.appendConfig)&&(n=null,r=Id(r).concat(o.value));let i;n?i=t.startState.values.slice():(n=m1.resolve(r,s,this),i=new pn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let a=t.startState.facet(Xx)?t.newSelection:t.newSelection.asSingle();new pn(n,t.newDoc,a,i,(o,l)=>l.update(o,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:ke.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=Id(r.effects);for(let o=1;o<n.ranges.length;o++){let l=t(n.ranges[o]),c=this.changes(l.changes),u=c.map(s);for(let f=0;f<o;f++)i[f]=i[f].map(u);let d=s.mapDesc(c,!0);i.push(l.range.map(d)),s=s.compose(u),a=Cn.mapEffects(a,u).concat(Cn.mapEffects(Id(l.effects),d))}return{changes:s,selection:ke.create(i,n.mainIndex),effects:a}}changes(t=[]){return t instanceof jr?t:jr.of(t,this.doc.length,this.facet(pn.lineSeparator))}toText(t){return en.of(t.split(this.facet(pn.lineSeparator)||Vx))}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:(Gf(this,n),p1(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 Za&&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 a=r[i],o=t[i];s.push(a.init(l=>a.spec.fromJSON(o,l)))}}return pn.create({doc:t.doc,selection:ke.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=m1.resolve(t.extensions||[],new Map),r=t.doc instanceof en?t.doc:en.of((t.doc||"").split(n.staticFacet(pn.lineSeparator)||Vx)),s=t.selection?t.selection instanceof ke?t.selection:ke.single(t.selection.anchor,t.selection.head):ke.single(0);return Rj(s,r.length),n.staticFacet(Xx)||(s=s.asSingle()),new pn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(pn.tabSize)}get lineBreak(){return this.facet(pn.lineSeparator)||`
`}get readOnly(){return this.facet($j)}phrase(t,...n){for(let r of this.facet(pn.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(Dj))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,t)&&s.push(a[t]);return s}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return whe(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:s}=this.doc.lineAt(t),i=this.charCategorizer(t),a=t-r,o=t-r;for(;a>0;){let l=hs(n,a,!1);if(i(n.slice(l,a))!=Mo.Word)break;a=l}for(;o<s;){let l=hs(n,o);if(i(n.slice(o,l))!=Mo.Word)break;o=l}return a==o?null:ke.range(a+r,o+r)}}pn.allowMultipleSelections=Xx;pn.tabSize=ct.define({combine:e=>e.length?e[0]:4});pn.lineSeparator=Oj;pn.readOnly=$j;pn.phrases=ct.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])}});pn.languageData=Dj;pn.changeFilter=Lj;pn.transactionFilter=Bj;pn.transactionExtender=zj;zu.reconfigure=Cn.define();function Ey(e,t,n={}){let r={};for(let s of e)for(let i of Object.keys(s)){let a=s[i],o=r[i];if(o===void 0)r[i]=a;else if(!(o===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](o,a);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 ic{eq(t){return this==t}range(t,n=t){return Zx.create(t,n,this)}}ic.prototype.startSide=ic.prototype.endSide=0;ic.prototype.point=!1;ic.prototype.mapMode=ui.TrackDel;function c5(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let Zx=class Uj{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new Uj(t,n,r)}};function ew(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class u5{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 a=s,o=i.length;;){if(a==o)return a;let l=a+o>>1,c=i[l]-t||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==a)return c>=0?a:o;c>=0?o=l:a=l+1}}between(t,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);i<a;i++)if(s(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let r=[],s=[],i=[],a=-1,o=-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||(a<0&&(a=f),c.point&&(o=Math.max(o,m-f)),r.push(c),s.push(f-a),i.push(m-a))}return{mapped:r.length?new u5(s,i,r,o):null,pos:a}}}class xn{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 xn(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,a=t.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(ew)),this.isEmpty)return n.length?xn.of(n):this;let o=new Hj(this,null,-1).goto(0),l=0,c=[],u=new xu;for(;o.value||l<n.length;)if(l<n.length&&(o.from-n[l].from||o.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else o.rangeIndex==1&&o.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(o.chunkIndex)<n[l].from)&&(!a||s>this.chunkEnd(o.chunkIndex)||i<this.chunkPos[o.chunkIndex])&&u.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!a||s>o.to||i<o.from||a(o.from,o.to,o.value))&&(u.addInner(o.from,o.to,o.value)||c.push(Zx.create(o.from,o.to,o.value))),o.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?xn.empty:this.nextLayer.update({add:c,filter:a,filterFrom:s,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let a=0;a<this.chunk.length;a++){let o=this.chunkPos[a],l=this.chunk[a],c=t.touchesRange(o,o+l.length);if(c===!1)s=Math.max(s,l.maxPoint),n.push(l),r.push(t.mapPos(o));else if(c===!0){let{mapped:u,pos:d}=l.map(o,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 xn(r,n,i||xn.empty,s)}between(t,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],a=this.chunk[s];if(n>=i&&t<=i+a.length&&a.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return T0.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return T0.from(t).goto(n)}static compare(t,n,r,s,i=-1){let a=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),o=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),l=lT(a,o,r),c=new af(a,l,i),u=new af(o,l,i);r.iterGaps((d,f,m)=>cT(c,d,u,f,m,s)),r.empty&&r.length==0&&cT(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),a=n.filter(u=>!u.isEmpty&&t.indexOf(u)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=lT(i,a),l=new af(i,o,0).goto(r),c=new af(a,o,0).goto(r);for(;;){if(l.to!=c.to||!tw(l.active,c.active)||l.point&&(!c.point||!c5(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 a=new af(t,null,i).goto(n),o=n,l=a.openStart;for(;;){let c=Math.min(a.to,r);if(a.point){let u=a.activeForPoint(a.to),d=a.pointFrom<n?u.length+1:a.point.startSide<0?u.length:Math.min(u.length,l);s.point(o,c,a.point,u,d,a.pointRank),l=Math.min(a.openEnd(c),u.length)}else c>o&&(s.span(o,c,a.active,l),l=a.openEnd(c));if(a.to>r)return l+(a.point&&a.to>r?1:0);o=a.to,a.next()}}static of(t,n=!1){let r=new xu;for(let s of t instanceof Zx?[t]:n?_he(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return xn.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=xn.empty;s=s.nextLayer)n=new xn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}xn.empty=new xn([],[],null,-1);function _he(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(ew(t,r)>0)return e.slice().sort(ew);t=r}return e}xn.empty.nextLayer=xn.empty;class xu{finishChunk(t){this.chunks.push(new u5(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 xu)).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(xn.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=xn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function lT(e,t,n){let r=new Map;for(let i of e)for(let a=0;a<i.chunk.length;a++)i.chunk[a].maxPoint<=0&&r.set(i.chunk[a],i.chunkPos[a]);let s=new Set;for(let i of t)for(let a=0;a<i.chunk.length;a++){let o=r.get(i.chunk[a]);o!=null&&(n?n.mapPos(o):o)==i.chunkPos[a]&&!(n!=null&&n.touchesRange(o,o+i.chunk[a].length))&&s.add(i.chunk[a])}return s}class Hj{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 T0{constructor(t){this.heap=t}static from(t,n=null,r=-1){let s=[];for(let i=0;i<t.length;i++)for(let a=t[i];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&s.push(new Hj(a,n,r,i));return s.length==1?s[0]:new T0(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--)c4(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--)c4(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(),c4(this.heap,0)}}}function c4(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 af{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=T0.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){op(this.active,t),op(this.activeTo,t),op(this.activeRank,t),this.minActive=uT(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++;lp(this.active,n,r),lp(this.activeTo,n,s),lp(this.activeRank,n,i),t&&lp(t,n,this.cursor.from),this.minActive=uT(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&&op(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 cT(e,t,n,r,s,i){e.goto(t),n.goto(r);let a=r+s,o=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,a);if(e.point||n.point?(e.point&&n.point&&c5(e.point,n.point)&&tw(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(o,p,e.point,n.point),u=!1):(u&&i.boundChange(o),p>o&&!tw(e.active,n.active)&&i.compareRange(o,p,e.active,n.active),c&&p<a&&(d||e.openEnd(m)!=n.openEnd(m))&&(u=!0)),m>a)break;o=m,f<=0&&e.next(),f>=0&&n.next()}}function tw(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!c5(e[n],t[n]))return!1;return!0}function op(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function lp(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function uT(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 am(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=hs(e,s));return r}function khe(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=hs(e,s)}return e.length}const nw="ͼ",dT=typeof Symbol>"u"?"__"+nw:Symbol.for(nw),rw=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),hT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ac{constructor(t,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,o,l,c){let u=[],d=/^@(\w+)\b/.exec(a[0]),f=d&&d[1]=="keyframes";if(d&&o==null)return l.push(a[0]+";");for(let m in o){let p=o[m];if(/&/.test(m))i(m.split(/,\s*/).map(y=>a.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?a.map(r):a).join(", ")+" {"+u.join(" ")+"}")}for(let a in t)i(s(a),t[a],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=hT[dT]||1;return hT[dT]=t+1,nw+t.toString(36)}static mount(t,n,r){let s=t[rw],i=r&&r.nonce;s?i&&s.setNonce(i):s=new She(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let fT=new Map;class She{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=fT.get(r);if(i)return t[rw]=i;this.sheet=new s.CSSStyleSheet,fT.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[rw]=this}mount(t,n){let r=this.sheet,s=0,i=0;for(let a=0;a<t.length;a++){let o=t[a],l=this.modules.indexOf(o);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,o),r)for(let c=0;c<o.rules.length;c++)r.insertRule(o.rules[c],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=o.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
`;this.styleTag.textContent=a;let o=n.head||n;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var oc={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:"'"},C0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},The=typeof navigator<"u"&&/Mac/.test(navigator.platform),Che=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Jr=0;Jr<10;Jr++)oc[48+Jr]=oc[96+Jr]=String(Jr);for(var Jr=1;Jr<=24;Jr++)oc[Jr+111]="F"+Jr;for(var Jr=65;Jr<=90;Jr++)oc[Jr]=String.fromCharCode(Jr+32),C0[Jr]=String.fromCharCode(Jr);for(var u4 in oc)C0.hasOwnProperty(u4)||(C0[u4]=oc[u4]);function Ahe(e){var t=The&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Che&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?C0:oc)[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:""},sw=typeof document<"u"?document:{documentElement:{style:{}}};const iw=/Edge\/(\d+)/.exec(ws.userAgent),Fj=/MSIE \d/.test(ws.userAgent),aw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ws.userAgent),My=!!(Fj||aw||iw),mT=!My&&/gecko\/(\d+)/i.test(ws.userAgent),d4=!My&&/Chrome\/(\d+)/.exec(ws.userAgent),pT="webkitFontSmoothing"in sw.documentElement.style,ow=!My&&/Apple Computer/.test(ws.vendor),gT=ow&&(/Mobile\/\w+/.test(ws.userAgent)||ws.maxTouchPoints>2);var Ve={mac:gT||/Mac/.test(ws.platform),windows:/Win/.test(ws.platform),linux:/Linux|X11/.test(ws.platform),ie:My,ie_version:Fj?sw.documentMode||6:aw?+aw[1]:iw?+iw[1]:0,gecko:mT,gecko_version:mT?+(/Firefox\/(\d+)/.exec(ws.userAgent)||[0,0])[1]:0,chrome:!!d4,chrome_version:d4?+d4[1]:0,ios:gT,android:/Android\b/.test(ws.userAgent),webkit:pT,webkit_version:pT?+(/\bAppleWebKit\/(\d+)/.exec(ws.userAgent)||[0,0])[1]:0,safari:ow,safari_version:ow?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ws.userAgent)||[0,0])[1]:0,tabSize:sw.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function d5(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 g1=Object.create(null);function h5(e,t,n){if(e==t)return!0;e||(e=g1),t||(t=g1);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 Ehe(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 yT(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 Mhe(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 eo{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 As=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(As||(As={}));class Gt extends ic{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 om(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 wu(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:a}=Vj(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new wu(t,r,s,n,t.widget||null,!0)}static line(t){return new lm(t)}static set(t,n=!1){return xn.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Gt.none=xn.empty;class om extends Gt{constructor(t){let{start:n,end:r}=Vj(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?d5(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||g1}eq(t){return this==t||t instanceof om&&this.tagName==t.tagName&&h5(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)}}om.prototype.point=!1;class lm extends Gt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof lm&&this.spec.class==t.spec.class&&h5(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)}}lm.prototype.mapMode=ui.TrackBefore;lm.prototype.point=!0;class wu extends Gt{constructor(t,n,r,s,i,a){super(n,r,i,t),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?ui.TrackBefore:ui.TrackAfter:ui.TrackDel}get type(){return this.startSide!=this.endSide?As.WidgetRange:this.startSide<=0?As.WidgetBefore:As.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof wu&&Nhe(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)}}wu.prototype.point=!0;function Vj(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 Nhe(e,t){return e==t||!!(e&&t&&e.compare(t))}function Rd(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 A0 extends ic{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof A0&&this.tagName==t.tagName&&h5(this.attributes,t.attributes)}static create(t){return new A0(t.tagName,t.attributes||g1,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return xn.of(t,n)}}A0.prototype.startSide=A0.prototype.endSide=-1;function E0(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function lw(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Kf(e,t){if(!t.anchorNode)return!1;try{return lw(e,t.anchorNode)}catch{return!1}}function Yf(e){return e.nodeType==3?N0(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Xf(e,t,n,r){return n?bT(e,t,n,r,-1)||bT(e,t,n,r,1):!1}function lc(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function y1(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function bT(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:Ho(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=lc(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?Ho(e):0}else return!1}}function Ho(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function M0(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Ihe(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Wj(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 Rhe(e,t,n,r,s,i,a,o){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=Ihe(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 g=u.getBoundingClientRect();({scaleX:p,scaleY:y}=Wj(u,g)),f={left:g.left,right:g.left+u.clientWidth*p,top:g.top,bottom:g.top+u.clientHeight*y}}let w=0,v=0;if(s=="nearest")t.top<f.top+a?(v=t.top-(f.top+a),n>0&&t.bottom>f.bottom+v&&(v=t.bottom-f.bottom+a)):t.bottom>f.bottom-a&&(v=t.bottom-f.bottom+a,n<0&&t.top-v<f.top&&(v=t.top-(f.top+a)));else{let g=t.bottom-t.top,x=f.bottom-f.top;v=(s=="center"&&g<=x?t.top+g/2-x/2:s=="start"||s=="center"&&n<0?t.top-a:t.bottom-x+a)-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"==o?t.left-i:t.right-(f.right-f.left)+i)-f.left,w||v)if(m)c.scrollBy(w,v);else{let g=0,x=0;if(v){let k=u.scrollTop;u.scrollTop+=v/y,x=(u.scrollTop-k)*y}if(w){let k=u.scrollLeft;u.scrollLeft+=w/p,g=(u.scrollLeft-k)*p}t={left:t.left-g,top:t.top-x,right:t.right-g,bottom:t.bottom-x},g&&Math.abs(g-w)<1&&(r="nearest"),x&&Math.abs(x-v)<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 Gj(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 jhe{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?Ho(n):0),r,Math.min(t.focusOffset,r?Ho(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Uc=null;Ve.safari&&Ve.safari_version>=26&&(Uc=!1);function Kj(e){if(e.setActive)return e.setActive();if(Uc)return e.focus(Uc);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Uc==null?{get preventScroll(){return Uc={preventScroll:!0},!0}}:void 0),!Uc){Uc=!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 vT;function N0(e,t,n=t){let r=vT||(vT=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function jd(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 a=new KeyboardEvent("keyup",s);return a.synthetic=!0,e.dispatchEvent(a),i.defaultPrevented||a.defaultPrevented}function Dhe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Ohe(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Ho(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Ho(n))}else{if(n==e)return!0;r=lc(n),n=n.parentNode}}function Yj(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 Xj(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=Ho(n)}else if(n.parentNode&&!y1(n))r=lc(n),n=n.parentNode;else return null}}function Qj(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&&!y1(n))r=lc(n)+1,n=n.parentNode;else return null}}class la{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new la(t.parentNode,lc(t),n)}static after(t,n){return new la(t.parentNode,lc(t)+1,n)}}var Un=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Un||(Un={}));const _u=Un.LTR,f5=Un.RTL;function Jj(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const Lhe=Jj("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Bhe=Jj("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),cw=Object.create(null),ka=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);cw[t]=n,cw[n]=-t}function Zj(e){return e<=247?Lhe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Bhe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const zhe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class $a{get dir(){return this.level%2?f5:_u}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 a=0;a<t.length;a++){let o=t[a];if(o.from<=n&&o.to>=n){if(o.level==r)return a;(i<0||(s!=0?s<0?o.from<n:o.to>n:t[i].level>o.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function eD(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||!eD(r.inner,s.inner))return!1}return!0}const Mn=[];function $he(e,t,n,r,s){for(let i=0;i<=r.length;i++){let a=i?r[i-1].to:t,o=i<r.length?r[i].from:n,l=i?256:s;for(let c=a,u=l,d=l;c<o;c++){let f=Zj(e.charCodeAt(c));f==512?f=u:f==8&&d==4&&(f=16),Mn[c]=f==4?2:f,f&7&&(d=f),u=f}for(let c=a,u=l,d=l;c<o;c++){let f=Mn[c];if(f==128)c<o-1&&u==Mn[c+1]&&u&24?f=Mn[c]=u:Mn[c]=256;else if(f==64){let m=c+1;for(;m<o&&Mn[m]==64;)m++;let p=c&&u==8||m<n&&Mn[m]==8?d==1?1:8:256;for(let y=c;y<m;y++)Mn[y]=p;c=m-1}else f==8&&d==1&&(Mn[c]=1);u=f,f&7&&(d=f)}}}function Phe(e,t,n,r,s){let i=s==1?2:1;for(let a=0,o=0,l=0;a<=r.length;a++){let c=a?r[a-1].to:t,u=a<r.length?r[a].from:n;for(let d=c,f,m,p;d<u;d++)if(m=cw[f=e.charCodeAt(d)])if(m<0){for(let y=o-3;y>=0;y-=3)if(ka[y+1]==-m){let w=ka[y+2],v=w&2?s:w&4?w&1?i:s:0;v&&(Mn[d]=Mn[ka[y]]=v),o=y;break}}else{if(ka.length==189)break;ka[o++]=d,ka[o++]=f,ka[o++]=l}else if((p=Mn[d])==2||p==1){let y=p==s;l=y?0:1;for(let w=o-3;w>=0;w-=3){let v=ka[w+2];if(v&2)break;if(y)ka[w+2]|=2;else{if(v&4)break;ka[w+2]|=4}}}}}function qhe(e,t,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:e,o=s<n.length?n[s].from:t;for(let l=a;l<o;){let c=Mn[l];if(c==256){let u=l+1;for(;;)if(u==o){if(s==n.length)break;u=n[s++].to,o=s<n.length?n[s].from:t}else if(Mn[u]==256)u++;else break;let d=i==1,f=(u<t?Mn[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),Mn[--p]=m;l=u}else i=c,l++}}}function uw(e,t,n,r,s,i,a){let o=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=Mn[l];y!=o&&(u=!1,d=y==16)}let f=!u&&o==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,v=c+1;;){if(w==n)break e;if(v<i.length&&i[v].from==w)w=i[v++].to;else{if(Mn[w]==o)break e;break}}if(c++,f)f.push(y);else{y.from>l&&a.push(new $a(l,y.from,m));let w=y.direction==_u!=!(m%2);dw(e,w?r+1:r,s,y.inner,y.from,y.to,a),l=y.to}p=y.to}else{if(p==n||(u?Mn[p]!=o:Mn[p]==o))break;p++}f?uw(e,l,p,r+1,s,f,a):l<p&&a.push(new $a(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=Mn[l-1];y!=o&&(u=!1,d=y==16)}let f=!u&&o==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,v=c;;){if(w==t)break e;if(v&&i[v-1].to==w)w=i[--v].from;else{if(Mn[w-1]==o)break e;break}}if(f)f.push(y);else{y.to<l&&a.push(new $a(y.to,l,m));let w=y.direction==_u!=!(m%2);dw(e,w?r+1:r,s,y.inner,y.from,y.to,a),l=y.from}p=y.from}else{if(p==t||(u?Mn[p-1]!=o:Mn[p-1]==o))break;p--}f?uw(e,p,l,r+1,s,f,a):p<l&&a.push(new $a(p,l,m)),l=p}}function dw(e,t,n,r,s,i,a){let o=t%2?2:1;$he(e,s,i,r,o),Phe(e,s,i,r,o),qhe(s,i,r,o),uw(e,s,i,t,n,r,a)}function Uhe(e,t,n){if(!e)return[new $a(0,0,t==f5?1:0)];if(t==_u&&!n.length&&!zhe.test(e))return tD(e.length);if(n.length)for(;e.length>Mn.length;)Mn[Mn.length]=256;let r=[],s=t==_u?0:1;return dw(e,s,s,n,0,e.length,r),r}function tD(e){return[new $a(0,e,0)]}let nD="";function Hhe(e,t,n,r,s){var i;let a=r.head-e.from,o=$a.find(t,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=t[o],c=l.side(s,n);if(a==c){let f=o+=s?1:-1;if(f<0||f>=t.length)return null;l=t[o=f],a=l.side(!s,n),c=l.side(s,n)}let u=hs(e.text,a,l.forward(s,n));(u<l.from||u>l.to)&&(u=c),nD=e.text.slice(Math.min(a,u),Math.max(a,u));let d=o==(s?t.length-1:0)?null:t[o+(s?1:-1)];return d&&u==c&&d.level+(s?0:1)<l.level?ke.cursor(d.side(!s,n)+e.from,d.forward(s,n)?1:-1,d.level):ke.cursor(u+e.from,l.forward(s,n)?-1:1,l.level)}function Fhe(e,t,n){for(let r=t;r<n;r++){let s=Zj(e.charCodeAt(r));if(s==1)return _u;if(s==2||s==4)return f5}return _u}const rD=ct.define(),sD=ct.define(),iD=ct.define(),aD=ct.define(),hw=ct.define(),oD=ct.define(),lD=ct.define(),m5=ct.define(),p5=ct.define(),cD=ct.define({combine:e=>e.some(t=>t)}),uD=ct.define({combine:e=>e.some(t=>t)}),dD=ct.define();class Dd{constructor(t,n,r,s,i,a=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new Dd(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 Dd(ke.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const cp=Cn.define({map:(e,t)=>e.map(t)}),hD=Cn.define();function hi(e,t,n){let r=e.facet(aD);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 wo=ct.define({combine:e=>e.length?e[0]:!0});let Vhe=0;const bd=ct.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 Xs{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(bd.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(bd.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:a}=n||{};return new Xs(Vhe++,t,r,s,o=>{let l=[];return a&&l.push(Ny.of(c=>{let u=c.plugin(o);return u?a(u):Gt.none})),i&&l.push(i(o)),l})}static fromClass(t,n){return Xs.define((r,s)=>new t(r,s),n)}}class h4{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(hi(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){hi(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){hi(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fD=ct.define(),g5=ct.define(),Ny=ct.define(),mD=ct.define(),y5=ct.define(),cm=ct.define(),pD=ct.define();function xT(e,t){let n=e.state.facet(pD);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return xn.spans(r,t.from,t.to,{point(){},span(i,a,o,l){let c=i-t.from,u=a-t.from,d=s;for(let f=o.length-1;f>=0;f--,l--){let m=o[f].spec.bidiIsolate,p;if(m==null&&(m=Fhe(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 gD=ct.define();function b5(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(gD)){let a=i(e);a&&(a.left!=null&&(t=Math.max(t,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:t,right:n,top:r,bottom:s}}const vf=ct.define();class qi{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new qi(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,a=0;;){let o=s<t.length?t[s].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(o,l);if(c==1e9)break;let u=c+a,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++)a=t[p].toA-t[p].toB;f=Math.max(f,m+a)}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),a=m.toA-m.toB}else break;r.push(new qi(u,f,c,d))}return r}}class b1{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=jr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,o,l)=>s.push(new qi(i,a,o,l))),this.changedRanges=s}static create(t,n,r){return new b1(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 Whe=[];class ar{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 Whe}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&&Ehe(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=lc(this.dom),s=this.length?t>0:n>0;return new la(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 Ry)return t;return null}static get(t){return t.cmTile}}class Iy extends ar{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,a=0;for(let o of this.children){if(o.sync(t),a+=o.length+o.breakAfter,s=r?r.nextSibling:n.firstChild,i&&s!=o.dom&&(i.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=wT(s);else n.insertBefore(o.dom,s);r=o.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=wT(s);this.length=a}}function wT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Ry extends Iy{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=ar.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 a=r.children[s++];if(a instanceof Oo)n.push(s),r=a,s=0;else{let o=i+a.length,l=t(a,i);if(l!==void 0)return l;i=o+a.breakAfter}}}resolveBlock(t,n){let r,s=-1,i,a=-1;if(this.blockTiles((o,l)=>{let c=l+o.length;if(t>=l&&t<=c){if(o.isWidget()&&n>=-1&&n<=1){if(o.flags&32)return!0;o.flags&16&&(r=void 0)}(l<t||t==c&&(n<-1?o.length:o.covers(1)))&&(!r||!o.isWidget()&&r.isWidget())&&(r=o,s=t-l),(c>t||t==l&&(n>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=t-l)}}),!r&&!i)throw new Error("No tile at position "+t);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:a}}}class Oo extends Iy{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 Oo(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class rh extends Iy{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new rh(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,a=null,o=-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):(!a||a.isHidden&&(n>0||r&&Khe(a,p)))&&(y>d||p.flags&32)?(a=p,o=d-m):(m<d||p.flags&16&&!p.isHidden)&&(s=p,i=d-m)),m=y}}l(this,t);let c=(n<0?s:a)||s||a;return c?{tile:c,offset:c==s?i:o}:null}coordsIn(t,n){let r=this.resolveInline(t,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):Ghe(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 la(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let a=r.tile.parent,o=!1;for(let l of a.children){if(o)return new la(l.dom,0);l==r.tile&&(o=!0)}}return new la(this.dom,0)}}function Ghe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Yf(t);return n[n.length-1]||null}function Khe(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Vs extends Iy{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new Vs(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class tu extends ar{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,a=0;t==0&&n<0||t==r&&n>=0?Ve.chrome||Ve.gecko||(t?(s--,a=1):i<r&&(i++,a=-1)):n<0?s--:i<r&&i++;let o=N0(this.dom,s,i).getClientRects();if(!o.length)return null;let l=o[(a?a<0:n>=0)?0:o.length-1];return Ve.safari&&!a&&l.width==0&&(l=Array.prototype.find.call(o,c=>c.width)||l),a?M0(l,a<0):l||null}static of(t,n){let r=new tu(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class ku extends ar{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 M0(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),a=null;if(!i.length)return null;let o=this.flags&16?!0:this.flags&32?!1:t>0;for(let l=o?i.length-1:0;a=i[l],!(t>0?l==0:l==i.length-1||a.top<a.bottom);l+=o?-1:1);return M0(a,!o)}}get overrideDOMText(){if(!this.length)return en.empty;let{root:t}=this;if(!t)return en.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 ku(i,r,t,s)}}class v1 extends ar{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 en.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class Yhe{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:s,index:i,beforeBreak:a,parents:o}=this;for(;t||n>0;)if(s.isComposite())if(a){if(!t)break;r&&r.break(),t--,a=!1}else if(i==s.children.length){if(!t&&!o.length)break;r&&r.leave(s),a=!!s.breakAfter,{tile:s,index:i}=o.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)?(a=!!c,i++,t-=l.length):(o.push({tile:s,index:i}),s=l,i=0,r&&l.isComposite()&&r.enter(l))}else if(i==s.length)a=!!s.breakAfter,{tile:s,index:i}=o.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=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Xhe{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class Qhe{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 a=this.ensureMarks(n,r),o=a.lastChild;if(o&&o.isText()&&!(o.flags&8)&&o.length+t.length<512){this.cache.reused.set(o,2);let l=a.children[a.children.length-1]=new tu(o.dom,o.text+t);l.parent=a}else a.append(s||tu.of(t,(i=this.cache.find(tu))===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)?f4(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let o=n.marks.length-1;o>=0;o--){let l=n.marks[o],c=s.lastChild;if(c instanceof Vs&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(f4(l.dom)),s=c;else{if(this.cache.reused.get(l)){let d=ar.get(l.dom);d&&d.setDOM(f4(l.dom))}let u=Vs.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=ar.get(t.text);i&&this.cache.reused.set(i,2);let a=new tu(t.text,t.text.nodeValue);a.flags|=8,this.pos=t.range.toB,s.append(a)}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=yD);let s=rh.start(t,n||((r=this.cache.find(rh))===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 a=t[i],o;if(n>0&&(o=s.lastChild)&&o instanceof Vs&&o.mark.eq(a))s=o,n--;else{let l=Vs.of(a,(r=this.cache.find(Vs,c=>c.mark.eq(a)))===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||!_T(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Ve.ios&&_T(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(m4,0,32)||new ku(m4.toDOM(),0,m4,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 Xhe(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 Oo&&s.wrapper.eq(r.wrapper))n=s;else{let i=Oo.of(r.wrapper,(t=this.cache.find(Oo,a=>a.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(v1,void 0,1);return r&&(r.flags=n),r||new v1(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Jhe{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:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=s;let o=this.textOff=Math.min(t,s.length);return i?null:s.slice(0,o)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const x1=[ku,rh,tu,Vs,v1,Oo,Ry];for(let e=0;e<x1.length;e++)x1[e].bucket=e;class Zhe{constructor(t){this.view=t,this.buckets=x1.map(()=>[]),this.index=x1.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],a=this.index[s];for(let o=i.length-1;o>=0;o--){let l=(o+a)%i.length,c=i[l];if((!n||n(c))&&!this.reused.has(c))return i.splice(l,1),l<a&&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,a=0;;i++){if(i==s.length){if(a)return null;a=1,i=0}let o=s[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(t):o.widget.constructor==t.constructor&&t.updateDOM(o.dom,this.view,o.widget)))return s.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==t&&o.length==n&&(o.flags&497)==r?(this.reused.set(o,1),o):(this.reused.set(o,2),new ku(o.dom,n,t,o.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 efe{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new Zhe(t),this.text=new Jhe(t.state.doc),this.builder=new Qhe(this.cache,new Ry(t,t.contentDOM),xn.iter(r)),this.cache.reused.set(n,2),this.old=new Yhe(n),this.reuseWalker={skip:(a,o,l)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(t,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,a=0;;){let o=a<t.length?t[a++]:null,l=o?o.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!a,!o),s=l,i+=c}if(!o)break;n&&o.fromA<=n.range.fromA&&o.toA>=n.range.toA?(this.forward(o.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,o.toA),this.emit(n.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,s=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,r){let s=rfe(this.old),i=this.openMarks;this.old.advance(t,r?1:-1,{skip:(a,o,l)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(l-o);else{let c=l>0||o<a.length?ku.of(a.widget,this.view,l-o,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);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(a.isText())this.builder.ensureLine(null),!o&&l==a.length&&!this.cache.reused.has(a)?this.builder.addText(a.text,s,i,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(o,l),s,i)),i=s.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof v1)this.cache.add(a);else if(a instanceof Vs)this.builder.ensureLine(null),this.builder.addMark(a,s,i),this.cache.reused.set(a,1),i=s.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Vs&&s.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?s.length&&(s.length=i=0):a instanceof Vs&&(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,a=xn.spans(this.decorations,t,n,{point:(o,l,c,u,d,f)=>{if(c instanceof wu){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(o).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-o);else{let m=c.widget||(c.block?sh.block:sh.inline),p=tfe(c),y=this.cache.findWidget(m,l-o,p)||ku.of(m,this.view,l-o,p);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(y)):(s.ensureLine(r),s.addInlineWidget(y,u,d))}r=null}else r=nfe(r,c);l>o&&this.text.skip(l-o)},span:(o,l,c,u)=>{for(let d=o;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==o?u:c.length),d+=f.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=a>i,this.openMarks=a}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=ar.get(s);if(s==this.view.contentDOM)break;i instanceof Vs?n.push(i):i!=null&&i.isLine()?r=i:i instanceof Oo||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new rh(s,yD):r||n.push(Vs.of(new om({tagName:s.nodeName.toLowerCase(),attributes:Mhe(s)}),s)))}return{line:r,marks:n}}}function _T(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 tfe(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 yD={class:"cm-line"};function nfe(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&d5(n,e),r&&(e.class+=" "+r)),e}function rfe(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 Vs&&t.push(r.mark)}return t}function f4(e){let t=ar.get(e);return t&&t.setDOM(e.cloneNode()),e}class sh extends eo{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}}sh.inline=new sh("span");sh.block=new sh("div");const m4=new class extends eo{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class kT{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Gt.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 Ry(t,t.contentDOM),this.updateInner([new qi(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:!hfe(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?ife(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new qi(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,(Ve.ie||Ve.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,o=this.blockWrappers;this.updateDeco();let l=lfe(a,this.decorations,t.changes);l.length&&(r=qi.extendWithRanges(r,l));let c=ufe(o,this.blockWrappers,t.changes);return c.length&&(r=qi.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 a=this.tile,o=new efe(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&ar.get(n.text)&&o.cache.reused.set(ar.get(n.text),2),this.tile=o.run(t,n),fw(a,o.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=Ve.chrome||Ve.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 p4&&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(hD)&&(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,a=!i&&!(this.view.state.facet(wo)||r.tabIndex>-1)&&Kf(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||a))return;let o=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)),Ve.gecko&&l.empty&&!this.hasComposition&&sfe(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new la(f,0),o=!0}let d=this.view.observer.selectionRange;(o||!d.focusNode||(!Xf(c.node,c.offset,d.anchorNode,d.anchorOffset)||!Xf(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{Ve.android&&Ve.chrome&&r.contains(d.focusNode)&&dfe(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=E0(this.view.root);if(f)if(l.empty){if(Ve.gecko){let m=afe(c.node,c.offset);if(m&&m!=3){let p=(m==1?Xj:Qj)(c.node,c.offset);p&&(c=new la(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)}a&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new la(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new la(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&Xf(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=E0(t.root),{anchorNode:s,anchorOffset:i}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=this.lineAt(n.head,n.assoc);if(!a)return;let o=a.posAtStart;if(n.head==o||n.head==o+a.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 a=Ho(t)==0?0:n==0?-1:1;for(;;){let o=t.parentNode;if(o==r.dom)break;a==0&&o.firstChild!=o.lastChild&&(t==o.firstChild?a=-1:a=1),t=o}a<0?i=t:i=t.nextSibling}if(i==r.dom.firstChild)return s;for(;i&&!ar.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let a=0,o=s;;a++){let l=r.children[a];if(l.dom==i)return o;o+=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,a,o=-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&&!a&&(a=c,o=t-u,l=u>t),u>t&&a)return!0}}),!r&&!a?this.domAtPos(t,n):(i&&a?r=null:l&&r&&(a=null),r&&n<0||!a?r.domIn(s,n):a.domIn(o,n))}coordsAt(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof p4?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,a){if(i.isComposite())for(let o of i.children){if(o.length>=a){let l=s(o,a);if(l)return l}if(a-=o.length,a<0)break}else if(i.isText()&&a<i.length){let o=hs(i.text,a);if(o==a)return null;let l=N0(i.dom,a,o).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,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Un.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,v=y.dom.getBoundingClientRect(),{height:g}=v;if(m&&!p&&(c+=v.top-m.top),y instanceof Oo)w>r&&u(y,f,v);else if(f>=r&&(c>0&&n.push(-c),n.push(g+c),c=0,a)){let x=y.dom.lastChild,k=x?Yf(x):[];if(k.length){let A=k[k.length-1],T=l?A.right-v.left:v.right-A.left;T>o&&(o=T,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=w)}}m&&p==d.children.length-1&&(c+=m.bottom-v.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"?Un.RTL:Un.LTR}measureTextSize(){let t=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let o=0,l;for(let c of a.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=Yf(c.dom);if(u.length!=1)return;o+=u[0].width,l=u[0].height}if(o)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:o/a.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 a=Yf(n.firstChild)[0];r=n.getBoundingClientRect().height,s=a&&a.width?a.width/27:7,i=a&&a.height?a.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],a=i?i.from-1:this.view.state.doc.length;if(a>r){let o=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(Gt.replace({widget:new p4(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return Gt.set(t)}updateDeco(){let t=1,n=this.view.state.facet(Ny).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(y5).map((i,a)=>{let o=typeof i=="function";return o&&(r=!0),o?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[t++]=r,n.push(xn.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(mD).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(dD))try{if(u(this.view,t.range,t))return!0}catch(d){hi(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 a=b5(this.view),o={left:s.left-a.left,top:s.top-a.top,right:s.right+a.right,bottom:s.bottom+a.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(Rhe(this.view.scrollDOM,o,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==Un.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(){fw(this.tile)}}function fw(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)fw(r,t)}}function sfe(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 bD(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Xj(n.focusNode,n.focusOffset),s=Qj(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let o=ar.get(s.node);if(!o||o.isText()&&o.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=ar.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=t-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function ife(e,t,n){let r=bD(e,n);if(!r)return null;let{node:s,from:i,to:a}=r,o=s.nodeValue;if(/[\n\r]/.test(o)||e.state.doc.sliceString(r.from,r.to)!=o)return null;let l=t.invertedDesc;return{range:new qi(l.mapPos(i),l.mapPos(a),i,a),text:s}}function afe(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 ofe=class{constructor(){this.changes=[]}compareRange(t,n){Rd(t,n,this.changes)}comparePoint(t,n){Rd(t,n,this.changes)}boundChange(t){Rd(t,t,this.changes)}};function lfe(e,t,n){let r=new ofe;return xn.compare(e,t,n,r),r.changes}class cfe{constructor(){this.changes=[]}compareRange(t,n){Rd(t,n,this.changes)}comparePoint(){}boundChange(t){Rd(t,t,this.changes)}}function ufe(e,t,n){let r=new cfe;return xn.compare(e,t,n,r),r.changes}function dfe(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function hfe(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class p4 extends eo{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 ffe(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return ke.cursor(t);i==0?n=1:i==s.length&&(n=-1);let a=i,o=i;n<0?a=hs(s.text,i,!1):o=hs(s.text,i);let l=r(s.text.slice(a,o));for(;a>0;){let c=hs(s.text,a,!1);if(r(s.text.slice(c,a))!=l)break;a=c}for(;o<s.length;){let c=hs(s.text,o);if(r(s.text.slice(o,c))!=l)break;o=c}return ke.range(a+s.from,o+s.from)}function mfe(e,t,n,r,s){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let o=e.viewState.heightOracle.textHeight,l=Math.floor((s-n.top-(e.defaultLineHeight-o)*.5)/o);i+=l*e.viewState.heightOracle.lineLength}let a=e.state.sliceDoc(n.from,n.to);return n.from+khe(a,i,e.state.tabSize)}function mw(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==As.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function pfe(e,t,n,r){let s=mw(e,t.head,t.assoc||-1),i=!r||s.type!=As.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(i){let a=e.dom.getBoundingClientRect(),o=e.textDirectionAt(s.from),l=e.posAtCoords({x:n==(o==Un.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(l!=null)return ke.cursor(l,n?-1:1)}return ke.cursor(n?s.to:s.from,n?-1:1)}function ST(e,t,n,r){let s=e.state.doc.lineAt(t.head),i=e.bidiSpans(s),a=e.textDirectionAt(s.from);for(let o=t,l=null;;){let c=Hhe(s,i,a,o,n),u=nD;if(!c){if(s.number==(n?e.state.doc.lines:1))return o;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 o}else{if(!r)return c;l=r(u)}o=c}}function gfe(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let a=r(i);return s==Mo.Space&&(s=a),s==a}}function yfe(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return ke.cursor(s,t.assoc);let a=t.goalColumn,o,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(c)a==null&&(a=c.left-l.left),o=i<0?c.top:c.bottom;else{let p=e.viewState.lineBlockAt(s);a==null&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(s-p.from))),o=(i<0?p.top:p.bottom)+u}let d=l.left+a,f=e.viewState.heightOracle.textHeight>>1,m=r??f;for(let p=0;;p+=f){let y=o+(m+p)*i,w=pw(e,{x:d,y},!1,i);if(n?y>l.bottom:y<l.top)return ke.cursor(w.pos,w.assoc);let v=e.coordsAtPos(w.pos,w.assoc),g=v?(v.top+v.bottom)/2:0;if(!v||(n?g>o:g<o))return ke.cursor(w.pos,w.assoc,void 0,a)}}function Qf(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(i,a,o)=>{if(t>i&&t<a){let l=r||n||(t-i<a-t?-1:1);t=l<0?i:a,r=l}});if(!r)return t}}function vD(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 a=Qf(e,s.from,0);a!=s.from&&(i=ke.cursor(a,-1))}else{let a=Qf(e,s.from,-1),o=Qf(e,s.to,1);(a!=s.from||o!=s.to)&&(i=ke.range(s.from==s.anchor?a:o,s.from==s.head?a:o))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?ke.create(n,t.mainIndex):t}function g4(e,t,n){let r=Qf(e.state.facet(cm).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:ke.cursor(r,r<n.from?1:-1)}class ja{constructor(t,n){this.pos=t,this.assoc=n}}function pw(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:a,y:o}=t,l=o-i,c;for(;;){if(l<0)return new ja(0,1);if(l>e.viewState.docHeight)return new ja(e.state.doc.length,-1);if(c=e.elementAtHeight(l),r==null)break;if(c.type==As.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==As.Text){let d=mfe(e,s,c,a,o);return new ja(d,d==c.from?1:-1)}}if(c.type!=As.Text)return l<(c.top+c.bottom)/2?new ja(c.from,1):new ja(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 bfe(e,a,o,e.textDirectionAt(c.from)).scanTile(u,c.from)}class bfe{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[$a.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[$a.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,a=new Set,o=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(a.has(y)){let v=s+Math.floor(Math.random()*p);for(let g=0;g<p;g++){if(!a.has(v)){y=v;break t}v++,v==i&&(v=s)}break e}a.add(y);let w=n(y);if(w)for(let v=0;v<w.length;v++){let g=w[v],x=0;if(!(g.width==0&&w.length>1)){if(g.bottom<this.y)(!l||l.bottom<g.bottom)&&(l=g),x=1;else if(g.top>this.y)(!c||c.top>g.top)&&(c=g),x=-1;else{let k=g.left>this.x?this.x-g.left:g.right<this.x?this.x-g.right:0,A=Math.abs(k);A<d&&(u=y,d=A,f=g),k&&(x=k<0==(this.baseDir==Un.LTR)?-1:1)}x==-1&&(!o||this.baseDirAt(t[y],1))?i=y:x==1&&(!o||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=(o?this.dirAt(t[u],1):this.baseDir)==Un.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=hs(t.text,i))r.push(n+i);r.push(n+t.length);let s=this.scan(r,i=>{let a=r[i]-n,o=r[i+1]-n;return N0(t.dom,a,o).getClientRects()});return s.after?new ja(r[s.i+1],-1):new ja(r[s.i],1)}scanTile(t,n){if(!t.length)return new ja(n,1);if(t.children.length==1){let o=t.children[0];if(o.isText())return this.scanText(o,n);if(o.isComposite())return this.scanTile(o,n)}let r=[n];for(let o=0,l=n;o<t.children.length;o++)r.push(l+=t.children[o].length);let s=this.scan(r,o=>{let l=t.children[o];return l.flags&48?null:(l.dom.nodeType==1?l.dom:N0(l.dom,0,l.length)).getClientRects()}),i=t.children[s.i],a=r[s.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):s.after?new ja(r[s.i+1],-1):new ja(a,1)}}const rd="";class vfe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(pn.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=rd}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 a=ar.get(s),o=s.nextSibling;if(o==n){a!=null&&a.breakAfter&&!o&&r!=this.view.contentDOM&&this.lineBreak();break}let l=ar.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:y1(s))||y1(o)&&(s.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>i)&&!wfe(o,n)&&this.lineBreak(),s=o}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,a=1,o;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(o=s.exec(n))&&(i=o.index,a=o[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=a-1);r=i+a}}readNode(t){let n=ar.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+(xfe(t,r.node,r.offset)?n:0))}}function xfe(e,t,n){for(;;){if(!t||n<Ho(t))return!1;if(t==e)return!0;n=lc(t)+1,t=t.parentNode}}function wfe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=ar.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 TT{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class _fe{constructor(t,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:a}=t.docView,o=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=xD(t.docView.tile,n,r,0))){let l=i||a?[]:Sfe(t),c=new vfe(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Tfe(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!lw(t.contentDOM,l.focusNode)?o.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),u=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!lw(t.contentDOM,l.anchorNode)?o.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=t.viewport;if((Ve.ios||Ve.chrome)&&o.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&&o.ranges.length>1)this.newSel=o.replaceRange(ke.range(u,c));else if(t.lineWrapping&&u==c&&!(o.main.empty&&o.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=ke.create([ke.cursor(c,m)])}else this.newSel=ke.single(u,c)}}}function xD(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,a=-1,o=-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 xD(d,t,n,c);if(f>=t&&s==-1&&(s=l,i=c),c>n&&d.dom.parentNode==e.dom){a=l,o=u;break}u=f,c=f+d.breakAfter}return{from:i,to:o<0?r+e.length:o,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:a<e.children.length&&a>=0?e.children[a].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function wD(e,t){let n,{newSel:r}=t,{state:s}=e,i=s.selection.main,a=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,c=i.from,u=null;(a===8||Ve.android&&t.text.length<l-o)&&(c=i.to,u="end");let d=s.doc.sliceString(o,l,rd),f,m;!i.empty&&i.from>=o&&i.to<=l&&(t.typeOver||d!=t.text)&&d.slice(0,i.from-o)==t.text.slice(0,i.from-o)&&d.slice(i.to-o)==t.text.slice(f=t.text.length-(d.length-(i.to-o)))?n={from:i.from,to:i.to,insert:en.of(t.text.slice(i.from-o,f).split(rd))}:(m=_D(d,t.text,c-o,u))&&(Ve.chrome&&a==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==rd+rd&&m.toB--,n={from:o+m.from,to:o+m.toA,insert:en.of(t.text.slice(m.from,m.toB).split(rd))})}else r&&(!e.hasFocus&&s.facet(wo)||w1(r,i))&&(r=null);if(!n&&!r)return!1;if((Ve.mac||Ve.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=ke.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:en.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)}:Ve.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=ke.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:en.of([" "])}),n)return v5(e,n,r,a);if(r&&!w1(r,i)){let o=!1,l="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(o=!0),l=e.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=vD(s.facet(cm).map(c=>c(e)),r))),e.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function v5(e,t,n,r=-1){if(Ve.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(Ve.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&&jd(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)&&jd(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&jd(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a,o=()=>a||(a=kfe(e,t,n));return e.state.facet(oD).some(l=>l(e,t.from,t.to,i,o))||e.dispatch(o()),!0}function kfe(e,t,n){let r,s=e.state,i=s.selection.main,a=-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=Qf(s.facet(cm).map(d=>d(e)),c,l);t.from==u&&(a=u)}if(a>-1)r={changes:t,selection:ke.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&&bD(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 v=s.changes({from:w,to:y,insert:t.insert}),g=p.to-i.to;return{changes:v,range:c?ke.range(Math.max(0,c.anchor+g),Math.max(0,c.head+g)):p.map(v)}})}else r={changes:l,selection:c&&s.selection.replaceRange(c)}}let o="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,o+=".compose",e.inputState.compositionFirstChange&&(o+=".start",e.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:o,scrollIntoView:!0})}function _D(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 a=e.length,o=t.length;for(;a>0&&o>0&&e.charCodeAt(a-1)==t.charCodeAt(o-1);)a--,o--;if(r=="end"){let l=Math.max(0,i-Math.min(a,o));n-=a+l-i}if(a<i&&e.length<t.length){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}else if(o<i){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}return{from:i,toA:a,toB:o}}function Sfe(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 TT(n,r)),(s!=n||i!=r)&&t.push(new TT(s,i))),t}function Tfe(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?ke.single(n+t,r+t):null}function w1(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Cfe{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,Ve.safari&&t.contentDOM.addEventListener("input",()=>null),Ve.gecko&&qfe(t.contentDOM.ownerDocument)}handleEvent(t){!Dfe(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=Afe(t),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,o=r[i];o&&a!=!o.handlers.length&&(s.removeEventListener(i,this.handleEvent),o=null),o||s.addEventListener(i,this.handleEvent,{passive:a})}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&&SD.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Ve.android&&Ve.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return Ve.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=kD.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||Efe.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,jd(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:Ve.safari&&!Ve.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 CT(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){hi(n.state,s)}}}function Afe(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,a=s&&s.plugin.domEventObservers;if(i)for(let o in i){let l=i[o];l&&n(o).handlers.push(CT(r.value,l))}if(a)for(let o in a){let l=a[o];l&&n(o).observers.push(CT(r.value,l))}}for(let r in ua)n(r).handlers.push(ua[r]);for(let r in Qs)n(r).observers.push(Qs[r]);return t}const kD=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Efe="dthko",SD=[16,17,18,20,91,92,224,225],up=6;function dp(e){return Math.max(0,e)*.7+8}function Mfe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Nfe{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=Gj(t.contentDOM),this.atoms=t.state.facet(cm).map(a=>a(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(pn.allowMultipleSelections)&&Ife(t,n),this.dragging=jfe(t,n)&&AD(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&&Mfe(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let l=b5(this.view);t.clientX-l.left<=s+up?n=-dp(s-t.clientX):t.clientX+l.right>=a-up&&(n=dp(t.clientX-a)),t.clientY-l.top<=i+up?r=-dp(i-t.clientY):t.clientY+l.bottom>=o-up&&(r=dp(t.clientY-o)),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=vD(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 Ife(e,t){let n=e.state.facet(rD);return n.length?n[0](t):Ve.mac?t.metaKey:t.ctrlKey}function Rfe(e,t){let n=e.state.facet(sD);return n.length?n[0](t):Ve.mac?!t.altKey:!t.ctrlKey}function jfe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=E0(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let a=s[i];if(a.left<=t.clientX&&a.right>=t.clientX&&a.top<=t.clientY&&a.bottom>=t.clientY)return!0}return!1}function Dfe(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=ar.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const ua=Object.create(null),Qs=Object.create(null),TD=Ve.ie&&Ve.ie_version<15||Ve.ios&&Ve.webkit_version<604;function Ofe(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(),CD(e,n.value)},50)}function jy(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function CD(e,t){t=jy(e.state,m5,t);let{state:n}=e,r,s=1,i=n.toText(t),a=i.lines==n.selection.ranges.length;if(gw!=null&&n.selection.ranges.every(l=>l.empty)&&gw==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((a?i.line(s++).text:t)+n.lineBreak);return{changes:{from:u.from,insert:d},range:ke.cursor(c.from+d.length)}})}else a?r=n.changeByRange(l=>{let c=i.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:ke.cursor(l.from+c.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Qs.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};Qs.wheel=Qs.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};ua.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Qs.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")};Qs.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};ua.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(iD))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Bfe(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Nfe(e,t,n,r)),r&&e.observer.ignore(()=>{Kj(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 AT(e,t,n,r){if(r==1)return ke.cursor(t,n);if(r==2)return ffe(e.state,t,n);{let s=e.docView.lineAt(t,n),i=e.state.doc.lineAt(s?s.posAtEnd:t),a=s?s.posAtStart:i.from,o=s?s.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,ke.range(a,o)}}const Lfe=Ve.ie&&Ve.ie_version<=11;let ET=null,MT=0,NT=0;function AD(e){if(!Lfe)return e.detail;let t=ET,n=NT;return ET=e,NT=Date.now(),MT=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(MT+1)%3:1}function Bfe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=AD(t),s=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,o){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=AT(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!a){let d=AT(e,n.pos,n.assoc,r),f=Math.min(d.from,u.from),m=Math.max(d.to,u.to);u=f<u.from?ke.range(f,m,u.assoc):ke.range(m,f,u.assoc)}return a?s.replaceRange(s.main.extend(u.from,u.to,u.assoc)):o&&r==1&&s.ranges.length>1&&(c=zfe(s,l.pos))?c:o?s.addRange(u):ke.create([u])}}}function zfe(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 ke.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}ua.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,a=i+s.length;(i>=n.to||a<=n.from)&&(n=ke.range(i,a))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",jy(e.state,p5,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};ua.dragend=e=>(e.inputState.draggedContent=null,!1);function IT(e,t,n,r){if(n=jy(e.state,m5,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,a=r&&i&&Rfe(e,t)?{from:i.from,to:i.to}:null,o={from:s,insert:n},l=e.state.changes(a?[a,o]:o);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}ua.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&&IT(e,t,r.filter(a=>a!=null).join(e.state.lineBreak),!1)};for(let a=0;a<n.length;a++){let o=new FileReader;o.onerror=i,o.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[a]=o.result),i()},o.readAsText(n[a])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return IT(e,t,r,!0),!0}return!1};ua.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=TD?null:t.clipboardData;return n?(CD(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Ofe(e),!1)};function $fe(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 Pfe(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 a=e.doc.lineAt(i);a.number>s&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),s=a.number}r=!0}return{text:jy(e,p5,t.join(e.lineBreak)),ranges:n,linewise:r}}let gw=null;ua.copy=ua.cut=(e,t)=>{if(!Kf(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=Pfe(e.state);if(!n&&!s)return!1;gw=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=TD?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):($fe(e,n),!1)};const ED=Yo.define();function MD(e,t){let n=[];for(let r of e.facet(lD)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:ED.of(!0)}):null}function ND(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=MD(e.state,t);n?e.dispatch(n):e.update([])}},10)}Qs.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),ND(e)};Qs.blur=e=>{e.observer.clearSelectionRange(),ND(e)};Qs.compositionstart=Qs.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Qs.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,Ve.chrome&&Ve.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Qs.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};ua.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"),a=t.getTargetRanges();if(i&&a.length){let o=a[0],l=e.posAtDOM(o.startContainer,o.startOffset),c=e.posAtDOM(o.endContainer,o.endOffset);return v5(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let s;if(Ve.chrome&&Ve.android&&(s=kD.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 a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Ve.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Ve.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Qs.compositionend(e,t),20),!1};const RT=new Set;function qfe(e){RT.has(e)||(RT.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const jT=["pre-wrap","normal","pre-line","break-spaces"];let ih=!1;function DT(){ih=!1}class Ufe{constructor(t){this.lineWrapping=t,this.doc=en.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 jT.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,a){let o=jT.indexOf(t)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<a.length;c++){let u=a[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class Hfe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class oa{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"?As.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 wu?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 oa(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Dn=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Dn||(Dn={}));const eg=.001;class Es{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)>eg&&(ih=!0),this.height=t)}replace(t,n,r){return Es.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let i=this,a=r.doc;for(let o=s.length-1;o>=0;o--){let{fromA:l,toA:c,fromB:u,toB:d}=s[o],f=i.lineAt(l,Dn.ByPosNoHeight,r.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,Dn.ByPosNoHeight,r,0,0);for(d+=m.to-c,c=m.to;o>0&&f.from<=s[o-1].toA;)l=s[o-1].fromA,u=s[o-1].fromB,o--,l<f.from&&(f=i.lineAt(l,Dn.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let p=x5.build(r.setDoc(a),t,u,d);i=_1(i,i.replace(l,c,p))}return i.updateHeight(r,0)}static empty(){return new oi(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 o=t[n-1];o.break?t.splice(--n,1,o.left,null,o.right):t.splice(--n,1,o.left,o.right),r+=1+o.break,s-=o.size}else if(i>s*2){let o=t[r];o.break?t.splice(r,1,o.left,null,o.right):t.splice(r,1,o.left,o.right),r+=2+o.break,i-=o.size}else break;else if(s<i){let o=t[n++];o&&(s+=o.size)}else{let o=t[--r];o&&(i+=o.size)}let a=0;return t[n-1]==null?(a=1,n--):t[n]==null&&(a=1,r++),new Vfe(Es.of(t.slice(0,n)),a,Es.of(t.slice(r)))}}function _1(e,t){return e==t?e:(e.constructor!=t.constructor&&(ih=!0),t)}Es.prototype.size=1;const Ffe=Gt.replace({});class ID extends Es{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new oa(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 oa(s,0,r,this.spaceAbove,Ffe):this.mainBlock(r,s)}lineAt(t,n,r,s,i){let a=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(a):a}forEachLine(t,n,r,s,i,a){t<=i+this.length&&n>=i&&a(this.lineAt(0,Dn.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 oi extends ID{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 oa(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 oi||s instanceof Qr&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Qr?s=new oi(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Es.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 Qr extends Es{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,a,o=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*i);a=l/i,this.length>i+1&&(o=(this.height-l)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:o}}blockAt(t,n,r,s){let{firstLine:i,lastLine:a,perLine:o,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=o+u.length*l,f=Math.max(r,t-d/2);return new oa(u.from,u.length,f,d,0)}else{let c=Math.max(0,Math.min(a-i,Math.floor((t-r)/o))),{from:u,length:d}=n.doc.line(i+c);return new oa(u,d,r+o*c,o,0)}}lineAt(t,n,r,s,i){if(n==Dn.ByHeight)return this.blockAt(t,r,s,i);if(n==Dn.ByPosNoHeight){let{from:m,to:p}=r.doc.lineAt(t);return new oa(m,p-m,0,0,0)}let{firstLine:a,perLine:o,perChar:l}=this.heightMetrics(r,i),c=r.doc.lineAt(t),u=o+c.length*l,d=c.number-a,f=s+o*d+l*(c.from-i-d);return new oa(c.from,c.length,Math.max(s,Math.min(f,s+this.height-u)),u,0)}forEachLine(t,n,r,s,i,a){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:o,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-o;d+=l*p+c*(t-i-p)}let m=l+c*f.length;a(new oa(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 Qr?r[r.length-1]=new Qr(i.length+s):r.push(null,new Qr(s-1))}if(t>0){let i=r[0];i instanceof Qr?r[0]=new Qr(t+i.length):r.unshift(new Qr(t-1),null)}return Es.of(r)}decomposeLeft(t,n){n.push(new Qr(t-1),null)}decomposeRight(t,n){n.push(null,new Qr(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 a=[],o=Math.max(n,s.from),l=-1;for(s.from>n&&a.push(new Qr(s.from-n-1).updateHeight(t,n));o<=i&&s.more;){let u=t.doc.lineAt(o).length;a.length&&a.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)>=eg&&(l=-2);let m=new oi(u,d,f);m.outdated=!1,a.push(m),o+=u+1}o<=i&&a.push(null,new Qr(i-o).updateHeight(t,o));let c=Es.of(a);return(l<0||Math.abs(c.height-this.height)>=eg||Math.abs(l-this.heightMetrics(t,n).perLine)>=eg)&&(ih=!0),_1(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 Vfe extends Es{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 a=s+this.left.height,o=i+this.left.length+this.break,l=n==Dn.ByHeight?t<a:t<o,c=l?this.left.lineAt(t,n,r,s,i):this.right.lineAt(t,n,r,a,o);if(this.break||(l?c.to<o:c.from>o))return c;let u=n==Dn.ByPosNoHeight?Dn.ByPosNoHeight:Dn.ByPos;return l?c.join(this.right.lineAt(o,u,r,a,o)):this.left.lineAt(o,u,r,s,i).join(c)}forEachLine(t,n,r,s,i,a){let o=s+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,r,s,i,a),n>=l&&this.right.forEachLine(t,n,r,o,l,a);else{let c=this.lineAt(l,Dn.ByPos,r,s,i);t<c.from&&this.left.forEachLine(t,c.from-1,r,s,i,a),c.to>=t&&c.from<=n&&a(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,o,l,a)}}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 a=i.length;for(let o of r)i.push(o);if(t>0&&OT(i,a-1),n<this.length){let o=i.length;this.decomposeRight(n,i),OT(i,o)}return Es.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?Es.of(this.break?[t,null,n]:[t,n]):(this.left=_1(this.left,t),this.right=_1(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:a}=this,o=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<=o+a.length&&s.more?l=a=a.updateHeight(t,o,r,s):a.updateHeight(t,o,r),l?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function OT(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Qr&&(r=e[t+1])instanceof Qr&&e.splice(t-1,3,new Qr(n.length+1+r.length))}const Wfe=5;class x5{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 oi?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new oi(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 a=n-t;r.block?this.addBlock(new ID(a,s,r)):(a||i||s>=Wfe)&&this.addLineDeco(s,i,a)}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 oi(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new Qr(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 oi)return t;let n=new oi(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 oi)&&!this.isCovered?this.nodes.push(new oi(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 oi&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new x5(r,t);return xn.spans(n,r,s,i,0),i.finish(r)}}function Gfe(e,t,n){let r=new Kfe;return xn.compare(e,t,n,r,0),r.changes}class Kfe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&Rd(t,n,this.changes,5)}}function Yfe(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),a=Math.min(s.innerWidth,n.right),o=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),a=Math.min(a,f.right),o=Math.max(o,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,a)-n.left,top:o-(n.top+t),bottom:Math.max(o,l)-(n.top+t)}}function Xfe(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 Qfe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class y4{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 Gt.replace({widget:new Jfe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class Jfe extends eo{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 LT{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=BT,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Un.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(g5).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new Ufe(r),this.stateDeco=zT(n),this.heightMap=Es.empty().applyChanges(this.stateDeco,en.empty,this.heightOracle.setDoc(n.doc),[new qi(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=Gt.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:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);t.push(new hp(i,a))}}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?BT:new w5(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(xf(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=zT(this.state);let s=t.changedRanges,i=qi.extendWithRanges(s,Gfe(r,this.stateDeco,t?t.changes:jr.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);DT(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||ih)&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);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(uD)&&(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"?Un.RTL:Un.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",o=n.getBoundingClientRect(),l=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,u=0;if(o.width&&o.height){let{scaleX:A,scaleY:T}=Wj(n,o);(A>.005&&Math.abs(this.scaleX-A)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=A,this.scaleY=T,c|=16,a=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=Gj(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=Yj(this.scrollParent||t.win);let y=(this.printing?Qfe:Yfe)(n,this.paddingTop),w=y.top-this.pixelViewport.top,v=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget&&!Xfe(t.dom))return 0;let x=o.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let A=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(A)&&(a=!0),a||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:T,charWidth:C,textHeight:j}=t.docView.measureTextSize();a=T>0&&s.refresh(i,T,C,j,Math.max(5,x/C),A),a&&(t.docView.minWidth=0,c|=16)}w>0&&v>0?u=Math.max(w,v):w<0&&v<0&&(u=Math.min(w,v)),DT();for(let T of this.viewports){let C=T.from==this.viewport.from?A:t.docView.measureVisibleLineHeights(T);this.heightMap=(a?Es.empty().applyChanges(this.stateDeco,en.empty,this.heightOracle,[new qi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Hfe(T.from,C))}ih&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]: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:a,visibleBottom:o}=this,l=new hp(s.lineAt(a-r*1e3,Dn.ByHeight,i,0,0).from,s.lineAt(o+(1-r)*1e3,Dn.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,Dn.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 hp(s.lineAt(f-1e3/2,Dn.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,Dn.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 hp(this.heightMap.lineAt(r,Dn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Dn.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,Dn.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Dn.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(t==0||s<=a-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=o+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i<o+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 y4(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,a=s<<1;if(this.defaultTextDirection!=Un.LTR&&!r)return[];let o=[],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 v of y)if(v>u&&v<d){l(u,v-10,f,m),l(v+10,d,f,m);return}let w=e0e(t,v=>v.from>=f.from&&v.to<=f.to&&Math.abs(v.from-u)<i&&Math.abs(v.to-d)<i&&!y.some(g=>v.from<g&&v.to>g));if(!w){if(d<f.to&&n&&r&&n.visibleRanges.some(x=>x.from<=d&&x.to>=d)){let x=n.moveToLineBoundary(ke.cursor(d),!1,!0).head;x>u&&(d=x)}let v=this.gapSize(f,u,d,m),g=r||v<2e6?v:2e6;w=new y4(u,d,v,g)}o.push(w)},c=u=>{if(u.length<a||u.type!=As.Text)return;let d=Zfe(u.from,u.to,this.stateDeco);if(d.total<a)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,m,p;if(r){let y=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,w,v;if(f!=null){let g=mp(d,f),x=((this.visibleBottom-this.visibleTop)/2+y)/u.height;w=g-x,v=g+x}else w=(this.visibleTop-u.top-y)/u.height,v=(this.visibleBottom-u.top+y)/u.height;m=fp(d,w),p=fp(d,v)}else{let y=d.total*this.heightOracle.charWidth,w=s*this.heightOracle.charWidth,v=0;if(y>2e6)for(let T of t)T.from>=u.from&&T.from<u.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=T.size-T.displaySize);let g=this.pixelViewport.left+v,x=this.pixelViewport.right+v,k,A;if(f!=null){let T=mp(d,f),C=((x-g)/2+w)/y;k=T-C,A=T+C}else k=(g-w)/y,A=(x+w)/y;m=fp(d,k),p=fp(d,A)}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 o}gapSize(t,n,r,s){let i=mp(s,r)-mp(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){y4.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=Gt.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=[];xn.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},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 a=this.visibleRanges[i],o=r[i];(a.from!=o.from||a.to!=o.to)&&(s|=4,t&&t.mapPos(a.from,-1)==o.from&&t.mapPos(a.to,1)==o.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)||xf(this.heightMap.lineAt(t,Dn.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)||xf(this.heightMap.lineAt(this.scaler.fromDOM(t),Dn.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 xf(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 hp{constructor(t,n){this.from=t,this.to=n}}function Zfe(e,t,n){let r=[],s=e,i=0;return xn.spans(n,e,t,{span(){},point(a,o){a>s&&(r.push({from:s,to:a}),i+=a-s),s=o}},20),s<t&&(r.push({from:s,to:t}),i+=t-s),{total:i,ranges:r}}function fp({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:a}=t[s],o=a-i;if(r<=o)return i+r;r-=o}}function mp(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 e0e(e,t){for(let n of e)if(t(n))return n}const BT={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function zT(e){let t=e.facet(Ny).filter(r=>typeof r!="function"),n=e.facet(y5).filter(r=>typeof r!="function");return n.length&&t.push(xn.join(n)),t}class w5{constructor(t,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:o,to:l})=>{let c=n.lineAt(o,Dn.ByPos,t,0,0).top,u=n.lineAt(l,Dn.ByPos,t,0,0).bottom;return s+=u-c,{from:o,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let o of this.viewports)o.domTop=a+(o.top-i)*this.scale,a=o.domBottom=o.domTop+(o.bottom-o.top),i=o.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 w5?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 xf(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new oa(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>xf(s,t)):e._content)}const pp=ct.define({combine:e=>e.join(" ")}),yw=ct.define({combine:e=>e.indexOf(!0)>-1}),bw=ac.newName(),RD=ac.newName(),jD=ac.newName(),DD={"&light":"."+RD,"&dark":"."+jD};function vw(e,t,n){return new ac(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 t0e=vw("."+bw,{"&":{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"}},DD),n0e={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},b4=Ve.ie&&Ve.ie_version<=11;class r0e{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new jhe,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);(Ve.ie&&Ve.ie_version<=11||Ve.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&&Ve.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Ve.chrome&&Ve.chrome_version<126)&&(this.editContext=new i0e(t),t.state.facet(wo)&&(t.contentDOM.editContext=this.editContext.editContext)),b4&&(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(wo)?r.root.activeElement!=this.dom:!Kf(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}(Ve.ie&&Ve.ie_version<=11||Ve.android&&Ve.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Xf(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=E0(t.root);if(!n)return!1;let r=Ve.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&s0e(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Kf(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Ohe(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,n0e),b4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),b4&&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&&jd(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 a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Kf(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 _fe(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=wD(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!w1(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=$T(n,t.previousSibling||t.target.previousSibling,-1),s=$T(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(wo)!=t.state.facet(wo)&&(t.view.contentDOM.editContext=t.state.facet(wo)?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 $T(e,t,n){for(;t;){let r=ar.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 PT(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor,1);return Xf(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function s0e(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return PT(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?PT(e,n):null}class i0e{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:a}=s,o=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let c=l-o>r.text.length;o==this.from&&i<this.from?o=i:l==this.to&&i>this.to&&(l=i);let u=_D(t.state.sliceDoc(o,l),r.text,(c?s.from:s.to)-o,c?"end":null);if(!u){let f=ke.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));w1(f,s)||t.dispatch({selection:f,userEvent:"select"});return}let d={from:u.from+o,to:u.toA+o,insert:en.of(r.text.slice(u.from,u.toB).split(`
`))};if((Ve.mac||Ve.android)&&d.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:o,to:l,insert:en.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!t.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);v5(t,d,ke.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 a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a<o;a++){let l=t.coordsForChar(a);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 a=i.underlineStyle,o=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(o)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(o)?1:2}px`;s.push(Gt.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:hD.of(Gt.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=E0(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,a,o,l,c)=>{if(r)return;let u=c.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(c)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(t.state);if(i+=n,a+=n,a<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),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 Ye{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||Dhe(t.parent)||document,this.viewState=new LT(this,t.state||pn.create(t)),t.scrollTo&&t.scrollTo.is(cp)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(bd).map(s=>new h4(s));for(let s of this.plugins)s.update(this);this.observer=new r0e(this),this.inputState=new Cfe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new kT(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 Or?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 a=this.hasFocus,o=0,l=null;t.some(f=>f.annotation(ED))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,l=MD(i,a),l||(o=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(pn.phrases)!=this.state.facet(pn.phrases))return this.setState(i);s=b1.create(this,i,t),s.flags|=o;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(Ye.cursorScrollMargin);d=new Dd(m.empty?m:ke.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,p)}for(let m of f.effects)m.is(cp)&&(d=m.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=k1.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(pp)!=s.state.facet(pp)&&(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(hw))try{f(s)}catch(m){hi(this.state,m,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!wD(this,u)&&c.force&&jd(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 LT(this,t),this.plugins=t.facet(bd).map(r=>new h4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new kT(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(bd),r=t.state.facet(bd);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new h4(i));else{let o=this.plugins[a];o.mustUpdate=t,s.push(o)}}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){hi(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:a}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(Yj(r||this.win))i=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(s);i=m.from,a=m.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>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 hi(this.state,p),qT}}),d=b1.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]!=qT)try{let p=c[m];p.write&&p.write(u[m],this)}catch(p){hi(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,a=-1;continue}else{let p=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-a)/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),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(hw))o(n)}get themeClasses(){return bw+" "+(this.state.facet(yw)?jD:RD)+" "+this.state.facet(pp)}updateAttrs(){let t=UT(this,fD,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(wo)?"true":"false",class:"cm-content",style:`${Ve.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),UT(this,g5,n);let r=this.observer.ignore(()=>{let s=yT(this.contentDOM,this.contentAttrs,n),i=yT(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(Ye.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(Ye.cspNonce);ac.mount(this.root,this.styleModules.concat(t0e).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 g4(this,t,ST(this,t,n,r))}moveByGroup(t,n){return g4(this,t,ST(this,t,n,r=>gfe(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 ke.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return pfe(this,t,n,r)}moveVertically(t,n,r){return g4(this,t,yfe(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=pw(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),pw(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),a=i[$a.find(i,t-s.from,-1,n)];return M0(r,a.dir==Un.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(cD)||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>a0e)return tD(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||eD(i.isolates,r=xT(this,t))))return i.order;r||(r=xT(this,t));let s=Uhe(t.text,n,r);return this.bidiCache.push(new k1(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ve.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Kj(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,a;return cp.of(new Dd(typeof t=="number"?ke.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,(a=n.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return cp.of(new Dd(ke.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 Xs.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Xs.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=ac.newName(),s=[pp.of(r),vf.of(vw(`.${r}`,t))];return n&&n.dark&&s.push(yw.of(!0)),s}static baseTheme(t){return Bu.lowest(vf.of(vw("."+bw,t,DD)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&ar.get(r)||ar.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}Ye.styleModule=vf;Ye.inputHandler=oD;Ye.clipboardInputFilter=m5;Ye.clipboardOutputFilter=p5;Ye.scrollHandler=dD;Ye.focusChangeEffect=lD;Ye.perLineTextDirection=cD;Ye.exceptionSink=aD;Ye.updateListener=hw;Ye.editable=wo;Ye.mouseSelectionStyle=iD;Ye.dragMovesSelection=sD;Ye.clickAddsSelectionRange=rD;Ye.decorations=Ny;Ye.blockWrappers=mD;Ye.outerDecorations=y5;Ye.atomicRanges=cm;Ye.bidiIsolatedRanges=pD;Ye.cursorScrollMargin=ct.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}}});Ye.scrollMargins=gD;Ye.darkTheme=yw;Ye.cspNonce=ct.define({combine:e=>e.length?e[0]:""});Ye.contentAttributes=g5;Ye.editorAttributes=fD;Ye.lineWrapping=Ye.contentAttributes.of({class:"cm-lineWrapping"});Ye.announce=Cn.define();const a0e=4096,qT={};class k1{constructor(t,n,r,s,i,a){this.from=t,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let r=[],s=t.length?t[t.length-1].dir:Un.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let a=t[i];a.dir==s&&!n.touchesRange(a.from,a.to)&&r.push(new k1(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function UT(e,t,n){for(let r=e.state.facet(t),s=r.length-1;s>=0;s--){let i=r[s],a=typeof i=="function"?i(e):i;a&&d5(a,n)}return n}const o0e=Ve.mac?"mac":Ve.windows?"win":Ve.linux?"linux":"key";function l0e(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,o;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))o=!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))a=!0;else if(/^mod$/i.test(c))t=="mac"?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),o&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function gp(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 c0e=Bu.default(Ye.domEventHandlers({keydown(e,t){return f0e(u0e(t.state),e,t,"editor")}})),I0=ct.define({enables:c0e}),HT=new WeakMap;function u0e(e){let t=e.facet(I0),n=HT.get(t);return n||HT.set(t,n=h0e(t.reduce((r,s)=>r.concat(s),[]))),n}let Tl=null;const d0e=4e3;function h0e(e,t=o0e){let n=Object.create(null),r=Object.create(null),s=(a,o)=>{let l=r[a];if(l==null)r[a]=o;else if(l!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,o,l,c,u)=>{var d,f;let m=n[a]||(n[a]=Object.create(null)),p=o.split(/ (?!$)/).map(v=>l0e(v,t));for(let v=1;v<p.length;v++){let g=p.slice(0,v).join(" ");s(g,!0),m[g]||(m[g]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=Tl={view:x,prefix:g,scope:a};return setTimeout(()=>{Tl==k&&(Tl=null)},d0e),!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 a of e){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let c of o){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=a;for(let f in u)u[f].run.push(m=>d(m,xw))}let l=a[t]||a.key;if(l)for(let c of o)i(c,l,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(c,"Shift-"+l,a.shift,a.preventDefault,a.stopPropagation)}return n}let xw=null;function f0e(e,t,n,r){xw=t;let s=Ahe(t),i=bl(s,0),a=nd(i)==s.length&&s!=" ",o="",l=!1,c=!1,u=!1;Tl&&Tl.view==n&&Tl.scope==r&&(o=Tl.prefix+" ",SD.indexOf(t.keyCode)<0&&(c=!0,Tl=null));let d=new Set,f=w=>{if(w){for(let v of w.run)if(!d.has(v)&&(d.add(v),v(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[o+gp(s,t,!a)])?l=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Ve.windows&&t.ctrlKey&&t.altKey)&&!(Ve.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=oc[t.keyCode])&&p!=s?(f(m[o+gp(p,t,!0)])||t.shiftKey&&(y=C0[t.keyCode])!=s&&y!=p&&f(m[o+gp(y,t,!1)]))&&(l=!0):a&&t.shiftKey&&f(m[o+gp(s,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),xw=null,l}class uu{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=OD(t);return[new uu(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return m0e(t,n,r)}}function OD(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Un.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function FT(e,t,n,r){let s=e.coordsAtPos(t,n*2);if(!s)return r;let i=e.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,o=e.posAtCoords({x:i.left+1,y:a}),l=e.posAtCoords({x:i.right-1,y:a});return o==null||l==null?r:{from:Math.max(r.from,Math.min(o,l)),to:Math.min(r.to,Math.max(o,l))}}function m0e(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==Un.LTR,a=e.contentDOM,o=a.getBoundingClientRect(),l=OD(e),c=a.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=o.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=o.right-(u?parseInt(u.paddingRight):0),m=mw(e,r,1),p=mw(e,s,-1),y=m.type==As.Text?m:null,w=p.type==As.Text?p:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=FT(e,r,1,y)),w&&(e.lineWrapping||p.widgetLineBreaks)&&(w=FT(e,s,-1,w)),y&&w&&y.from==w.from&&y.to==w.to)return g(x(n.from,n.to,y));{let A=y?x(n.from,null,y):k(m,!1),T=w?x(null,n.to,w):k(p,!0),C=[];return(y||m).to<(w||p).from-(y&&w?1:0)||m.widgetLineBreaks>1&&A.bottom+e.defaultLineHeight/2<T.top?C.push(v(d,A.bottom,f,T.top)):A.bottom<T.top&&e.elementAtHeight((A.bottom+T.top)/2).type==As.Text&&(A.bottom=T.top=(A.bottom+T.top)/2),g(A).concat(C).concat(g(T))}function v(A,T,C,j){return new uu(t,A-l.left,T-l.top,Math.max(0,C-A),j-T)}function g({top:A,bottom:T,horizontal:C}){let j=[];for(let z=0;z<C.length;z+=2)j.push(v(C[z],A,C[z+1],T));return j}function x(A,T,C){let j=1e9,z=-1e9,E=[];function P(W,J,Y,Z,Q){let L=e.coordsAtPos(W,W==C.to?-2:2),R=e.coordsAtPos(Y,Y==C.from?2:-2);!L||!R||(j=Math.min(L.top,R.top,j),z=Math.max(L.bottom,R.bottom,z),Q==Un.LTR?E.push(i&&J?d:L.left,i&&Z?f:R.right):E.push(!i&&Z?d:R.left,!i&&J?f:L.right))}let D=A??C.from,H=T??C.to;for(let W of e.visibleRanges)if(W.to>D&&W.from<H)for(let J=Math.max(W.from,D),Y=Math.min(W.to,H);;){let Z=e.state.doc.lineAt(J);for(let Q of e.bidiSpans(Z)){let L=Q.from+Z.from,R=Q.to+Z.from;if(L>=Y)break;R>J&&P(Math.max(L,J),A==null&&L<=D,Math.min(R,Y),T==null&&R>=H,Q.dir)}if(J=Z.to+1,J>=Y)break}return E.length==0&&P(D,A==null,H,T==null,e.textDirection),{top:j,bottom:z,horizontal:E}}function k(A,T){let C=o.top+(T?A.top:A.bottom);return{top:C,bottom:C,horizontal:[]}}}function p0e(e,t){return e.constructor==t.constructor&&e.eq(t)}class g0e{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(tg)!=t.state.facet(tg)&&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(tg);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)=>!p0e(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,Ve.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const tg=ct.define();function LD(e){return[Xs.define(t=>new g0e(t,e)),tg.of(e)]}const ah=ct.define({combine(e){return Ey(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function y0e(e={}){return[ah.of(e),b0e,v0e,x0e,uD.of(!0)]}function BD(e){return e.startState.facet(ah)!=e.state.facet(ah)}const b0e=LD({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&&Ve.ios&&n.iosSelectionHandles)){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=s.empty?s:ke.cursor(s.head,s.assoc);for(let l of uu.forRange(e,a,o))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=BD(e);return n&&VT(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){VT(t.state,e)},class:"cm-cursorLayer"});function VT(e,t){t.style.animationDuration=e.facet(ah).cursorBlinkRate+"ms"}const v0e=LD({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 uu.forRange(e,"cm-selectionBackground",s))t.push(i);if(Ve.ios&&!n.empty&&e.state.facet(ah).iosSelectionHandles){for(let s of uu.forRange(e,"cm-selectionHandle cm-selectionHandle-start",ke.cursor(n.from,1)))t.push(s);for(let s of uu.forRange(e,"cm-selectionHandle cm-selectionHandle-end",ke.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||BD(e)},class:"cm-selectionLayer"}),x0e=Bu.highest(Ye.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 WT(e,t,n,r,s){t.lastIndex=0;for(let i=e.iterRange(n,r),a=n,o;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;o=t.exec(i.value);)s(a+o.index,o)}function w0e(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 _0e{constructor(t){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=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=(o,l,c,u)=>s(u,c,c+o[0].length,o,l);else if(typeof r=="function")this.addMatch=(o,l,c,u)=>{let d=r(o,l,c);d&&u(c,c+o[0].length,d)};else if(r)this.addMatch=(o,l,c,u)=>u(c,c+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(t){let n=new xu,r=n.add.bind(n);for(let{from:s,to:i}of w0e(t,this.maxLength))WT(t.state.doc,this.regexp,s,i,(a,o)=>this.addMatch(o,t,a,r));return n.finish()}updateDeco(t,n){let r=1e9,s=-1;return t.docChanged&&t.changes.iterChanges((i,a,o,l)=>{l>=t.view.viewport.from&&o<=t.view.viewport.to&&(r=Math.min(o,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 a=Math.max(i.from,r),o=Math.min(i.to,s);if(o>=a){let l=t.state.doc.lineAt(a),c=l.to<o?t.state.doc.lineAt(o):l,u=Math.max(i.from,l.from),d=Math.min(i.to,c.to);if(this.boundary){for(;a>l.from;a--)if(this.boundary.test(l.text[a-1-l.from])){u=a;break}for(;o<c.to;o++)if(this.boundary.test(c.text[o-c.from])){d=o;break}}let f=[],m,p=(y,w,v)=>f.push(v.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 WT(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 ww=/x/.unicode!=null?"gu":"g",k0e=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,ww),S0e={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let v4=null;function T0e(){var e;if(v4==null&&typeof document<"u"&&document.body){let t=document.body.style;v4=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return v4||!1}const ng=ct.define({combine(e){let t=Ey(e,{render:null,specialChars:k0e,addSpecialChars:null});return(t.replaceTabs=!T0e())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,ww)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,ww)),t}});function C0e(e={}){return[ng.of(e),A0e()]}let GT=null;function A0e(){return GT||(GT=Xs.fromClass(class{constructor(e){this.view=e,this.decorations=Gt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(ng)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new _0e({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=bl(t[0],0);if(i==9){let a=s.lineAt(r),o=n.state.tabSize,l=am(a.text,o,r-a.from);return Gt.replace({widget:new I0e((o-l%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=Gt.replace({widget:new N0e(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(ng);e.startState.facet(ng)!=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 E0e="•";function M0e(e){return e>=32?E0e:e==10?"␤":String.fromCharCode(9216+e)}class N0e extends eo{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=M0e(this.code),r=t.state.phrase("Control character")+" "+(S0e[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 I0e extends eo{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 R0e extends eo{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?Yf(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=M0(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 KT(e){let t=Xs.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Gt.set([Gt.widget({widget:new R0e(e),side:1}).range(0)]):Gt.none}get decorations(){return this.view.state.doc.length?Gt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Ye.contentAttributes.of({"aria-placeholder":e})]:t}const yp="-10000px";class j0e{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(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,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 a=[],o=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)a[l]=this.createTooltipView(c,l?a[l-1]:null),o&&(o[l]=!!c.above);else{let d=a[l]=this.tooltipViews[u];o&&(o[l]=n[u]),d.update&&d.update(t)}}}for(let l of this.tooltipViews)a.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(o.forEach((l,c)=>n[c]=l),n.length=o.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function D0e(e={}){return rg.of(e)}function O0e(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const rg=ct.define({combine:e=>{var t,n,r;return{position:Ve.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)||O0e}}}),YT=new WeakMap,zD=Xs.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(rg);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 j0e(e,$D,(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(rg);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=yp,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(Ve.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.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=b5(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,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(rg).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let l=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:u}=c,d=e.pos[o],f=e.size[o];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=yp;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,y=f.right-f.left,w=(t=YT.get(c))!==null&&t!==void 0?t:f.bottom-f.top,v=c.offset||B0e,g=this.view.textDirection==Un.LTR,x=f.width>r.right-r.left?g?r.left:r.right-f.width:g?Math.max(r.left,Math.min(d.left-(m?14:0)+v.x,r.right-y)):Math.min(Math.max(r.left,d.left-y+(m?14:0)-v.x),r.right-y),k=this.above[o];!l.strictSide&&(k?d.top-w-p-v.y<r.top:d.bottom+w+p+v.y>r.bottom)&&k==r.bottom-d.bottom>d.top-r.top&&(k=this.above[o]=!k);let A=(k?d.top-r.top:r.bottom-d.bottom)-p;if(A<w&&c.resize!==!1){if(A<this.view.defaultLineHeight){u.style.top=yp;continue}YT.set(c,w),u.style.height=(w=A)/i+"px"}else u.style.height&&(u.style.height="");let T=k?d.top-w-p-v.y:d.bottom+p+v.y,C=x+y;if(c.overlap!==!0)for(let j of a)j.left<C&&j.right>x&&j.top<T+w&&j.bottom>T&&(T=k?j.top-w-2-p:j.bottom+p+2);if(this.position=="absolute"?(u.style.top=(T-e.parent.top)/i+"px",XT(u,(x-e.parent.left)/s)):(u.style.top=T/i+"px",XT(u,x/s)),m){let j=d.left+(g?v.x:-v.x)-(x+14-7);m.style.left=j/s+"px"}c.overlap!==!0&&a.push({left:x,top:T,right:C,bottom:T+w}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),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=yp}},{eventObservers:{scroll(){this.maybeMeasure()}}});function XT(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const L0e=Ye.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"}}}),B0e={x:0,y:0},$D=ct.define({enables:[zD,L0e]});function PD(e,t){let n=e.plugin(zD);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}class oh extends ic{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}oh.prototype.elementClass="";oh.prototype.toDOM=void 0;oh.prototype.mapMode=ui.TrackBefore;oh.prototype.startSide=oh.prototype.endSide=-1;oh.prototype.point=!0;const z0e=1024;let $0e=0;class x4{constructor(t,n){this.from=t,this.to=n}}class Zt{constructor(t={}){this.id=$0e++,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=Xi.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}Zt.closedBy=new Zt({deserialize:e=>e.split(" ")});Zt.openedBy=new Zt({deserialize:e=>e.split(" ")});Zt.group=new Zt({deserialize:e=>e.split(" ")});Zt.isolate=new Zt({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Zt.contextHash=new Zt({perNode:!0});Zt.lookAhead=new Zt({perNode:!0});Zt.mounted=new Zt({perNode:!0});class Jf{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[Zt.mounted.id]}}const P0e=Object.create(null);class Xi{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):P0e,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new Xi(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(Zt.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(Zt.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}Xi.none=new Xi("",Object.create(null),0,8);const bp=new WeakMap,QT=new WeakMap;var dr;(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"})(dr||(dr={}));class ns{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[a,o]of i)this.props[typeof a=="number"?a:a.id]=o}}toString(){let t=Jf.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 kw(this.topNode,t)}cursorAt(t,n=0,r=0){let s=bp.get(this)||this.topNode,i=new kw(s);return i.moveTo(t,n),bp.set(this,i._tree),i}get topNode(){return new Wi(this,0,0,null)}resolve(t,n=0){let r=R0(bp.get(this)||this.topNode,t,n,!1);return bp.set(this,r),r}resolveInner(t,n=0){let r=R0(QT.get(this)||this.topNode,t,n,!0);return QT.set(this,r),r}resolveStack(t,n=0){return H0e(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,a=t.mode||0,o=(a&dr.IncludeAnonymous)>0;for(let l=this.cursor(a|dr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!o&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(o||!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:S5(Xi.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new ns(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new ns(Xi.none,n,r,s)))}static build(t){return F0e(t)}}ns.empty=new ns(Xi.none,[],[],0);class _5{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 _5(this.buffer,this.index)}}class cc{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return Xi.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 a=[];for(;t<r;)a.push(this.childString(t)),t=this.buffer[t+3];return i+"("+a.join(",")+")"}findChild(t,n,r,s,i){let{buffer:a}=this,o=-1;for(let l=t;l!=n&&!(qD(i,s,a[l+1],a[l+2])&&(o=l,r>0));l=a[l+3]);return o}slice(t,n,r){let s=this.buffer,i=new Uint16Array(n-t),a=0;for(let o=t,l=0;o<n;){i[l++]=s[o++],i[l++]=s[o++]-r;let c=i[l++]=s[o++]-r;i[l++]=s[o++]-t,a=Math.max(a,c)}return new cc(i,a,this.set)}}function qD(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 R0(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 a=!r&&e instanceof Wi&&e.index<0?null:e.parent;if(!a)return e;e=a}let i=r?0:dr.IgnoreOverlays;if(r)for(let a=e,o=a.parent;o;a=o,o=a.parent)a instanceof Wi&&a.index<0&&((s=o.enter(t,n,i))===null||s===void 0?void 0:s.from)!=a.from&&(e=o);for(;;){let a=e.enter(t,n,i);if(!a)return e;e=a}}class UD{cursor(t=0){return new kw(this,t)}getChild(t,n=null,r=null){let s=JT(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return JT(this,t,n,r)}resolve(t,n=0){return R0(this,t,n,!1)}resolveInner(t,n=0){return R0(this,t,n,!0)}matchContext(t){return _w(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 Wi extends UD{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 a=this;;){for(let{children:o,positions:l}=a._tree,c=n>0?o.length:-1;t!=c;t+=n){let u=o[t],d=l[t]+a.from,f;if(!(!(i&dr.EnterBracketed&&u instanceof ns&&(f=Jf.get(u))&&!f.overlay&&f.bracketed&&r>=d&&r<=d+u.length)&&!qD(s,r,d,d+u.length))){if(u instanceof cc){if(i&dr.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,n,r-d,s);if(m>-1)return new Ol(new q0e(a,u,t,d),null,m)}else if(i&dr.IncludeAnonymous||!u.type.isAnonymous||k5(u)){let m;if(!(i&dr.IgnoreMounts)&&(m=Jf.get(u))&&!m.overlay)return new Wi(m.tree,d,t,a);let p=new Wi(u,d,t,a);return i&dr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&dr.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))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&dr.IgnoreOverlays)&&(s=Jf.get(this._tree))&&s.overlay){let i=t-this.from,a=r&dr.EnterBracketed&&s.bracketed;for(let{from:o,to:l}of s.overlay)if((n>0||a?o<=i:o<i)&&(n<0||a?l>=i:l>i))return new Wi(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 JT(e,t,n,r){let s=e.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=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 _w(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 q0e{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class Ol extends UD{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 Ol(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&dr.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 Ol(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 Ol(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 Ol(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 a=r.buffer[this.index+1];t.push(r.slice(s,i,a)),n.push(0)}return new ns(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function HD(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let a=e[i];(a.from>n.from||a.to<n.to)&&(n=a,t=i)}let r=n instanceof Wi&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new U0e(s,n)}class U0e{constructor(t,n){this.heads=t,this.node=n}get next(){return HD(this.heads)}}function H0e(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof Wi?r:r.context.parent;i;i=i.parent)if(i.index<0){let a=i.parent;(s||(s=[r])).push(a.resolve(t,n)),i=a}else{let a=Jf.get(i.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Wi(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(R0(o,t,n,!1))}}return s?HD(s):r}class kw{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&~dr.EnterBracketed,t instanceof Wi)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 Wi?(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&dr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&dr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&dr.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,a=t<0?-1:r._tree.children.length;i!=a;i+=t){let o=r._tree.children[i];if(this.mode&dr.IncludeAnonymous||o instanceof cc||!o.type.isAnonymous||k5(o))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 a=t;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new Ol(this.buffer,n,this.stack[s]);return this.bufferNode=new Ol(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 _w(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 _w(this._tree,t,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(t[s]&&t[s]!=a.name)return!1;s--}}return!0}}function k5(e){return e.children.some(t=>t instanceof cc||!t.type.isAnonymous||k5(t))}function F0e(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=z0e,reused:i=[],minRepeatType:a=r.types.length}=e,o=Array.isArray(n)?new _5(n,n.length):n,l=r.types,c=0,u=0;function d(A,T,C,j,z,E){let{id:P,start:D,end:H,size:W}=o,J=u,Y=c;if(W<0)if(o.next(),W==-1){let $=i[P];C.push($),j.push(D-A);return}else if(W==-3){c=P;return}else if(W==-4){u=P;return}else throw new RangeError(`Unrecognized record size: ${W}`);let Z=l[P],Q,L,R=D-A;if(H-D<=s&&(L=w(o.pos-T,z))){let $=new Uint16Array(L.size-L.skip),I=o.pos-L.size,M=$.length;for(;o.pos>I;)M=v(L.start,$,M);Q=new cc($,H-L.start,r),R=L.start-A}else{let $=o.pos-W;o.next();let I=[],M=[],G=P>=a?P:-1,ne=0,fe=H;for(;o.pos>$;)G>=0&&o.id==G&&o.size>=0?(o.end<=fe-s&&(p(I,M,D,ne,o.end,fe,G,J,Y),ne=I.length,fe=o.end),o.next()):E>2500?f(D,$,I,M):d(D,$,I,M,G,E+1);if(G>=0&&ne>0&&ne<I.length&&p(I,M,D,ne,D,fe,G,J,Y),I.reverse(),M.reverse(),G>-1&&ne>0){let Pe=m(Z,Y);Q=S5(Z,I,M,0,I.length,0,H-D,Pe,Pe)}else Q=y(Z,I,M,H-D,J-H,Y)}C.push(Q),j.push(R)}function f(A,T,C,j){let z=[],E=0,P=-1;for(;o.pos>T;){let{id:D,start:H,end:W,size:J}=o;if(J>4)o.next();else{if(P>-1&&H<P)break;P<0&&(P=W-s),z.push(D,H,W),E++,o.next()}}if(E){let D=new Uint16Array(E*4),H=z[z.length-2];for(let W=z.length-3,J=0;W>=0;W-=3)D[J++]=z[W],D[J++]=z[W+1]-H,D[J++]=z[W+2]-H,D[J++]=J;C.push(new cc(D,z[2]-H,r)),j.push(H-A)}}function m(A,T){return(C,j,z)=>{let E=0,P=C.length-1,D,H;if(P>=0&&(D=C[P])instanceof ns){if(!P&&D.type==A&&D.length==z)return D;(H=D.prop(Zt.lookAhead))&&(E=j[P]+D.length+H)}return y(A,C,j,z,E,T)}}function p(A,T,C,j,z,E,P,D,H){let W=[],J=[];for(;A.length>j;)W.push(A.pop()),J.push(T.pop()+C-z);A.push(y(r.types[P],W,J,E-z,D-E,H)),T.push(z-C)}function y(A,T,C,j,z,E,P){if(E){let D=[Zt.contextHash,E];P=P?[D].concat(P):[D]}if(z>25){let D=[Zt.lookAhead,z];P=P?[D].concat(P):[D]}return new ns(A,T,C,j,P)}function w(A,T){let C=o.fork(),j=0,z=0,E=0,P=C.end-s,D={size:0,start:0,skip:0};e:for(let H=C.pos-A;C.pos>H;){let W=C.size;if(C.id==T&&W>=0){D.size=j,D.start=z,D.skip=E,E+=4,j+=4,C.next();continue}let J=C.pos-W;if(W<0||J<H||C.start<P)break;let Y=C.id>=a?4:0,Z=C.start;for(C.next();C.pos>J;){if(C.size<0)if(C.size==-3||C.size==-4)Y+=4;else break e;else C.id>=a&&(Y+=4);C.next()}z=Z,j+=W,E+=Y}return(T<0||j==A)&&(D.size=j,D.start=z,D.skip=E),D.size>4?D:void 0}function v(A,T,C){let{id:j,start:z,end:E,size:P}=o;if(o.next(),P>=0&&j<a){let D=C;if(P>4){let H=o.pos-(P-4);for(;o.pos>H;)C=v(A,T,C)}T[--C]=D,T[--C]=E-A,T[--C]=z-A,T[--C]=j}else P==-3?c=j:P==-4&&(u=j);return C}let g=[],x=[];for(;o.pos>0;)d(e.start||0,e.bufferStart||0,g,x,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:g.length?x[0]+g[0].length:0;return new ns(l[e.topID],g.reverse(),x.reverse(),k)}const ZT=new WeakMap;function sg(e,t){if(!e.isAnonymous||t instanceof cc||t.type!=e)return 1;let n=ZT.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof ns)){n=1;break}n+=sg(e,r)}ZT.set(t,n)}return n}function S5(e,t,n,r,s,i,a,o,l){let c=0;for(let p=r;p<s;p++)c+=sg(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],f=[];function m(p,y,w,v,g){for(let x=w;x<v;){let k=x,A=y[x],T=sg(e,p[x]);for(x++;x<v;x++){let C=sg(e,p[x]);if(T+C>=u)break;T+=C}if(x==k+1){if(T>u){let C=p[k];m(C.children,C.positions,0,C.children.length,y[k]+g);continue}d.push(p[k])}else{let C=y[x-1]+p[x-1].length-A;d.push(S5(e,p,y,k,x,A,C,null,l))}f.push(A+g-i)}}return m(t,n,r,s,0),(o||l)(d,f,a)}class du{constructor(t,n,r,s,i=!1,a=!1){this.from=t,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?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 du(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,a=t.length?t[0]:null;for(let o=0,l=0,c=0;;o++){let u=o<n.length?n[o]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;a&&a.from<d;){let f=a;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 du(m,p,f.tree,f.offset+c,o>0,!!u)}if(f&&s.push(f),a.to>d)break;a=i<t.length?t[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class V0e{startParse(t,n,r){return typeof t=="string"&&(t=new W0e(t)),r=r?r.length?r.map(s=>new x4(s.from,s.to)):[new x4(0,0)]:[new x4(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 W0e{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 Zt({perNode:!0});let G0e=0;class Oi{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=G0e++}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 Oi&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new Oi(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 S1(t);return r=>r.modified.indexOf(n)>-1?r:S1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let K0e=0;class S1{constructor(t){this.name=t,this.instances=[],this.id=K0e++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(o=>o.base==t&&Y0e(n,o.modified));if(r)return r;let s=[],i=new Oi(t.name,s,t,n);for(let o of n)o.instances.push(i);let a=X0e(n);for(let o of t.set)if(!o.modified.length)for(let l of a)s.push(S1.get(o,l));return i}}function Y0e(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function X0e(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 Q0e(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=[],a=2,o=s;for(let d=0;;){if(o=="..."&&d>0&&d+3==s.length){a=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);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=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+s);o=s.slice(d)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new j0(r,a,l>0?i.slice(0,l):null);t[c]=u.sort(t[c])}}return FD.add(t)}const FD=new Zt({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 j0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class j0{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}}j0.empty=new j0([],2,null);function VD(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 a of i.tag)n[a.id]=i.class;let{scope:r,all:s=null}=t||{};return{style:i=>{let a=s;for(let o of i)for(let l of o.set){let c=n[l.id];if(c){a=a?a+" "+c:c;break}}return a},scope:r}}function J0e(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function Z0e(e,t,n,r=0,s=e.length){let i=new eme(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class eme{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:a,from:o,to:l}=t;if(o>=r||l<=n)return;a.isTop&&(i=this.highlighters.filter(m=>!m.scope||m.scope(a)));let c=s,u=tme(t)||j0.empty,d=J0e(i,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(n,o),c),u.opaque)return;let f=t.tree&&t.tree.prop(Zt.mounted);if(f&&f.overlay){let m=t.node.enter(f.overlay[0].from+o,1),p=this.highlighters.filter(w=>!w.scope||w.scope(f.tree.type)),y=t.firstChild();for(let w=0,v=o;;w++){let g=w<f.overlay.length?f.overlay[w]:null,x=g?g.from+o:l,k=Math.max(n,v),A=Math.min(r,x);if(k<A&&y)for(;t.from<A&&(this.highlightRange(t,k,A,s,i),this.startSpan(Math.min(A,t.to),c),!(t.to>=x||!t.nextSibling())););if(!g||x>r)break;v=g.to+o,v>n&&(this.highlightRange(m.cursor(),Math.max(n,g.from+o),Math.min(r,v),"",p),this.startSpan(Math.min(r,v),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 tme(e){let t=e.type.prop(FD);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const De=Oi.define,vp=De(),vl=De(),e9=De(vl),t9=De(vl),xl=De(),xp=De(xl),w4=De(xl),Ea=De(),Lc=De(Ea),Sa=De(),Ta=De(),Sw=De(),of=De(Sw),wp=De(),$e={comment:vp,lineComment:De(vp),blockComment:De(vp),docComment:De(vp),name:vl,variableName:De(vl),typeName:e9,tagName:De(e9),propertyName:t9,attributeName:De(t9),className:De(vl),labelName:De(vl),namespace:De(vl),macroName:De(vl),literal:xl,string:xp,docString:De(xp),character:De(xp),attributeValue:De(xp),number:w4,integer:De(w4),float:De(w4),bool:De(xl),regexp:De(xl),escape:De(xl),color:De(xl),url:De(xl),keyword:Sa,self:De(Sa),null:De(Sa),atom:De(Sa),unit:De(Sa),modifier:De(Sa),operatorKeyword:De(Sa),controlKeyword:De(Sa),definitionKeyword:De(Sa),moduleKeyword:De(Sa),operator:Ta,derefOperator:De(Ta),arithmeticOperator:De(Ta),logicOperator:De(Ta),bitwiseOperator:De(Ta),compareOperator:De(Ta),updateOperator:De(Ta),definitionOperator:De(Ta),typeOperator:De(Ta),controlOperator:De(Ta),punctuation:Sw,separator:De(Sw),bracket:of,angleBracket:De(of),squareBracket:De(of),paren:De(of),brace:De(of),content:Ea,heading:Lc,heading1:De(Lc),heading2:De(Lc),heading3:De(Lc),heading4:De(Lc),heading5:De(Lc),heading6:De(Lc),contentSeparator:De(Ea),list:De(Ea),quote:De(Ea),emphasis:De(Ea),strong:De(Ea),link:De(Ea),monospace:De(Ea),strikethrough:De(Ea),inserted:De(),deleted:De(),changed:De(),invalid:De(),meta:wp,documentMeta:De(wp),annotation:De(wp),processingInstruction:De(wp),definition:Oi.defineModifier("definition"),constant:Oi.defineModifier("constant"),function:Oi.defineModifier("function"),standard:Oi.defineModifier("standard"),local:Oi.defineModifier("local"),special:Oi.defineModifier("special")};for(let e in $e){let t=$e[e];t instanceof Oi&&(t.name=e)}VD([{tag:$e.link,class:"tok-link"},{tag:$e.heading,class:"tok-heading"},{tag:$e.emphasis,class:"tok-emphasis"},{tag:$e.strong,class:"tok-strong"},{tag:$e.keyword,class:"tok-keyword"},{tag:$e.atom,class:"tok-atom"},{tag:$e.bool,class:"tok-bool"},{tag:$e.url,class:"tok-url"},{tag:$e.labelName,class:"tok-labelName"},{tag:$e.inserted,class:"tok-inserted"},{tag:$e.deleted,class:"tok-deleted"},{tag:$e.literal,class:"tok-literal"},{tag:$e.string,class:"tok-string"},{tag:$e.number,class:"tok-number"},{tag:[$e.regexp,$e.escape,$e.special($e.string)],class:"tok-string2"},{tag:$e.variableName,class:"tok-variableName"},{tag:$e.local($e.variableName),class:"tok-variableName tok-local"},{tag:$e.definition($e.variableName),class:"tok-variableName tok-definition"},{tag:$e.special($e.variableName),class:"tok-variableName2"},{tag:$e.definition($e.propertyName),class:"tok-propertyName tok-definition"},{tag:$e.typeName,class:"tok-typeName"},{tag:$e.namespace,class:"tok-namespace"},{tag:$e.className,class:"tok-className"},{tag:$e.macroName,class:"tok-macroName"},{tag:$e.propertyName,class:"tok-propertyName"},{tag:$e.operator,class:"tok-operator"},{tag:$e.comment,class:"tok-comment"},{tag:$e.meta,class:"tok-meta"},{tag:$e.invalid,class:"tok-invalid"},{tag:$e.punctuation,class:"tok-punctuation"}]);var _4;const wf=new Zt,nme=new Zt;class Pa{constructor(t,n,r=[],s=""){this.data=t,this.name=s,pn.prototype.hasOwnProperty("tree")||Object.defineProperty(pn.prototype,"tree",{get(){return da(this)}}),this.parser=n,this.extension=[ch.of(this),pn.languageData.of((i,a,o)=>{let l=n9(i,a,o),c=l.type.prop(wf);if(!c)return[];let u=i.facet(c),d=l.type.prop(nme);if(d){let f=l.resolve(a-l.from,o);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 n9(t,n,r).type.prop(wf)==this.data}findRegions(t){let n=t.facet(ch);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,a)=>{if(i.prop(wf)==this.data){r.push({from:a,to:a+i.length});return}let o=i.prop(Zt.mounted);if(o){if(o.tree.prop(wf)==this.data){if(o.overlay)for(let l of o.overlay)r.push({from:l.from+a,to:l.to+a});else r.push({from:a,to:a+i.length});return}else if(o.overlay){let l=r.length;if(s(o.tree,o.overlay[0].from+a),r.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof ns&&s(c,i.positions[l]+a)}};return s(da(t),0),r}get allowsNesting(){return!0}}Pa.setState=Cn.define();function n9(e,t,n){let r=e.facet(ch),s=da(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,dr.ExcludeBuffers|dr.EnterBracketed))i.type.isTop&&(s=i);return s}function da(e){let t=e.field(Pa.state,!1);return t?t.tree:ns.empty}class rme{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 lf=null;class T1{constructor(t,n,r=[],s,i,a,o,l){this.parser=t,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new T1(t,n,[],ns.empty,0,r,[],null)}startParse(){return this.parser.startParse(new rme(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ns.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(du.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(du.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=lf;lf=this;try{return t()}finally{lf=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=r9(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:o}=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=du.applyChanges(r,l),s=ns.empty,i=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.to,1)},this.skipped.length){o=[];for(let c of this.skipped){let u=t.mapPos(c.from,1),d=t.mapPos(c.to,-1);u<d&&o.push({from:u,to:d})}}}return new T1(this.parser,n,r,s,i,a,o,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=r9(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 V0e{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let l=lf;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=a,new ns(Xi.none,[],[],a-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 lf}}function r9(e,t,n){return du.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class lh{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 lh(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=T1.create(t.facet(ch).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new lh(r)}}Pa.state=Za.define({create:lh.init,update(e,t){for(let n of t.effects)if(n.is(Pa.setState))return n.value;return t.startState.facet(ch)!=t.state.facet(ch)?lh.init(t.state):e.apply(t)}});let WD=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(WD=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const k4=typeof navigator<"u"&&(!((_4=navigator.scheduling)===null||_4===void 0)&&_4.isInputPending)?()=>navigator.scheduling.isInputPending():null,sme=Xs.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(Pa.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(Pa.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=WD(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(Pa.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,t&&!k4?Math.max(25,t.timeRemaining()-5):1e9),o=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>k4&&k4()||Date.now()>a,s+(o?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Pa.setState.of(new lh(i.context))})),this.chunkBudget>0&&!(l&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>hi(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()}}}),ch=ct.define({combine(e){return e.length?e[0]:null},enables:e=>[Pa.state,sme,Ye.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),ime=ct.define(),T5=ct.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 C1(e){let t=e.facet(T5);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function A1(e,t){let n="",r=e.tabSize,s=e.facet(T5)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function GD(e,t){e instanceof pn&&(e=new Dy(e));for(let r of e.state.facet(ime)){let s=r(e,t);if(s!==void 0)return s}let n=da(e.state);return n.length>=t?ome(e,n,t):null}class Dy{constructor(t,n={}){this.state=t,this.options=n,this.unit=C1(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),a=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return a>-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(t,n=t.length){return am(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 a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ame=new Zt;function ome(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 a=s;a&&!(a.from<r.node.from||a.to>r.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return KD(r,e,n)}function KD(e,t,n){for(let r=e;r;r=r.next){let s=cme(r.node);if(s)return s(C5.create(t,n,r))}return 0}function lme(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function cme(e){let t=e.type.prop(ame);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Zt.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>fme(a,!0,1,void 0,i&&!lme(a)?s.from:void 0)}return e.parent==null?ume:null}function ume(){return 0}class C5 extends Dy{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 C5(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(dme(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return KD(this.context.next,this.base,this.pos)}}function dme(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function hme(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),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let o=n.to;;){let l=t.childAfter(o);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=a)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}o=l.to}}function fme(e,t,n,r,s){let i=e.textAfter,a=i.match(/^\s*/)[0].length,o=r&&i.slice(a,a+r.length)==r||s==e.pos+a,l=hme(e);return l?o?e.column(l.from):e.column(l.to):e.baseIndent+(o?0:e.unit*n)}class Oy{constructor(t,n){this.specs=t;let r;function s(o){let l=ac.newName();return(r||(r=Object.create(null)))["."+l]=o,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Pa?o=>o.prop(wf)==a.data:a?o=>o==a:void 0,this.style=VD(t.map(o=>({tag:o.tag,class:o.class||s(Object.assign({},o,{tag:null}))})),{all:i}).style,this.module=r?new ac(r):null,this.themeType=n.themeType}static define(t,n){return new Oy(t,n||{})}}const Tw=ct.define(),YD=ct.define({combine(e){return e.length?[e[0]]:null}});function S4(e){let t=e.facet(Tw);return t.length?t:e.facet(YD)}function mme(e,t){let n=[gme],r;return e instanceof Oy&&(e.module&&n.push(Ye.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(YD.of(e)):r?n.push(Tw.computeN([Ye.darkTheme],s=>s.facet(Ye.darkTheme)==(r=="dark")?[e]:[])):n.push(Tw.of(e)),n}class pme{constructor(t){this.markCache=Object.create(null),this.tree=da(t.state),this.decorations=this.buildDeco(t,S4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=da(t.state),r=S4(t.state),s=r!=S4(t.startState),{viewport:i}=t.view,a=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=a):(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 Gt.none;let r=new xu;for(let{from:s,to:i}of t.visibleRanges)Z0e(this.tree,n,(a,o,l)=>{r.add(a,o,this.markCache[l]||(this.markCache[l]=Gt.mark({class:l})))},s,i);return r.finish()}}const gme=Bu.high(Xs.fromClass(pme,{decorations:e=>e.decorations})),yme=Oy.define([{tag:$e.meta,color:"#404740"},{tag:$e.link,textDecoration:"underline"},{tag:$e.heading,textDecoration:"underline",fontWeight:"bold"},{tag:$e.emphasis,fontStyle:"italic"},{tag:$e.strong,fontWeight:"bold"},{tag:$e.strikethrough,textDecoration:"line-through"},{tag:$e.keyword,color:"#708"},{tag:[$e.atom,$e.bool,$e.url,$e.contentSeparator,$e.labelName],color:"#219"},{tag:[$e.literal,$e.inserted],color:"#164"},{tag:[$e.string,$e.deleted],color:"#a11"},{tag:[$e.regexp,$e.escape,$e.special($e.string)],color:"#e40"},{tag:$e.definition($e.variableName),color:"#00f"},{tag:$e.local($e.variableName),color:"#30a"},{tag:[$e.typeName,$e.namespace],color:"#085"},{tag:$e.className,color:"#167"},{tag:[$e.special($e.variableName),$e.macroName],color:"#256"},{tag:$e.definition($e.propertyName),color:"#00c"},{tag:$e.comment,color:"#940"},{tag:$e.invalid,color:"#f00"}]),bme=1e4,vme="()[]{}",xme=new Zt;function Cw(e,t,n){let r=e.prop(t<0?Zt.openedBy:Zt.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 Aw(e){let t=e.type.prop(xme);return t?t(e.node):e}function vd(e,t,n,r={}){let s=r.maxScanDistance||bme,i=r.brackets||vme,a=da(e),o=a.resolveInner(t,n);for(let l=o;l;l=l.parent){let c=Cw(l.type,n,i);if(c&&l.from<l.to){let u=Aw(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return wme(e,t,n,l,u,c,i)}}return _me(e,t,n,a,o.type,s,i)}function wme(e,t,n,r,s,i,a){let o=r.parent,l={from:s.from,to:s.to},c=0,u=o==null?void 0:o.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=Aw(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(Cw(u.type,n,a))c++;else if(Cw(u.type,-n,a)){if(c==0){let d=Aw(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 _me(e,t,n,r,s,i,a){if(n<0?!t:t==e.doc.length)return null;let o=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=a.indexOf(o);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 v=a.indexOf(m[y]);if(!(v<0||r.resolveInner(p+y,1).type!=s))if(v%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+y,to:p+y+1},matched:v>>1==l>>1};d--}}n>0&&(f+=m.length)}return u.done?{start:c,matched:!1}:null}const kme=Object.create(null),s9=[Xi.none],i9=[],a9=Object.create(null),Sme=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"]])Sme[e]=Tme(kme,t);function T4(e,t){i9.indexOf(e)>-1||(i9.push(e),console.warn(t))}function Tme(e,t){let n=[];for(let o of t.split(" ")){let l=[];for(let c of o.split(".")){let u=e[c]||$e[c];u?typeof u=="function"?l.length?l=l.map(u):T4(c,`Modifier ${c} used at start of tag`):l.length?T4(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:T4(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(o=>o.id),i=a9[s];if(i)return i.id;let a=a9[s]=Xi.define({id:s9.length,name:r,props:[Q0e({[r]:n})]});return s9.push(a),a.id}Un.RTL,Un.LTR;const Cme=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=E5(e.state,n.from);return r.line?Ame(e):r.block?Mme(e):!1};function A5(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 Ame=A5(Rme,0),Eme=A5(XD,0),Mme=A5((e,t)=>XD(e,t,Ime(t)),0);function E5(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const cf=50;function Nme(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-cf,r),a=e.sliceDoc(s,s+cf),o=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(a)[0].length,c=i.length-o;if(i.slice(c-t.length,c)==t&&a.slice(l,l+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+l,margin:l&&1}};let u,d;s-r<=2*cf?u=d=e.sliceDoc(r,s):(u=e.sliceDoc(r,r+cf),d=e.sliceDoc(s-cf,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 Ime(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 XD(e,t,n=t.selection.ranges){let r=n.map(i=>E5(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Nme(t,r[a],i.from,i.to));if(e!=2&&!s.every(i=>i))return{changes:t.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(e!=1&&s.some(i=>i)){let i=[];for(let a=0,o;a<s.length;a++)if(o=s[a]){let l=r[a],{open:c,close:u}=o;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 Rme(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:a}of n){let o=r.length,l=1e9,c;for(let u=i;u<=a;){let d=t.doc.lineAt(u);if(c==null&&(c=E5(t,d.from).line,!c))continue e;if(d.from>s&&(i==a||a>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=o;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==o+1&&(r[o].single=!0)}if(e!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:o,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&i.push({from:o.from+c,insert:l+" "});let a=t.changes(i);return{changes:a,selection:t.selection.map(a,1)}}else if(e!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:o,token:l}of r)if(o>=0){let c=a.from+o,u=c+l.length;a.text[u-a.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const Ew=Yo.define(),jme=Yo.define(),Dme=ct.define(),QD=ct.define({combine(e){return Ey(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)})}}),JD=Za.define({create(){return qa.empty},update(e,t){let n=t.state.facet(QD),r=t.annotation(Ew);if(r){let l=Ws.fromTransaction(t,r.selection),c=r.side,u=c==0?e.undone:e.done;return l?u=E1(u,u.length,n.minDepth,l):u=nO(u,t.startState.selection),new qa(c==0?r.rest:u,c==0?u:r.rest)}let s=t.annotation(jme);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Or.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=Ws.fromTransaction(t),a=t.annotation(Or.time),o=t.annotation(Or.userEvent);return i?e=e.addChanges(i,a,o,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,o,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 qa(e.done.map(Ws.fromJSON),e.undone.map(Ws.fromJSON))}});function ZD(e={}){return[JD,QD.of(e),Ye.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?eO:t.inputType=="historyRedo"?Mw:null;return r?(t.preventDefault(),r(n)):!1}})]}function Ly(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(JD,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const eO=Ly(0,!1),Mw=Ly(1,!1),Ome=Ly(0,!0),Lme=Ly(1,!0);class Ws{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 Ws(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 Ws(t.changes&&jr.fromJSON(t.changes),[],t.mapped&&Fa.fromJSON(t.mapped),t.startSelection&&ke.fromJSON(t.startSelection),t.selectionsAfter.map(ke.fromJSON))}static fromTransaction(t,n){let r=Ui;for(let s of t.startState.facet(Dme)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new Ws(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Ui)}static selection(t){return new Ws(void 0,Ui,void 0,void 0,t)}}function E1(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 Bme(e,t){let n=[],r=!1;return e.iterChangedRanges((s,i)=>n.push(s,i)),t.iterChangedRanges((s,i,a,o)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];o>=c&&a<=u&&(r=!0)}}),r}function zme(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function tO(e,t){return e.length?t.length?e.concat(t):e:t}const Ui=[],$me=200;function nO(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-$me));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),E1(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Ws.selection([t])]}function Pme(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 C4(e,t){if(!e.length)return e;let n=e.length,r=Ui;for(;n;){let s=qme(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?[Ws.selection(r)]:Ui}function qme(e,t,n){let r=tO(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):Ui,n);if(!e.changes)return Ws.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(i):i;return new Ws(s,Cn.mapEffects(e.effects,t),a,e.startSelection.map(i),r)}const Ume=/^(input\.type|delete)($|\.)/;class qa{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 qa(this.done,this.undone):this}addChanges(t,n,r,s,i){let a=this.done,o=a[a.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!r||Ume.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,Bme(o.changes,t.changes))||r=="input.type.compose")?a=E1(a,a.length-1,s.minDepth,new Ws(t.changes.compose(o.changes),tO(Cn.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,Ui)):a=E1(a,a.length,s.minDepth,t),new qa(a,Ui,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Ui;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&zme(i[i.length-1],t)?this:new qa(nO(this.done,t),this.undone,n,r)}addMapping(t){return new qa(C4(this.done,t),C4(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],a=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:Ew.of({side:t,rest:Pme(s),selection:a}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let o=s.length==1?Ui:s.slice(0,s.length-1);return i.mapped&&(o=C4(o,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Ew.of({side:t,rest:o,selection:a}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}qa.empty=new qa(Ui,Ui);const rO=[{key:"Mod-z",run:eO,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Mw,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Mw,preventDefault:!0},{key:"Mod-u",run:Ome,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Lme,preventDefault:!0}];function Eh(e,t){return ke.create(e.ranges.map(t),e.mainIndex)}function fa(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function ma({state:e,dispatch:t},n){let r=Eh(e.selection,n);return r.eq(e.selection,!0)?!1:(t(fa(e,r)),!0)}function By(e,t){return ke.cursor(t?e.to:e.from)}function sO(e,t){return ma(e,n=>n.empty?e.moveByChar(n,t):By(n,t))}function ps(e){return e.textDirectionAt(e.state.selection.main.head)==Un.LTR}const iO=e=>sO(e,!ps(e)),aO=e=>sO(e,ps(e));function oO(e,t){return ma(e,n=>n.empty?e.moveByGroup(n,t):By(n,t))}const Hme=e=>oO(e,!ps(e)),Fme=e=>oO(e,ps(e));function Vme(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 zy(e,t,n){let r=da(e).resolveInner(t.head),s=n?Zt.closedBy:Zt.openedBy;for(let l=t.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;Vme(e,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),a,o;return i&&(a=n?vd(e,r.from,1):vd(e,r.to,-1))&&a.matched?o=n?a.end.to:a.end.from:o=n?r.to:r.from,ke.cursor(o,n?-1:1)}const Wme=e=>ma(e,t=>zy(e.state,t,!ps(e))),Gme=e=>ma(e,t=>zy(e.state,t,ps(e)));function lO(e,t){return ma(e,n=>{if(!n.empty)return By(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const cO=e=>lO(e,!1),uO=e=>lO(e,!0);function dO(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(Ye.scrollMargins)){let a=i(e);a!=null&&a.top&&(n=Math.max(a==null?void 0:a.top,n)),a!=null&&a.bottom&&(r=Math.max(a==null?void 0:a.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 hO(e,t){let n=dO(e),{state:r}=e,s=Eh(r.selection,a=>a.empty?e.moveVertically(a,t,n.height):By(a,t));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,c=o.bottom-n.marginBottom;a&&a.top>l&&a.bottom<c&&(i=Ye.scrollIntoView(s.main.head,{y:"start",yMargin:a.top-l}))}return e.dispatch(fa(r,s),{effects:i}),!0}const o9=e=>hO(e,!1),Nw=e=>hO(e,!0);function yc(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=ke.cursor(r.from+i))}return s}const Kme=e=>ma(e,t=>yc(e,t,!0)),Yme=e=>ma(e,t=>yc(e,t,!1)),Xme=e=>ma(e,t=>yc(e,t,!ps(e))),Qme=e=>ma(e,t=>yc(e,t,ps(e))),Jme=e=>ma(e,t=>ke.cursor(e.lineBlockAt(t.head).from,1)),Zme=e=>ma(e,t=>ke.cursor(e.lineBlockAt(t.head).to,-1));function epe(e,t,n){let r=!1,s=Eh(e.selection,i=>{let a=vd(e,i.head,-1)||vd(e,i.head,1)||i.head>0&&vd(e,i.head-1,1)||i.head<e.doc.length&&vd(e,i.head+1,-1);if(!a||!a.end)return i;r=!0;let o=a.start.from==i.head?a.end.to:a.end.from;return ke.cursor(o)});return r?(t(fa(e,s)),!0):!1}const tpe=({state:e,dispatch:t})=>epe(e,t);function Qi(e,t){let n=Eh(e.state.selection,r=>{let s=t(r);return ke.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(fa(e.state,n)),!0)}function fO(e,t){return Qi(e,n=>e.moveByChar(n,t))}const mO=e=>fO(e,!ps(e)),pO=e=>fO(e,ps(e));function gO(e,t){return Qi(e,n=>e.moveByGroup(n,t))}const npe=e=>gO(e,!ps(e)),rpe=e=>gO(e,ps(e)),spe=e=>Qi(e,t=>zy(e.state,t,!ps(e))),ipe=e=>Qi(e,t=>zy(e.state,t,ps(e)));function yO(e,t){return Qi(e,n=>e.moveVertically(n,t))}const bO=e=>yO(e,!1),vO=e=>yO(e,!0);function xO(e,t){return Qi(e,n=>e.moveVertically(n,t,dO(e).height))}const l9=e=>xO(e,!1),c9=e=>xO(e,!0),ape=e=>Qi(e,t=>yc(e,t,!0)),ope=e=>Qi(e,t=>yc(e,t,!1)),lpe=e=>Qi(e,t=>yc(e,t,!ps(e))),cpe=e=>Qi(e,t=>yc(e,t,ps(e))),upe=e=>Qi(e,t=>ke.cursor(e.lineBlockAt(t.head).from)),dpe=e=>Qi(e,t=>ke.cursor(e.lineBlockAt(t.head).to)),u9=({state:e,dispatch:t})=>(t(fa(e,{anchor:0})),!0),d9=({state:e,dispatch:t})=>(t(fa(e,{anchor:e.doc.length})),!0),h9=({state:e,dispatch:t})=>(t(fa(e,{anchor:e.selection.main.anchor,head:0})),!0),f9=({state:e,dispatch:t})=>(t(fa(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),hpe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),fpe=({state:e,dispatch:t})=>{let n=$y(e).map(({from:r,to:s})=>ke.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:ke.create(n),userEvent:"select"})),!0},mpe=({state:e,dispatch:t})=>{let n=Eh(e.selection,r=>{let s=da(e),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:o}=a;if((o.from<r.from&&o.to>=r.to||o.to>r.to&&o.from<=r.from)&&a.next)return ke.range(o.to,o.from)}return r});return n.eq(e.selection)?!1:(t(fa(e,n)),!0)};function wO(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(t?a.to<e.state.doc.length:a.from>0)for(let o=i;;){let l=e.moveVertically(o,t);if(l.head<a.from||l.head>a.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==o.head)break;o=l}}}return s.length==r.ranges.length?!1:(e.dispatch(fa(n,ke.create(s,s.length-1))),!0)}const ppe=e=>wO(e,!1),gpe=e=>wO(e,!0),ype=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=ke.create([n.main]):n.main.empty||(r=ke.create([ke.cursor(n.main.head)])),r?(t(fa(e,r)),!0):!1};function um(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let l=t(i);l<a?(n="delete.backward",l=_p(e,l,!1)):l>a&&(n="delete.forward",l=_p(e,l,!0)),a=Math.min(a,l),o=Math.max(o,l)}else a=_p(e,a,!1),o=_p(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:ke.cursor(a,a<i.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Ye.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function _p(e,t,n){if(e instanceof Ye)for(let r of e.state.facet(Ye.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const _O=(e,t,n)=>um(e,r=>{let s=r.from,{state:i}=e,a=i.doc.lineAt(s),o,l;if(n&&!t&&s>a.from&&s<a.from+200&&!/[^ \t]/.test(o=a.text.slice(0,s-a.from))){if(o[o.length-1]=="	")return s-1;let c=am(o,i.tabSize),u=c%C1(i)||C1(i);for(let d=0;d<u&&o[o.length-1-d]==" ";d++)s--;l=s}else l=hs(a.text,s-a.from,t,t)+a.from,l==s&&a.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(a.text.slice(l-a.from,s-a.from))&&(l=hs(a.text,l-a.from,!1,!1)+a.from);return l}),Iw=e=>_O(e,!1,!0),kO=e=>_O(e,!0,!1),SO=(e,t)=>um(e,n=>{let r=n.head,{state:s}=e,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let o=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=hs(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=a(c);if(o!=null&&u!=o)break;(c!=" "||r!=n.head)&&(o=u),r=l}return r}),TO=e=>SO(e,!1),bpe=e=>SO(e,!0),vpe=e=>um(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),xpe=e=>um(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),wpe=e=>um(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),_pe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:en.of(["",""])},range:ke.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},kpe=({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),a=s==i.from?s-1:hs(i.text,s-i.from,!1)+i.from,o=s==i.to?s+1:hs(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(s,o).append(e.doc.slice(a,s))},range:ke.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function $y(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 a=t[t.length-1];a.to=i.to,a.ranges.push(r)}else t.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return t}function CO(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of $y(e)){if(n?i.to==e.doc.length:i.from==0)continue;let a=e.doc.lineAt(n?i.to+1:i.from-1),o=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+e.lineBreak});for(let l of i.ranges)s.push(ke.range(Math.min(e.doc.length,l.anchor+o),Math.min(e.doc.length,l.head+o)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:e.lineBreak+a.text});for(let l of i.ranges)s.push(ke.range(l.anchor-o,l.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:ke.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Spe=({state:e,dispatch:t})=>CO(e,t,!1),Tpe=({state:e,dispatch:t})=>CO(e,t,!0);function AO(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of $y(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 Cpe=({state:e,dispatch:t})=>AO(e,t,!1),Ape=({state:e,dispatch:t})=>AO(e,t,!0),Epe=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes($y(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=Eh(t.selection,s=>{let i;if(e.lineWrapping){let a=e.lineBlockAt(s.head),o=e.coordsAtPos(s.head,s.assoc||1);o&&(i=a.bottom+e.documentTop-o.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 Mpe(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=da(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(Zt.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 m9=EO(!1),Npe=EO(!0);function EO(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:i,to:a}=s,o=t.doc.lineAt(i),l=!e&&i==a&&Mpe(t,i);e&&(i=a=(a<=o.to?o:t.doc.lineAt(a)).to);let c=new Dy(t,{simulateBreak:i,simulateDoubleBreak:!!l}),u=GD(c,i);for(u==null&&(u=am(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));a<o.to&&/\s/.test(o.text[a-o.from]);)a++;l?{from:i,to:a}=l:i>o.from&&i<o.from+100&&!/\S/.test(o.text.slice(0,i))&&(i=o.from);let d=["",A1(t,u)];return l&&d.push(A1(t,c.lineIndent(o.from,-1))),{changes:{from:i,to:a,insert:en.of(d)},range:ke.cursor(i+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function M5(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,s,r),n=o.number),a=o.to+1}let i=e.changes(s);return{changes:s,range:ke.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const Ipe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Dy(e,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=M5(e,(i,a,o)=>{let l=GD(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=A1(e,l);(c!=u||o.from<i.from+c.length)&&(n[i.from]=l,a.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},Rpe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(M5(e,(n,r)=>{r.push({from:n.from,insert:e.facet(T5)})}),{userEvent:"input.indent"})),!0),jpe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(M5(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=am(s,e.tabSize),a=0,o=A1(e,Math.max(0,i-C1(e)));for(;a<s.length&&a<o.length&&s.charCodeAt(a)==o.charCodeAt(a);)a++;r.push({from:n.from+a,to:n.from+s.length,insert:o.slice(a)})}),{userEvent:"delete.dedent"})),!0),Dpe=e=>(e.setTabFocusMode(),!0),Ope=[{key:"Ctrl-b",run:iO,shift:mO,preventDefault:!0},{key:"Ctrl-f",run:aO,shift:pO},{key:"Ctrl-p",run:cO,shift:bO},{key:"Ctrl-n",run:uO,shift:vO},{key:"Ctrl-a",run:Jme,shift:upe},{key:"Ctrl-e",run:Zme,shift:dpe},{key:"Ctrl-d",run:kO},{key:"Ctrl-h",run:Iw},{key:"Ctrl-k",run:vpe},{key:"Ctrl-Alt-h",run:TO},{key:"Ctrl-o",run:_pe},{key:"Ctrl-t",run:kpe},{key:"Ctrl-v",run:Nw}],Lpe=[{key:"ArrowLeft",run:iO,shift:mO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Hme,shift:npe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Xme,shift:lpe,preventDefault:!0},{key:"ArrowRight",run:aO,shift:pO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Fme,shift:rpe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Qme,shift:cpe,preventDefault:!0},{key:"ArrowUp",run:cO,shift:bO,preventDefault:!0},{mac:"Cmd-ArrowUp",run:u9,shift:h9},{mac:"Ctrl-ArrowUp",run:o9,shift:l9},{key:"ArrowDown",run:uO,shift:vO,preventDefault:!0},{mac:"Cmd-ArrowDown",run:d9,shift:f9},{mac:"Ctrl-ArrowDown",run:Nw,shift:c9},{key:"PageUp",run:o9,shift:l9},{key:"PageDown",run:Nw,shift:c9},{key:"Home",run:Yme,shift:ope,preventDefault:!0},{key:"Mod-Home",run:u9,shift:h9},{key:"End",run:Kme,shift:ape,preventDefault:!0},{key:"Mod-End",run:d9,shift:f9},{key:"Enter",run:m9,shift:m9},{key:"Mod-a",run:hpe},{key:"Backspace",run:Iw,shift:Iw,preventDefault:!0},{key:"Delete",run:kO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:TO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:bpe,preventDefault:!0},{mac:"Mod-Backspace",run:xpe,preventDefault:!0},{mac:"Mod-Delete",run:wpe,preventDefault:!0}].concat(Ope.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),MO=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Wme,shift:spe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Gme,shift:ipe},{key:"Alt-ArrowUp",run:Spe},{key:"Shift-Alt-ArrowUp",run:Cpe},{key:"Alt-ArrowDown",run:Tpe},{key:"Shift-Alt-ArrowDown",run:Ape},{key:"Mod-Alt-ArrowUp",run:ppe},{key:"Mod-Alt-ArrowDown",run:gpe},{key:"Escape",run:ype},{key:"Mod-Enter",run:Npe},{key:"Alt-l",mac:"Ctrl-l",run:fpe},{key:"Mod-i",run:mpe,preventDefault:!0},{key:"Mod-[",run:jpe},{key:"Mod-]",run:Rpe},{key:"Mod-Alt-\\",run:Ipe},{key:"Shift-Mod-k",run:Epe},{key:"Shift-Mod-\\",run:tpe},{key:"Mod-/",run:Cme},{key:"Alt-A",run:Eme},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Dpe}].concat(Lpe);class NO{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=da(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(IO(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 p9(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 Bpe(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=p9(t)+p9(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function zpe(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Bpe(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class g9{constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function hu(e){return e.selection.main.from}function IO(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 RO=Yo.define();function $pe(e,t,n,r){let{main:s}=e.selection,i=n-s.from,a=r-s.from;return{...e.changeByRange(o=>{if(o!=s&&n!=r&&e.sliceDoc(o.from+i,o.from+a)!=e.sliceDoc(n,r))return{range:o};let l=e.toText(t);return{changes:{from:o.from+i,to:r==s.from?o.to:o.from+a,insert:l},range:ke.cursor(o.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const y9=new WeakMap;function Ppe(e){if(!Array.isArray(e))return e;let t=y9.get(e);return t||y9.set(e,t=zpe(e)),t}const M1=Cn.define(),D0=Cn.define();class qpe{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=bl(t,n),s=nd(r);this.chars.push(r);let i=t.slice(n,n+s),a=i.toUpperCase();this.folded.push(bl(a==i?i.toLowerCase():a,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:a}=this;if(n.length==1){let g=bl(t,0),x=nd(g),k=x==t.length?0:-100;if(g!=n[0])if(g==r[0])k+=-200;else return null;return this.ret(k,[0,x])}let o=t.indexOf(this.pattern);if(o==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(o<0){for(let g=0,x=Math.min(t.length,200);g<x&&c<l;){let k=bl(t,g);(k==n[c]||k==r[c])&&(s[c++]=g),g+=nd(k)}if(c<l)return null}let u=0,d=0,f=!1,m=0,p=-1,y=-1,w=/[a-z]/.test(t),v=!0;for(let g=0,x=Math.min(t.length,200),k=0;g<x&&d<l;){let A=bl(t,g);o<0&&(u<l&&A==n[u]&&(i[u++]=g),m<l&&(A==n[m]||A==r[m]?(m==0&&(p=g),y=g+1,m++):m=0));let T,C=A<255?A>=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(T=uhe(A))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!g||C==1&&w||k==0&&C!=0)&&(n[d]==A||r[d]==A&&(f=!0)?a[d++]=g:a.length&&(v=!1)),k=C,g+=nd(A)}return d==l&&a[0]==0&&v?this.result(-100+(f?-200:0),a,t):m==l&&p==0?this.ret(-200-t.length+(y==t.length?0:-100),[0,y]):o>-1?this.ret(-700-t.length,[o,o+this.pattern.length]):m==l?this.ret(-900-t.length,[p,y]):d==l?this.result(-100+(f?-200:0)+-700+(v?0:-1100),a,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 a of n){let o=a+(this.astral?nd(bl(r,a)):1);i&&s[i-1]==a?s[i-1]=o:(s[i++]=a,s[i++]=o)}return this.ret(t-r.length,s)}}class Upe{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 Hr=ct.define({combine(e){return Ey(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:Hpe,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=>b9(t(r),n(r)),optionClass:(t,n)=>r=>b9(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function b9(e,t){return e?t?e+" "+t:e:t}function Hpe(e,t,n,r,s,i){let a=e.textDirection==Un.RTL,o=a,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(o&&f<Math.min(p,m)?o=!1:!o&&m<Math.min(p,f)&&(o=!0),p<=(o?f:m))u=Math.max(s.top,Math.min(n.top,s.bottom-y))-t.top,d=Math.min(400,o?f:m);else{l=!0,d=Math.min(400,(a?t.right:s.right-t.left)-30);let g=s.bottom-t.bottom;g>=y||g>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let w=(t.bottom-t.top)/i.offsetHeight,v=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${d/v}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}const N5=Cn.define();function Fpe(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 a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],d=i[c++];u>l&&a.appendChild(document.createTextNode(o.slice(l,u)));let f=a.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(o.slice(u,d))),f.className="cm-completionMatchedText",l=d}return l<o.length&&a.appendChild(document.createTextNode(o.slice(l))),a},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 A4(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 Vpe{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:a}=s.open,o=t.state.facet(Hr);this.optionContent=Fpe(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=A4(i.length,a,o.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:N5.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(Hr).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:D0.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:a,disabled:o}=r.open;(!s.open||s.open.options!=i)&&(this.range=A4(i.length,a,t.state.facet(Hr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}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=A4(n.options.length,n.selected,this.view.state.facet(Hr).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 a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,s)}).catch(o=>hi(this.view.state,o,"completion info")):(this.addInfoPane(a,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&&Gpe(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 a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.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(Hr).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",a=>{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;a<r.to;a++){let{completion:o,match:l}=t[a],{section:c}=o;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(a>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+"-"+a,u.setAttribute("role","option");let d=this.optionClass(o);d&&(u.className=d);for(let f of this.optionContent){let m=f(o,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 Wpe(e,t){return n=>new Vpe(n,e,t)}function Gpe(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 v9(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function Kpe(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)}},a=t.facet(Hr);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 g9(f,u.source,d?d(f):[],1e9-n.length));else{let f=t.sliceDoc(u.from,u.to),m,p=a.filterStrict?new Upe(f):new qpe(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,v=m.score+(y.boost||0);if(i(new g9(y,u.source,w,v)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:g}=y.section;s||(s=Object.create(null)),s[g]=Math.max(v,s[g]||-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 o=[],l=null,c=a.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?o.push(u):v9(u.completion)>v9(l)&&(o[o.length-1]=u),l=u.completion}return o}class xd{constructor(t,n,r,s,i,a){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new xd(this.options,x9(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,s,i,a){if(s&&!a&&t.some(c=>c.isPending))return s.setDisabled();let o=Kpe(t,n);if(!o.length)return s&&t.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(Hr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<o.length;u++)if(o[u].completion==c){l=u;break}}return new xd(o,x9(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:ege,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(t){return new xd(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new xd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class N1{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new N1(Jpe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Hr),i=(r.override||n.languageDataAt("autocomplete",hu(n)).map(Ppe)).map(l=>(this.active.find(u=>u.source==l)||new Hi(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 a=this.open,o=t.effects.some(l=>l.is(I5));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!Ype(i,this.active)||o?a=xd.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(l=>l.isPending)&&(a=null),!a&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Hi(l.source,0):l));for(let l of t.effects)l.is(N5)&&(a=a&&a.setSelected(l.value,this.id));return i==this.active&&a==this.open?this:new N1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Xpe:Qpe}}function Ype(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 Xpe={"aria-autocomplete":"list"},Qpe={};function x9(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Jpe=[];function jO(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(RO);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 Hi{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=jO(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new Hi(s.source,0)),r&4&&s.state==0&&(s=new Hi(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(M1))s=new Hi(s.source,1,i.value);else if(i.is(D0))s=new Hi(s.source,0);else if(i.is(I5))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(hu(t.state))}}class Od extends Hi{constructor(t,n,r,s,i,a){super(t,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}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),a=t.changes.mapPos(this.to,1),o=hu(t.state);if(o>a||!s||n&2&&(hu(t.startState)==this.from||o<this.limit))return new Hi(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Zpe(s.validFor,t.state,i,a)?new Od(this.source,this.explicit,l,s,i,a):s.update&&(s=s.update(s,i,a,new NO(t.state,o,!1)))?new Od(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:hu(t.state)):new Hi(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 Od(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Hi(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Zpe(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):IO(e,!0).test(s)}const I5=Cn.define({map(e,t){return e.map(n=>n.map(t))}}),ks=Za.define({create(){return N1.start()},update(e,t){return e.update(t)},provide:e=>[$D.from(e,t=>t.tooltip),Ye.contentAttributes.from(e,t=>t.attrs)]});function R5(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 Od?(typeof n=="string"?e.dispatch({...$pe(e.state,n,r.from,r.to),annotations:RO.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const ege=Wpe(ks,R5);function Ll(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(Hr).interactionDelay)return!1;let s=1,i;t=="page"&&(i=PD(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,o=r.open.selected>-1?r.open.selected+s*(e?1:-1):e?0:a-1;return o<0?o=t=="page"?0:a-1:o>=a&&(o=t=="page"?a-1:0),n.dispatch({effects:N5.of(o)}),!0}}const DO=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(Hr).interactionDelay?!1:R5(e,t.open.options[t.open.selected])},Ld=e=>e.state.field(ks,!1)?(e.dispatch({effects:M1.of(!0)}),!0):!1,ig=e=>{let t=e.state.field(ks,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:D0.of(null)}),!0)};class tge{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const nge=50,rge=1e3,sge=Xs.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(Hr);if(!e.selectionSet&&!e.docChanged&&e.startState.field(ks)==t)return;let r=e.transactions.some(i=>{let a=jO(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;i<this.running.length;i++){let a=this.running[i];if(r||a.context.abortOnDocChange&&e.docChanged||a.updates.length+e.transactions.length>nge&&Date.now()-a.time>rge){for(let o of a.context.abortListeners)try{o()}catch(l){hi(this.view.state,l)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(a=>a.is(M1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(a=>a.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(Hr).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=hu(t),r=new NO(t,n,e.explicit,this.view),s=new tge(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:D0.of(null)}),hi(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(Hr).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Hr),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 o=hu(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(o,i.done.from+(i.active.explicit?0:1)),c=new Od(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:o);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){t.push(c);continue}}let a=r.active.find(o=>o.source==i.active.source);if(a&&a.isPending)if(i.done==null){let o=new Hi(i.active.source,0);for(let l of i.updates)o=o.update(l,n);o.isPending||t.push(o)}else this.startQuery(a)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:I5.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(ks,!1);if(t&&t.tooltip&&this.view.state.facet(Hr).closeOnBlur){let n=t.open&&PD(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:D0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:M1.of(!1)}),20),this.composing=0}}}),ige=typeof navigator=="object"&&/Win/.test(navigator.platform),age=Bu.highest(Ye.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&&!(ige&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&R5(t,r),!1}})),oge=Ye.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"}}}),OO=new class extends ic{};OO.startSide=1;OO.endSide=-1;function lge(e={}){return[age,ks,Hr.of(e),sge,uge,oge]}const cge=[{key:"Ctrl-Space",run:Ld},{mac:"Alt-`",run:Ld},{mac:"Alt-i",run:Ld},{key:"Escape",run:ig},{key:"ArrowDown",run:Ll(!0)},{key:"ArrowUp",run:Ll(!1)},{key:"PageDown",run:Ll(!0,"page")},{key:"PageUp",run:Ll(!1,"page")},{key:"Enter",run:DO}],uge=Bu.highest(I0.computeN([Hr],e=>e.facet(Hr).defaultKeymap?[cge]:[]));function si(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 dge=[C0e(),ZD(),y0e(),mme(yme,{fallback:!0}),I0.of([...MO,...rO])],O0=["custom","skill","system"];function Rw(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function hge(e,t,n=O0){return w9(Rw(e),n)-w9(Rw(t),n)}function w9(e,t=O0){const n=t.indexOf(e);return n>=0?n:t.length+O0.indexOf(e)}const j5=String.raw`([^\s/]+)`,Py={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:"安装扩展"}]},qy={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"}]},Uy={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 文件列表"}]},Hy={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 fge(e,t,n,r,s){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(o=>({name:o.name,description:o.description}));let a=(r==="zh-CN"?Py:qy)[e];if(a||(a=(r==="zh-CN"?Uy:Hy)[e]),!a&&t.length===0&&(s!=null&&s.length)&&(a=s.map(o=>({name:o,description:""}))),!a)return null;for(const o of t){const l=a.find(c=>c.name===o);if(!(l!=null&&l.children))return null;a=l.children}return a}function LO(e,t,n){const r=e.toLowerCase(),s=t.toLowerCase(),i=r.startsWith(n),a=s.startsWith(n);return i!==a?i?-1:1:e.localeCompare(t)}function mge(e,t,n,r){const s=hge(e,t,r);return s!==0?s:n?LO(e.name,t.name,n):0}const pge={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function gge(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 yge(e,t,n){var c;const r=e.match(new RegExp(`^/${j5}\\s+$`));if(!r)return null;const s=r[1],i=t.find(u=>u.name===s),a=n==="zh-CN"?Py:qy;if((c=i==null?void 0:i.subcommands)!=null&&c.length||a[s]||s==="skills")return null;const l=(n==="zh-CN"?Uy:Hy)[s];return!l||l.length===0?null:`/${s} ${l[0].name} `}function bge(e,t,n){var u,d;const r=e.match(new RegExp(`^/${j5}(\\s*)$`));if(!r)return null;const s=r[1],i=t.find(f=>f.name===s);if(!i)return null;const a=(u=i.argumentHint)==null?void 0:u.trim();if(a)return a;const o=n==="zh-CN"?Py:qy;if((d=i.subcommands)!=null&&d.length||o[s]||s==="skills")return null;const c=(n==="zh-CN"?Uy:Hy)[s];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function vge(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}}function xge(e,t,n,r=[],s="en",i=o=>o,a=O0){var g,x;const{lineStart:o,lineEnd:l,lineText:c,textBefore:u,cursor:d}=vge(e,t),f=u.match(new RegExp(`^/${j5}\\s+(.*)$`));if(f){const[,k,A]=f,T=n.find(R=>R.name===k),C=s==="zh-CN"?Py:qy,j=s==="zh-CN"?Uy:Hy,z=!!C[k]||k==="skills",E=!!j[k];if(!((g=T==null?void 0:T.subcommands)!=null&&g.length)&&!z&&!E)return null;const P=A.split(/\s+/),D=P.pop()||"",H=P;if(!((x=T==null?void 0:T.subcommands)!=null&&x.length)&&!z&&E&&!D)return null;const W=fge(k,H,r,s,T==null?void 0:T.subcommands);if(!W)return null;const J=D.toLowerCase(),Y=`/${k} ${H.length>0?H.join(" ")+" ":""}`,Z=W.filter(R=>!D||R.name.toLowerCase().includes(J)).sort((R,$)=>D?LO(R.name,$.name,J):0),Q=k==="skills"&&H.length===0,L=Z.map(R=>{const $=`${Y}${R.name}`;return{id:$,label:R.name,detail:R.description||void 0,apply:`${$} `,...Q?{type:"skill"}:{}}});return L.length===0?null:{kind:"subcommand",from:o,to:d,query:D,items:L}}const m=c.match(/^\/([^\s/]*)$/);if(!m)return null;const p=m[1],y=p.toLowerCase(),v=n.filter(k=>p?k.name.toLowerCase().includes(y):!0).sort((k,A)=>mge(k,A,y,a)).map(k=>{const A=`/${k.name} `,T=Rw(k),C=T==="custom"||T==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:A,category:T,section:i(pge[T]),...C&&k.description?{type:"command-info"}:{}}});return v.length===0?null:{kind:"command",from:o,to:l,query:p,items:v}}function wge(e){return t=>_ge(t,e)}function _ge(e,t){const n=e.state.doc.lineAt(e.pos),s=n.text.slice(0,e.pos-n.from).match(/@([\w./-]*)$/);if(!s)return null;const i=t();if(!i)return null;const a=s[1],o=e.pos-s[0].length;return kge(a,i).then(l=>l.length===0?null:{from:o,options:l.map(c=>({label:`@${c}`,apply:`@${c} `,type:"file"})),filter:!1})}async function kge(e,t){try{const n=e?`${e}*`:"**/*";return(await t(n,{maxResults:50})).matches.filter(s=>s!==".")}catch{return[]}}const Sge="qwen-web-shell-history",BO=100;function Tge(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 Cge(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-BO)))}catch{}}function _9(e=Sge){const t=b.useRef(e);t.current=e;const n=b.useRef(Tge(e)),r=b.useRef(-1),s=b.useRef(""),i=b.useRef(-1),[a,o]=b.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=b.useCallback(()=>{const g=n.current,x=r.current;o({canUp:g.length>0&&(x===-1||x>0),canDown:x!==-1})},[]),c=b.useCallback(g=>{const x=n.current;x[x.length-1]!==g&&(x.push(g),x.length>BO&&x.shift(),Cge(t.current,x),r.current=-1,l())},[l]),u=b.useCallback(g=>{const x=n.current;if(x.length===0)return null;if(r.current===-1)s.current=g,r.current=x.length-1;else if(r.current>0)r.current--;else return null;return l(),x[r.current]},[l]),d=b.useCallback(()=>{const g=n.current;return r.current===-1?null:r.current<g.length-1?(r.current++,l(),g[r.current]):(r.current=-1,l(),s.current)},[l]),f=b.useCallback(()=>r.current!==-1,[]),m=b.useCallback(()=>{r.current=-1,i.current=-1,l()},[l]),p=b.useCallback(g=>{const x=n.current;if(x.length===0||!g)return null;const k=i.current===-1?x.length-1:i.current-1;if(k<0)return i.current=-1,null;const A=g.toLowerCase();for(let T=k;T>=0;T--)if(x[T].toLowerCase().includes(A))return i.current=T,x[T];return i.current=-1,null},[]),y=b.useCallback(g=>{const x=g.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!x||k.toLowerCase().includes(x))},[]),w=b.useCallback(g=>{const x=n.current;if(!g)return x.length>0?x[x.length-1]:null;for(let k=x.length-1;k>=0;k--)if(g(x[k]))return x[k];return null},[]),v=b.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:u,navigateDown:d,isNavigating:f,reset:m,searchReverse:p,getReverseMatches:y,getLastEntry:w,resetSearch:v,nav:a}}const Age=Gt.mark({class:"cm-input-slash"}),Ege=Gt.mark({class:"cm-input-at"}),Mge=Gt.mark({class:"cm-input-code"});class Nge extends eo{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 k9(e,t,n){const r=new xu,s=e.state.doc,i=[];for(let a=1;a<=s.lines;a++){const o=s.line(a),l=o.text,c=o.from;if(l.startsWith("/")){const p=l.indexOf(" "),y=p===-1?l.length:p;i.push({from:c,to:c+y,deco:Age})}const u=bge(l,t(),n());if(u){const p=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:Gt.widget({widget:new Nge(`${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:Ege});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:Mge})}i.sort((a,o)=>a.from-o.from||a.to-o.to);for(const{from:a,to:o,deco:l}of i)r.add(a,o,l);return r.finish()}function Ige(e=()=>[],t=()=>"en"){return Xs.fromClass(class{constructor(n){se(this,"decorations");this.decorations=k9(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=k9(n.view,e,t))}},{decorations:n=>n.decorations})}const Rge=Ye.baseTheme({".cm-input-slash":{color:"var(--accent-color, #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(--text-secondary, #a0aec0)"},".cm-input-slash-argument-hint":{color:"var(--text-tertiary, rgba(160, 174, 192, 0.55))",pointerEvents:"none"}}),jge=1e3,Dge=10,S9="web-shell-tooltip-styles",Oge=`
[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(--bg-primary, #0d0d0d) !important;
  border: 1px solid var(--border-color, #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-color) 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-color);
  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(--text-primary, #e4e4e4) !important;
  overflow: hidden;
}

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

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

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li:is(:hover, [aria-selected]) .cm-completionLabel {
  color: var(--accent-color, #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-color) !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(--text-secondary);
  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-color, #2a2a2a);
  border-radius: 6px;
  background: var(--bg-secondary, #161616);
  color: var(--text-primary, #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-color) 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-color);
  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 Lge(){if(document.getElementById(S9))return;const e=document.createElement("style");e.id=S9,e.textContent=Oge,document.head.appendChild(e)}function Bge(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function zge(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function D5(e){return zge(e)}function $ge(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function Pge(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function qge(e,t,n){if(!t.detail||!D5(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=`${$ge(t)}

${t.detail}`;const i=s.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete s.dataset.hideTimerId);const a=s.getBoundingClientRect(),o=18,l=12,c=12,u=window.innerWidth,d=window.innerHeight,f=n.clientX+o,m=f+a.width+c>u?Math.max(c,n.clientX-a.width-o):f,p=Math.min(Math.max(c,n.clientY+l),Math.max(c,d-a.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 Uge(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 Hge(e){if(!e.detail||!D5(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=>{qge(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&Uge(r)}))}),t}function Fge(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function Vge(e){return[...e].length>jge||e.split(`
`).length>Dge}function Wge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gge(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 Kge(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function Yge(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(Wge).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function ag(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function Xge(e){return e.map(ag).join(`
`)}function O5(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function L5(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function zO(e){return L5(e)||O5(e)||e.id}function E4(e,t){const n=Xge(t);return n?e?`${n}

${e}`:n:e}const jw=Cn.define({map:e=>e}),B5=Cn.define(),Hc=Cn.define();class Qge extends eo{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-color);border-radius:4px;background:var(--bg-tertiary);color:var(--text-primary);font-family:var(--font-mono,monospace);font-size:12px;line-height:1.2;vertical-align:baseline;";const r=O5(this.tag),s=L5(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(--accent-color);",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(--text-secondary);",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(--accent-color);",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 ${zO(this.tag)}`),i.style.cssText="flex:0 0 auto;width:22px;height:22px;padding:0;border:0;background:transparent;color:var(--text-dimmed);font:inherit;line-height:22px;cursor:pointer;",i.textContent="×",i.addEventListener("mousedown",a=>a.preventDefault()),i.addEventListener("click",a=>{a.stopPropagation();const o=[];t.state.field(wd).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&&o.push({from:l,to:c,insert:""})}),o.length!==0&&(t.dispatch({changes:o,effects:B5.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(--text-dimmed)"}),n.appendChild(i)}return n}ignoreEvent(){return!1}}function Jge(e){const t={widget:new Qge(e.tag),inclusive:!1,tag:e.tag};return Gt.replace(t).range(e.from,e.to)}const wd=Za.define({create(){return Gt.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is(jw)?n=n.update({add:[Jge(r.value)]}):r.is(B5)?n=n.update({filter:(s,i,a)=>{const o=a.spec.tag;return o&&r.value.predicate?!r.value.predicate(o):!0}}):r.is(Hc)&&(n=Gt.none);return n},provide:e=>[Ye.decorations.from(e),Ye.atomicRanges.of(t=>t.state.field(e))]});function Zge(e){const t=[];return e.state.field(wd).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push(i)}),t}const T9=new zu,C9=new zu,A9=new zu;function og(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function e1e(e,t){const n=og(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class t1e extends eo{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 E9(e){return Xs.fromClass(class{constructor(t){se(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return Gt.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=e1e(r,e);return!s||!n.empty||n.head!==r.length?Gt.none:Gt.set([Gt.widget({widget:new t1e(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}function M9(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 n1e(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:r,disabled:s=!1,placeholderText:i="Type a message...",commands:a,skills:o=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:u,onClearQueuedMessages:d,currentMode:f="default",onFocusFooter:m,dialogOpen:p=!1,followupState:y,onAcceptFollowup:w,onDismissFollowup:v,sessionName:g,composerInput:x,composerInputVersion:k,editorTheme:A}=e,T=EM(),{language:C,t:j}=nt(),z=b.useRef(null),E=b.useRef(null),P=b.useRef(t);P.current=t;const D=b.useRef(n);D.current=n;const H=b.useRef(r);H.current=r;const W=b.useRef(s);W.current=s;const J=b.useRef(a);J.current=a;const Y=b.useRef(o);Y.current=o;const Z=b.useRef(l);Z.current=l;const Q=b.useRef(j);Q.current=j;const L=b.useRef(c);L.current=c;const R=b.useRef(u);R.current=u;const $=b.useRef(d);$.current=d;const I=b.useRef(y);I.current=y;const M=b.useRef(w);M.current=w;const G=b.useRef(v);G.current=v;const ne=b.useRef(m);ne.current=m;const fe=b.useRef(C);fe.current=C;const Pe=b.useRef(T==null?void 0:T.actions);Pe.current=T==null?void 0:T.actions;const[oe,Xe]=b.useState(!1),ht=b.useRef(oe);ht.current=oe;const At=b.useCallback(()=>{var K,ee,ye;(K=I.current)!=null&&K.isVisible&&((ee=G.current)==null||ee.call(G)),Xe(_e=>!_e),(ye=E.current)==null||ye.focus()},[]),[zt,Vt]=b.useState(!1),[gt,Le]=b.useState(""),[qt,tn]=b.useState([]),[Mt,Kt]=b.useState(0),$t=b.useRef(null),gn=b.useRef(null),Xt=b.useRef(""),[Be,Qe]=b.useState([]),st=b.useRef([]),te=b.useRef(new Map),ue=b.useRef(1),[re,ae]=b.useState([]),pe=b.useRef([]);pe.current=re;const wt=b.useRef(x);wt.current=x;const Je=b.useRef(()=>!0),_t=b.useRef(null),[fn,Vn]=b.useState(null),de=b.useRef(null),je=b.useRef(!1),Te=b.useCallback(K=>{de.current=K,Vn(K)},[]),Nt=b.useCallback((K,ee)=>{var ot;if(!K||W.current||ht.current){Te(null);return}if(je.current){Te(null);return}const ye=K.state.selection.main;if(!ye.empty){Te(null);return}const _e=xge(K.state.doc.toString(),ye.head,J.current,Y.current,fe.current,ut=>Q.current(ut),Z.current??O0);if(!_e){Te(null);return}const kt=ee??((ot=de.current)==null?void 0:ot.selectedIndex)??0,at=Math.max(0,Math.min(kt,_e.items.length-1));Te({..._e,selectedIndex:at})},[Te]),An=b.useCallback(()=>{Te(null)},[Te]),Tr=b.useCallback(K=>{const ee=de.current;return!ee||K<0||K>=ee.items.length?!1:(ee.selectedIndex===K||Te({...ee,selectedIndex:K}),!0)},[Te]),Ee=b.useCallback(K=>{const ee=de.current;if(!ee)return!1;const ye=Bge(ee.selectedIndex,ee.items.length,K);return ye===null?!1:(Te({...ee,selectedIndex:ye}),!0)},[Te]),it=b.useCallback(K=>{const ee=E.current,ye=de.current;if(!ee||!ye)return!1;const _e=ye.items[K??ye.selectedIndex];return _e?(ee.dispatch({changes:{from:ye.from,to:ye.to,insert:_e.apply},selection:{anchor:ye.from+_e.apply.length},scrollIntoView:!0}),ee.focus(),!0):!1},[]),[bt,Is]=b.useState(!1);b.useEffect(()=>{const K=E.current,ee=(K==null?void 0:K.state.doc.toString().trim())??"";Is(ee.length>0||re.length>0||Be.length>0)},[re,Be]);const ei=_9(),bc=_9("qwen-web-shell-command-history"),{push:pa,navigateUp:Xo,navigateDown:Qo,isNavigating:to,reset:_n,getReverseMatches:Rs,getLastEntry:js,resetSearch:Ds}=ei,Ln=b.useRef({push:pa,navigateUp:Xo,navigateDown:Qo,isNavigating:to,reset:_n,getReverseMatches:Rs,getLastEntry:js,resetSearch:Ds});Ln.current={push:pa,navigateUp:Xo,navigateDown:Qo,isNavigating:to,reset:_n,getReverseMatches:Rs,getLastEntry:js,resetSearch:Ds};const ft=b.useRef(bc);ft.current=bc,st.current=Be;const ss=b.useCallback(K=>{const ee=ht.current,_e=(ee?ft.current:Ln.current).getReverseMatches(K);return ee?_e:_e.filter(kt=>!kt.trimStart().startsWith("/"))},[]),Bn=b.useCallback(()=>{if(W.current)return;const K=E.current;if(!K)return;An();const ee=K.state.doc.toString();Xt.current=ee,Vt(!0),Le("");const ye=ht.current?ft.current:Ln.current;tn(ss("")),Kt(0),ye.resetSearch(),setTimeout(()=>{var _e;return(_e=$t.current)==null?void 0:_e.focus()},0)},[An,ss]),Jo=b.useRef(Bn);Jo.current=Bn;const Zo=b.useCallback(()=>{if(W.current)return;const K=E.current;if(!K)return;if(si(K.state)==="active"){Ll(!1)(K),K.focus();return}if(K.state.doc.lines>1){K.focus();return}const ee=ht.current?ft.current:Ln.current,ye=K.state.doc.toString(),_e=ee.navigateUp(ye);_e!==null&&K.dispatch({changes:{from:0,to:K.state.doc.length,insert:_e},selection:{anchor:_e.length}}),K.focus()},[]),Ji=b.useCallback(()=>{if(W.current)return;const K=E.current;if(!K)return;if(si(K.state)==="active"){Ll(!0)(K),K.focus();return}if(K.state.doc.lines>1){K.focus();return}const ye=(ht.current?ft.current:Ln.current).navigateDown();ye!==null&&K.dispatch({changes:{from:0,to:K.state.doc.length,insert:ye},selection:{anchor:ye.length}}),K.focus()},[]);b.useEffect(()=>{var _c,Rh;if(!z.current)return;Lge();const K=document.createElement("div");K.setAttribute("data-web-shell-tooltip-portal",""),K.style.position="fixed",K.style.inset="0",K.style.zIndex="var(--web-shell-tooltip-z-index)",K.style.pointerEvents="none";const ee=/\b\S*theme(?:Dark|Light)\S*/gi,ye=()=>{var yt,Et;let me=z.current,lt=null;if(z.current){const Ot=getComputedStyle(z.current);for(let Bt=0;Bt<Ot.length;Bt+=1){const mn=Ot[Bt];mn.startsWith("--")&&K.style.setProperty(mn,Ot.getPropertyValue(mn))}Ot.getPropertyValue("--web-shell-tooltip-z-index").trim()||K.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;me;){const Ot=(Et=(yt=me.className)==null?void 0:yt.match)==null?void 0:Et.call(yt,ee);if(Ot){lt=Ot[0];break}me=me.parentElement}lt&&(K.className=lt)};ye(),document.body.appendChild(K);const _e=new MutationObserver(ye);let kt=z.current;for(;kt&&(_e.observe(kt,{attributes:!0,attributeFilter:["class","style"]}),!((Rh=(_c=kt.className)==null?void 0:_c.match)!=null&&Rh.call(_c,ee)));)kt=kt.parentElement;const at=(me,lt,yt)=>{var kc;const Et=(lt??me.state.doc.toString()).trim(),Ot=yt??pe.current;if(!Et&&Ot.length===0)return!0;const Bt=Yge(te.current,Et),mn=E4(Bt,Ot),Qn=st.current,Wr=ht.current;return P.current(Wr?`!${mn}`:mn,Qn.length>0?[...Qn]:void 0)===!1||(Te(null),(kc=G.current)==null||kc.call(G),te.current.clear(),ue.current=1,Wr?(ft.current.push(Bt),ft.current.reset()):(Ln.current.push(Bt),Ln.current.reset()),je.current=!1,ae([]),Qe([]),me.dispatch({changes:{from:0,to:me.state.doc.length,insert:""},effects:Hc.of()})),!0};Je.current=at;const ot=[wge(()=>{var me;return(me=Pe.current)==null?void 0:me.globWorkspace})],ut=me=>(me.dispatch(me.state.replaceSelection(`
`)),!0),jn=(me,lt)=>{var Bt;const yt=I.current,Et=yt==null?void 0:yt.suggestion,Ot=og(me.state.doc.toString(),Et);return!(yt!=null&&yt.isVisible)||!Ot?!1:(me.dispatch({changes:{from:0,to:me.state.doc.length,insert:Ot},selection:{anchor:Ot.length},scrollIntoView:!0}),me.focus(),(Bt=M.current)==null||Bt.call(M,lt,{skipOnAccept:!0}),!0)},kn=I0.of([{key:"Backspace",run:me=>{var Ot;const lt=me.state.selection.main;if(!lt.empty||lt.from!==0)return!1;let yt=!1;if(me.state.field(wd).between(0,1,Bt=>{Bt===0&&(yt=!0)}),yt)return!1;let Et=-1;for(let Bt=pe.current.length-1;Bt>=0;Bt-=1)if(((Ot=pe.current[Bt])==null?void 0:Ot.removable)!==!1){Et=Bt;break}return Et<0?!1:(ae(Bt=>Bt.filter((mn,Qn)=>Qn!==Et)),!0)}},{key:"Delete",run:me=>{const lt=me.state.selection.main;if(!lt.empty||lt.from!==0)return!1;let yt=!1;if(me.state.field(wd).between(0,1,Ot=>{Ot===0&&(yt=!0)}),yt)return!1;const Et=pe.current.findIndex(Ot=>Ot.removable!==!1);return Et<0?!1:(ae(Ot=>Ot.filter((Bt,mn)=>mn!==Et)),!0)}},{key:"Enter",run:me=>{var Et;if(de.current)return it();if(si(me.state)==="active")return!1;const lt=I.current,yt=og(me.state.doc.toString(),lt==null?void 0:lt.suggestion);return lt!=null&&lt.isVisible&&yt?((Et=M.current)==null||Et.call(M,"enter",{skipOnAccept:!0}),at(me,yt)):at(me)}},{key:"Shift-Enter",run:ut},{key:"Ctrl-j",run:ut},{key:"Mod-Enter",run:ut},{key:"Alt-Enter",run:ut},{key:"Escape",run:()=>{var me;return de.current?(An(),!0):ht.current?(Xe(!1),!0):L.current.length===0?!1:((me=$.current)==null?void 0:me.call($))??!1}},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:me=>{var mn;const lt=ht.current?ft.current:Ln.current;if(je.current)ig(me),An();else{if(Ee("up"))return!0;if(si(me.state)==="active")return Ll(!1)(me)}const Et=M9(me,"up");if(Et==="handled")return!0;if(Et==="editor")return!1;if(ht.current){const Qn=me.state.doc.toString(),Wr=lt.navigateUp(Qn);return Wr===null||(je.current=!0,me.dispatch({changes:{from:0,to:me.state.doc.length,insert:Wr},selection:{anchor:Wr.length}})),!0}if(L.current.length>0){const Qn=(mn=R.current)==null?void 0:mn.call(R);if(Qn){const Wr=me.state.doc.toString(),Ti=Wr.trim()?`${Qn}
${Wr}`:Qn;return me.dispatch({changes:{from:0,to:me.state.doc.length,insert:Ti},selection:{anchor:Ti.length}}),!0}}const Ot=me.state.doc.toString(),Bt=lt.navigateUp(Ot);return Bt===null?!1:(je.current=!0,me.dispatch({changes:{from:0,to:me.state.doc.length,insert:Bt},selection:{anchor:Bt.length}}),!0)}},{key:"ArrowDown",run:me=>{var Bt;const lt=ht.current?ft.current:Ln.current;if(je.current)ig(me),An();else{if(Ee("down"))return!0;if(si(me.state)==="active")return Ll(!0)(me)}const Et=M9(me,"down");if(Et==="handled")return!0;if(Et==="editor")return!1;if(ht.current){const mn=lt.navigateDown();return mn===null||(je.current=lt.isNavigating(),me.dispatch({changes:{from:0,to:me.state.doc.length,insert:mn},selection:{anchor:mn.length}})),!0}const Ot=lt.navigateDown();return Ot===null?((Bt=ne.current)==null?void 0:Bt.call(ne))??!1:(je.current=lt.isNavigating(),me.dispatch({changes:{from:0,to:me.state.doc.length,insert:Ot},selection:{anchor:Ot.length}}),!0)}},{key:"Ctrl-r",run:()=>(Jo.current(),!0)},{key:"Tab",run:me=>{if(jn(me,"tab"))return!0;if(de.current)return it();if(si(me.state)==="active")return DO(me);const lt=me.state.doc.toString(),yt=yge(lt,J.current,fe.current);if(yt)return me.dispatch({changes:{from:0,to:me.state.doc.length,insert:yt},selection:{anchor:yt.length}}),!0;const Et=gge(lt,J.current);return Et&&me.dispatch({changes:{from:0,to:me.state.doc.length,insert:Et},selection:{anchor:Et.length}}),!0}},{key:"ArrowRight",run:me=>!!(si(me.state)!=="active"&&jn(me,"right"))},{key:"Shift-Tab",run:()=>{var me;return(me=D.current)==null||me.call(D),!0}}]),ea=Ye.updateListener.of(me=>{if(me.docChanged&&te.current.size>0){const yt=Kge(te.current,me.state.doc.toString());yt!==null&&(ue.current=yt)}me.transactions.some(yt=>yt.isUserEvent("input")||yt.isUserEvent("delete"))&&(je.current=!1),(me.docChanged||me.selectionSet)&&Nt(me.view)});let so=!1;const il=Ye.updateListener.of(me=>{const lt=_t.current,yt=si(me.state)==="active";if(lt){const Et=me.state.doc;if(!(Et.length===lt.from+lt.text.length&&Et.sliceString(lt.from)===lt.text))_t.current=null;else if(so&&!yt){_t.current=null;const{view:Bt}=me,{from:mn}=lt;window.setTimeout(()=>{if(E.current!==Bt)return;const Qn=Bt.state.doc;Qn.length===mn+lt.text.length&&Qn.sliceString(mn)===lt.text&&Bt.dispatch({changes:{from:mn,to:Qn.length,insert:""}})},0)}}so=yt,yt||Pge(K)}),Nh=pn.create({doc:"",extensions:[Bu.highest(kn),dge,ZD(),I0.of([...MO,...rO]),lge({override:ot,activateOnTyping:!0,icons:!1,optionClass:me=>me.type==="file"?"cm-file-completion":D5(me)?"cm-command-info-completion":"",addToOptions:[{render:Hge,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(me,lt,yt,Et,Ot)=>{const Bt=Et.bottom-Et.top,mn=Ot.bottom-lt.bottom,Qn=mn>=Bt||mn>lt.top,Wr=Qn?"top":"bottom",Ti=Qn?yt.bottom-lt.top:lt.bottom-yt.top;return{style:`${Wr}: ${Ti}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:me=>typeof me.apply=="string"&&me.apply.endsWith(" ")}),D0e({parent:K}),C9.of(KT("")),A9.of(E9(null)),Ye.lineWrapping,T9.of(Ye.editable.of(!0)),Ige(()=>J.current,()=>fe.current),Rge,wd,ea,il,Ye.updateListener.of(me=>{if(me.docChanged){const lt=me.state.doc.toString().trim();Is(lt.length>0||pe.current.length>0||st.current.length>0)}}),Ye.inputHandler.of((me,lt,yt,Et)=>{var Ot;return Et==="!"&&me.state.doc.toString()===""&&si(me.state)!=="active"?(At(),!0):Et==="?"&&me.state.doc.toString()===""&&si(me.state)!=="active"?((Ot=H.current)==null||Ot.call(H),!0):!1}),Ye.domEventHandlers({blur(){return An(),!1},paste(me){var Qn,Wr,Ti,kc;const lt=(Qn=me.clipboardData)==null?void 0:Qn.items;if(!lt)return!1;let yt=!1;for(const $u of lt)if($u.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test($u.type)){yt=!0;const dm=$u.getAsFile();if(!dm)continue;const Vy=$u.type,Cr=new FileReader;Cr.onload=()=>{const hm=Cr.result.split(",")[1];Qe(Wy=>[...Wy,{data:hm,media_type:Vy}])},Cr.readAsDataURL(dm)}if(yt)return me.preventDefault(),!0;const Et=Fge(((Wr=me.clipboardData)==null?void 0:Wr.getData("text/plain"))??"");if(!Et||!Vge(Et))return!1;me.preventDefault(),ya.state.doc.toString()===""&&((Ti=I.current)!=null&&Ti.isVisible)&&((kc=G.current)==null||kc.call(G));const{placeholderText:Ot,nextPasteId:Bt}=Gge(te.current,ue.current,Et);ue.current=Bt;const mn=ya.state.selection.main;return ya.dispatch({changes:{from:mn.from,to:mn.to,insert:Ot},selection:{anchor:mn.from+Ot.length},scrollIntoView:!0}),!0}}),Ye.theme(A)]}),ya=new Ye({state:Nh,parent:z.current});E.current=ya,ya.focus();const Ih=ya.state.doc.toString().trim();return Is(Ih.length>0||pe.current.length>0||st.current.length>0),()=>{ya.destroy(),E.current=null,_e.disconnect(),K.remove()}},[]),b.useEffect(()=>{const K=E.current;K&&(K.dispatch({effects:T9.reconfigure(Ye.editable.of(!s))}),s||K.focus())},[s]),b.useEffect(()=>{const K=E.current;if(!K)return;const ee=!s&&(y!=null&&y.isVisible)&&y.suggestion?y.suggestion:null,ye=ee??(oe?j("editor.shellPlaceholder"):i);K.dispatch({effects:[C9.reconfigure(KT(ye)),A9.reconfigure(E9(ee))]})},[s,i,oe,j,y==null?void 0:y.isVisible,y==null?void 0:y.suggestion]),b.useEffect(()=>{const K=E.current;!K||si(K.state)!=="active"||(ig(K),window.setTimeout(()=>{E.current===K&&Ld(K)},0))},[C]);const el=[a.map(K=>{var ee;return[K.name,K.description??"",K.source??"",K.displayCategory??"",K.argumentHint??"",((ee=K.subcommands)==null?void 0:ee.join(","))??""].join("\0")}).join(""),o.map(K=>[K.name,K.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");b.useEffect(()=>{de.current&&Nt(E.current)},[el,C,Nt]),b.useEffect(()=>{const K=E.current;K&&(p?(An(),K.contentDOM.blur()):K.focus())},[p,An]),b.useEffect(()=>{const K=ee=>{var kn,ea,so;if(W.current||zt||p||ee.defaultPrevented)return;const ye=ee.target,_e=(kn=z.current)==null?void 0:kn.contains(ye),kt=document.activeElement===document.body;if(!_e&&!kt)return;const at=E.current,ot=I.current,ut=og((at==null?void 0:at.state.doc.toString())??"",ot==null?void 0:ot.suggestion);if(at&&!at.hasFocus&&(ot!=null&&ot.isVisible)&&ut&&!u1(ee.target)){if(ee.key==="Tab"&&!ee.shiftKey&&!ee.metaKey&&!ee.ctrlKey&&!ee.altKey&&si(at.state)!=="active"){ee.preventDefault(),at.dispatch({changes:{from:0,to:at.state.doc.length,insert:ut},selection:{anchor:ut.length},scrollIntoView:!0}),at.focus(),(ea=M.current)==null||ea.call(M,"tab",{skipOnAccept:!0});return}if(ee.key==="ArrowRight"&&!ee.shiftKey&&!ee.metaKey&&!ee.ctrlKey&&!ee.altKey&&si(at.state)!=="active"){ee.preventDefault(),at.dispatch({changes:{from:0,to:at.state.doc.length,insert:ut},selection:{anchor:ut.length},scrollIntoView:!0}),at.focus(),(so=M.current)==null||so.call(M,"right",{skipOnAccept:!0});return}}if(ee.metaKey||ee.ctrlKey||ee.altKey||ee.key.length!==1||u1(ee.target)||!at||at.hasFocus)return;if(ee.preventDefault(),ee.key==="!"&&at.state.doc.toString()===""){At();return}const jn=at.state.selection.main;at.dispatch({changes:{from:jn.from,to:jn.to,insert:ee.key},selection:{anchor:jn.from+ee.key.length},scrollIntoView:!0}),at.focus(),ee.key==="/"?window.setTimeout(()=>{Nt(E.current)},0):ee.key==="@"&&window.setTimeout(()=>{const il=E.current;il&&il.hasFocus&&Ld(il)},0)};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[zt,p,Nt,At]);const vc=b.useCallback(()=>{var K;(K=E.current)==null||K.focus()},[]),ga=b.useCallback((K,ee)=>{const ye=E.current;if(!ye||!K){ye==null||ye.focus();return}if((ee==null?void 0:ee.mode)==="replace"){ye.dispatch({changes:{from:0,to:ye.state.doc.length,insert:K},effects:Hc.of(),selection:{anchor:K.length},scrollIntoView:!0}),ye.focus();return}const _e=ye.state.selection.main;let kt=K,at=!1,ot=null;const ut=K==="@";let jn=K==="/";if(K==="/")ye.state.doc.lineAt(_e.head).text.startsWith("/")?at=!0:ye.state.doc.length>0&&(at=!0,jn=!1);else if(K==="@"){const kn=_e.from>0?ye.state.doc.sliceString(_e.from-1,_e.from):"";ye.state.doc.sliceString(_e.from,_e.from+1)==="@"?(at=!0,ot=_e.from+1):kn==="@"?at=!0:kn&&!/\s/.test(kn)&&(kt=" @")}at?ot!==null&&ye.dispatch({selection:{anchor:ot},scrollIntoView:!0}):(ye.dispatch({changes:{from:_e.from,to:_e.to,insert:kt},selection:{anchor:_e.from+kt.length},scrollIntoView:!0}),ut&&(_t.current={text:kt,from:_e.from})),ye.focus(),jn?window.setTimeout(()=>{Nt(E.current)},0):ut&&window.setTimeout(()=>{const kn=E.current;kn&&kn.hasFocus&&Ld(kn)},0)},[Nt]),Si=b.useCallback(()=>{var K;return((K=E.current)==null?void 0:K.state.doc.toString())??""},[]),tl=b.useCallback(K=>{const ee=E.current;ee&&(ee.dispatch({changes:{from:0,to:ee.state.doc.length,insert:K},effects:Hc.of(),selection:{anchor:K.length},scrollIntoView:!0}),ee.focus())},[]),nn=b.useCallback(K=>{const ee=E.current;if(!ee)return;const ye=[];ee.state.field(wd).between(0,ee.state.doc.length,(_e,kt,at)=>{const ot=at.spec.tag;ot&&(!K||K(ot))&&ye.push({from:_e,to:kt,insert:""})}),ee.dispatch({...ye.length>0?{changes:ye}:{},effects:B5.of({predicate:K}),scrollIntoView:!0})},[]),an=b.useCallback(K=>{const ee=(K==null?void 0:K.text)??!0,ye=(K==null?void 0:K.tags)??!0,_e=E.current;ee&&_e&&_e.state.doc.length>0&&_e.dispatch({changes:{from:0,to:_e.state.doc.length,insert:""},effects:Hc.of()}),ee&&(Qe([]),te.current.clear(),ue.current=1),ye&&(ae([]),ee||nn())},[nn]),Zi=b.useCallback(()=>{an({text:!0,tags:!1})},[an]),nl=b.useCallback((K,ee)=>{if(K.length!==0){if((ee==null?void 0:ee.placement)==="inline"){const ye=E.current;if(!ye)return;const _e=ye.state.selection.main;let kt=_e.from;const at=[],ot=K.map(jn=>{const kn=ag(jn);return at.push({from:kt,to:kt+kn.length,tag:jn}),kt+=kn.length+1,kn}).join(" "),ut=ot?`${ot} `:"";ye.dispatch({changes:{from:_e.from,to:_e.to,insert:ut},effects:at.length>0?at.map(jn=>jw.of(jn)):void 0,selection:{anchor:_e.from+ut.length},scrollIntoView:!0}),ye.focus();return}ae(ye=>{const _e=[...ye];for(const kt of K){const at=_e.findIndex(ot=>ot.id===kt.id);at>=0?_e[at]=kt:_e.push(kt)}return _e})}},[]),xc=b.useCallback(K=>{ae(ee=>ee.filter(ye=>ye.id!==K||ye.removable===!1)),nn(ee=>ee.id===K&&ee.removable!==!1)},[nn]),wc=b.useCallback(()=>{var K;return(((K=E.current)==null?void 0:K.state.doc.toString().trim().length)??0)>0||pe.current.length>0||st.current.length>0},[]),ti=b.useCallback(K=>{const ee=E.current;if(!ee)return;const ye=Zge(ee);if((K==null?void 0:K.tagPlacement)==="inline"){Je.current(ee,E4(K.text??"",K.tags??ye),[]);return}if((K==null?void 0:K.text)!==void 0&&K.tags===void 0&&ye.length>0){Je.current(ee,E4(K.text,ye),[]);return}Je.current(ee,K==null?void 0:K.text,K?K.tags??[]:void 0)},[]),no=b.useCallback(()=>{const K=Ln.current.getLastEntry(ye=>!ye.startsWith("/")&&!ye.startsWith("!"));!K||P.current(K)===!1||Qe([])},[]),ni=b.useCallback(K=>{const ee=E.current;ee&&ee.dispatch({changes:{from:0,to:ee.state.doc.length,insert:K},selection:{anchor:K.length},scrollIntoView:!0})},[]);b.useEffect(()=>{const K=wt.current;if(!K)return;const ee=E.current;if(!ee)return;const ye=K.tagPlacement??"top";if(K.tags!==void 0&&ye==="top"&&ae([...K.tags]),K.text!==void 0||ye==="inline"){const kt=ye==="inline"?[...K.tags??[]]:[],at=kt.map(ag).join(" "),ot=ye==="inline"?at&&K.text?`${at} ${K.text}`:at||(K.text??""):K.text??"",ut=[Hc.of()];if(kt.length>0){let jn=0;for(const kn of kt){const ea=ag(kn);ut.push(jw.of({from:jn,to:jn+ea.length,tag:kn})),jn+=ea.length+1}}ee.dispatch({changes:{from:0,to:ee.state.doc.length,insert:ot},effects:ut,selection:{anchor:ot.length},scrollIntoView:!0})}else ee.dispatch({effects:Hc.of()});(K.text!==void 0||K.submit)&&ee.focus();let _e=null;return K.submit&&(_e=window.setTimeout(()=>{E.current&&ti(K)},0)),()=>{_e!==null&&window.clearTimeout(_e)}},[k,ti]);const Os=b.useCallback((K,ee=!0)=>{var _e;K&&ni(Xt.current),Vt(!1),Le(""),tn([]),Kt(0),(ht.current?ft.current:Ln.current).resetSearch(),ee&&((_e=E.current)==null||_e.focus())},[ni]);b.useEffect(()=>{if(!zt)return;const K=ee=>{if(ee instanceof MouseEvent&&ee.button!==0||ee.defaultPrevented)return;const ye=gn.current,_e=ee.target;ye&&_e instanceof Node&&!ye.contains(_e)&&Os(!0,!1)};return window.addEventListener("mousedown",K),window.addEventListener("touchstart",K),()=>{window.removeEventListener("mousedown",K),window.removeEventListener("touchstart",K)}},[zt,Os]);const ri=b.useCallback(K=>{var ot;if(!E.current)return;Os(!1);const ye=K.trim();if(!ye)return;const _e=st.current,kt=ht.current;if(P.current(kt?`!${ye}`:ye,_e.length>0?[..._e]:void 0)===!1){ni(K);return}(ot=G.current)==null||ot.call(G),kt?(ft.current.push(ye),ft.current.reset()):(Ln.current.push(ye),Ln.current.reset()),Qe([]),ni("")},[Os,ni]),rl=K=>{if(!K.nativeEvent.isComposing)if(K.key==="Escape")K.preventDefault(),Os(!0);else if(K.key==="Tab"){K.preventDefault();const ee=qt[Mt];ee&&ni(ee),Os(!1)}else if(K.key==="Enter"){K.preventDefault();const ee=qt[Mt];ee?ri(ee):Os(!1)}else K.key==="r"&&K.ctrlKey&&(K.preventDefault(),qt.length>0&&Kt(ee=>(ee+1)%qt.length))},sl=K=>{const ee=ht.current?ft.current:Ln.current;tn(ss(K)),Kt(0),ee.resetSearch()},tr=K=>{const ee=K.target.value;Le(ee),!K.nativeEvent.isComposing&&sl(ee)},ro=K=>{const ee=K.currentTarget.value;Le(ee),sl(ee)},rt=b.useCallback(K=>{Qe(ee=>ee.filter((ye,_e)=>_e!==K))},[]),on=!oe&&!zt&&!(y!=null&&y.isVisible)&&!s&&!p,mr={clearText:Zi,clear:an,focus:vc,getText:Si,hasInput:wc,setText:tl,addTags:nl,removeTag:xc,insertText:ga,retryLast:no,submit:ti};return{containerRef:z,viewRef:E,focus:vc,submitText:b.useCallback(()=>{const K=E.current;K&&Je.current(K)},[]),clearText:Zi,getText:Si,hasInput:wc,hasContent:bt,handle:mr,pastedImages:Be,removeImage:rt,composerTags:re,removeTopTag:xc,addTags:nl,removeInlineTags:nn,insertText:ga,setText:tl,submit:ti,clear:an,retryLast:no,replaceEditorText:ni,shellMode:oe,setShellMode:Xe,toggleShellMode:At,currentMode:f,sessionName:g,searchState:{searchMode:zt,searchQuery:gt,searchMatches:qt,searchActiveIndex:Mt,searchInputRef:$t,searchUiRef:gn,openHistorySearch:Bn,closeSearch:Os,submitSearchMatch:ri,handleSearchKeyDown:rl,handleSearchInput:tr,handleSearchCompositionEnd:ro},navigatePrevHistory:Zo,navigateNextHistory:Ji,showShortcutHints:on,followupState:y,disabled:s,onAcceptFollowup:w,onDismissFollowup:v,slashMenu:fn,closeSlashMenu:An,selectSlashCompletion:Tr,acceptSlashCompletion:it}}function Dw({mode:e}){return e==="plan"?h.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[h.jsx("path",{d:"M192 64h576a128 128 0 0 1 128 128v640a128 128 0 0 1-128 128H192a128 128 0 0 1-128-128V192a128 128 0 0 1 128-128z m0 64a64 64 0 0 0-64 64v640a64 64 0 0 0 64 64h576a64 64 0 0 0 64-64V192a64 64 0 0 0-64-64H192z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),h.jsx("path",{d:"M438.848 265.216a31.808 31.808 0 0 0-44.992 0L287.232 371.84l-42.688-42.688a30.72 30.72 0 1 0-43.456 43.456l59.584 59.584c1.344 2.304 2.432 4.672 4.416 6.656 6.656 6.592 15.36 9.408 23.936 9.088a30.848 30.848 0 0 0 21.824-9.024c0.704-0.704 1.024-1.6 1.6-2.432l126.4-126.336a31.744 31.744 0 0 0 0-44.928zM544 320a32 32 0 0 0 0 64h192a32 32 0 0 0 0-64h-192zM393.856 489.216L287.232 595.84l-42.688-42.688a30.72 30.72 0 1 0-43.456 43.456l59.584 59.584c1.344 2.304 2.432 4.672 4.416 6.656 6.656 6.592 15.36 9.408 23.936 9.088a30.848 30.848 0 0 0 21.824-9.024c0.704-0.704 1.024-1.6 1.6-2.432l126.4-126.336a31.872 31.872 0 0 0-44.992-44.928zM544 544a32 32 0 0 0 0 64h192a32 32 0 0 0 0-64h-192z",fill:"currentColor"})]}):e==="default"?h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M7.8 11.8V5.6a1.4 1.4 0 0 1 2.8 0v5.2M10.6 10V4.7a1.4 1.4 0 0 1 2.8 0v6.1M13.4 10.8V6.1a1.4 1.4 0 0 1 2.8 0v6.2M16.2 12.2V8.7a1.4 1.4 0 0 1 2.8 0v4.9c0 4-2.7 6.8-6.4 6.8h-.9c-2.4 0-4.2-1-5.5-3.1L4.4 14a1.45 1.45 0 0 1 2.5-1.45l1.2 2.1",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}):e==="auto-edit"?h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"4",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),h.jsx("path",{d:"M8 10h.01M8 14h.01M11 12h5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}):e==="auto"?h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("path",{d:"M12 3.5 18.8 7v5.2c0 4-2.7 7.4-6.8 8.8-4.1-1.4-6.8-4.8-6.8-8.8V7L12 3.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),h.jsx("path",{d:"m9 12.1 2 2 4-4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]}):e==="yolo"?h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("path",{d:"M12 3.5 19 6v5.2c0 4.1-2.8 7.8-7 9.3-4.2-1.5-7-5.2-7-9.3V6l7-2.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),h.jsx("path",{d:"M12 8v4.2M12 15.6h.01",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}):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
 * SPDX-License-Identifier: Apache-2.0
 */const M4=16e3,r1e=4096,N9=6e4;function s1e(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 i1e="qwen-bearer.",a1e="qwen-ws";function o1e(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`${i1e}${r}`}function l1e(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 c1e(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 u1e(e){const{baseUrl:t,token:n,onFinal:r,onError:s}=e,[i,a]=b.useState("idle"),[o,l]=b.useState(""),[c,u]=b.useState(0),[d,f]=b.useState(void 0),m=b.useRef({}),p=b.useRef(!0),y=b.useRef(0),w=b.useRef("idle"),v=b.useRef(r);v.current=r;const g=b.useRef(s);g.current=s;const x=b.useCallback(D=>{w.current=D,a(D)},[]),k=b.useCallback(()=>{const D=m.current;D.transcribeTimeout&&(clearTimeout(D.transcribeTimeout),D.transcribeTimeout=void 0)},[]),A=b.useCallback(()=>{var H;const D=m.current;D.processor&&(D.processor.onaudioprocess=null);for(const W of[D.processor,D.source,D.sink])try{W==null||W.disconnect()}catch{}(H=D.stream)==null||H.getTracks().forEach(W=>W.stop()),D.context&&D.context.state!=="closed"&&D.context.close().catch(()=>{}),D.processor=void 0,D.sink=void 0,D.source=void 0,D.stream=void 0,D.context=void 0},[]),T=b.useCallback(()=>{y.current++,A();const D=m.current;if(k(),D.ws){try{D.ws.onmessage=null,D.ws.onerror=null,D.ws.onclose=null,D.ws.close()}catch{}D.ws=void 0}},[A,k]),C=b.useCallback((D,H)=>{var W;!p.current||H!==void 0&&y.current!==H||(T(),x("error"),l(""),u(0),f(D),(W=g.current)==null||W.call(g,D))},[T,x]),j=b.useCallback((D,H)=>{H!==void 0&&y.current!==H||(T(),p.current&&(x("idle"),l(""),u(0),v.current(D)))},[T,x]),z=b.useCallback(()=>{if(w.current!=="idle"&&w.current!=="error")return;f(void 0),l(""),x("connecting");const D=++y.current,H=()=>!p.current||y.current!==D;(async()=>{var W;try{if(!((W=navigator.mediaDevices)!=null&&W.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 J;try{J=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch($){throw new Error(l1e($))}if(H()){J.getTracks().forEach($=>$.stop());return}m.current.stream=J;const Y=new AudioContext({sampleRate:M4});if(Y.sampleRate!==M4)throw J.getTracks().forEach($=>$.stop()),Y.close().catch(()=>{}),new Error(`Browser audio rate ${Y.sampleRate} Hz is not the required ${M4} Hz.`);if(m.current.context=Y,Y.state==="suspended"&&await Y.resume(),H()){J.getTracks().forEach($=>$.stop()),Y.close().catch(()=>{});return}const Z=Y.createMediaStreamSource(J),Q=Y.createScriptProcessor(r1e,1,1),L=Y.createGain();L.gain.value=0,m.current.source=Z,m.current.processor=Q,m.current.sink=L;const R=new WebSocket(s1e(t),n?[a1e,o1e(n)]:void 0);R.binaryType="arraybuffer",m.current.ws=R,Q.onaudioprocess=$=>{const{pcm:I,level:M}=c1e($.inputBuffer.getChannelData(0));p.current&&u(M),R.readyState===WebSocket.OPEN&&R.send(I)},R.onopen=()=>{if(H()){Q.onaudioprocess=null;for(const I of[Q,Z,L])try{I.disconnect()}catch{}J.getTracks().forEach(I=>I.stop()),Y.state!=="closed"&&Y.close().catch(()=>{});const $=m.current;$.ws===R&&($.ws=void 0),$.processor===Q&&($.processor=void 0),$.source===Z&&($.source=void 0),$.sink===L&&($.sink=void 0),$.stream===J&&($.stream=void 0),$.context===Y&&($.context=void 0);try{R.close()}catch{}return}R.send(JSON.stringify({type:"start"})),Z.connect(Q),Q.connect(L),L.connect(Y.destination),k(),m.current.transcribeTimeout=setTimeout(()=>{w.current==="recording"&&C("No response from server. Check that the voice model is running.",D)},N9),p.current&&x("recording")},R.onmessage=$=>{(w.current==="connecting"||w.current==="recording")&&k();let I;try{I=JSON.parse(String($.data))}catch{return}I.type==="interim"?p.current&&l(I.text??""):I.type==="final"?j(I.text??"",D):I.type==="error"&&C(I.message??I.text??"Voice transcription failed.",D)},R.onerror=()=>{},R.onclose=$=>{if(p.current&&(w.current==="recording"||w.current==="connecting"||w.current==="transcribing")){const I=$.code||1006,M=$.reason||"none";C(`Voice connection closed (code=${I}, reason=${M}).`,D)}}}catch(J){C(J instanceof Error?J.message:String(J),D)}})()},[t,n,C,j,x,k]),E=b.useCallback(()=>{const D=m.current.ws;if(!D||D.readyState!==WebSocket.OPEN){T(),x("idle");return}A(),u(0),x("transcribing");const H=y.current;try{D.send(JSON.stringify({type:"stop"})),k(),m.current.transcribeTimeout=setTimeout(()=>{w.current==="transcribing"&&C("Transcription timed out.",H)},N9)}catch{C("Failed to finalize voice transcription.",H)}},[T,A,C,x,k]),P=b.useCallback(()=>{const D=m.current.ws;if(D&&D.readyState===WebSocket.OPEN)try{D.send(JSON.stringify({type:"abort"}))}catch{}T(),x("idle"),l(""),u(0)},[T,x]);return b.useEffect(()=>(p.current=!0,()=>{p.current=!1,T()}),[T]),{status:i,interimText:o,audioLevel:c,errorMessage:d,start:z,stop:E,abort:P}}const d1e="_root_mbh07_7",h1e="_iconBtn_mbh07_14",f1e="_error_mbh07_47",m1e="_connecting_mbh07_51",p1e="_pill_mbh07_56",g1e="_transcribing_mbh07_75",y1e="_recDot_mbh07_79",b1e="_wave_mbh07_88",v1e="_bar_mbh07_95",x1e="_time_mbh07_103",w1e="_stop_mbh07_111",_1e="_spinner_mbh07_118",k1e="_interim_mbh07_128",is={root:d1e,iconBtn:h1e,error:f1e,connecting:m1e,pill:p1e,transcribing:g1e,recDot:y1e,wave:b1e,bar:v1e,time:x1e,stop:w1e,spinner:_1e,interim:k1e},S1e="voice_transcribe",I9=16,T1e=()=>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"})]}),C1e=()=>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 A1e(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function E1e({onInsert:e,disabled:t}){var E;const n=K_(),r=((E=n.capabilities)==null?void 0:E.features)??[],[s,i]=b.useState(void 0),{status:a,interimText:o,audioLevel:l,errorMessage:c,start:u,stop:d,abort:f}=u1e({baseUrl:n.baseUrl,token:n.token,onFinal:P=>{const D=P.trim();D?(i(void 0),e(D)):i("No speech detected.")}}),m=a==="recording",[p,y]=b.useState(()=>new Array(I9).fill(0));b.useEffect(()=>{if(!m){y(new Array(I9).fill(0));return}y(P=>[...P.slice(1),Math.min(1,l*8)])},[l,m]);const[w,v]=b.useState(0);if(b.useEffect(()=>{if(!m){v(0);return}const P=performance.now(),D=setInterval(()=>v(performance.now()-P),200);return()=>clearInterval(D)},[m]),!r.includes(S1e))return null;const g=a==="connecting",x=a==="transcribing",k=a==="error",A=!!s&&!k,T=m||g,C=m?"Stop dictation":x?"Transcribing…":g?"Starting…":k?`Voice error — click to retry${c?`: ${c}`:""}`:A?"No speech detected — click to retry":"Start voice dictation";let j;if(m)j=h.jsxs("button",{type:"button",className:is.pill,onClick:()=>d(),"aria-label":C,title:C,children:[h.jsx("span",{className:is.recDot,"aria-hidden":"true"}),h.jsx("span",{className:is.wave,"aria-hidden":"true",children:p.map((P,D)=>h.jsx("span",{className:is.bar,style:{height:`${2+Math.round(P*14)}px`}},D))}),h.jsx("span",{className:is.time,children:A1e(w)}),h.jsx("span",{className:is.stop,"aria-hidden":"true",children:h.jsx(C1e,{})})]});else if(x)j=h.jsxs("span",{className:`${is.pill} ${is.transcribing}`,role:"status","aria-label":C,children:[h.jsx("span",{className:is.spinner,"aria-hidden":"true"}),h.jsx("span",{className:is.time,children:"…"})]});else{const P=[is.iconBtn,k?is.error:"",g?is.connecting:""].filter(Boolean).join(" ");j=h.jsx("button",{type:"button",className:P,onClick:()=>{if(g)f();else{if(t)return;i(void 0),u()}},disabled:!!t&&!T,"aria-label":C,title:c??s??C,children:h.jsx(T1e,{})})}const z=m&&o||k||A;return h.jsxs("span",{className:is.root,children:[j,z&&h.jsx("span",{role:"status","aria-live":"polite",className:`${is.interim}${k?` ${is.error}`:""}`,children:k?c||"Voice error":A?s:o})]})}const M1e="_editorShell_d2ixx_1",N1e="_container_d2ixx_7",I1e="_content_d2ixx_20",R1e="_dacAura_d2ixx_29",j1e="_dacHalo_d2ixx_30",D1e="_slashPortalLayer_d2ixx_171",O1e="_slashPanel_d2ixx_175",L1e="_slashPanelBody_d2ixx_208",B1e="_slashList_d2ixx_214",z1e="_slashEntry_d2ixx_242",$1e="_slashSection_d2ixx_248",P1e="_slashItem_d2ixx_254",q1e="_slashItemActive_d2ixx_275",U1e="_slashCommand_d2ixx_279",H1e="_slashDetail_d2ixx_284",F1e="_slashDetailCommand_d2ixx_302",V1e="_slashDetailText_d2ixx_311",W1e="_slashDescription_d2ixx_326",G1e="_tags_d2ixx_354",K1e="_tag_d2ixx_354",Y1e="_tagLabel_d2ixx_375",X1e="_tagValue_d2ixx_376",Q1e="_tagRemove_d2ixx_394",J1e="_editorArea_d2ixx_414",Z1e="_shellPrefix_d2ixx_427",eye="_toolbar_d2ixx_463",tye="_toolbarLeading_d2ixx_472",nye="_toolbarStart_d2ixx_473",rye="_toolbarEnd_d2ixx_474",sye="_toolbarLeft_d2ixx_475",iye="_toolbarRight_d2ixx_476",aye="_toolBtn_d2ixx_505",oye="_toolBtnText_d2ixx_511",lye="_dropdownWrapper_d2ixx_516",cye="_dropdown_d2ixx_516",uye="_dropdownRich_d2ixx_536",dye="_dropdownCheck_d2ixx_542",hye="_dropdownItem_d2ixx_548",fye="_dropdownItemActive_d2ixx_584",mye="_dropdownItemIcon_d2ixx_589",pye="_dropdownItemCheck_d2ixx_590",gye="_dropdownItemContent_d2ixx_607",yye="_dropdownItemLabel_d2ixx_614",bye="_dropdownItemDesc_d2ixx_624",vye="_toolBtnIcon_d2ixx_682",xye="_widthModeBtn_d2ixx_696",wye="_quickActionsBtn_d2ixx_700",_ye="_toolBtnModeIcon_d2ixx_704",kye="_toolBtnModelIcon_d2ixx_705",Sye="_toolBtnArrow_d2ixx_727",Tye="_chevronDown_d2ixx_740",Cye="_quickActionsPanel_d2ixx_749",Aye="_quickActionsHeader_d2ixx_762",Eye="_quickActionsLayout_d2ixx_769",Mye="_quickActionsGrid_d2ixx_776",Nye="_quickAction_d2ixx_700",Iye="_quickActionLabel_d2ixx_807",Rye="_quickKeysGrid_d2ixx_822",jye="_quickKey_d2ixx_822",Dye="_quickKeyLabel_d2ixx_851",Oye="_sendBtn_d2ixx_874",Lye="_sendBtnRunning_d2ixx_911",Bye="_sendIcon_d2ixx_922",zye="_stopIcon_d2ixx_928",$ye="_images_d2ixx_935",Pye="_imageThumb_d2ixx_942",qye="_imageRemove_d2ixx_957",Uye="_searchPanel_d2ixx_978",Hye="_searchBar_d2ixx_995",Fye="_searchLabel_d2ixx_1003",Vye="_searchInput_d2ixx_1008",Wye="_searchResults_d2ixx_1022",Gye="_searchResult_d2ixx_1022",Kye="_searchResultActive_d2ixx_1055",Yye="_searchResultMarker_d2ixx_1060",Xye="_searchResultText_d2ixx_1065",Qye="_searchEmpty_d2ixx_1072",Me={editorShell:M1e,container:N1e,content:I1e,dacAura:R1e,dacHalo:j1e,slashPortalLayer:D1e,slashPanel:O1e,slashPanelBody:L1e,slashList:B1e,slashEntry:z1e,slashSection:$1e,slashItem:P1e,slashItemActive:q1e,slashCommand:U1e,slashDetail:H1e,slashDetailCommand:F1e,slashDetailText:V1e,slashDescription:W1e,tags:G1e,tag:K1e,tagLabel:Y1e,tagValue:X1e,tagRemove:Q1e,editorArea:J1e,shellPrefix:Z1e,toolbar:eye,toolbarLeading:tye,toolbarStart:nye,toolbarEnd:rye,toolbarLeft:sye,toolbarRight:iye,toolBtn:aye,toolBtnText:oye,dropdownWrapper:lye,dropdown:cye,dropdownRich:uye,dropdownCheck:dye,dropdownItem:hye,dropdownItemActive:fye,dropdownItemIcon:mye,dropdownItemCheck:pye,dropdownItemContent:gye,dropdownItemLabel:yye,dropdownItemDesc:bye,toolBtnIcon:vye,widthModeBtn:xye,quickActionsBtn:wye,toolBtnModeIcon:_ye,toolBtnModelIcon:kye,toolBtnArrow:Sye,chevronDown:Tye,quickActionsPanel:Cye,quickActionsHeader:Aye,quickActionsLayout:Eye,quickActionsGrid:Mye,quickAction:Nye,quickActionLabel:Iye,quickKeysGrid:Rye,quickKey:jye,quickKeyLabel:Dye,sendBtn:Oye,sendBtnRunning:Lye,sendIcon:Bye,stopIcon:zye,images:$ye,imageThumb:Pye,imageRemove:qye,searchPanel:Uye,searchBar:Hye,searchLabel:Fye,searchInput:Vye,searchResults:Wye,searchResult:Gye,searchResultActive:Kye,searchResultMarker:Yye,searchResultText:Xye,searchEmpty:Qye},Jye={"&":{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(--text-primary, #e0e0e0)",caretColor:"var(--accent-color, #4a9eff)",fontSize:"14px",lineHeight:"1.6"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--text-dimmed, #666)"},".cm-followup-ghost":{color:"var(--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(--accent-color, #4a9eff)",borderLeftWidth:"2px"}},Zye=["--accent-color","--bg-primary","--bg-tertiary","--border-color","--font-mono","--font-sans","--text-primary","--text-secondary"];function ebe(){return h.jsx("svg",{className:Me.sendIcon,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M1 1L15 8L1 15V9.5L10 8L1 6.5V1Z",fill:"currentColor"})})}function tbe(){return h.jsx("span",{className:Me.stopIcon,"aria-hidden":"true"})}function nbe(){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 rbe(e,t){let n,r,s,i,a=0,o=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=a,v=y-w;if(Math.abs(v)<.001){a=y,l(y,o);return}const g=performance.now(),x=k=>{const A=Math.min((k-g)/220,1);a=w+v*(1-(1-A)**2),l(a,o),n=A<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},u=()=>{r!==void 0&&window.cancelAnimationFrame(r);const y=o,w=performance.now(),v=g=>{const x=Math.min((g-w)/300,1);o=y*(1-x),l(a,o),r=x<1?window.requestAnimationFrame(v):void 0};r=window.requestAnimationFrame(v)},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),o=1,l(a,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 sbe({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 R9(){return h.jsx("span",{className:Me.chevronDown,"aria-hidden":"true"})}function ibe(){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 abe(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 obe=[{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 lbe(){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 j9(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 D9({open:e,items:t,activeId:n,onClose:r,onSelect:s,anchorRef:i,showCheck:a=!1}){const o=b.useRef(null);if(b.useEffect(()=>{if(!e)return;const u=d=>{if(d instanceof MouseEvent&&d.button!==0||d.defaultPrevented)return;const f=o.current,m=i.current,p=d.target;f&&p instanceof Node&&!f.contains(p)&&m&&!m.contains(p)&&r()};return window.addEventListener("mousedown",u),()=>window.removeEventListener("mousedown",u)},[e,r,i]),b.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),r())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,r]),!e)return null;const l=t.some(u=>u.description||u.icon),c=l||a;return h.jsx("div",{ref:o,className:`${Me.dropdown} ${l?Me.dropdownRich:a?Me.dropdownCheck:""}`,children:t.map(u=>h.jsx("button",{type:"button",className:`${Me.dropdownItem} ${u.id===n?Me.dropdownItemActive:""}`,onMouseDown:d=>{d.preventDefault(),s(u.id)},children:c?h.jsxs(h.Fragment,{children:[l&&h.jsx("span",{className:Me.dropdownItemIcon,children:u.icon}),h.jsxs("span",{className:Me.dropdownItemContent,children:[h.jsx("span",{className:Me.dropdownItemLabel,children:u.label}),u.description&&h.jsx("span",{className:Me.dropdownItemDesc,children:u.description})]}),h.jsx("span",{className:Me.dropdownItemCheck,children:u.id===n?h.jsx(lbe,{}):null})]}):u.label},u.id))})}function cbe({menu:e,anchorRef:t,panelRef:n,onSelect:r,onAccept:s}){const i=b.useRef([]),[a,o]=b.useState(null),[l,c]=b.useState({}),[u,d]=b.useState(null),f=b.useRef(null);b.useEffect(()=>{var k;(k=i.current[e.selectedIndex])==null||k.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),b.useLayoutEffect(()=>{const k=t.current;if(!k)return;const A=()=>{const C=k.getBoundingClientRect(),j=getComputedStyle(k),z=Object.fromEntries(Zye.map(E=>[E,j.getPropertyValue(E)]));o({left:Math.max(12,Math.min(C.left+16,window.innerWidth-252)),bottom:window.innerHeight-C.top+8,width:C.width}),c(z)};A();const T=new ResizeObserver(A);return T.observe(k),window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{T.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[t,e.items]),b.useEffect(()=>{d(null)},[e.items]);const m=k=>Array.from(k).length,p=Math.max(...e.items.map(k=>m(k.label)),0),y=Math.max(...e.items.map(k=>m(k.detail??"")),0),w=y>0,v={"--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"};let g;if(!a)return null;const x={...v,...l,left:a.left,bottom:a.bottom,"--slash-anchor-width":`${a.width}px`};return O1.createPortal(h.jsxs("div",{ref:n,className:Me.slashPortalLayer,style:l,children:[h.jsx("div",{className:Me.slashPanel,style:x,role:"listbox",onMouseDown:k=>k.preventDefault(),onMouseLeave:k=>{var T;const A=k.relatedTarget;A instanceof Node&&((T=f.current)!=null&&T.contains(A))||d(null)},children:h.jsx("div",{className:Me.slashPanelBody,children:h.jsx("div",{className:Me.slashList,onScroll:()=>d(null),children:e.items.map((k,A)=>{const T=k.section,C=e.kind==="command"&&A>0&&T!==void 0&&T!==g;return g=T??g,h.jsxs("div",{className:Me.slashEntry,children:[C&&h.jsx("div",{className:Me.slashSection}),h.jsxs("button",{ref:j=>{i.current[A]=j},type:"button",role:"option","aria-selected":A===e.selectedIndex,className:`${Me.slashItem} ${A===e.selectedIndex?Me.slashItemActive:""}`,onMouseEnter:j=>{if(r(A),!k.detail){d(null);return}const z=j.currentTarget,E=8,P=180,D=z.getBoundingClientRect(),W=Math.min(D.left+Math.min(220,D.width*.34),window.innerWidth-320-12),J=window.innerHeight-D.bottom-E-12,Y=D.top-E-12,Z=J>=96||J>=Y,Q=Math.max(72,Math.min(P,Z?J:Y));d({label:k.label,detail:k.detail,left:Math.max(12,W),...Z?{top:D.bottom+E}:{bottom:window.innerHeight-D.top+E},maxHeight:Q})},onMouseDown:j=>{j.preventDefault(),j.stopPropagation(),s(A)},children:[h.jsx("span",{className:Me.slashCommand,children:k.label}),k.detail&&h.jsx("span",{className:Me.slashDescription,children:k.detail})]})]},`${k.id}:${A}`)})})})}),u&&h.jsxs("div",{ref:f,className:Me.slashDetail,style:{...l,left:u.left,top:u.top,bottom:u.bottom,maxHeight:u.maxHeight},children:[h.jsx("div",{className:Me.slashDetailCommand,children:u.label}),h.jsx("div",{className:Me.slashDetailText,children:u.detail})]})]}),document.body)}function ube({actions:e,onRun:t,onPressKey:n}){const{t:r}=nt();return h.jsxs("div",{className:Me.quickActionsPanel,onMouseDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[h.jsx("div",{className:Me.quickActionsHeader,children:r("quickActions.title")}),h.jsxs("div",{className:Me.quickActionsLayout,children:[h.jsx("div",{className:Me.quickActionsGrid,children:e.map(s=>h.jsx("button",{type:"button",className:Me.quickAction,onClick:()=>t(s),children:h.jsx("span",{className:Me.quickActionLabel,children:s.label})},s.id))}),h.jsx("div",{className:Me.quickKeysGrid,children:obe.map(s=>h.jsx("button",{type:"button",className:Me.quickKey,title:r(s.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(s),children:h.jsx("span",{className:Me.quickKeyLabel,children:s.label})},s.id))})]})]})}const dbe=b.memo(b.forwardRef(function(t,n){const{onSubmit:r,onCycleMode:s,onToggleShortcuts:i,onCancel:a,isRunning:o=!1,disabled:l=!1,placeholderText:c="Type a message...",commands:u,skills:d=[],slashCommandCategoryOrder:f,queuedMessages:m=[],onPopQueuedMessages:p,onClearQueuedMessages:y,currentMode:w="default",currentModel:v="",chatWidthMode:g="1000",showChatWidthToggle:x=!0,chatWidthToggleMin:k,visibleToolbarActions:A,availableModels:T=[],onSelectMode:C,onSelectModel:j,onChatWidthModeChange:z,onFocusFooter:E,dialogOpen:P=!1,followupState:D,onAcceptFollowup:H,onDismissFollowup:W,sessionName:J,composerInput:Y,composerInputVersion:Z}=t,Q=n1e({onSubmit:r,onCycleMode:s,onToggleShortcuts:i,disabled:l,placeholderText:c,commands:u,skills:d,slashCommandCategoryOrder:f,queuedMessages:m,onPopQueuedMessages:p,onClearQueuedMessages:y,currentMode:w,onFocusFooter:E,dialogOpen:P,followupState:D,onAcceptFollowup:H,onDismissFollowup:W,sessionName:J,composerInput:Y,composerInputVersion:Z,editorTheme:Jye}),{t:L}=nt(),{renderComposerToolbarStart:R,renderComposerToolbarEnd:$}=Ru();b.useImperativeHandle(n,()=>Q.handle,[Q.handle]);const[I,M]=b.useState(!1),[G,ne]=b.useState(!1),[fe,Pe]=b.useState(!1),oe=b.useRef(null),Xe=b.useRef(null),ht=b.useRef(null),At=b.useRef(null),[zt,Vt]=b.useState(!1),gt=Q.slashMenu,Le=Q.closeSlashMenu,qt=Q.viewRef;b.useEffect(()=>{if(!gt)return;const Ee=it=>{var ei;const bt=it.target,Is=oe.current;bt instanceof Node&&Is&&!Is.contains(bt)&&!((ei=Xe.current)!=null&&ei.contains(bt))&&Le()};return window.addEventListener("mousedown",Ee),window.addEventListener("touchstart",Ee),()=>{window.removeEventListener("mousedown",Ee),window.removeEventListener("touchstart",Ee)}},[gt,Le]),b.useEffect(()=>{var bt;const Ee=oe.current,it=(bt=qt.current)==null?void 0:bt.contentDOM;if(!(!Ee||!it))return rbe(Ee,it)},[qt]),b.useEffect(()=>{const Ee=oe.current,it=k;if(!Ee||it===void 0){Vt(!1);return}const bt=()=>{Vt(Ee.getBoundingClientRect().width>=it-50)};bt();const Is=new ResizeObserver(bt);return Is.observe(Ee),()=>Is.disconnect()},[k]);const tn=b.useMemo(()=>J1.map(Ee=>({id:Ee,label:j9(Ee,L),description:L(`mode.desc.${Ee}`),icon:h.jsx(Dw,{mode:Ee})})),[L]),Mt=b.useMemo(()=>A?new Set(A):null,[A]),Kt=Ee=>Mt?Mt.has(Ee):!0,$t=b.useMemo(()=>new Set(u.map(Ee=>Ee.name.replace(/^\/+/,""))),[u]),gn=b.useCallback(Ee=>$t.has(Ee),[$t]),Xt=b.useMemo(()=>[{id:"new",label:L("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:L("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:L("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:L("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:L("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:L("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:L("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:L("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:L("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:L("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:L("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:L("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:L("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:L("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:L("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"extensions",label:L("quickActions.extensions"),action:{type:"run",command:"/extensions manage"}},{id:"theme",label:L("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:Q.shellMode?L("quickActions.exitShellMode"):L("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:L("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Ee=>{const it=abe(Ee);return!it||gn(it)}),[Q.shellMode,gn,L]),Be=b.useMemo(()=>T.map(Ee=>({id:Ee.id,label:Ee.label||Ee.id})),[T]),Qe=b.useCallback(Ee=>{C==null||C(Ee),M(!1),Q.focus()},[C,Q]),st=b.useCallback(Ee=>{j==null||j(Ee),ne(!1),Q.focus()},[j,Q]),te=b.useCallback(Ee=>{const it=Q.viewRef.current;it&&(it.focus(),it.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Ee,bubbles:!0,cancelable:!0})))},[Q]),ue=b.useCallback(Ee=>{if(Pe(!1),M(!1),ne(!1),Q.closeSlashMenu(),Ee.action.type==="insert"){Q.insertText(Ee.action.text,{mode:"replace"});return}if(Ee.action.type==="shell"){Q.toggleShellMode();return}if(Ee.action.type==="key"){te(Ee.action.item.event);return}r(Ee.action.command)},[Q,te,r]),re=b.useCallback(Ee=>{te(Ee.event),Ee.id==="ctrl-r"&&Pe(!1)},[te]),{searchMode:ae,searchQuery:pe,searchMatches:wt,searchActiveIndex:Je,searchInputRef:_t,searchUiRef:fn,closeSearch:Vn,handleSearchKeyDown:de,handleSearchInput:je,handleSearchCompositionEnd:Te}=Q.searchState,Nt=Ee=>{const it=O5(Ee),bt=L5(Ee);return!it&&!bt?h.jsx("span",{className:Me.tagLabel,children:Ee.id}):h.jsxs(h.Fragment,{children:[it&&h.jsx("span",{className:Me.tagLabel,children:it}),bt&&h.jsx("span",{className:Me.tagValue,children:bt})]})},An=j9(w,L),Tr=v;return h.jsxs("div",{className:Me.editorShell,children:[h.jsxs("div",{ref:oe,className:Me.container,"data-dac-glow":!0,onClick:()=>{M(!1),ne(!1),Pe(!1),Q.focus()},children:[h.jsx("div",{className:Me.dacAura,"aria-hidden":"true"}),h.jsx("div",{className:Me.dacHalo,"aria-hidden":"true"}),ae&&h.jsxs("div",{ref:fn,className:Me.searchPanel,onMouseDown:Ee=>Ee.stopPropagation(),onClick:Ee=>Ee.stopPropagation(),children:[h.jsxs("div",{className:Me.searchBar,children:[h.jsx("span",{className:Me.searchLabel,children:L("editor.searchLabel")}),h.jsx("input",{ref:_t,className:Me.searchInput,value:pe,onChange:je,onCompositionEnd:Te,onKeyDown:de,placeholder:L("editor.searchPlaceholder")})]}),wt.length>0&&h.jsx("div",{className:Me.searchResults,children:wt.map((Ee,it)=>h.jsxs("button",{type:"button",className:`${Me.searchResult} ${it===Je?Me.searchResultActive:""}`,onMouseDown:bt=>{bt.preventDefault(),Q.replaceEditorText(Ee),Vn(!1)},children:[h.jsx("span",{className:Me.searchResultMarker,children:it===Je?"›":""}),h.jsx("span",{className:Me.searchResultText,children:Ee})]},`${Ee}-${it}`))}),wt.length===0&&h.jsx("div",{className:Me.searchEmpty,children:L("editor.noHistory")})]}),h.jsxs("div",{className:Me.content,children:[Q.composerTags.length>0&&h.jsx("div",{className:Me.tags,children:Q.composerTags.map(Ee=>h.jsxs("span",{className:Me.tag,children:[Nt(Ee),Ee.removable!==!1&&h.jsx("button",{type:"button",className:Me.tagRemove,"aria-label":`Remove ${zO(Ee)}`,onMouseDown:it=>it.preventDefault(),onClick:it=>{var bt;it.stopPropagation(),Q.removeTopTag(Ee.id),(bt=Q.viewRef.current)==null||bt.focus()},onKeyDown:it=>{var bt;it.key!=="Backspace"&&it.key!=="Delete"||(it.preventDefault(),Q.removeTopTag(Ee.id),(bt=Q.viewRef.current)==null||bt.focus())},children:"×"})]},Ee.id))}),Q.pastedImages.length>0&&h.jsx("div",{className:Me.images,children:Q.pastedImages.map((Ee,it)=>h.jsxs("div",{className:Me.imageThumb,children:[h.jsx("img",{src:`data:${Ee.media_type};base64,${Ee.data}`,alt:""}),h.jsx("button",{className:Me.imageRemove,onClick:bt=>{bt.stopPropagation(),Q.removeImage(it)},children:"×"})]},it))}),Q.slashMenu&&h.jsx(cbe,{menu:Q.slashMenu,anchorRef:oe,panelRef:Xe,onSelect:Q.selectSlashCompletion,onAccept:Q.acceptSlashCompletion}),h.jsxs("div",{className:Me.editorArea,children:[Q.shellMode&&h.jsx("span",{className:Me.shellPrefix,"aria-hidden":"true",children:"!"}),h.jsx("div",{ref:Q.containerRef})]}),h.jsxs("div",{className:Me.toolbar,children:[h.jsxs("div",{className:Me.toolbarLeading,children:[R&&h.jsx("div",{className:Me.toolbarStart,children:h.jsx(R,{disabled:l,isRunning:o,currentMode:w,currentModel:v,sessionName:J})}),h.jsxs("div",{className:Me.toolbarLeft,children:[Kt("approvalMode")&&h.jsxs("div",{className:Me.dropdownWrapper,children:[h.jsx(D9,{open:I,items:tn,activeId:w,onClose:()=>M(!1),onSelect:Qe,anchorRef:ht}),h.jsxs("button",{ref:ht,className:Me.toolBtn,onClick:Ee=>{Ee.stopPropagation(),Q.closeSlashMenu(),Pe(!1),M(it=>!it),ne(!1)},"aria-label":L("status.mode"),children:[h.jsx("span",{className:Me.toolBtnModeIcon,children:h.jsx(Dw,{mode:w})}),h.jsx("span",{className:Me.toolBtnText,children:An}),h.jsx("span",{className:Me.toolBtnArrow,children:h.jsx(R9,{})})]})]}),Kt("model")&&h.jsxs("div",{className:Me.dropdownWrapper,children:[h.jsx(D9,{open:G,items:Be,activeId:v,onClose:()=>ne(!1),onSelect:st,anchorRef:At,showCheck:!0}),h.jsxs("button",{ref:At,className:Me.toolBtn,onClick:Ee=>{Ee.stopPropagation(),Q.closeSlashMenu(),Pe(!1),ne(it=>!it),M(!1)},"aria-label":L("model.select"),children:[h.jsx("span",{className:Me.toolBtnModelIcon,children:h.jsx(ibe,{})}),h.jsx("span",{className:Me.toolBtnText,children:Tr}),h.jsx("span",{className:Me.toolBtnArrow,children:h.jsx(R9,{})})]})]}),$&&h.jsx("div",{className:Me.toolbarEnd,children:h.jsx($,{disabled:l,isRunning:o,currentMode:w,currentModel:v,sessionName:J})})]})]}),h.jsxs("div",{className:Me.toolbarRight,children:[Kt("commands")&&h.jsx("button",{className:Me.toolBtn,onClick:Ee=>{Ee.stopPropagation(),Pe(!1),Q.insertText("/")},"aria-label":L("editor.hintCommands"),title:L("editor.hintCommands"),"data-tooltip":L("editor.hintCommands"),children:h.jsx("span",{className:Me.toolBtnIcon,children:"/"})}),Kt("files")&&h.jsx("button",{className:Me.toolBtn,onClick:Ee=>{Ee.stopPropagation(),Pe(!1),Q.insertText("@")},"aria-label":L("editor.hintFiles"),title:L("editor.hintFiles"),"data-tooltip":L("editor.hintFiles"),children:h.jsx("span",{className:Me.toolBtnIcon,children:"@"})}),Xt.length>0&&h.jsx("button",{className:`${Me.toolBtn} ${Me.quickActionsBtn}`,onClick:Ee=>{Ee.stopPropagation(),Q.closeSlashMenu(),M(!1),ne(!1),Pe(it=>!it)},"aria-expanded":fe,"aria-label":L("quickActions.open"),title:L("quickActions.open"),"data-tooltip":L("quickActions.open"),children:h.jsx("span",{className:Me.toolBtnIcon,children:h.jsx(nbe,{})})}),x&&zt&&Kt("widthMode")&&h.jsx("button",{className:`${Me.toolBtn} ${Me.widthModeBtn}`,onClick:Ee=>{Ee.stopPropagation(),z==null||z(g==="wide"?"1000":"wide")},disabled:!z,"aria-label":L(g==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:L(g==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":L(g==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:h.jsx("span",{className:Me.toolBtnIcon,children:h.jsx(sbe,{mode:g})})}),h.jsx(E1e,{disabled:l,onInsert:Ee=>{const it=Q.getText(),bt=it&&!/\s$/.test(it)?" ":"";Q.insertText(`${bt}${Ee} `),Q.focus()}}),h.jsx("button",{className:o?`${Me.sendBtn} ${Me.sendBtnRunning}`:Me.sendBtn,disabled:o?!a:Q.disabled||!Q.hasContent,onClick:Ee=>{if(Ee.stopPropagation(),o){a==null||a();return}Q.submitText()},"aria-label":L(o?"stream.cancel":"editor.send"),children:o?h.jsx(tbe,{}):h.jsx(ebe,{})})]})]})]})]}),fe&&Xt.length>0&&h.jsx(ube,{actions:Xt,onRun:ue,onPressKey:re})]})})),hbe="_bar_1bfj1_1",fbe="_left_1bfj1_12",mbe="_right_1bfj1_13",pbe="_settingsButton_1bfj1_23",gbe="_modeButton_1bfj1_49",ybe="_modeHint_1bfj1_62",bbe="_modeLabel_1bfj1_67",vbe="_modeDefault_1bfj1_71",xbe="_modePlan_1bfj1_75",wbe="_modeAutoEdit_1bfj1_79",_be="_modeAuto_1bfj1_79",kbe="_modeYolo_1bfj1_87",Sbe="_shortcutsButton_1bfj1_96",Tbe="_modelButton_1bfj1_114",Cbe="_model_1bfj1_114",Abe="_escapeHint_1bfj1_133",Ebe="_contextButton_1bfj1_143",Mbe="_context_1bfj1_143",Nbe="_goal_1bfj1_166",Ibe="_separator_1bfj1_172",Rbe="_taskPill_1bfj1_176",cr={bar:hbe,left:fbe,right:mbe,settingsButton:pbe,modeButton:gbe,modeHint:ybe,modeLabel:bbe,modeDefault:vbe,modePlan:xbe,modeAutoEdit:wbe,modeAuto:_be,modeYolo:kbe,shortcutsButton:Sbe,modelButton:Tbe,model:Cbe,escapeHint:Abe,contextButton:Ebe,context:Mbe,goal:Nbe,separator:Ibe,taskPill:Rbe},jbe=1e3;function Dbe(e,t){switch(e){case"default":return{label:t("mode.default"),className:cr.modeDefault};case"plan":return{label:t("mode.plan"),className:cr.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:cr.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:cr.modeAuto};case"yolo":return{label:t("mode.yolo"),className:cr.modeYolo};default:return null}}function Obe(){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 N4(e,t,n,r){return r(e===1?t:n,{count:e})}function Lbe(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 a of n)s[a.kind]++;const i=[];return s.shell>0&&i.push(N4(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.agent>0&&i.push(N4(s.agent,"tasks.pill.agent","tasks.pill.agents",t)),s.monitor>0&&i.push(N4(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 Bbe(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 zbe=b.forwardRef(function({escapeHint:t,onSelectMode:n,onSelectModel:r,onShowContext:s,onOpenSettings:i,onOpenTasks:a,onReturnToInput:o,tasks:l,activeGoal:c,hideSettings:u,onToggleShortcuts:d,compact:f=!1},m){const p=Iu(),y=p.status==="connected",w=p.currentModel??"",v=p.currentMode??"",g=p.tokenCount??0,x=p.contextWindow??0,{t:k}=nt(),T=(x>0?g/x*100:0).toFixed(1),C=Dbe(v,k),[,j]=b.useState(0),z=b.useRef(null);b.useEffect(()=>{if(!c)return;const Z=setInterval(()=>j(Q=>(Q+1)%1e6),jbe);return()=>clearInterval(Z)},[c]);const E=b.useMemo(()=>Lbe(l,k),[l,k]),P=!!t||!f&&(y||!!C),D=c?Bbe(Date.now()-c.setAt):"",H=c?`◎ ${k("goal.statusActive")}${D?` (${D})`:""}`:"",W=!!t||!!E||!f,J=!f&&!!w||!f&&x>0&&g>0||!!H;if(b.useImperativeHandle(m,()=>({focusTaskPill(){var Z;return E?((Z=z.current)==null||Z.focus({preventScroll:!0}),!0):!1}}),[E]),!W&&!J)return null;const Y=Z=>{if(Z.key==="Enter"||Z.key==="ArrowDown"||Z.key==="n"&&Z.ctrlKey){Z.preventDefault(),Z.stopPropagation(),a==null||a();return}if(Z.key==="ArrowUp"||Z.key==="Escape"||Z.key==="p"&&Z.ctrlKey){Z.preventDefault(),Z.stopPropagation(),o==null||o();return}Z.key.length===1&&!Z.metaKey&&!Z.ctrlKey&&!Z.altKey&&(Z.preventDefault(),Z.stopPropagation(),o==null||o(Z.key))};return h.jsxs("div",{className:cr.bar,children:[h.jsxs("div",{className:cr.left,children:[y&&!u&&!f&&h.jsx("button",{type:"button",className:cr.settingsButton,onClick:i,onMouseDown:Z=>Z.stopPropagation(),onTouchStart:Z=>Z.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:h.jsx(Obe,{})}),t?h.jsx("span",{className:cr.escapeHint,children:k("editor.escClearHint")}):h.jsxs(h.Fragment,{children:[C&&!f&&h.jsxs("button",{type:"button",className:cr.modeButton,onClick:n,onMouseDown:Z=>Z.stopPropagation(),onTouchStart:Z=>Z.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[h.jsx("span",{className:`${cr.modeLabel} ${C.className}`,children:C.label}),!f&&h.jsx("span",{className:cr.modeHint,children:k("status.modeHint")})]}),!f&&h.jsx(h.Fragment,{children:d?h.jsx("button",{type:"button",className:cr.shortcutsButton,onClick:d,onMouseDown:Z=>Z.stopPropagation(),onTouchStart:Z=>Z.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):h.jsx("span",{children:k("status.shortcuts")})})]}),E&&h.jsxs(h.Fragment,{children:[P&&h.jsx("span",{className:cr.separator,children:"·"}),h.jsx("button",{ref:z,type:"button",className:cr.taskPill,onClick:a,onKeyDown:Y,disabled:!a,children:E})]})]}),h.jsxs("div",{className:cr.right,children:[!f&&w&&h.jsx("button",{type:"button",className:cr.modelButton,onClick:r,onMouseDown:Z=>Z.stopPropagation(),onTouchStart:Z=>Z.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:h.jsx("span",{className:cr.model,children:w})}),!f&&x>0&&g>0&&h.jsx("button",{type:"button",className:cr.contextButton,onClick:s,title:k("contextUsage.title"),children:h.jsx("span",{className:cr.context,children:k("status.contextUsed",{pct:T})})}),H&&h.jsx("span",{className:cr.goal,title:c==null?void 0:c.condition,children:H})]})]})}),$be=15e3,Pbe=["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."],qbe=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function O9(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?qbe:Pbe}function Ube(){const e=Q_(),t=ty(),n=e!=="idle",r=b.useRef(0),s=b.useRef(0),[i,a]=b.useState({estimatedOutputTokens:0,isReceivingContent:!1}),o=b.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=Hbe(y.rawOutput);w!==void 0&&!f.has(y.toolCallId)&&(u+=w,f.add(y.toolCallId))}}return{chars:c,agentTokens:u,isReceiving:d}},[t]),l=b.useRef(o);return l.current=o,o.chars<s.current&&(r.current=o.chars),s.current=o.chars,b.useEffect(()=>{if(!n){r.current=0,a({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:u,agentTokens:d,isReceiving:f}=l.current;if(u<r.current){r.current=u,a({estimatedOutputTokens:d+Math.round(u/4),isReceivingContent:f});return}const m=u-r.current;if(m<=0){a(w=>{const v={estimatedOutputTokens:d+Math.round(r.current/4),isReceivingContent:f};return w.estimatedOutputTokens===v.estimatedOutputTokens&&w.isReceivingContent===v.isReceivingContent?w:v});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,a({estimatedOutputTokens:d+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function Hbe(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.totalTokens;if(typeof s=="number"&&s>0)return s}}function Fbe(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}const Vbe="_status_u3ktv_1",Wbe="_spinner_u3ktv_11",Gbe="_label_u3ktv_15",Kbe="_meta_u3ktv_19",kp={status:Vbe,spinner:Wbe,label:Gbe,meta:Kbe};function Ybe({startedAt:e}){const t=Q_(),{estimatedOutputTokens:n,isReceivingContent:r}=Ube(),{language:s,t:i}=nt(),[a,o]=b.useState(0),l=b.useRef(Date.now()),[c,u]=b.useState(0),[d,f]=b.useState(()=>O9(s)[0]??""),m=t!=="idle";if(b.useEffect(()=>{if(!m){o(0);return}l.current=e??Date.now(),o(L9(l.current));const x=setInterval(()=>{o(L9(l.current))},1e3);return()=>clearInterval(x)},[m,e]),b.useEffect(()=>{const x=O9(s);if(t==="idle"||x.length===0){f(x[0]??"");return}const k=()=>{const T=Math.floor(Math.random()*x.length);f(x[T]??"")};k();const A=setInterval(k,$be);return()=>clearInterval(A)},[s,t]),b.useEffect(()=>{if(t==="idle")return;const x=setInterval(()=>{u(k=>(k+1)%4)},250);return()=>clearInterval(x)},[t]),t==="idle")return null;const p=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],y=p[c%p.length],w=r?"↓":"↑",v=a<60?`${a}s`:Xbe(a*1e3),g=n>0?` · ${w} ${i("stream.tokens",{count:Fbe(n)})}`:"";return h.jsxs("div",{className:kp.status,children:[h.jsx("span",{className:kp.spinner,children:y}),d&&h.jsx("span",{className:kp.label,children:d}),h.jsxs("span",{className:kp.meta,children:["(",v,g," · ",i("stream.cancel"),")"]})]})}function Xbe(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 L9(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const Qbe="_host_1k5oc_1",Jbe="_toast_1k5oc_13",Zbe="_message_1k5oc_32",eve="_close_1k5oc_40",tve="_info_1k5oc_59",nve="_success_1k5oc_67",rve="_warning_1k5oc_75",sve="_error_1k5oc_83",_f={host:Qbe,toast:Jbe,message:Zbe,close:eve,info:tve,success:nve,warning:rve,error:sve};function ive({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:h.jsx("div",{className:_f.host,role:"status","aria-live":"polite",children:e.map(r=>h.jsx(ave,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function ave({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=nt();return b.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),h.jsxs("div",{className:`${_f.toast} ${_f[e.tone]}`,children:[h.jsx("div",{className:_f.message,children:e.message}),h.jsx("button",{type:"button",className:_f.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const ove="_panel_1w5zb_1",lve="_summary_1w5zb_10",cve="_progressRing_1w5zb_27",uve="_stepText_1w5zb_41",dve="_detail_1w5zb_48",hve="_item_1w5zb_80",fve="_icon_1w5zb_90",mve="_content_1w5zb_98",pve="_completed_1w5zb_106",gve="_inProgress_1w5zb_111",yve="_pending_1w5zb_117",ia={panel:ove,summary:lve,progressRing:cve,stepText:uve,detail:dve,item:hve,icon:fve,content:mve,completed:pve,inProgress:gve,pending:yve};function bve(e){switch(e){case"completed":return ia.completed;case"in_progress":return ia.inProgress;case"pending":return ia.pending}}const vve=b.memo(function({todos:t,title:n}){const{t:r}=nt();if(t.length===0)return null;const s=t.length,i=t.findIndex(c=>c.status==="in_progress"),a=i>=0?i:t.findIndex(c=>c.status==="pending"),o=a>=0?a+1:s,l=s>0?o/s:0;return h.jsxs("section",{className:ia.panel,"aria-label":n??r("todo.title"),tabIndex:0,children:[h.jsxs("div",{className:ia.summary,"aria-label":r("todo.stepProgress",{current:o,total:s}),children:[h.jsx("span",{className:ia.progressRing,style:{"--todo-progress":String(l)},"aria-hidden":"true"}),h.jsx("span",{className:ia.stepText,children:r("todo.stepProgress",{current:o,total:s})})]}),h.jsx("div",{className:ia.detail,role:"tooltip",children:t.map((c,u)=>h.jsxs("div",{className:`${ia.item} ${bve(c.status)}`,children:[h.jsx("span",{className:ia.icon,"aria-hidden":"true",children:h1(c.status)}),h.jsx("span",{className:ia.content,title:c.content,children:c.content})]},`${c.id||u}:${c.content}`))})]})}),xve="_header_1hnu3_1",wve="_banner_1hnu3_8",_ve="_logo_1hnu3_15",kve="_panel_1hnu3_29",Sve="_titleRow_1hnu3_40",Tve="_title_1hnu3_40",Cve="_version_1hnu3_53",Ave="_subtitle_1hnu3_58",Eve="_metaLine_1hnu3_62",Mve="_sep_1hnu3_75",Nve="_shellLabel_1hnu3_79",Ive="_model_1hnu3_84",Rve="_modelHint_1hnu3_92",jve="_cwd_1hnu3_98",Dve="_tip_1hnu3_107",Ove="_tipLabel_1hnu3_115",Lve="_tipText_1hnu3_119",Er={header:xve,banner:wve,logo:_ve,panel:kve,titleRow:Sve,title:Tve,version:Cve,subtitle:Ave,metaLine:Eve,sep:Mve,shellLabel:Nve,model:Ive,modelHint:Rve,cwd:jve,tip:Dve,tipLabel:Ove,tipText:Lve},Bve=["Type / to open commands; Tab completes slash commands and saved prompts.","Add a QWEN.md file to give Qwen Code durable project context.","Use ! to run shell commands through Qwen Code, for example !ls.","When a chat gets long, use /compress to free context.","Use Shift+Tab or /approval-mode to switch approval modes quickly.","Use /clear or /new to start fresh; previous sessions stay resumable."],zve=["输入 / 打开命令弹窗；Tab 可以补全斜杠命令和已保存的 prompt。","添加 QWEN.md 文件，为 Qwen Code 提供持久的项目上下文。","可以使用 ! 从 Qwen Code 运行 shell 命令，例如 !ls。","对话变长时，使用 /compress 压缩历史并释放上下文。","使用 Shift+Tab 或 /approval-mode 快速切换权限模式。","使用 /clear 或 /new 开始新想法；之前的会话仍可从历史恢复。"],$ve=`
 ▄▄▄▄▄▄  ▄▄     ▄▄ ▄▄▄▄▄▄▄ ▄▄▄    ▄▄
██╔═══██╗██║    ██║██╔════╝████╗  ██║
██║   ██║██║ █╗ ██║█████╗  ██╔██╗ ██║
██║▄▄ ██║██║███╗██║██╔══╝  ██║╚██╗██║
╚██████╔╝╚███╔███╔╝███████╗██║ ╚████║
 ╚══▀▀═╝  ╚══╝╚══╝ ╚══════╝╚═╝  ╚═══╝
`.trim();function Pve(e){const t=e==="zh-CN"?zve:Bve;return t[Math.floor(Math.random()*t.length)]}function qve(e,t=72){if(!e||e.length<=t)return e;const n=Math.max(12,Math.floor((t-3)*.38)),r=Math.max(18,t-n-3);return`${e.slice(0,n)}...${e.slice(-r)}`}function Uve(e,t){switch(e){case"plan":return t("mode.plan");case"auto-edit":return t("mode.auto-edit");case"yolo":return t("mode.yolo");case"default":return t("mode.default");default:return e||t("mode.unknown")}}function Hve({version:e,cwd:t,currentModel:n,currentMode:r,hideTips:s=!1}){const{language:i,t:a}=nt(),o=b.useMemo(()=>Pve(i),[i]),l=b.useMemo(()=>qve(t),[t]),c=n||a("welcome.defaultModel"),u=Uve(r,a);return h.jsxs("div",{className:Er.header,children:[h.jsxs("div",{className:Er.banner,children:[h.jsx("pre",{className:Er.logo,"aria-hidden":"true",children:$ve}),h.jsxs("div",{className:Er.panel,children:[h.jsxs("div",{className:Er.titleRow,children:[h.jsx("span",{className:Er.title,children:">_ Qwen Code"}),e&&h.jsxs("span",{className:Er.version,children:["(v",e,")"]})]}),h.jsx("div",{className:Er.subtitle,"aria-hidden":"true",children:" "}),h.jsxs("div",{className:Er.metaLine,children:[h.jsx("span",{className:Er.shellLabel,children:"Web chat"}),h.jsx("span",{className:Er.sep,children:"|"}),h.jsx("span",{className:Er.model,children:c}),h.jsx("span",{className:Er.modelHint,children:a("welcome.changeModel")})]}),h.jsxs("div",{className:Er.metaLine,children:[h.jsx("span",{children:u}),h.jsx("span",{className:Er.modelHint,children:a("welcome.modeHint")})]}),l&&h.jsx("div",{className:Er.cwd,title:t,children:l})]})]}),!s&&h.jsxs("div",{className:Er.tip,children:[h.jsx("span",{className:Er.tipLabel,children:a("welcome.tipLabel")}),h.jsx("span",{className:Er.tipText,children:o})]})]})}const Fve="_list_h8vah_1",Vve="_row_h8vah_10",Wve="_selected_h8vah_26",Gve="_modeName_h8vah_30",Kve="_modeIcon_h8vah_34",Yve="_modeText_h8vah_50",Xve="_modeDesc_h8vah_66",Bc={list:Fve,row:Vve,selected:Wve,modeName:Gve,modeIcon:Kve,modeText:Yve,modeDesc:Xve};function Qve({currentMode:e,onSelect:t}){const{t:n}=nt(),r=b.useRef(null),s=J1.map(a=>({id:a,name:n(`mode.label.${a}`),description:n(`mode.desc.${a}`)})),i=s.findIndex(a=>a.id===e);return b.useEffect(()=>{var o;const a=(o=r.current)==null?void 0:o.children[i];a==null||a.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:Bc.list,ref:r,role:"listbox","aria-label":n("mode.select"),children:s.map(a=>{const o=a.id===e;return h.jsxs("button",{type:"button",role:"option","aria-selected":o,className:`${Bc.row} ${o?Bc.selected:""}`,onClick:()=>t(a.id),children:[h.jsx("span",{className:Bc.modeIcon,children:h.jsx(Dw,{mode:a.id})}),h.jsxs("span",{className:Bc.modeText,children:[h.jsx("span",{className:Bc.modeName,children:a.name}),h.jsx("span",{className:Bc.modeDesc,children:a.description})]})]},a.id)})})}const Jve="_selected_16b4b_154",Zve="_disabled_16b4b_175",e4e={"resume-picker":"_resume-picker_16b4b_4","resume-picker-in-shell":"_resume-picker-in-shell_16b4b_15","resume-picker-header":"_resume-picker-header_16b4b_22","resume-picker-close":"_resume-picker-close_16b4b_29","resume-picker-title":"_resume-picker-title_16b4b_69","resume-picker-count":"_resume-picker-count_16b4b_75","resume-picker-search":"_resume-picker-search_16b4b_80","resume-picker-search-label":"_resume-picker-search-label_16b4b_89","resume-picker-search-input":"_resume-picker-search-input_16b4b_93","resume-picker-search-value":"_resume-picker-search-value_16b4b_103","resume-picker-search-hint":"_resume-picker-search-hint_16b4b_107","resume-picker-sep":"_resume-picker-sep_16b4b_111","resume-picker-list":"_resume-picker-list_16b4b_116","resume-picker-list-compact":"_resume-picker-list-compact_16b4b_123","resume-picker-empty":"_resume-picker-empty_16b4b_127","resume-picker-item":"_resume-picker-item_16b4b_133","resume-picker-session-item":"_resume-picker-session-item_16b4b_149",selected:Jve,"resume-picker-item-current":"_resume-picker-item-current_16b4b_162","resume-picker-keyboard-only":"_resume-picker-keyboard-only_16b4b_167",disabled:Zve,"resume-picker-item-row":"_resume-picker-item-row_16b4b_180","resume-picker-item-prefix":"_resume-picker-item-prefix_16b4b_189","resume-picker-item-title":"_resume-picker-item-title_16b4b_199","resume-picker-item-checkbox":"_resume-picker-item-checkbox_16b4b_212","resume-picker-item-number":"_resume-picker-item-number_16b4b_224","resume-picker-item-provider":"_resume-picker-item-provider_16b4b_232","resume-picker-item-meta":"_resume-picker-item-meta_16b4b_245","resume-picker-item-detail":"_resume-picker-item-detail_16b4b_253","resume-picker-item-check":"_resume-picker-item-check_16b4b_212","resume-picker-item-badge":"_resume-picker-item-badge_16b4b_269","tools-status-badge":"_tools-status-badge_16b4b_278","tools-status-badge-enabled":"_tools-status-badge-enabled_16b4b_289","tools-status-badge-disabled":"_tools-status-badge-disabled_16b4b_293","tools-status-badge-busy":"_tools-status-badge-busy_16b4b_297","tools-picker-item":"_tools-picker-item_16b4b_301","tools-picker-item-expanded":"_tools-picker-item-expanded_16b4b_312","tools-item-icon":"_tools-item-icon_16b4b_316","tools-item-chevron":"_tools-item-chevron_16b4b_348","tools-item-chevron-expanded":"_tools-item-chevron-expanded_16b4b_360","tools-item-detail":"_tools-item-detail_16b4b_364","mcp-status":"_mcp-status_16b4b_369","mcp-status-connected":"_mcp-status-connected_16b4b_373","mcp-status-connecting":"_mcp-status-connecting_16b4b_377","mcp-status-disconnected":"_mcp-status-disconnected_16b4b_381","mcp-status-disabled":"_mcp-status-disabled_16b4b_385","mcp-status-unknown":"_mcp-status-unknown_16b4b_386","resume-picker-detail-panel":"_resume-picker-detail-panel_16b4b_389","resume-picker-detail-row":"_resume-picker-detail-row_16b4b_399","resume-picker-detail-label":"_resume-picker-detail-label_16b4b_406","resume-picker-detail-value":"_resume-picker-detail-value_16b4b_411","dialog-inline-button":"_dialog-inline-button_16b4b_416","dialog-primary-button":"_dialog-primary-button_16b4b_417","dialog-danger-button":"_dialog-danger-button_16b4b_418","dialog-inline-actions":"_dialog-inline-actions_16b4b_441","dialog-footer-actions":"_dialog-footer-actions_16b4b_447","dialog-form":"_dialog-form_16b4b_465","dialog-form-row":"_dialog-form-row_16b4b_493","dialog-textarea":"_dialog-textarea_16b4b_499","dialog-split":"_dialog-split_16b4b_504","dialog-split-list":"_dialog-split-list_16b4b_511","tools-desc-expanded":"_tools-desc-expanded_16b4b_515","tools-desc-body":"_tools-desc-body_16b4b_525","extensions-toolbar":"_extensions-toolbar_16b4b_532","extensions-row-button":"_extensions-row-button_16b4b_536","extensions-detail":"_extensions-detail_16b4b_551","extensions-detail-actions":"_extensions-detail-actions_16b4b_562","extensions-detail-grid":"_extensions-detail-grid_16b4b_569","extensions-detail-field":"_extensions-detail-field_16b4b_575","extensions-detail-label":"_extensions-detail-label_16b4b_582","extensions-detail-value":"_extensions-detail-value_16b4b_588","extensions-confirm":"_extensions-confirm_16b4b_595","dialog-detail":"_dialog-detail_16b4b_605","dialog-detail-title":"_dialog-detail-title_16b4b_613","dialog-detail-shortcut":"_dialog-detail-shortcut_16b4b_621","dialog-detail-meta":"_dialog-detail-meta_16b4b_628","dialog-detail-body":"_dialog-detail-body_16b4b_633"};function ce(...e){return e.filter(t=>!!t).map(t=>e4e[t]).filter(Boolean).join(" ")}function z5(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 t4e({onSelect:e,onClose:t}){const{t:n}=nt(),r=Iu(),{sessions:s,loading:i,error:a}=Z_({autoLoad:!0}),o=r.sessionId,[l,c]=b.useState(0),[u,d]=b.useState(""),f=b.useRef(null),m=b.useRef(null),p=u?s.filter(y=>{const w=u.toLowerCase();return(y.displayName||"").toLowerCase().includes(w)||y.sessionId.toLowerCase().includes(w)}):s;return b.useEffect(()=>{l>=p.length&&p.length>0&&c(p.length-1)},[p.length,l]),b.useEffect(()=>{var w;const y=(w=f.current)==null?void 0:w.children[l];y==null||y.scrollIntoView({block:"nearest"})},[l]),b.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]),h.jsxs("div",{className:ce("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ce("resume-picker-search"),children:[h.jsxs("span",{className:ce("resume-picker-search-label"),children:[n("resume.search"),":"," "]}),h.jsx("input",{ref:m,className:ce("resume-picker-search-input"),value:u,onChange:y=>{d(y.target.value),c(0)},placeholder:""})]}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("resume-picker-list"),ref:f,children:[i&&h.jsx("div",{className:ce("resume-picker-empty"),children:n("common.loading")}),!i&&a&&h.jsx("div",{className:ce("resume-picker-empty"),children:a.message||"Failed to load sessions"}),!i&&!a&&p.length===0&&h.jsx("div",{className:ce("resume-picker-empty"),children:u?n("resume.noMatch",{query:u}):n("resume.none")}),!i&&p.map(y=>{const w=y.sessionId===o;return h.jsxs("div",{className:ce("resume-picker-item","resume-picker-session-item",w?"resume-picker-item-current":void 0),onClick:()=>{e(y.sessionId),t()},children:[h.jsxs("div",{className:ce("resume-picker-item-row"),children:[h.jsx("span",{className:ce("resume-picker-item-title"),children:y.displayName||y.sessionId.slice(0,8)}),w&&h.jsx("span",{className:ce("resume-picker-item-badge"),children:n("resume.current")})]}),h.jsxs("div",{className:ce("resume-picker-item-meta"),children:[h.jsx("span",{children:(y.updatedAt||y.createdAt)&&z5(y.updatedAt||y.createdAt||"",n)}),h.jsx("span",{className:ce("resume-picker-item-detail"),children:n("common.clients",{count:y.clientCount??0})}),y.hasActivePrompt&&h.jsx("span",{className:ce("resume-picker-item-detail"),children:n("resume.activePrompt")})]})]},y.sessionId)})]})]})}const n4e="_themeDark_gzezx_1",r4e="_themeLight_gzezx_21",s4e="_backdrop_gzezx_41",i4e="_panel_gzezx_61",a4e="_sizeSm_gzezx_73",o4e="_sizeMd_gzezx_77",l4e="_sizeLg_gzezx_81",c4e="_sizeXl_gzezx_85",u4e="_header_gzezx_89",d4e="_titleWrap_gzezx_98",h4e="_title_gzezx_98",f4e="_subtitle_gzezx_110",m4e="_close_gzezx_117",p4e="_body_gzezx_156",qs={themeDark:n4e,themeLight:r4e,backdrop:s4e,panel:i4e,sizeSm:a4e,sizeMd:o4e,sizeLg:l4e,sizeXl:c4e,header:u4e,titleWrap:d4e,title:h4e,subtitle:f4e,close:m4e,body:p4e},g4e={sm:qs.sizeSm,md:qs.sizeMd,lg:qs.sizeLg,xl:qs.sizeXl};function as({title:e,subtitle:t,size:n="md",onClose:r,children:s}){const{t:i}=nt(),o=r3()===us.Light?qs.themeLight:qs.themeDark,l=h.jsx("div",{className:`${qs.backdrop} ${o}`,"data-keyboard-scope":!0,children:h.jsxs("section",{className:`${qs.panel} ${g4e[n]}`,role:"dialog","aria-modal":"true","aria-label":e,children:[h.jsxs("header",{className:qs.header,children:[h.jsxs("div",{className:qs.titleWrap,children:[h.jsx("div",{className:qs.title,children:e}),t&&h.jsx("div",{className:qs.subtitle,children:t})]}),h.jsx("button",{type:"button",className:qs.close,onClick:r,"aria-label":i("common.close"),title:i("common.close")})]}),h.jsx("div",{className:qs.body,children:s})]})});return typeof document>"u"?l:O1.createPortal(l,document.body)}const y4e="_layout_1rkrj_1",b4e="_list_1rkrj_9",v4e="_row_1rkrj_17",x4e="_selected_1rkrj_33",w4e="_label_1rkrj_37",_4e="_divider_1rkrj_41",k4e="_number_1rkrj_48",S4e="_provider_1rkrj_54",T4e="_badge_1rkrj_69",C4e="_detail_1rkrj_75",A4e="_detailRow_1rkrj_87",E4e="_detailLabel_1rkrj_94",M4e="_detailValue_1rkrj_100",N4e="_empty_1rkrj_105",$s={layout:y4e,list:b4e,row:v4e,selected:x4e,label:w4e,divider:_4e,number:k4e,provider:S4e,badge:T4e,detail:C4e,detailRow:A4e,detailLabel:E4e,detailValue:M4e,empty:N4e};function I4e(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function R4e(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 B9(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function j4e(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function D4e(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function O4e(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function Sp({label:e,value:t}){return h.jsxs("div",{className:$s.detailRow,children:[h.jsx("span",{className:$s.detailLabel,children:e}),h.jsx("span",{className:$s.detailValue,children:t})]})}function L4e({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=Iu(),i=r??s.currentModel??"",a=b.useMemo(()=>n??s.models??[],[n,s.models]),{t:o}=nt(),l=b.useRef(null),c=e==="fast",u=e==="voice",d=a.findIndex(m=>m.id===i),f=d>=0?a[d]:a[0];return b.useEffect(()=>{var p;const m=(p=l.current)==null?void 0:p.children[d];m==null||m.scrollIntoView({block:"nearest"})},[d]),h.jsxs("div",{className:$s.layout,children:[h.jsxs("div",{className:$s.list,ref:l,role:"listbox","aria-label":o(c?"model.setFast":u?"model.setVoice":"model.select"),children:[a.length===0?h.jsx("div",{className:$s.empty,children:o("model.none")}):null,a.map((m,p)=>{const y=m.id===i,w=B9(m);return h.jsxs("button",{type:"button",role:"option","aria-selected":y,className:`${$s.row} ${y?$s.selected:""}`,onClick:()=>t(O4e(m,c)),children:[h.jsxs("span",{className:$s.number,children:[p+1,"."]}),w?h.jsxs("span",{className:$s.provider,children:["[",w,"]"]}):null,h.jsx("span",{className:$s.label,children:j4e(m)}),m.isRuntime?h.jsx("span",{className:$s.badge,children:"Runtime"}):null]},D4e(m))})]}),f?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:$s.divider}),h.jsxs("div",{className:$s.detail,children:[h.jsx(Sp,{label:o("model.modality"),value:R4e(f.modalities,o)}),h.jsx(Sp,{label:o("model.contextWindow"),value:I4e(f.contextWindow,o)}),B9(f)!=="qwen-oauth"?h.jsxs(h.Fragment,{children:[h.jsx(Sp,{label:o("model.baseUrl"),value:f.baseUrl??o("model.default")}),h.jsx(Sp,{label:o("model.apiKey"),value:f.envKey??o("model.notSet")})]}):null]})]}):null]})}function $5(e){return e.replace(/[：:\s]+$/u,"")}const B4e="_panel_etiho_1",z4e="_embedded_etiho_13",$4e="_footer_etiho_21",P4e="_titleLine_etiho_25",q4e="_icon_etiho_32",U4e="_title_etiho_25",H4e="_subtitle_etiho_44",F4e="_text_etiho_49",V4e="_options_etiho_55",W4e="_option_etiho_55",G4e="_optionActive_etiho_77",K4e="_optionLabel_etiho_81",Y4e="_optionIcon_etiho_86",X4e="_optionContent_etiho_119",Q4e="_optionDesc_etiho_129",J4e="_badge_etiho_135",Z4e="_toolDetail_etiho_170",e2e="_toolDetailTitle_etiho_175",t2e="_toolDetailBody_etiho_180",n2e="_toolList_etiho_181",r2e="_textInput_etiho_193",s2e="_textArea_etiho_211",i2e="_summary_etiho_231",a2e="_summaryRow_etiho_238",o2e="_summaryLabel_etiho_244",l2e="_summaryValue_etiho_250",c2e="_summaryBlockTitle_etiho_255",u2e="_summaryBlock_etiho_255",d2e="_manageList_etiho_295",h2e="_manageItem_etiho_301",f2e="_manageItemExpanded_etiho_307",m2e="_manageRow_etiho_312",p2e="_manageRowActive_etiho_329",g2e="_manageIcon_etiho_333",y2e="_manageName_etiho_362",b2e="_levelTag_etiho_370",v2e="_manageChevron_etiho_380",x2e="_manageChevronExpanded_etiho_398",w2e="_manageDetail_etiho_402",_2e="_manageDetailInner_etiho_409",k2e="_manageDetailHeader_etiho_419",S2e="_manageActions_etiho_426",T2e="_manageButton_etiho_433",C2e="_dangerButton_etiho_453",A2e="_deleteText_etiho_457",E2e="_viewerRow_etiho_487",M2e="_viewerLabel_etiho_500",N2e="_viewerField_etiho_507",I2e="_viewerSectionTitle_etiho_512",R2e="_viewerBlock_etiho_518",j2e="_closed_etiho_524",D2e="_closedText_etiho_528",O2e="_loading_etiho_534",L2e="_error_etiho_539",B2e="_createWizard_etiho_545",z2e="_createSteps_etiho_551",$2e="_createStepPill_etiho_559",P2e="_createStepPillActive_etiho_571",q2e="_createStepPillDone_etiho_576",U2e="_createStepNumber_etiho_580",H2e="_createStepLabel_etiho_591",F2e="_createBody_etiho_597",V2e="_createActions_etiho_601",he={panel:B4e,embedded:z4e,footer:$4e,titleLine:P4e,icon:q4e,title:U4e,subtitle:H4e,text:F4e,options:V4e,option:W4e,optionActive:G4e,optionLabel:K4e,optionIcon:Y4e,optionContent:X4e,optionDesc:Q4e,badge:J4e,toolDetail:Z4e,toolDetailTitle:e2e,toolDetailBody:t2e,toolList:n2e,textInput:r2e,textArea:s2e,summary:i2e,summaryRow:a2e,summaryLabel:o2e,summaryValue:l2e,summaryBlockTitle:c2e,summaryBlock:u2e,manageList:d2e,manageItem:h2e,manageItemExpanded:f2e,manageRow:m2e,manageRowActive:p2e,manageIcon:g2e,manageName:y2e,levelTag:b2e,manageChevron:v2e,manageChevronExpanded:x2e,manageDetail:w2e,manageDetailInner:_2e,manageDetailHeader:k2e,manageActions:S2e,manageButton:T2e,dangerButton:C2e,deleteText:A2e,viewerRow:E2e,viewerLabel:M2e,viewerField:N2e,viewerSectionTitle:I2e,viewerBlock:R2e,closed:j2e,closedText:D2e,loading:O2e,error:L2e,createWizard:B2e,createSteps:z2e,createStepPill:$2e,createStepPillActive:P2e,createStepPillDone:q2e,createStepNumber:U2e,createStepLabel:H2e,createBody:F2e,createActions:V2e};function $O(e){if(e==="project")return"workspace";if(e==="user")return"global"}function PO(e){return $O(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function W2e(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 Da=$5;function G2e(e){return e.displayName||e.name}function qO(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 UO(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function HO(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function K2e(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 Y2e({mode:e,embedded:t=!1,onMessage:n,onClose:r}){const{t:s}=nt(),{agents:i,loading:a,reload:o,getAgent:l,createAgent:c,generateAgent:u,deleteAgent:d}=MU({autoLoad:!0}),{tools:f}=$M({autoLoad:!0}),[m,p]=b.useState(!1),[y,w]=b.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[v,g]=b.useState(0),[x,k]=b.useState(0),[A,T]=b.useState(null),[C,j]=b.useState(null),[z,E]=b.useState(!1),[P,D]=b.useState(null),[H,W]=b.useState(1),[J,Y]=b.useState(()=>e==="create-user"?"global":"workspace"),[Z,Q]=b.useState("manual"),[L,R]=b.useState(""),[$,I]=b.useState(""),[M,G]=b.useState(""),[ne,fe]=b.useState([]),[Pe,oe]=b.useState(0),[Xe,ht]=b.useState(!1),[At,zt]=b.useState(!1),Vt=b.useRef(0),gt=b.useCallback(()=>{p(!0),r()},[r]),Le=b.useMemo(()=>{const Be=i.filter(ue=>ue.level==="project"),Qe=i.filter(ue=>ue.level==="user"),st=i.filter(ue=>ue.level==="builtin"),te=i.filter(ue=>ue.level==="extension");return{project:Be,user:Qe,builtin:st,extension:te}},[i]),qt=b.useMemo(()=>[...Le.project,...Le.user,...Le.builtin,...Le.extension],[Le]),tn=b.useMemo(()=>{const Be=f.filter(ue=>ue.enabled).map(G2e).sort((ue,re)=>ue.localeCompare(re)),Qe=Be.filter(qO),st=Be.filter(UO),te=Be.filter(HO);return[{id:"all",label:s("agent.create.tools.all"),tools:[]},{id:"read",label:s("agent.create.tools.readOnly"),tools:Qe},{id:"edit",label:s("agent.create.tools.readEdit"),tools:[...new Set([...Qe,...st])]},{id:"execute",label:s("agent.create.tools.readEditExecute"),tools:[...new Set([...Qe,...st,...te])]}]},[s,f]);b.useEffect(()=>{if(y!=="manage")return;const Be=C!==null?qt[C]:void 0;Be&&l(Be.name).then(T).catch(Qe=>D(Qe instanceof Error?Qe.message:String(Qe)))},[y,qt,C,l]),b.useEffect(()=>{x>=qt.length&&qt.length>0&&k(qt.length-1),C!==null&&C>=qt.length&&j(null)},[C,qt.length,x]);const Mt=b.useCallback((Be=x)=>{const Qe=qt[Be];if(!Qe||!PO(Qe))return;const st=$O(Qe.level);st&&(E(!0),d(Qe.name,st).then(()=>{n(s("agent.deleted",{name:Qe.name})),T(null),j(null),k(0),o()}).catch(te=>D(te instanceof Error?te.message:String(te))).finally(()=>E(!1)))},[qt,x,d,n,o,s]),Kt=b.useCallback(()=>{if(!L.trim()||!$.trim()||!M.trim()){D(s("agent.create.required"));return}E(!0),c({name:L.trim(),description:$.trim(),systemPrompt:M.trim(),scope:J,tools:ne}).then(Be=>{n(s("agent.created",{name:Be.agent.name})),gt()}).catch(Be=>D(Be instanceof Error?Be.message:String(Be))).finally(()=>E(!1))},[L,$,M,J,ne,c,n,gt,s]),$t=b.useCallback(async()=>{const Be=$.trim();if(!Be||Xe)return;const Qe=Vt.current+1;Vt.current=Qe,ht(!0),zt(!1),D(null);try{const st=await u(Be);if(Vt.current!==Qe)return;R(st.name),I(st.description),G(st.systemPrompt),W(Z==="manual"?6:4),oe(0)}catch(st){if(Vt.current!==Qe)return;D(s("agent.create.generateFailed",{error:st instanceof Error?st.message:String(st)})),zt(!0)}finally{Vt.current===Qe&&ht(!1)}},[$,Xe,Z,u,s]),gn=b.useCallback(Be=>{if(Be==="name"&&L.trim())W(4),zt(!0);else if(Be==="prompt"&&M.trim())W(5),zt(!0);else if(Be==="desc"&&$.trim()){if(Z==="qwen"){$t();return}W(Z==="manual"?6:4),oe(0),zt(!1)}},[L,$,M,Z,$t]);if(m)return h.jsx("div",{className:`${he.panel} ${t?he.embedded:""} ${he.closed}`,children:h.jsx("div",{className:he.closedText,children:s("agents.closed")})});if(a&&i.length===0)return h.jsxs("div",{className:`${he.panel} ${t?he.embedded:""}`,children:[h.jsxs("div",{className:he.titleLine,children:[h.jsx("span",{className:he.icon,children:"?"}),h.jsx("span",{className:he.title,children:s("agents.title")})]}),h.jsx("div",{className:he.loading,children:s("common.loading")})]});const Xt=s("agents.title");return h.jsxs("div",{className:`${he.panel} ${t?he.embedded:""}`,children:[!t&&y!=="create"&&h.jsxs("div",{className:he.titleLine,children:[h.jsx("span",{className:he.icon,children:"?"}),h.jsx("span",{className:he.title,children:Xt}),h.jsx("span",{className:he.subtitle,children:s("agent.count",{count:i.length})})]}),P&&h.jsx("div",{className:he.error,children:P}),y==="menu"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.text,children:s("agent.selectAction")}),h.jsxs("div",{className:he.options,children:[h.jsx(Xc,{idx:0,active:v===0,label:s("agent.manage"),desc:s("agent.manage.desc"),onClick:()=>{g(0),w("manage")},onHover:()=>g(0)}),h.jsx(Xc,{idx:1,active:v===1,label:s("agent.create"),desc:s("agent.create.desc"),onClick:()=>{g(1),w("create")},onHover:()=>g(1)})]}),h.jsx("div",{className:he.footer,children:s("agent.footer.nav")})]}),y==="manage"&&h.jsx(X2e,{agents:qt,expandedAgentIdx:C,selectedAgent:A,busy:z,onToggleAgent:Be=>{k(Be),j(Qe=>Qe===Be?null:Be),T(null)},onDelete:Be=>{z||Mt(Be)},t:s}),y==="create"&&h.jsx(Q2e,{step:H,method:Z,scope:J,name:L,desc:$,prompt:M,tools:ne,toolCategories:tn,selIdx:Pe,busy:z,generating:Xe,inputFocused:At,onSetName:R,onSetDesc:I,onSetPrompt:G,onInputNext:gn,onInputFocus:()=>zt(!0),onInputBlur:()=>zt(!1),onSetStep:W,onSetSelectedIndex:oe,onSelectLocation:Be=>{oe(Be),Y(Be===0?"workspace":"global")},onSelectMethod:Be=>{oe(Be),Q(Be===0?"qwen":"manual")},onSelectTools:Be=>{var Qe;oe(Be),fe(((Qe=tn[Be])==null?void 0:Qe.tools)??[])},onSave:()=>{z||Kt()},t:s})]})}function Xc({idx:e,active:t,label:n,desc:r,badge:s,numbered:i=!1,onClick:a,onHover:o}){return h.jsxs("div",{className:`${he.option} ${t?he.optionActive:""}`,onClick:a,onMouseEnter:o,children:[h.jsx("span",{className:he.optionIcon,"aria-hidden":"true"}),h.jsxs("span",{className:he.optionContent,children:[h.jsxs("span",{className:he.optionLabel,children:[i?`${e+1}. `:"",n,s&&h.jsx("span",{className:he.badge,children:s})]}),r&&h.jsx("span",{className:he.optionDesc,children:r})]})]})}function X2e({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:r,onToggleAgent:s,onDelete:i,t:a}){const[o,l]=b.useState(null),c=b.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:he.text,children:a("agent.empty")}),h.jsx("div",{className:he.text,children:a("agent.createFirstHint")})]}):h.jsx("div",{className:he.manageList,children:e.map((u,d)=>{const f=t===d,m=f&&(n==null?void 0:n.name)===u.name?n:null,p=PO(u),y=(m==null?void 0:m.tools)??[],w=y.length===0||y.includes("*")?a("agent.create.tools.all"):y.join(", ");return h.jsxs("div",{className:`${he.manageItem} ${f?he.manageItemExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${he.manageRow} ${f?he.manageRowActive:""}`,onClick:()=>{l(null),s(d)},children:[h.jsx("span",{className:he.manageIcon,"aria-hidden":"true"}),h.jsx("span",{className:he.manageName,children:u.name}),h.jsx("span",{className:he.levelTag,children:W2e(u.level,a)}),u.level==="user"&&c.has(u.name)?h.jsx("span",{className:he.levelTag,children:a("agent.overriddenBadge")}):null,h.jsx("span",{className:`${he.manageChevron} ${f?he.manageChevronExpanded:""}`})]}),f?h.jsx("div",{className:he.manageDetail,children:m?h.jsxs("div",{className:he.manageDetailInner,children:[h.jsx("div",{className:he.manageDetailHeader,children:p?h.jsx("div",{className:he.manageActions,children:o===d?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:he.deleteText,children:r?a("agent.delete.loading"):a("agent.delete.confirm",{name:u.name})}),h.jsx("button",{type:"button",className:he.manageButton,onClick:()=>l(null),disabled:r,children:a("common.cancel")}),h.jsx("button",{type:"button",className:`${he.manageButton} ${he.dangerButton}`,onClick:()=>i(d),disabled:r,children:a("agent.action.delete")})]}):h.jsx("button",{type:"button",className:`${he.manageButton} ${he.dangerButton}`,onClick:()=>l(d),disabled:r,children:a("agent.action.delete")})}):null}),h.jsxs("div",{className:he.viewerField,children:[h.jsx("div",{className:he.viewerSectionTitle,children:Da(a("agent.toolsLabel"))}),h.jsx("div",{className:he.viewerBlock,children:w})]}),h.jsxs("div",{className:he.viewerField,children:[h.jsx("div",{className:he.viewerSectionTitle,children:Da(a("agent.filePathLabel"))}),h.jsx("div",{className:he.viewerBlock,children:m.filePath||"—"})]}),m.model?h.jsxs("div",{className:he.viewerRow,children:[h.jsx("span",{className:he.viewerLabel,children:Da(a("agent.modelLabel"))}),h.jsx("span",{children:m.model})]}):null,h.jsxs("div",{className:he.viewerField,children:[h.jsx("div",{className:he.viewerSectionTitle,children:Da(a("agent.descriptionLabel"))}),h.jsx("div",{className:he.viewerBlock,children:m.description||"—"})]}),h.jsxs("div",{className:he.viewerField,children:[h.jsx("div",{className:he.viewerSectionTitle,children:Da(a("agent.systemPromptLabel"))}),h.jsx("div",{className:he.viewerBlock,children:m.systemPrompt||"—"})]})]}):h.jsx("div",{className:he.loading,children:a("common.loading")})}):null]},`${u.level}:${u.name}`)})})}function Q2e({step:e,method:t,scope:n,name:r,desc:s,prompt:i,tools:a,toolCategories:o,selIdx:l,busy:c,generating:u,inputFocused:d,onSetName:f,onSetDesc:m,onSetPrompt:p,onInputNext:y,onInputFocus:w,onInputBlur:v,onSetStep:g,onSetSelectedIndex:x,onSelectLocation:k,onSelectMethod:A,onSelectTools:T,onSave:C,t:j}){const z=b.useRef(null),E=b.useRef(null),P=b.useRef(null);b.useEffect(()=>{var $,I,M,G;d&&(t==="manual"?e===3?($=z.current)==null||$.focus():e===4?(I=P.current)==null||I.focus():e===5&&((M=E.current)==null||M.focus()):e===3&&((G=E.current)==null||G.focus()))},[e,t,d]);const D=t==="manual"?6:4,H=D+1,W=t==="manual"?[j("agent.create.location"),j("agent.create.method"),j("agent.create.name"),j("agent.create.prompt"),j("agent.create.description"),j("agent.create.toolsSelection")]:[j("agent.create.location"),j("agent.create.method"),j("agent.create.describeAgent"),j("agent.create.toolsSelection")],J=$=>$===1?n==="workspace"?0:1:$===2?t==="qwen"?0:1:$===D?K2e(o,a):0,Y=$=>{g($),x(J($)),t==="manual"&&($===3||$===4||$===5)||t==="qwen"&&$===3?w():v()},Z=()=>{e<=1||u||Y(e-1)},Q=()=>{if(!u){if(e===1){Y(2);return}if(e===2){Y(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===D&&(T(l),Y(H))}},L=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 R=null;if(e===1&&(R=h.jsx(h.Fragment,{children:h.jsxs("div",{className:he.options,children:[h.jsx(Xc,{idx:0,active:l===0,label:j("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),h.jsx(Xc,{idx:1,active:l===1,label:j("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(R=h.jsx(h.Fragment,{children:h.jsxs("div",{className:he.options,children:[h.jsx(Xc,{idx:0,active:l===0,label:j("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>A(0)}),h.jsx(Xc,{idx:1,active:l===1,label:j("agent.create.method.manual"),numbered:!0,onClick:()=>A(1)})]})})),t==="manual"&&e===3&&(R=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.text,children:j("agent.create.nameHelp")}),h.jsx("input",{ref:z,className:he.textInput,value:r,onChange:$=>f($.target.value),onFocus:w,onBlur:v,placeholder:j("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(R=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.text,children:j("agent.create.promptHelp")}),h.jsx("textarea",{ref:P,className:he.textArea,value:i,onChange:$=>p($.target.value),onFocus:w,onBlur:v,placeholder:j("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(R=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.text,children:j("agent.create.manualDescHelp")}),h.jsx("textarea",{ref:E,className:he.textArea,value:s,onChange:$=>m($.target.value),onFocus:w,onBlur:v,placeholder:j("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(R=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.text,children:j("agent.create.qwenHint")}),u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.text,children:j("agent.create.generatingConfig")}),h.jsx("div",{className:he.footer,children:j("agent.footer.generating")})]}):h.jsx(h.Fragment,{children:h.jsx("textarea",{ref:E,className:he.textArea,value:s,onChange:$=>m($.target.value),onFocus:w,onBlur:v,placeholder:j("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===D){const $=o[l]??o[0],I=($==null?void 0:$.tools)??[],M=($==null?void 0:$.id)==="all"?j("agent.create.tools.allInfo"):I.length>0?I.join(", "):j("agent.create.tools.none"),G=I.filter(qO),ne=I.filter(UO),fe=I.filter(HO);R=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.options,children:o.map((Pe,oe)=>h.jsx(Xc,{idx:oe,active:l===oe,label:Pe.label,numbered:!0,onClick:()=>T(oe)},Pe.id))}),h.jsx("div",{className:he.toolDetail,children:($==null?void 0:$.id)==="all"?h.jsx("div",{className:he.toolDetailBody,children:M}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:he.toolDetailTitle,children:j("agent.create.tools.selected")}),h.jsx("div",{className:he.toolList,children:I.length===0?M:h.jsxs(h.Fragment,{children:[G.length>0&&h.jsxs("div",{children:[j("agent.create.tools.readOnlyLabel")," ",G.join(", ")]}),ne.length>0&&h.jsxs("div",{children:[j("agent.create.tools.editLabel")," ",ne.join(", ")]}),fe.length>0&&h.jsxs("div",{children:[j("agent.create.tools.executionLabel")," ",fe.join(", ")]})]})})]})})]})}if(e===H){const $=a.length===0?"*":a.join(", ");R=h.jsx(h.Fragment,{children:h.jsxs("div",{className:he.summary,children:[h.jsxs("div",{className:he.summaryRow,children:[h.jsx("span",{className:he.summaryLabel,children:Da(j("agent.create.name"))}),h.jsx("span",{className:he.summaryValue,children:r||"—"})]}),h.jsxs("div",{className:he.summaryRow,children:[h.jsx("span",{className:he.summaryLabel,children:Da(j("agent.location"))}),h.jsx("span",{className:he.summaryValue,children:j(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),h.jsxs("div",{className:he.summaryRow,children:[h.jsx("span",{className:he.summaryLabel,children:Da(j("agent.toolsLabel"))}),h.jsx("span",{className:he.summaryValue,children:$})]}),h.jsx("div",{className:he.summaryBlockTitle,children:Da(j("agent.descriptionLabel"))}),h.jsx("div",{className:he.summaryBlock,children:s||"—"}),h.jsx("div",{className:he.summaryBlockTitle,children:Da(j("agent.systemPromptLabel"))}),h.jsx("div",{className:he.summaryBlock,children:i||"—"})]})})}return h.jsxs("div",{className:he.createWizard,children:[h.jsx("div",{className:he.createSteps,children:W.map(($,I)=>{const M=I+1;return h.jsxs("div",{className:`${he.createStepPill} ${M===Math.min(e,D)?he.createStepPillActive:""} ${M<Math.min(e,D)?he.createStepPillDone:""}`,children:[h.jsx("span",{className:he.createStepNumber,children:M}),h.jsx("span",{className:he.createStepLabel,children:$})]},`${M}:${$}`)})}),h.jsx("div",{className:he.createBody,children:R}),h.jsxs("div",{className:he.createActions,children:[h.jsx("button",{type:"button",className:he.manageButton,onClick:Z,disabled:e<=1||u||c,children:j("common.previous")}),e===H?h.jsx("button",{type:"button",className:he.manageButton,onClick:C,disabled:c,children:j(c?"agent.create.loading":"agent.create.save")}):h.jsx("button",{type:"button",className:he.manageButton,onClick:Q,disabled:L,children:j("common.next")})]})]})}const J2e="_page_9tap4_1",Z2e="_tabs_9tap4_11",exe="_memoryCard_9tap4_19",txe="_memoryCardActive_9tap4_35",nxe="_memoryTitle_9tap4_44",rxe="_detailPath_9tap4_48",sxe="_status_9tap4_49",ixe="_actionButton_9tap4_54",axe="_primaryButton_9tap4_55",oxe="_secondaryButton_9tap4_56",lxe="_detail_9tap4_48",cxe="_detailHeader_9tap4_79",uxe="_detailTitleWrap_9tap4_87",dxe="_actions_9tap4_91",hxe="_content_9tap4_105",fxe="_editor_9tap4_106",mxe="_editorFooter_9tap4_127",Kr={page:J2e,tabs:Z2e,memoryCard:exe,memoryCardActive:txe,memoryTitle:nxe,detailPath:rxe,status:sxe,actionButton:ixe,primaryButton:axe,secondaryButton:oxe,detail:lxe,detailHeader:cxe,detailTitleWrap:uxe,actions:dxe,content:hxe,editor:fxe,editorFooter:mxe};function z9(e,t){return e.find(n=>n.scope===t)}function $9(e,t){return t(e==="global"?"memory.global":"memory.project")}function pxe({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var R,$;const{t:s}=nt(),{files:i,loading:a,error:o,readFile:l,reload:c,writeMemory:u}=NU({autoLoad:!0}),d=b.useRef(null),f=b.useRef(0),[m,p]=b.useState("workspace"),[y,w]=b.useState("view"),[v,g]=b.useState(""),[x,k]=b.useState(""),[A,T]=b.useState(!1),[C,j]=b.useState(!1),[z,E]=b.useState(null),P=b.useRef(0),D=b.useMemo(()=>{const I=z9(i,"global"),M=z9(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:M},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:I}]},[i,s]),H=D.find(I=>I.scope===m)??D[0],W=b.useCallback((I,M)=>{const G=++f.current;if(w(M),E(null),g(""),k(""),!(I!=null&&I.file)){M==="edit"&&requestAnimationFrame(()=>{var ne;return(ne=d.current)==null?void 0:ne.focus()});return}T(!0),l(I.file.path).then(ne=>{G===f.current&&(g(ne.content),k(ne.content),ne.truncated&&E(s("memory.fileTruncated")),requestAnimationFrame(()=>{var fe;return(fe=d.current)==null?void 0:fe.focus()}))}).catch(ne=>{if(G!==f.current)return;const fe=ne instanceof Error?ne.message:String(ne);E(fe),I.scope!=="global"&&(r==null||r(fe,"error"))}).finally(()=>{G===f.current&&T(!1)})},[r,l,s]);b.useEffect(()=>{H&&W(H,y)},[(R=H==null?void 0:H.file)==null?void 0:R.path,H==null?void 0:H.scope]),b.useEffect(()=>{o&&E(o.message)},[o]),b.useEffect(()=>{e<=0||c().then(()=>E(s("memory.refreshed"))).catch(I=>{const M=I instanceof Error?I.message:String(I);E(M),r==null||r(M,"error")})},[r,e,c,s]),b.useEffect(()=>{if(t<=0||P.current===t)return;P.current=t;const I=n==="global"?"global":"workspace";p(I);const M=D.find(G=>G.scope===I);W(M,"edit")},[n,t,D,W]);const J=I=>{p(I.scope),W(I,"view")},Y=()=>{H&&W(H,"edit")},Z=()=>{if(H){if(!x.trim()){E(s("memory.contentEmpty"));return}j(!0),E(null),u({scope:H.scope,mode:"replace",content:x}).then(I=>{const M=s("memory.saved",{scope:$9(H.scope,s),bytes:I.bytesWritten,path:I.filePath});g(x),w("view"),E(M),r==null||r(M,"status"),c().catch(()=>{})}).catch(I=>{const M=I instanceof Error?I.message:String(I);E(M),r==null||r(M,"error")}).finally(()=>j(!1))}},Q=(($=H==null?void 0:H.file)==null?void 0:$.path)??(H==null?void 0:H.fallbackPath)??"",L=z??(a?s("memory.loading"):null);return h.jsxs("div",{className:Kr.page,children:[h.jsx("nav",{className:Kr.tabs,"aria-label":s("memory.menu"),children:D.map(I=>{const M=I.scope===m;return h.jsx("button",{type:"button",className:`${Kr.memoryCard} ${M?Kr.memoryCardActive:""}`,onClick:()=>J(I),children:h.jsx("span",{className:Kr.memoryTitle,children:I.title})},I.scope)})}),h.jsxs("section",{className:Kr.detail,children:[h.jsxs("header",{className:Kr.detailHeader,children:[h.jsx("div",{className:Kr.detailTitleWrap,children:h.jsx("div",{className:Kr.detailPath,children:Q})}),h.jsx("div",{className:Kr.actions,children:h.jsx("button",{type:"button",className:Kr.actionButton,onClick:Y,children:s("settings.action.edit")})})]}),L&&h.jsx("div",{className:Kr.status,children:L}),y==="edit"?h.jsxs(h.Fragment,{children:[h.jsx("textarea",{ref:d,className:Kr.editor,value:x,disabled:C||A,onChange:I=>k(I.target.value),placeholder:s("memory.placeholder",{scope:H?$9(H.scope,s):""})}),h.jsxs("div",{className:Kr.editorFooter,children:[h.jsx("button",{type:"button",className:Kr.secondaryButton,disabled:C,onClick:()=>{k(v),w("view")},children:s("common.cancel")}),h.jsx("button",{type:"button",className:Kr.primaryButton,disabled:C||A,onClick:Z,children:s(C?"memory.saving":"memory.save")})]})]}):h.jsx("pre",{className:Kr.content,children:A?s("memory.loadingFile"):v||s("memory.noFiles")})]})]})}const gxe="_panel_1emak_1",yxe="_steps_1emak_10",bxe="_stepPill_1emak_18",vxe="_stepPillActive_1emak_29",xxe="_stepPillDone_1emak_34",wxe="_stepNumber_1emak_38",_xe="_stepLabel_1emak_49",kxe="_body_1emak_55",Sxe="_text_1emak_59",Txe="_muted_1emak_64",Cxe="_options_1emak_68",Axe="_option_1emak_68",Exe="_optionActive_1emak_90",Mxe="_label_1emak_94",Nxe="_optionText_1emak_98",Ixe="_description_1emak_112",Rxe="_input_1emak_119",jxe="_preview_1emak_135",Dxe="_error_1emak_146",Oxe="_link_1emak_150",Lxe="_terms_1emak_161",Bxe="_actions_1emak_169",zxe="_actionButton_1emak_177",rn={panel:gxe,steps:yxe,stepPill:bxe,stepPillActive:vxe,stepPillDone:xxe,stepNumber:wxe,stepLabel:_xe,body:kxe,text:Sxe,muted:Txe,options:Cxe,option:Axe,optionActive:Exe,label:Mxe,optionText:Nxe,description:Ixe,input:Rxe,preview:jxe,error:Dxe,link:Oxe,terms:Lxe,actions:Bxe,actionButton:zxe},$xe=[{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 uf(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function P9(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function Pxe(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 qxe(e){const t=e.trim();return t?t.length<=6?"***":`${t.slice(0,3)}...${t.slice(-4)}`:"(not set)"}function I4(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Uxe({onMessage:e,onClose:t}){const{t:n}=nt(),r=fc(),[s,i]=b.useState("groups"),[a,o]=b.useState(0),[l,c]=b.useState(0),[u,d]=b.useState("providers"),[f,m]=b.useState(0),[p,y]=b.useState(),[w,v]=b.useState("alibaba"),[g,x]=b.useState(null),[k,A]=b.useState("openai"),[T,C]=b.useState(""),[j,z]=b.useState(""),[E,P]=b.useState(""),[D,H]=b.useState(!1),[W,J]=b.useState(!1),[Y,Z]=b.useState(!0),[Q,L]=b.useState(!0),[R,$]=b.useState(!1),[I,M]=b.useState(!1),[G,ne]=b.useState(""),[fe,Pe]=b.useState(!0),[oe,Xe]=b.useState(!1),[ht,At]=b.useState(null);b.useEffect(()=>{r.getAuthProviders().then(de=>{y(de),Pe(!1)}).catch(de=>{At(de instanceof Error?de.message:String(de)),Pe(!1)})},[r]);const zt=b.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),Vt=b.useMemo(()=>{var je;return(((je=zt.find(Te=>Te.id===w))==null?void 0:je.providerIds)??[]).map(Te=>p==null?void 0:p.providers.find(Nt=>Nt.id===Te)).filter(Te=>!!Te)},[p,w,zt]),gt=b.useMemo(()=>(g==null?void 0:g.steps)??[],[g==null?void 0:g.steps]),Le=gt[f],qt=(g==null?void 0:g.showAdvancedConfig)===!0,tn=b.useMemo(()=>W?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[W]),Mt=tn.indexOf("context"),Kt=Le==="apiKey"||Le==="models"||Le==="baseUrl"&&!Array.isArray(g==null?void 0:g.baseUrl),[$t,gn]=b.useState(0),Xt=b.useCallback((de,je="providers")=>{var Nt,An;x(de),d(je);const Te=((Nt=de.protocolOptions)==null?void 0:Nt[0])??de.protocol;A(Te),typeof de.baseUrl=="string"?C(de.baseUrl):Array.isArray(de.baseUrl)?C(((An=de.baseUrl[0])==null?void 0:An.url)??""):C(uf(Te)),z(""),P(P9(de)),H(!1),J(!1),Z(!0),L(!0),$(!1),M(!1),ne(""),m(0),gn(0),At(null),i(de.steps.length>0?"step":"review")},[]),Be=b.useCallback(()=>{if(At(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(gt.length===0){i(u);return}i("step"),m(Math.max(0,gt.length-1));return}if(f>0){m(de=>de-1),gn(0);return}i(u)},[t,u,f,gt.length,s]),Qe=b.useCallback(()=>{if(!g||oe)return;Xe(!0),At(null);const de=Number(G);r.installAuthProvider({providerId:g.id,protocol:k,baseUrl:T,apiKey:j,modelIds:I4(E),advancedConfig:D||W||Number.isFinite(de)&&de>0?{...D?{enableThinking:!0}:{},...W?{multimodal:{...Y?{image:!0}:{},...Q?{video:!0}:{},...R?{audio:!0}:{},...I?{pdf:!0}:{}}}:{},...Number.isFinite(de)&&de>0?{contextWindowSize:de}:{}}:void 0}).then(je=>{e(je.message),t()}).catch(je=>{const Te=je instanceof Error?je.message:String(je);At(Te),e(Te,"error")}).finally(()=>Xe(!1))},[j,T,G,W,R,Y,I,Q,E,t,e,k,g,oe,D,r]),st=b.useCallback(()=>{if(g){if(Le==="baseUrl"){const de=T.trim()||uf(k);if(!de){At(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(de)){At(n("auth.baseUrlInvalid"));return}T.trim()||C(de)}if(Le==="apiKey"&&j.trim().length===0){At(n("auth.apiKeyRequired"));return}if(Le==="models"&&I4(E).length===0){At(n("auth.modelsRequired"));return}At(null),f>=gt.length-1?qt?i("review"):Qe():(m(de=>de+1),gn(0))}},[j,T,Le,E,k,g,Qe,qt,f,gt.length,n]),te=b.useCallback(de=>{switch(de){case"thinking":H(je=>!je);return;case"modality":J(je=>!je);return;case"image":Z(je=>!je);return;case"video":L(je=>!je);return;case"audio":$(je=>!je);return;case"pdf":M(je=>!je);return;case"context":st();return;default:return}},[st]),ue=b.useCallback(()=>{if(s==="groups"){const de=zt[a];if(!de)return;if(de.id==="custom"){const je=de.providerIds.map(Te=>p==null?void 0:p.providers.find(Nt=>Nt.id===Te)).find(Te=>!!Te);je&&Xt(je,"groups");return}v(de.id),c(0),i("providers");return}if(s==="providers"){const de=Vt[l];de&&Xt(de,"providers");return}if(s==="review"){Qe();return}if(!(!g||!Le)){if(Le==="protocol"){const de=(g.protocolOptions??[g.protocol])[$t];de&&(A(de),g.baseUrl||C(uf(de))),st();return}if(Le==="baseUrl"&&Array.isArray(g.baseUrl)){const de=g.baseUrl[$t];de&&C(de.url),st();return}if(Le==="advancedConfig"){te(tn[$t]);return}st()}},[Le,p,st,a,zt,$t,g,l,Vt,Qe,Xt,s,te,tn]),re=b.useCallback(de=>{if(s==="groups"){const je=zt[de];if(!je)return;if(je.id==="custom"){const Te=je.providerIds.map(Nt=>p==null?void 0:p.providers.find(An=>An.id===Nt)).find(Nt=>!!Nt);Te&&Xt(Te,"groups");return}v(je.id),c(0),i("providers");return}if(s==="providers"){const je=Vt[de];je&&Xt(je,"providers");return}if(!g||!Le){s==="review"&&Qe();return}if(Le==="protocol"){const je=(g.protocolOptions??[g.protocol])[de];je&&(A(je),g.baseUrl||C(uf(je))),st();return}if(Le==="baseUrl"&&Array.isArray(g.baseUrl)){const je=g.baseUrl[de];je&&C(je.url),st();return}Le==="advancedConfig"&&te(tn[de])},[Le,p,st,zt,te,tn,g,Vt,Qe,Xt,s]),ae=(de,je,Te)=>h.jsx("div",{className:rn.options,children:de.map((Nt,An)=>h.jsx("button",{type:"button",className:`${rn.option} ${je===An?rn.optionActive:""}`,onClick:()=>{Te(An),re(An)},children:h.jsxs("div",{className:rn.optionText,children:[h.jsx("div",{className:rn.label,children:Nt.label}),Nt.description&&h.jsx("div",{className:rn.description,children:Nt.description})]})},Nt.value))}),pe=()=>{if(!g||!Le)return null;if(Le==="protocol"){const Te=g.protocolOptions??[g.protocol];return ae($xe.filter(Nt=>Te.includes(Nt.value)),$t,gn)}if(Le==="baseUrl")return Array.isArray(g.baseUrl)?ae(g.baseUrl.map(Te=>({value:Te.url,label:Te.label,description:Te.url})),$t,gn):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:rn.text,children:n("auth.baseUrlPrompt")}),h.jsx("input",{className:rn.input,value:T,placeholder:uf(k),onChange:Te=>{C(Te.target.value),At(null)},onKeyDown:Te=>{Te.key==="Enter"&&(Te.preventDefault(),Te.stopPropagation(),st())},autoFocus:!0}),g.documentationUrl&&h.jsx("a",{className:rn.link,href:g.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(Le==="apiKey")return h.jsxs(h.Fragment,{children:[g.documentationUrl&&h.jsxs("a",{className:rn.link,href:g.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",g.documentationUrl]}),h.jsx("input",{className:rn.input,type:"password",value:j,placeholder:g.apiKeyPlaceholder??"sk-...",onChange:Te=>{z(Te.target.value),At(null)},onKeyDown:Te=>{Te.key==="Enter"&&(Te.preventDefault(),Te.stopPropagation(),st())},autoFocus:!0})]});if(Le==="models"){const Te=P9(g);return h.jsxs(h.Fragment,{children:[Te&&h.jsx("div",{className:rn.muted,children:n("auth.modelsPrompt",{modelIds:Te})}),h.jsx("input",{className:rn.input,value:E,placeholder:Te||"model-id-1, model-id-2",onChange:Nt=>{P(Nt.target.value),At(null)},onKeyDown:Nt=>{Nt.key==="Enter"&&(Nt.preventDefault(),Nt.stopPropagation(),st())},autoFocus:!0})]})}const de=Te=>Te?"◉":"○",je=[{value:"thinking",label:`${de(D)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${de(W)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return W&&je.push({value:"image",label:`${de(Y)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${de(Q)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${de(R)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${de(I)} ${n("auth.advanced.modalityPdf")}`}),je.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${G||"auto"}`,description:n("auth.advanced.contextDesc")}),h.jsxs(h.Fragment,{children:[h.jsx("div",{className:rn.text,children:n("auth.advanced.prompt")}),ae(je,$t,gn),h.jsx("input",{className:rn.input,value:G,placeholder:"auto",onChange:Te=>ne(Te.target.value.replace(/[^0-9]/g,"")),onFocus:()=>gn(Mt),onKeyDown:Te=>{Te.key==="Enter"&&(Te.preventDefault(),Te.stopPropagation(),st())}})]})},wt=b.useMemo(()=>{if(!g)return"";const de=g.envKey??`${k.toUpperCase()}_API_KEY`,je=I4(E),Te={};if(D&&(Te.extra_body={enable_thinking:!0}),W){const Tr={};Y&&(Tr.image=!0),Q&&(Tr.video=!0),R&&(Tr.audio=!0),I&&(Tr.pdf=!0),Object.keys(Tr).length>0&&(Te.modalities=Tr)}const Nt=Number(G);Number.isFinite(Nt)&&Nt>0&&(Te.contextWindowSize=Nt);const An=Object.keys(Te).length>0;return JSON.stringify({env:{[de]:qxe(j)},modelProviders:{[k]:je.map(Tr=>({id:Tr,name:Tr,baseUrl:T.trim(),envKey:de,...An?{generationConfig:Te}:{}}))},security:{auth:{selectedType:k}},model:{name:je[0]}},null,2)},[j,T,G,W,R,Y,I,Q,E,k,g,D]),Je=b.useMemo(()=>{const de=[n("auth.step.group"),n("auth.step.provider")];return g&&(de.push(...gt.map(je=>Pxe(je,g,n))),qt&&de.push(n("auth.review"))),de},[g,qt,gt,n]),_t=b.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+f,Je.length):Je.length,[f,Je.length,s]),fn=fe?h.jsx("div",{className:rn.muted,children:n("common.loading")}):s==="groups"?h.jsxs(h.Fragment,{children:[ae(zt.map(de=>({value:de.id,label:n(de.label),description:n(de.description)})),a,o),h.jsxs("div",{className:rn.terms,children:[h.jsxs("div",{children:[n("auth.termsTitle"),":"]}),h.jsx("a",{className:rn.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"?ae(Vt.map(de=>({value:de.id,label:n(de.label),description:n(de.description)})),l,c):s==="step"?pe():h.jsxs(h.Fragment,{children:[h.jsx("div",{className:rn.text,children:n("auth.reviewText")}),h.jsx("div",{className:rn.preview,children:wt})]}),Vn=()=>{if(s==="review"){Qe();return}if(Kt||Le==="advancedConfig"){st();return}ue()};return h.jsxs("div",{className:rn.panel,children:[h.jsx("div",{className:rn.steps,children:Je.map((de,je)=>{const Te=je+1;return h.jsxs("div",{className:`${rn.stepPill} ${Te===_t?rn.stepPillActive:""} ${Te<_t?rn.stepPillDone:""}`,children:[h.jsx("span",{className:rn.stepNumber,children:Te}),h.jsx("span",{className:rn.stepLabel,children:de})]},`${Te}:${de}`)})}),h.jsx("div",{className:rn.body,children:fn}),ht&&h.jsx("div",{className:rn.error,children:ht}),h.jsxs("div",{className:rn.actions,children:[h.jsx("button",{type:"button",className:rn.actionButton,onClick:Be,disabled:s==="groups"||fe||oe,children:n("common.previous")}),h.jsx("button",{type:"button",className:rn.actionButton,onClick:Vn,disabled:fe||oe,children:n(s==="review"?oe?"auth.saving":"auth.save":"common.next")})]})]})}function Hxe(e){return e.displayName||e.name}function Fxe(){const{t:e}=nt(),{status:t,tools:n,loading:r,error:s}=$M({autoLoad:!0}),[i,a]=b.useState(0),[o,l]=b.useState(null),[c,u]=b.useState(()=>new Set),d=b.useRef(null);b.useEffect(()=>{var p,y;s?l(s.message):(y=(p=t==null?void 0:t.errors)==null?void 0:p[0])!=null&&y.error?l(t.errors[0].error):t&&l(null)},[t,s]);const f=b.useCallback(p=>{u(y=>y.has(p.name)?new Set:new Set([p.name]))},[]);b.useEffect(()=>{i>=n.length&&n.length>0&&a(n.length-1)},[i,n.length]),b.useEffect(()=>{var y;const p=(y=d.current)==null?void 0:y.children[i];p==null||p.scrollIntoView({block:"nearest"})},[i]);const m=b.useMemo(()=>{if(!t)return"";const p=n.filter(y=>y.enabled).length;return e("tools.summary",{enabled:p,total:n.length})},[t,n,e]);return h.jsxs("div",{className:ce("resume-picker","resume-picker-in-shell"),children:[m&&h.jsx("div",{className:ce("resume-picker-search"),children:h.jsx("span",{className:ce("resume-picker-search-hint"),children:m})}),(o||r)&&h.jsx("div",{className:ce("resume-picker-search"),children:h.jsx("span",{className:ce("resume-picker-search-hint"),children:o||e("tools.loading")})}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("resume-picker-list"),ref:d,children:[!r&&n.length===0&&h.jsx("div",{className:ce("resume-picker-empty"),children:e("tools.empty")}),n.map((p,y)=>{const w=c.has(p.name),v=p.description??"";return h.jsxs("div",{className:ce("resume-picker-item","resume-picker-session-item","tools-picker-item",w?"selected":void 0,w?"tools-picker-item-expanded":void 0),onClick:()=>{a(y),p.description&&f(p)},children:[h.jsxs("div",{className:ce("resume-picker-item-row"),children:[h.jsx("span",{className:ce("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:ce("resume-picker-item-title"),children:Hxe(p)}),h.jsx("span",{className:ce("tools-status-badge",p.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:p.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),v?h.jsx("svg",{className:ce("tools-item-chevron",w?"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]}),w&&v&&h.jsx("div",{className:ce("tools-desc-expanded"),children:h.jsx("div",{className:ce("tools-desc-body"),children:v})})]},p.name)})]})]})}const FO="update available";function Vxe(e){return e.displayName||e.name}function VO(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function Wxe(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 Yu(e){return e&&e.length>0?e.join(", "):"-"}const Gxe=$5;function Kxe(){const{t:e}=nt(),t=Iu(),n=fc(),r=Nu(),[s,i]=b.useState([]),[a,o]=b.useState(null),[l,c]=b.useState(null),[u,d]=b.useState({}),[f,m]=b.useState(!1),[p,y]=b.useState(!1),[w,v]=b.useState(null),[g,x]=b.useState(null),k=b.useCallback(()=>(m(!0),n.loadExtensionsStatus().then(z=>{var P,D;const E=z.extensions??[];i(E),x(((D=(P=z.errors)==null?void 0:P[0])==null?void 0:D.error)??null),o(H=>H&&E.some(W=>W.name===H)?H:null)}).catch(z=>{x(z instanceof Error?z.message:String(z))}).finally(()=>m(!1))),[n]),A=b.useCallback(()=>{const z=t.clientId;return z?(y(!0),n.checkExtensionUpdates(z).then(E=>d(E.states)).catch(E=>{x(E instanceof Error?E.message:String(E))}).finally(()=>y(!1))):(x(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),T=b.useCallback(()=>{const z=t.clientId;if(!z){x(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(z).then(async E=>{x(e("extensions.manage.refreshed",{refreshed:E.refreshed,failed:E.failed})),await k(),await A()}).catch(E=>{x(E instanceof Error?E.message:String(E))}).finally(()=>y(!1))},[n,A,t.clientId,k,e]);b.useEffect(()=>{k()},[k]),b.useEffect(()=>{s.length>0&&A()},[A,s.length]),b.useEffect(()=>{((r==null?void 0:r.extensionsVersion)??0)>0&&(d({}),k())},[k,r==null?void 0:r.extensionsVersion]);const C=b.useCallback((z,E)=>{const P=t.clientId;if(!P){x(e("extensions.install.waitForSession"));return}v(z),x(null),E(P).then(()=>x(e("extensions.manage.queued",{name:z}))).catch(D=>{x(D instanceof Error?D.message:String(D))}).finally(()=>v(null))},[t.clientId,e]),j=b.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:ce("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ce("resume-picker-search","extensions-toolbar"),children:[h.jsx("span",{className:ce("resume-picker-search-hint"),children:g||j}),h.jsx("button",{type:"button",className:ce("dialog-inline-button"),disabled:f||p,onClick:T,children:e("common.refresh")})]}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("resume-picker-list"),children:[!f&&s.length===0&&h.jsx("div",{className:ce("resume-picker-empty"),children:e("extensions.manage.empty")}),s.map(z=>{const E=u[z.name]??z.updateState,P=a===z.name,D=w===z.name;return h.jsxs("div",{className:ce("resume-picker-item","resume-picker-session-item","tools-picker-item",P?"selected":void 0,P?"tools-picker-item-expanded":void 0),children:[h.jsxs("button",{type:"button",className:ce("extensions-row-button"),onClick:()=>{o(P?null:z.name),c(null)},children:[h.jsx("span",{className:ce("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:ce("resume-picker-item-title"),children:Vxe(z)}),h.jsxs("span",{className:ce("resume-picker-item-badge"),children:["v",z.version]}),h.jsx("span",{className:ce("tools-status-badge",z.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:VO(z,e)}),h.jsx("span",{className:ce("tools-status-badge",E===FO?"tools-status-badge-busy":void 0),children:Wxe(E,e)}),h.jsx("svg",{className:ce("tools-item-chevron",P?"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"})})]}),P&&h.jsx(Yxe,{extension:z,updateState:E,busy:D,confirmingUninstall:l===z.name,onUpdate:()=>C(z.name,H=>n.updateExtension(z.name,H)),onToggleScope:(H,W)=>C(z.name,J=>H==="enable"?n.enableExtension(z.name,{scope:W},J):n.disableExtension(z.name,{scope:W},J)),onRequestUninstall:()=>c(z.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{C(z.name,H=>n.uninstallExtension(z.name,H)),c(null),o(null)}})]},z.id||z.name)})]})]})}function Yxe({extension:e,updateState:t,busy:n,confirmingUninstall:r,onUpdate:s,onToggleScope:i,onRequestUninstall:a,onCancelUninstall:o,onConfirmUninstall:l}){const{t:c}=nt(),u=e.details,d=e.isActive?"disable":"enable";return h.jsxs("div",{className:ce("extensions-detail"),children:[h.jsxs("div",{className:ce("extensions-detail-actions"),children:[h.jsx("button",{type:"button",className:ce("dialog-inline-button"),disabled:n||t!==FO,onClick:s,children:c("extensions.manage.update")}),h.jsxs("button",{type:"button",className:ce("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:ce("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:ce("dialog-danger-button"),disabled:n,onClick:a,children:c("extensions.manage.uninstallAction")})]}),r&&h.jsxs("div",{className:ce("extensions-confirm"),children:[h.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),h.jsxs("div",{className:ce("dialog-inline-actions"),children:[h.jsx("button",{type:"button",className:ce("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),h.jsx("button",{type:"button",className:ce("dialog-inline-button"),onClick:o,children:c("common.cancel")})]})]}),h.jsxs("div",{className:ce("extensions-detail-grid"),children:[h.jsx(sa,{label:c("extensions.manage.name"),value:e.name}),h.jsx(sa,{label:c("extensions.manage.version"),value:e.version}),h.jsx(sa,{label:c("extensions.manage.status"),value:VO(e,c)}),h.jsx(sa,{label:c("extensions.manage.path"),value:e.path}),h.jsx(sa,{label:c("extensions.manage.source"),value:e.source??"-"}),h.jsx(sa,{label:c("extensions.manage.commands"),value:Yu(u==null?void 0:u.commands)}),h.jsx(sa,{label:c("extensions.manage.skills"),value:Yu(u==null?void 0:u.skills)}),h.jsx(sa,{label:c("extensions.manage.agents"),value:Yu(u==null?void 0:u.agents)}),h.jsx(sa,{label:c("extensions.manage.mcpServers"),value:Yu(u==null?void 0:u.mcpServers)}),h.jsx(sa,{label:c("extensions.manage.contextFiles"),value:Yu(u==null?void 0:u.contextFiles)}),h.jsx(sa,{label:c("extensions.manage.settings"),value:Yu(u==null?void 0:u.settings)})]})]})}function sa({label:e,value:t}){return h.jsxs("div",{className:ce("extensions-detail-field"),children:[h.jsx("span",{className:ce("extensions-detail-label"),children:Gxe(e)}),h.jsx("span",{className:ce("extensions-detail-value"),children:t})]})}const Xxe="_panel_1kugk_1",Qxe="_embeddedPanel_1kugk_16",Jxe="_header_1kugk_26",Zxe="_title_1kugk_32",ewe="_secondary_1kugk_36",twe="_hint_1kugk_37",nwe="_empty_1kugk_38",rwe="_busy_1kugk_39",swe="_scopeTabs_1kugk_49",iwe="_scopeTab_1kugk_49",awe="_scopeTabActive_1kugk_71",owe="_settingsPage_1kugk_76",lwe="_sidebar_1kugk_83",cwe="_categoryButton_1kugk_92",uwe="_categoryButtonActive_1kugk_110",dwe="_categoryCount_1kugk_115",hwe="_content_1kugk_121",fwe="_card_1kugk_128",mwe="_cardBody_1kugk_142",pwe="_cardTitle_1kugk_146",gwe="_cardDescription_1kugk_155",ywe="_scopeHint_1kugk_156",bwe="_scopeBadge_1kugk_164",vwe="_cardControl_1kugk_174",xwe="_select_1kugk_180",wwe="_actionButton_1kugk_181",_we="_editInput_1kugk_182",kwe="_editor_1kugk_219",Swe="_switchOn_1kugk_241",Twe="_switchKnob_1kugk_246",Cwe="_footer_1kugk_261",jt={panel:Xxe,embeddedPanel:Qxe,header:Jxe,title:Zxe,secondary:ewe,hint:twe,empty:nwe,busy:rwe,scopeTabs:swe,scopeTab:iwe,scopeTabActive:awe,settingsPage:owe,sidebar:lwe,categoryButton:cwe,categoryButtonActive:uwe,categoryCount:dwe,content:hwe,card:fwe,cardBody:mwe,cardTitle:pwe,cardDescription:gwe,scopeHint:ywe,scopeBadge:bwe,cardControl:vwe,select:xwe,actionButton:wwe,editInput:_we,editor:kwe,switch:"_switch_1kugk_231",switchOn:Swe,switchKnob:Twe,footer:Cwe},Awe=new Set(["fastModel"]),Ewe=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function Fy(e,t,n){const r=e(t);return r===t?n:r}function Mwe(e,t){return Fy(t,`settings.category.${e}`,e)}function Nwe(e,t){return Fy(t,`settings.label.${e.key}`,e.label)}function Iwe(e,t){if(e.description)return Fy(t,`settings.description.${e.key}`,e.description)}function WO(e,t,n,r){return Fy(r,`settings.option.${e.key}.${String(t)}`,n)}function R4(e,t,n){const r=KO(e,t);if(r==null)return"";if(e.key===Fc){const i=s3(r,us.Dark);return n(`theme.${i}`)}if(e.key===$f){const i=t3(r);return i?n3(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(a=>a.value===r);return i?WO(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?s.slice(0,21)+"...":s}function GO(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function Rwe(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return GO(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function KO(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function jwe(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:Mwe(r,t),items:s}))}function Dwe({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,embedded:a=!1}){const{t:o}=nt(),{status:l,settings:c,loading:u,error:d,reload:f,setValue:m}=e,[p,y]=b.useState("workspace"),[w,v]=b.useState(""),[g,x]=b.useState(null),[k,A]=b.useState(null),[T,C]=b.useState(null),j=b.useRef(null),[z,E]=b.useState(!1),P=u&&!l,D=c.find(I=>I.key===Fc),H=s3(D==null?void 0:D.values.effective),W=c.find(I=>I.key===$f),J=t3(W==null?void 0:W.values.effective),Y=b.useMemo(()=>{const I=c.filter(fe=>!Ewe.has(fe.key)),M=jwe(I,o).map(fe=>({id:fe.category,label:fe.category,items:fe.items.map(Pe=>({type:"setting",setting:Pe}))})),G={type:"local",localKey:"chatWidth"},ne=M.find(fe=>fe.items.some(Pe=>Pe.type==="setting"&&Pe.setting.key===Fc));if(ne){const fe=ne.items.findIndex(Pe=>Pe.type==="setting"&&Pe.setting.key===Fc);ne.items.splice(fe+1,0,G)}else M.push({id:o("settings.category.UI"),label:o("settings.category.UI"),items:[G]});return M},[c,o]);b.useEffect(()=>{Y.length!==0&&(Y.some(I=>I.id===w)||v(Y[0].id))},[w,Y]),b.useEffect(()=>{var I;d?A(d.message):(I=l==null?void 0:l.warnings)!=null&&I.length?A(l.warnings.map(M=>o("settings.corrupted",{recovered:M.recovered?"true":"false"})).join("; ")):c.length>0&&!z&&A(null)},[d,c,l,o,z]),b.useEffect(()=>{T&&setTimeout(()=>{var I;return(I=j.current)==null?void 0:I.focus()},0)},[T]);const Z=b.useCallback((I,M)=>{z||A(null),x(I),m("workspace",I,M).then(async G=>{try{await f()}catch{}G!=null&&G.requiresRestart&&I!==$f&&(E(!0),A(o("settings.requiresRestart")))}).catch(G=>{A(G instanceof Error?G.message:String(G))}).finally(()=>x(null))},[f,z,m,o]),Q=b.useCallback(()=>{if(!T)return;const I=c.find(G=>G.key===T.key);if(!I){C(null);return}let M=T.draft;if(I.type==="number"){const G=T.draft.trim();if(G===""||!Number.isFinite(Number(G))){A(o("settings.invalidNumber"));return}M=Number(G)}C(null),Z(I.key,M)},[T,c,Z,o]),L=Y.find(I=>I.id===w)??Y[0],R=(I,M,G,ne=!1)=>h.jsx("select",{className:jt.select,value:I,disabled:ne,onChange:fe=>M(fe.target.value),children:G.map(fe=>h.jsx("option",{value:fe.value,children:fe.label},fe.value))}),$=I=>{var Pe;const M=KO(I,p),G=g===I.key,ne=(T==null?void 0:T.key)===I.key;if(p!=="workspace")return h.jsx("button",{type:"button",className:jt.actionButton,disabled:!0,title:o("settings.readOnly"),children:R4(I,p,o)||o("settings.readOnly")});if(I.key===Fc)return R(H??us.Dark,oe=>{const Xe=oe;r(Xe),Z(Fc,_H(Xe))},WM.map(oe=>({value:oe,label:o(`theme.${oe}`)})),G);if(I.key===$f)return R(J??"zh-CN",oe=>t(oe),aH.map(oe=>({value:oe,label:n3(oe)})),G);if(Awe.has(I.key))return h.jsx("button",{type:"button",className:jt.actionButton,onClick:()=>n(I.key),children:R4(I,p,o)||o("settings.action.edit")});if(I.type==="boolean"){const oe=M===!0;return h.jsx("button",{type:"button",className:`${jt.switch} ${oe?jt.switchOn:""}`,disabled:G,onClick:()=>Z(I.key,!oe),"aria-pressed":oe,children:h.jsx("span",{className:jt.switchKnob})})}if(I.type==="enum"&&((Pe=I.options)!=null&&Pe.length)){const oe=I.options.findIndex(Xe=>Xe.value===M);return R(oe>=0?String(oe):"",Xe=>{var At;const ht=(At=I.options)==null?void 0:At[Number(Xe)];ht&&Z(I.key,ht.value)},I.options.map((Xe,ht)=>({value:String(ht),label:WO(I,Xe.value,Xe.label,o)})),G)}return ne?h.jsxs("div",{className:jt.editor,children:[h.jsx("input",{ref:j,className:jt.editInput,type:I.type==="number"?"number":"text",value:T.draft,onChange:oe=>C({key:T.key,draft:oe.target.value}),onKeyDown:oe=>{oe.key==="Enter"&&(oe.preventDefault(),Q()),oe.key==="Escape"&&(oe.preventDefault(),C(null))}}),h.jsx("button",{type:"button",className:jt.actionButton,onClick:Q,children:o("settings.action.save")})]}):h.jsx("button",{type:"button",className:jt.actionButton,disabled:G,onClick:()=>C({key:I.key,draft:String(M??"")}),children:R4(I,p,o)||o("settings.action.edit")})};return h.jsxs("div",{className:`${jt.panel} ${a?jt.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!a&&h.jsxs("div",{className:jt.header,children:[h.jsx("span",{className:jt.title,children:o("settings.title")}),h.jsx("span",{className:jt.secondary,children:o("settings.scope.workspace")})]}),(k||P)&&h.jsx("div",{className:jt.hint,children:k||o("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:o("settings.scope.workspace")}),h.jsx("button",{type:"button",role:"tab","aria-selected":p==="user",className:`${jt.scopeTab} ${p==="user"?jt.scopeTabActive:""}`,onClick:()=>{C(null),y("user")},children:o("settings.scope.user")})]}),h.jsxs("div",{className:jt.settingsPage,children:[h.jsx("nav",{className:jt.sidebar,"aria-label":o("settings.title"),children:Y.map(I=>h.jsxs("button",{type:"button",className:`${jt.categoryButton} ${I.id===w?jt.categoryButtonActive:""}`,onClick:()=>v(I.id),children:[h.jsx("span",{children:I.label}),h.jsx("span",{className:jt.categoryCount,children:I.items.length})]},I.id))}),h.jsxs("section",{className:jt.content,children:[!u&&!L&&h.jsx("div",{className:jt.empty,children:o("settings.empty")}),L==null?void 0:L.items.map(I=>{if(I.type==="local")return h.jsxs("div",{className:jt.card,children:[h.jsxs("div",{className:jt.cardBody,children:[h.jsx("div",{className:jt.cardTitle,children:o("settings.label.ui.chatWidth")}),h.jsx("div",{className:jt.cardDescription,children:o("settings.description.ui.chatWidth")})]}),h.jsx("div",{className:jt.cardControl,children:R(s,Pe=>i(Pe),[{value:"1000",label:o("settings.option.ui.chatWidth.1000")},{value:"wide",label:o("settings.option.ui.chatWidth.wide")}])})]},I.localKey);const M=I.setting,G=Iwe(M,o),ne=Rwe(M,p),fe=GO(M,p);return h.jsxs("div",{className:jt.card,children:[h.jsxs("div",{className:jt.cardBody,children:[h.jsxs("div",{className:jt.cardTitle,children:[Nwe(M,o),fe&&h.jsx("span",{className:jt.scopeBadge,children:o(p==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),G&&h.jsx("div",{className:jt.cardDescription,children:G}),ne&&h.jsx("div",{className:jt.scopeHint,children:o(ne,{scope:o(p==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),h.jsx("div",{className:jt.cardControl,children:g===M.key?h.jsx("span",{className:jt.busy,children:"..."}):$(M)})]},M.key)})]})]}),!a&&h.jsx("div",{className:jt.footer,children:o(T?"settings.footer.edit":"settings.footer")})]})}const Owe="_dialog_1i0hj_1",Lwe="_toolbar_1i0hj_12",Bwe="_tabs_1i0hj_21",zwe="_tab_1i0hj_21",$we="_tabActive_1i0hj_39",Pwe="_search_1i0hj_48",qwe="_general_1i0hj_60",Uwe="_shortcuts_1i0hj_67",Hwe="_shortcut_1i0hj_67",Fwe="_shortcutKey_1i0hj_87",Vwe="_shortcutDesc_1i0hj_95",Wwe="_commandList_1i0hj_101",Gwe="_commandCard_1i0hj_108",Kwe="_commandCardExpanded_1i0hj_115",Ywe="_commandRow_1i0hj_119",Xwe="_commandName_1i0hj_135",Qwe="_commandTag_1i0hj_142",Jwe="_chevron_1i0hj_152",Zwe="_chevronExpanded_1i0hj_160",e_e="_commandDetail_1i0hj_164",t_e="_commandDescription_1i0hj_174",n_e="_commandSubcommands_1i0hj_175",r_e="_empty_1i0hj_182",Zn={dialog:Owe,toolbar:Lwe,tabs:Bwe,tab:zwe,tabActive:$we,search:Pwe,general:qwe,shortcuts:Uwe,shortcut:Hwe,shortcutKey:Fwe,shortcutDesc:Vwe,commandList:Wwe,commandCard:Gwe,commandCardExpanded:Kwe,commandRow:Ywe,commandName:Xwe,commandTag:Qwe,chevron:Jwe,chevronExpanded:Zwe,commandDetail:e_e,commandDescription:t_e,commandSubcommands:n_e,empty:r_e},s_e=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],i_e=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"]),a_e=[["@","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 o_e(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function Ow(e){return!i_e.has(e.name)}function l_e(e,t){return Ow(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function c_e(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!Ow(s):t==="custom-commands"?Ow(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 u_e(){const{t:e}=nt();return h.jsx("div",{className:Zn.general,children:h.jsx("div",{className:Zn.shortcuts,children:a_e.map(([t,n])=>h.jsxs("div",{className:Zn.shortcut,children:[h.jsx("span",{className:Zn.shortcutDesc,children:e(n)}),h.jsx("span",{className:Zn.shortcutKey,children:t})]},t))})})}function d_e({commands:e,tab:t,query:n}){const{t:r}=nt(),[s,i]=b.useState(null),a=b.useMemo(()=>c_e(e,t,n),[e,n,t]);return a.length===0?h.jsx("div",{className:Zn.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):h.jsx("div",{className:Zn.commandList,children:a.map(o=>{var c;const l=s===o.name;return h.jsxs("article",{className:`${Zn.commandCard} ${l?Zn.commandCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:Zn.commandRow,onClick:()=>i(l?null:o.name),"aria-expanded":l,children:[h.jsx("span",{className:Zn.commandName,children:o_e(o)}),h.jsx("span",{className:Zn.commandTag,children:l_e(o,r)}),h.jsx("svg",{className:`${Zn.chevron} ${l?Zn.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:Zn.commandDetail,children:[o.description&&h.jsx("div",{className:Zn.commandDescription,children:o.description}),!!((c=o.subcommands)!=null&&c.length)&&h.jsxs("div",{className:Zn.commandSubcommands,children:[r("help.subcommands"),": ",o.subcommands.join(", ")]})]})]},o.name)})})}function h_e({commands:e}){const{t}=nt(),[n,r]=b.useState("general"),[s,i]=b.useState(""),a=n!=="general";return h.jsxs("div",{className:Zn.dialog,children:[h.jsxs("div",{className:Zn.toolbar,children:[h.jsx("div",{className:Zn.tabs,children:s_e.map(o=>h.jsx("button",{type:"button",className:`${Zn.tab} ${o.id===n?Zn.tabActive:""}`,onClick:()=>r(o.id),children:t(o.labelKey)},o.id))}),a&&h.jsx("input",{className:Zn.search,value:s,onChange:o=>i(o.target.value),placeholder:t("help.search")})]}),n==="general"?h.jsx(u_e,{}):h.jsx(d_e,{commands:e,tab:n,query:s})]})}function f_e({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=nt(),s=WM.map(l=>({id:l,label:r(`theme.${l}`),description:r(`theme.${l}.desc`)})),[i,a]=b.useState(()=>{const l=s.findIndex(c=>c.id===e);return l>=0?l:0}),o=b.useRef(null);return b.useEffect(()=>{var c;const l=(c=o.current)==null?void 0:c.children[i];l==null||l.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:ce("resume-picker-list","resume-picker-list-compact"),ref:o,role:"listbox",children:s.map((l,c)=>{const u=l.id===e;return h.jsxs("button",{type:"button",role:"option","aria-selected":u,className:ce("resume-picker-item","resume-picker-session-item",c===i||u?"selected":void 0),onClick:()=>{t(l.id),n()},onMouseEnter:()=>a(c),children:[h.jsxs("div",{className:ce("resume-picker-item-row"),children:[h.jsx("span",{className:ce("resume-picker-item-title"),children:l.label}),u&&h.jsx("span",{className:ce("resume-picker-item-check"),children:" ✓"})]}),h.jsx("div",{className:ce("resume-picker-item-meta"),children:l.description})]},l.id)})})}function m_e({onDeleted:e,onError:t,onClose:n}){const{t:r}=nt(),s=Iu(),{sessions:i,loading:a,error:o,deleteSession:l,deleteSessions:c}=Z_({autoLoad:!0}),u=s.sessionId,[d,f]=b.useState(!1),[m,p]=b.useState(0),[y,w]=b.useState(new Set),[v,g]=b.useState(""),[x,k]=b.useState(null),A=b.useRef(null),T=b.useRef(null);b.useEffect(()=>{o&&k(o.message)},[o]);const C=b.useMemo(()=>v?i.filter(D=>{const H=v.toLowerCase();return(D.displayName||"").toLowerCase().includes(H)||D.sessionId.toLowerCase().includes(H)}):i,[i,v]);b.useEffect(()=>{if(v&&y.size>0){const D=new Set(C.map(H=>H.sessionId));w(H=>{const W=new Set([...H].filter(J=>D.has(J)));return W.size===H.size?H:W})}},[v,C,y.size]),b.useEffect(()=>{m>=C.length&&C.length>0&&p(C.length-1)},[C.length,m]),b.useEffect(()=>{var H;const D=(H=A.current)==null?void 0:H.children[m];D==null||D.scrollIntoView({block:"nearest"})},[m]),b.useEffect(()=>{var D;(D=T.current)==null||D.focus()},[]);const j=b.useCallback(D=>{D!==u&&w(H=>{const W=new Set(H);return W.has(D)?W.delete(D):W.add(D),W})},[u]),z=b.useCallback(()=>{if(d)return;if(y.size>0){const H=new Set(C.map(J=>J.sessionId)),W=Array.from(y).filter(J=>H.has(J));if(W.length===0)return;f(!0),c(W).then(J=>{const Y=J.removed.length+J.notFound.length,Z=J.errors.length;if(Z>0&&Y>0){t(new Error(r("delete.partialFail",{removed:Y,failed:Z,detail:J.errors[0].error}))),n();return}if(Z>0){k(r("delete.allFailed",{count:Z,reason:J.errors[0].error})),f(!1),w(new Set);return}if(Y===0){k(r("delete.nonRemoved")),f(!1),w(new Set);return}e([...J.removed,...J.notFound]),n()}).catch(J=>{t(J),f(!1)});return}const D=C[m];if(D){if(D.sessionId===u){k(r("delete.cannotCurrent"));return}f(!0),l(D.sessionId).then(H=>{if(!H){k(r("delete.notFound")),f(!1);return}e([D.sessionId]),n()}).catch(H=>{t(H),f(!1)})}},[u,l,c,d,C,n,e,t,m,y,r]),E=y.size>0,P=!d&&!a&&E;return h.jsxs("div",{className:ce("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ce("resume-picker-search"),children:[h.jsxs("span",{className:ce("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:T,className:ce("resume-picker-search-input"),value:v,onChange:D=>{g(D.target.value),p(0),w(new Set)},placeholder:""}),h.jsx("span",{className:ce("resume-picker-search-hint"),children:x||(d?r("delete.deleting"):a?r("common.loading"):E?r("delete.selected",{count:y.size}):v?r("delete.matches",{count:C.length}):"")})]}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("resume-picker-list"),ref:A,children:[a&&h.jsx("div",{className:ce("resume-picker-empty"),children:r("common.loading")}),!a&&o&&h.jsx("div",{className:ce("resume-picker-empty"),children:o.message}),!a&&!o&&C.length===0&&h.jsx("div",{className:ce("resume-picker-empty"),children:v?r("delete.noMatch",{query:v}):r("delete.none")}),!a&&C.map((D,H)=>{const W=D.sessionId===u,J=y.has(D.sessionId),Y=J?"[x] ":"[ ] ";return h.jsxs("div",{className:ce("resume-picker-item","resume-picker-session-item",J?"selected":void 0,W?"resume-picker-item-current":void 0,W?"disabled":void 0),onClick:()=>{p(H),W||j(D.sessionId)},children:[h.jsxs("div",{className:ce("resume-picker-item-row"),children:[h.jsx("span",{className:ce("resume-picker-item-checkbox"),children:Y}),h.jsx("span",{className:ce("resume-picker-item-title"),children:D.displayName||D.sessionId.slice(0,8)}),W&&h.jsx("span",{className:ce("resume-picker-item-badge"),children:r("resume.current")})]}),h.jsxs("div",{className:ce("resume-picker-item-meta"),children:[h.jsx("span",{children:(D.updatedAt||D.createdAt)&&z5(D.updatedAt||D.createdAt||"",r)}),h.jsx("span",{className:ce("resume-picker-item-detail"),children:r("common.clients",{count:D.clientCount??0})}),D.hasActivePrompt&&h.jsx("span",{className:ce("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},D.sessionId)})]}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:ce("dialog-inline-button"),onClick:n,disabled:d,children:r("common.cancel")}),h.jsx("button",{type:"button",className:ce("dialog-danger-button"),onClick:z,disabled:!P,children:r(d?"delete.deleting":"delete.action")})]})]})}function p_e({onReleased:e,onError:t,onClose:n}){const{t:r}=nt(),s=Iu(),{sessions:i,loading:a,error:o,releaseSession:l}=Z_({autoLoad:!0}),c=s.sessionId,[u,d]=b.useState(!1),[f,m]=b.useState(0),[p,y]=b.useState(!1),[w,v]=b.useState(""),[g,x]=b.useState(null),k=b.useRef(null),A=b.useRef(null);b.useEffect(()=>{o&&x(o.message)},[o]);const T=w?i.filter(P=>{const D=w.toLowerCase();return(P.displayName||"").toLowerCase().includes(D)||P.sessionId.toLowerCase().includes(D)}):i;b.useEffect(()=>{f>=T.length&&T.length>0&&m(T.length-1)},[T.length,f]),b.useEffect(()=>{var D;const P=(D=k.current)==null?void 0:D.children[f];P==null||P.scrollIntoView({block:"nearest"})},[f]),b.useEffect(()=>{var P;(P=A.current)==null||P.focus()},[]);const C=b.useCallback(P=>{const D=P??T[f];if(!D||u)return;if(!((D.clientCount??0)>0||D.hasActivePrompt===!0)){x(r("release.inactive"));return}if(D.sessionId===c){x(r("release.cannotCurrent"));return}l&&(d(!0),l(D.sessionId).then(()=>{e(D.sessionId),n()}).catch(W=>{t(W),d(!1)}))},[c,u,T,n,t,e,l,f,r]),j=T[f],z=j&&((j.clientCount??0)>0||j.hasActivePrompt===!0),E=!u&&!a&&p&&!!j&&j.sessionId!==c&&!!z;return h.jsxs("div",{className:ce("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ce("resume-picker-search"),children:[h.jsxs("span",{className:ce("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:A,className:ce("resume-picker-search-input"),value:w,onChange:P=>{v(P.target.value),m(0),y(!1)},placeholder:""}),h.jsx("span",{className:ce("resume-picker-search-hint"),children:g||(u?r("release.releasing"):a?r("common.loading"):w?r("release.matches",{count:T.length}):"")})]}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("resume-picker-list"),ref:k,children:[a&&h.jsx("div",{className:ce("resume-picker-empty"),children:r("common.loading")}),!a&&T.length===0&&h.jsx("div",{className:ce("resume-picker-empty"),children:w?r("release.noMatch",{query:w}):r("release.none")}),!a&&T.map((P,D)=>{const H=P.sessionId===c,W=(P.clientCount??0)>0||P.hasActivePrompt===!0,J=H||!W;return h.jsxs("div",{className:ce("resume-picker-item","resume-picker-session-item",p&&D===f?"selected":void 0,H?"resume-picker-item-current":void 0,J?"disabled":void 0),onClick:()=>{m(D),y(!0)},children:[h.jsxs("div",{className:ce("resume-picker-item-row"),children:[h.jsx("span",{className:ce("resume-picker-item-title"),children:P.displayName||P.sessionId.slice(0,8)}),H&&h.jsx("span",{className:ce("resume-picker-item-badge"),children:r("resume.current")}),!H&&!W&&h.jsx("span",{className:ce("resume-picker-item-badge"),children:r("release.inactiveBadge")})]}),h.jsxs("div",{className:ce("resume-picker-item-meta"),children:[h.jsx("span",{children:(P.updatedAt||P.createdAt)&&z5(P.updatedAt||P.createdAt||"",r)}),h.jsx("span",{className:ce("resume-picker-item-detail"),children:r("common.clients",{count:P.clientCount??0})}),P.hasActivePrompt&&h.jsx("span",{className:ce("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},P.sessionId)})]}),h.jsx("div",{className:ce("resume-picker-sep")}),h.jsxs("div",{className:ce("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:ce("dialog-inline-button"),onClick:n,disabled:u,children:r("common.cancel")}),h.jsx("button",{type:"button",className:ce("dialog-danger-button"),onClick:()=>C(),disabled:!E,children:r(u?"release.releasing":"release.action")})]})]})}const g_e="_root_1aw20_1",y_e="_list_1aw20_8",b_e="_item_1aw20_15",v_e="_itemSelected_1aw20_33",x_e="_prompt_1aw20_42",w_e="_turn_1aw20_51",__e="_time_1aw20_56",k_e="_footer_1aw20_62",S_e="_dangerButton_1aw20_69",po={root:g_e,list:y_e,item:b_e,itemSelected:v_e,prompt:x_e,turn:w_e,time:__e,footer:k_e,dangerButton:S_e};function T_e(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 C_e(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function A_e({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=nt(),[a,o]=b.useState([]),[l,c]=b.useState(!0),[u,d]=b.useState(null),[f,m]=b.useState(null);b.useEffect(()=>{let w=!0;return c(!0),t().then(v=>{w&&o(v.snapshots)}).catch(v=>{w&&r(v)}).finally(()=>{w&&c(!1)}),()=>{w=!1}},[t,r]);const p=b.useMemo(()=>a.map(w=>({snapshot:w,promptText:T_e(e,w.turnIndex)})).sort((w,v)=>w.snapshot.turnIndex-v.snapshot.turnIndex),[e,a]);b.useEffect(()=>{p.length>0&&!f&&m(p[0].snapshot.promptId)},[p,f]);const y=()=>{const w=f;w&&(u||(d(w),n(w).then(()=>{s()}).catch(v=>{r(v),d(null)})))};return l?h.jsx("div",{className:ce("resume-picker-empty"),children:i("rewind.loading")}):p.length===0?h.jsx("div",{className:ce("resume-picker-empty"),children:i("rewind.empty")}):h.jsxs("div",{className:po.root,children:[h.jsx("div",{className:po.list,role:"list",children:p.map(({snapshot:w,promptText:v})=>{const g=f===w.promptId,x=u!==null,k=v||i("rewind.promptFallback",{id:w.promptId.slice(-8)});return h.jsxs("button",{type:"button",className:`${po.item} ${g?po.itemSelected:""}`,disabled:x,onClick:()=>m(w.promptId),children:[h.jsxs("div",{className:po.prompt,title:k,children:[h.jsxs("span",{className:po.turn,children:["#",w.turnIndex+1]})," ",k]}),h.jsx("div",{className:po.time,children:C_e(w.timestamp)})]},w.promptId)})}),h.jsxs("div",{className:po.footer,children:[h.jsx("button",{type:"button",className:ce("dialog-inline-button"),onClick:s,disabled:u!==null,children:i("common.cancel")}),h.jsx("button",{type:"button",className:`${ce("dialog-danger-button")} ${po.dangerButton}`,onClick:y,disabled:!f||u!==null,children:i(u?"rewind.rewinding":"rewind.confirm")})]})]})}function E_e(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] [<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 M_e(...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 N_e(e){const[t,n]=b.useState(e);return b.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(r)},[e]),t}const I_e=3e3,R_e=2;function q9(e){return e.some(t=>t.status==="running"||t.status==="paused")}function j_e(e,t,n=0){const r=J_(),[s,i]=b.useState([]),[a,o]=b.useState(!1),[l,c]=b.useState(!1),u=b.useRef(0),d=b.useRef(!1);b.useEffect(()=>{if(!t){i([]),o(!1),u.current=0;return}},[t]),b.useEffect(()=>{!t||!e||(u.current=0,o(!0))},[t,e]),b.useEffect(()=>{!t||n===0||(u.current=0,o(!0))},[t,n]),b.useEffect(()=>{if(l||!t||!a)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>=R_e&&o(!1);return}u.current=0,q9(w.tasks)||o(!1)}}).catch(w=>{m||console.warn("[web-shell] failed to refresh tasks:",w)}).finally(()=>{d.current=!1}))};p();const y=setInterval(p,I_e);return()=>{m=!0,clearInterval(y)}},[r,t,a,l]);const f=b.useRef(s);return f.current=s,b.useEffect(()=>{const m=p=>{const y=p.detail,w=(y==null?void 0:y.active)===!0;c(w),!w&&q9(f.current)&&o(!0)};return window.addEventListener(th,m),()=>window.removeEventListener(th,m)},[]),s}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function D_e(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function O_e(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 L_e(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 B_e(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function z_e(e){return B_e(e)||!e.text&&!e.usage?null:e}function U9(e){return e.text.length===0}function $_e(e){const t=e.flatMap((n,r)=>{const s=Ks(n),i=Fs(s,"content");return i?[{id:Fs(s,"id")??`plan-${r}`,content:i,status:V_e(Fs(s,"status")),...(()=>{const o=W_e(Fs(s,"priority"));return o?{priority:o}:{}})()}]:[]});return t.length>0?t:void 0}function H9(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 P_e(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 a=null,o=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":{a=null,o=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(v=>({data:v.data,mimeType:v.mimeType||"image/*"}))),n.push(w);break}case"assistant":{const y=z_e(m);if(!y)break;const w=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(w){F9(w,y.text);break}const v=i3e(y.text);if(v){let x=null,k=!1,A=0,T=0;for(const C of v)C.kind==="insight"?C.data.type==="insight_progress"?x=C.data:C.data.type==="insight_ready"?(k=!0,n.push({id:`${m.id}-ir-${A++}`,role:"insight_ready",path:C.data.path,timestamp:p})):C.data.type==="insight_error"&&(k=!0,n.push({id:`${m.id}-ie-${T++}`,role:"insight_error",error:C.data.error,timestamp:p})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:C.text,timestamp:p}),a=n.length-1,o=null);x&&!k&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:p}),l=!0;break}const g=a!==null?n[a]:void 0;if(g&&g.role==="assistant"&&!l&&!U9(y)){const x=H9(g.usage,y.usage);n[a]={...g,content:g.content+y.text,isStreaming:y.streaming,...x?{usage:x}:{}},l=!1,o=null}else if(!U9(y))n.push({id:m.id,role:"assistant",content:y.text,isStreaming:y.streaming,timestamp:p,...y.usage?{usage:y.usage}:{}}),a=n.length-1,o=null,l=!1;else if(y.usage&&g&&g.role==="assistant"){const x=H9(g.usage,y.usage);n[a]={...g,...x?{usage:x}:{}}}break}case"thought":{const y=m,w=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(w){F9(w,y.text);break}const v=o!==null?n[o]:void 0;v&&v.role==="thinking"&&!l?(n[o]={...v,content:v.content+y.text,isStreaming:y.streaming},l=!1):(n.push({id:m.id,role:"thinking",content:y.text,isStreaming:y.streaming,timestamp:p}),o=n.length-1,l=!1),a=null;break}case"tool":{const w=G_e(m),v=i.get(w.callId);v!=null&&v.title&&(w.title=v.title),!w.args&&(v!=null&&v.args)&&(w.args=v.args);const g=w.parentToolCallId?s.get(w.parentToolCallId):void 0,x=s.get(w.callId);if(x){V9(x,w);break}if(g){q_e(g,w),s.set(w.callId,w);break}j4(n,m.id,w,p),s.set(w.callId,w),a=null,o=null,l=!0;break}case"shell":{const y=m,w=n[n.length-1];if(w&&w.role==="tool_group"){const v=U_e(w.tools),g=w.tools[v];if(g){const x=typeof g.rawOutput=="string"?g.rawOutput:"",k={...g,rawOutput:x+y.text};n[n.length-1]={...w,tools:[...w.tools.slice(0,v),k,...w.tools.slice(v+1)]},s.get(g.callId)===g&&s.set(g.callId,k)}}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;Y_e(y,i);const w=K_e(y);if(!w)break;const v=YO(w);if(!y.resolved)break;const g=s.get(w.callId);if(g){const x=g.status;w.toolName=g.toolName,y.resolved&&(D4(y.resolved)?w.status=v?w.status:"in_progress":(w.status="failed",w.endTime=y.updatedAt)),V9(g,w),y.resolved&&v&&D4(y.resolved)&&(g.status=x);break}if(y.resolved){D4(y.resolved)?(v||(w.status="in_progress"),j4(n,m.id,w,p),s.set(w.callId,w),l=!0):(w.status="failed",w.endTime=y.updatedAt,j4(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"?O_e(y.data):null,v=y.source==="mid_turn_message_injected"?L_e(y.data):null,g=w&&((u=t.labels)!=null&&u.branchSuccess)?t.labels.branchSuccess(w):v&&((d=t.labels)!=null&&d.midTurnInserted)?t.labels.midTurnInserted(v):y.text;if(D_e(g))break;const x=F_e(g);if(x){n.push({id:m.id,role:"plan",todos:x,timestamp:p}),l=!0;break}n.push({id:m.id,role:"system",content:g,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 q_e(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function F9(e,t){e.subContent=(e.subContent||"")+t}function j4(e,t,n,r){const s=a=>YO(a)||Ah(a.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 U_e(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 V9(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 YO(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||H_e(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function H_e(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function F_e(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=Ks(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:$_e(r.entries)}catch{return}}function Ks(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Fs(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function V_e(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function W_e(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function G_e(e){const t=Q_e(e),n=X_e(e,t),r=J_e(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:QO(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 K_e(e){const t=Ks(e.toolCall);if(!t)return;const n=XO(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=Ks(t._meta),s=Fs(t,"kind"),i=Fs(r,"toolName")??Fs(t,"toolName")??Fs(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),a=Fs(t,"toolCallId")??Fs(t,"id");return!a||!i?void 0:{callId:a,toolName:i,title:Fs(t,"title")??e.title,status:"pending",kind:QO(i,s),args:n,startTime:e.createdAt}}function Y_e(e,t){const n=Ks(e.toolCall),r=Fs(n,"toolCallId")??Fs(n,"id");if(!r)return;const s=Fs(n,"title")??e.title,i=n?XO(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function D4(e){const[t="",n=""]=e.toLowerCase().split(":",2);return W9(t)?!0:t!=="selected"?!1:W9(n.trim())}function W9(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 XO(e){return Ks(e.rawInput)??Ks(e.input)??Ks(e.args)}function X_e(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=Ks(t);return(r==null?void 0:r.status)==="background"}function Q_e(e){return Z_e(e)&&e.status==="failed"?e3e(e)??e.details??e.rawOutput:!t3e(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 J_e(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=Ks(n);if(!r)return[];const s=r.type;if(s==="content"){const i=Ks(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 a=r.path,o=r.oldText;return[{type:"diff",...typeof a=="string"?{path:a}:{},...typeof o=="string"?{oldText:o}:{},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 Z_e(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function e3e(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 t3e(e){return e==="cancelled"||e==="canceled"}const n3e=['"insight_progress":','"insight_ready":','"insight_error":'];function r3e(e){try{const t=JSON.parse(e),n=Ks(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=Ks(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=Ks(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function s3e(e,t){if(e[t]!=="{")return null;let n=0,r=!1,s=!1;for(let i=t;i<e.length;i++){const a=e[i];if(s){s=!1;continue}if(a==="\\"&&r){s=!0;continue}if(a==='"'){r=!r;continue}if(!r){if(a==="{")n++;else if(a==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function i3e(e){const t=[];let n=0,r=0,s=!1;for(;r<e.length;){const a=e.indexOf("{",r);if(a===-1)break;const o=e.slice(a+1).trimStart();if(!n3e.some(f=>o.startsWith(f))){r=a+1;continue}const c=s3e(e,a);if(!c){r=a+1;continue}const u=r3e(c);if(!u){r=a+1;continue}s=!0;const d=e.slice(n,a).trim();d&&t.push({kind:"text",text:d}),t.push({kind:"insight",data:u}),n=a+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 QO(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 a3e(e){const t=ty();return b.useMemo(()=>P_e(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n})}}),[t,e])}function G9(e){const[t,n]=b.useState(null);return b.useEffect(()=>{const r=s=>{const i=s.detail;if(!(i!=null&&i.id)&&(i==null?void 0:i.active)===!1){n(null);return}i!=null&&i.id&&(i.active?n(i.id):n(a=>a===i.id?null:a))};return window.addEventListener(e,r),()=>window.removeEventListener(e,r)},[e]),t!==null}function o3e(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,a)=>i===t[a]);const n=Object.keys(e),r=t,s=e;return n.length!==Object.keys(r).length?!1:n.every(i=>{const a=s[i],o=r[i];return a===o?!0:Array.isArray(a)&&Array.isArray(o)?a.length===o.length&&a.every((l,c)=>l===o[c]):!1})}function l3e(e){const t=b.useRef(e);return o3e(t.current,e)||(t.current=e),t.current}function c3e(e,t){const n=b.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 Ir={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"},K9=1024,u3e=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${K9}}\S\$)([^$\n]{1,${K9}})\$(?![\w$])`,"g");function d3e(e){var c,u,d;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=new Map;let i=null,a=null,o=null,l=[];for(const f of n){const m=f.match(r);if(!i){if(m){if(i=m[1]??null,a=((u=(c=m[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:u.toLowerCase())||null,a){const p=(s.get(a)??0)+1;s.set(a,p),o=p}else o=null;l=[]}continue}if(m&&((d=m[1])!=null&&d.startsWith(i[0]??""))&&m[1].length>=i.length){t.push({lang:a,content:l.join(`
`),index:t.length+1,langIndex:o}),i=null,a=null,o=null,l=[];continue}l.push(f)}return t}function h3e(e){var l;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,a=!1,o=[];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(!a){if(u){i=u[1]??null;continue}s.test(c)&&(a=!0,o=[]);continue}if(s.test(c)){t.push({content:o.join(`
`),index:t.length+1}),a=!1,o=[];continue}o.push(c)}return t}function f3e(e){var o;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,a=!1;for(const l of n){const c=l.match(r);if(i){c&&((o=c[1])!=null&&o.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(a){s.test(l)&&(a=!1);continue}if(c){i=c[1]??null;continue}if(s.test(l)){a=!0;continue}for(const u of l.matchAll(u3e)){const d=u[1];d&&t.push({content:d,index:t.length+1})}}return t}function Y9(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function m3e(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=d3e(e);if(s.length===0)return null;let i=null,a=null;const o=r==="code"?n.slice(1):n.map(d=>d);r!=="code"&&(i=r);for(const d of o)/^\d+$/.test(d)?a=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(a!==null){const d=i?l.find(f=>f.langIndex===a):s.find(f=>f.index===a);return d?{content:d.content,label:Y9(d,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:Y9(c,i)}:null}function X9(e,t){const n=f3e(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 p3e(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 X9(e,n.slice(1));const s=n.slice(1),i=s.findIndex(u=>u.toLowerCase()==="inline");if(i!==-1)return X9(e,s.filter((u,d)=>d!==i));const a=h3e(e);if(a.length===0)return null;let o=null;for(const u of s)/^\d+$/.test(u)&&(o=Number(u));const l=o!==null?a.find(u=>u.index===o):a[a.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function g3e(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 y3e(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 b3e(e,t,n=y3e){const r=g3e(e);if(r===null)return{status:"info",message:Ir.NO_OUTPUT};if(!r)return{status:"info",message:Ir.NO_TEXT};try{const s=p3e(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Ir.INLINE_LATEX_MISSING:Ir.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${Ir.COPIED_SUFFIX}`};const i=m3e(r,t);if(i===null)return{status:"info",message:Ir.CODE_MISSING};const a=(i==null?void 0:i.content)??r;return await n(a),{status:"info",message:i?`${i.label}${Ir.COPIED_SUFFIX}`:Ir.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${Ir.CLIPBOARD_PREFIX}${i}`}}}function Q9(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}const v3e="_layout_1drq9_1",x3e="_muted_1drq9_8",w3e="_notice_1drq9_13",_3e="_list_1drq9_20",k3e="_group_1drq9_26",S3e="_groupTitle_1drq9_33",T3e="_server_1drq9_39",C3e="_serverCard_1drq9_44",A3e="_serverCardExpanded_1drq9_50",E3e="_row_1drq9_55",M3e="_expandedRow_1drq9_72",N3e="_serverRow_1drq9_76",I3e="_rowMain_1drq9_81",R3e="_rowIcon_1drq9_96",j3e="_chevronCell_1drq9_125",D3e="_toolRow_1drq9_135",O3e="_chevron_1drq9_125",L3e="_chevronExpanded_1drq9_150",B3e="_disabled_1drq9_154",z3e="_name_1drq9_158",$3e="_serverName_1drq9_166",P3e="_status_1drq9_170",q3e="_badge_1drq9_171",U3e="_toolCount_1drq9_185",H3e="_success_1drq9_190",F3e="_warning_1drq9_194",V3e="_error_1drq9_198",W3e="_serverDetail_1drq9_202",G3e="_serverDetailHeader_1drq9_212",K3e="_serverActions_1drq9_217",Y3e="_field_1drq9_224",X3e="_label_1drq9_232",Q3e="_value_1drq9_238",J3e="_button_1drq9_243",Z3e="_message_1drq9_263",e5e="_schema_1drq9_264",t5e="_tools_1drq9_275",n5e="_tool_1drq9_135",r5e="_toolDetail_1drq9_286",s5e="_section_1drq9_296",i5e="_sectionTitle_1drq9_303",a5e="_description_1drq9_309",o5e="_parameter_1drq9_315",l5e="_empty_1drq9_321",c5e="_emptyTools_1drq9_322",et={layout:v3e,muted:x3e,notice:w3e,list:_3e,group:k3e,groupTitle:S3e,server:T3e,serverCard:C3e,serverCardExpanded:A3e,row:E3e,expandedRow:M3e,serverRow:N3e,rowMain:I3e,rowIcon:R3e,chevronCell:j3e,toolRow:D3e,chevron:O3e,chevronExpanded:L3e,disabled:B3e,name:z3e,serverName:$3e,status:P3e,badge:q3e,toolCount:U3e,success:H3e,warning:F3e,error:V3e,serverDetail:W3e,serverDetailHeader:G3e,serverActions:K3e,field:Y3e,label:X3e,value:Q3e,button:J3e,message:Z3e,schema:e5e,tools:t5e,tool:n5e,toolDetail:r5e,section:s5e,sectionTitle:i5e,description:a5e,parameter:o5e,empty:l5e,emptyTools:c5e};function J9(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 u5e(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:et.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:et.success};case"connecting":return{text:t("mcp.status.starting"),className:et.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:et.error}}}function d5e(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function O4(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function h5e(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 f5e(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 Z9(e,t){return`${e}:${t}`}const L4=$5;function eC({expanded:e}){return h.jsx("svg",{className:`${et.chevron} ${e?et.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 m5e(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 p5e({tool:e,t}){const n=h5e(e);if(!n)return h.jsx("div",{className:et.muted,children:t("mcp.noSchema")});const r=n.properties,s=Array.isArray(n.required)?new Set(n.required.filter(a=>typeof a=="string")):new Set;if(!r||typeof r!="object")return h.jsx("pre",{className:et.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:et.section,children:[h.jsx("div",{className:et.sectionTitle,children:t("mcp.parameters")}),i.map(([a,o])=>{const l=o&&typeof o=="object"?o:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:et.parameter,children:`- ${a}${s.has(a)?t("mcp.required"):""}: ${c}${u?` - ${u}`:""}`},a)})]})}function g5e({label:e,value:t}){return h.jsxs("div",{className:et.field,children:[h.jsx("span",{className:et.label,children:e}),h.jsx("span",{className:et.value,children:t})]})}function y5e({tool:e,t}){const n=f5e(e,t);return h.jsxs("div",{className:et.toolDetail,children:[e.isValid?null:h.jsxs("div",{className:et.section,children:[h.jsx("div",{className:`${et.sectionTitle} ${et.error}`,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{className:et.muted,children:[L4(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:et.muted,children:t("mcp.invalidToolHelp")})]}),e.description?h.jsxs("div",{className:et.section,children:[h.jsx("div",{className:et.sectionTitle,children:L4(t("mcp.description"))}),h.jsx("div",{className:et.description,children:e.description.trim()})]}):h.jsx("div",{className:et.muted,children:t("mcp.noDescription")}),n?h.jsx(g5e,{label:L4(t("mcp.annotations")),value:n}):null,h.jsx(p5e,{tool:e,t})]})}function b5e({message:e}){const{t}=nt(),n=zM({autoLoad:!1}),[r,s]=b.useState(e.status),[i,a]=b.useState(e.toolsByServer),o=b.useMemo(()=>r.servers??[],[r.servers]),[l,c]=b.useState(new Set),[u,d]=b.useState(new Set),[f,m]=b.useState(null),[p,y]=b.useState(null);b.useEffect(()=>{c(T=>{const C=new Set(o.map(j=>j.name));return new Set([...T].filter(j=>C.has(j)))})},[o]);const w=o.filter(T=>!T.disabled&&T.mcpStatus==="connecting").length,v=b.useMemo(()=>{var C;const T=[];for(const j of o){const z=d5e(j,t),E={server:j,tools:((C=i[j.name])==null?void 0:C.tools)??[]},P=T.find(D=>D.label===z);P?P.items.push(E):T.push({label:z,items:[E]})}return T},[o,t,i]),g=b.useCallback(async T=>{var E;const C=await n.reload();if(!C)return;s(C);const j=(E=C.servers)==null?void 0:E.find(P=>P.name===T);if(!j)return;const z=await n.loadTools(j.name);a(P=>({...P,[j.name]:z}))},[n]),x=b.useCallback(async(T,C)=>{if(!p){c(new Set([T.name])),y(T.name),m({serverName:T.name,text:C.id==="authenticate"?O4(T.name,t):t("mcp.action.running",{action:C.label})});try{let j=null;if(C.id==="reconnect")await n.restartServer(T.name);else{const z=await n.manageServer(T.name,C.id),E=[...z.messages??[],...z.authUrl?[z.authUrl]:[]].join(`
`);E&&(j=C.id==="authenticate"?O4(T.name,t,E):E)}await g(T.name),m({serverName:T.name,text:j??t("mcp.action.done",{action:C.label})})}catch(j){m({serverName:T.name,text:C.id==="authenticate"?O4(T.name,t,J9(j)):t("mcp.action.failed",{error:J9(j)})})}finally{y(null)}}},[p,n,g,t]),k=b.useCallback(T=>{c(C=>C.has(T)?new Set:new Set([T])),d(new Set)},[]),A=b.useCallback((T,C)=>{const j=Z9(T,C);d(z=>z.has(j)?new Set:new Set([j]))},[]);return h.jsxs("div",{className:et.layout,"data-keyboard-scope":!0,children:[w>0?h.jsxs("div",{className:et.notice,children:[t("mcp.starting",{count:w}),h.jsx("div",{className:et.muted,children:t("mcp.startingNote")})]}):null,o.length===0?h.jsx("div",{className:et.empty,children:t("mcp.empty")}):h.jsx("div",{className:et.list,children:v.map(T=>h.jsxs("div",{className:et.group,children:[T.label!==t("mcp.extensionMcp")?h.jsx("div",{className:et.groupTitle,children:T.label}):null,T.items.map(({server:C,tools:j})=>{var H;const z=u5e(C,t),E=l.has(C.name),P=m5e(C,t),D=((H=i[C.name])==null?void 0:H.tools.length)??0;return h.jsx("div",{className:et.server,children:h.jsxs("div",{className:`${et.serverCard} ${E?et.serverCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${et.row} ${et.serverRow} ${E?et.expandedRow:""}`,onClick:()=>k(C.name),"aria-label":t(E?"mcp.collapse":"mcp.expand"),children:[h.jsxs("span",{className:et.rowMain,children:[h.jsx("span",{className:et.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${et.name} ${et.serverName}`,children:C.name})]}),h.jsx("span",{className:`${et.status} ${z.className}`,children:z.text}),h.jsx("span",{className:`${et.badge} ${et.toolCount}`,children:t(D===1?"mcp.toolCount":"mcp.toolsCount",{count:D})}),h.jsx("span",{className:et.chevronCell,"aria-hidden":"true",children:h.jsx(eC,{expanded:E})})]}),E?h.jsxs("div",{className:et.serverDetail,children:[P.length>0?h.jsx("div",{className:et.serverDetailHeader,children:h.jsx("div",{className:et.serverActions,children:P.map(W=>h.jsx("button",{type:"button",className:et.button,onClick:()=>void x(C,W),disabled:p!==null,children:W.label},W.id))})}):null,(f==null?void 0:f.serverName)===C.name?h.jsx("pre",{className:et.message,children:f.text}):null,j.length===0?h.jsx("div",{className:et.emptyTools,children:t("mcp.emptyTools")}):h.jsx("div",{className:et.tools,children:j.map(W=>{const J=Z9(C.name,W.name),Y=u.has(J);return h.jsxs("div",{className:et.tool,children:[h.jsxs("button",{type:"button",className:`${et.row} ${et.toolRow} ${Y?et.expandedRow:""} ${W.isValid?"":et.disabled}`,onClick:()=>A(C.name,W.name),children:[h.jsx("span",{className:et.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:et.name,children:W.name}),h.jsx(eC,{expanded:Y})]}),Y?h.jsx(y5e,{tool:W,t}):null]},W.name)})})]}):null]})},C.name)})]},T.label))})]})}const v5e="_app_1oztp_1",x5e="_appChat_1oztp_24",w5e="_appChatEmpty_1oztp_30",_5e="_themeDark_1oztp_40",k5e="_themeLight_1oztp_84",S5e="_content_1oztp_128",T5e="_contentHasMessages_1oztp_136",C5e="_footer_1oztp_145",A5e="_footerHidden_1oztp_155",E5e="_bottomPanels_1oztp_159",M5e="_approvalOverlay_1oztp_174",N5e="_scrollToBottomLayer_1oztp_183",I5e="_scrollToBottomLayerWithTodos_1oztp_194",R5e="_scrollToBottomButton_1oztp_198",j5e="_scrollToBottomIcon_1oztp_231",D5e="_btwPanel_1oztp_237",O5e="_composer_1oztp_244",L5e="_emptyWelcomeFooter_1oztp_249",B5e="_queuedPrompts_1oztp_253",z5e="_queuedPrompt_1oztp_253",$5e="_queuedPromptText_1oztp_272",P5e="_queuedPromptActions_1oztp_280",q5e="_queuedPromptAction_1oztp_280",U5e="_queuedHint_1oztp_310",bn={app:v5e,appChat:x5e,appChatEmpty:w5e,themeDark:_5e,themeLight:k5e,content:S5e,contentHasMessages:T5e,footer:C5e,footerHidden:A5e,bottomPanels:E5e,approvalOverlay:M5e,scrollToBottomLayer:N5e,scrollToBottomLayerWithTodos:I5e,scrollToBottomButton:R5e,scrollToBottomIcon:j5e,btwPanel:D5e,composer:O5e,emptyWelcomeFooter:L5e,queuedPrompts:B5e,queuedPrompt:z5e,queuedPromptText:$5e,queuedPromptActions:P5e,queuedPromptAction:q5e,queuedHint:U5e},Mh=b.createContext(!1),P5=b.createContext(new Map),JO=b.createContext(new Map);function H5e({timeline:e,details:t,children:n}){return h.jsx(P5.Provider,{value:e,children:h.jsx(JO.Provider,{value:t,children:n})})}const Tp=J1,tC=240,F5e="ui.compactMode",V5e="ui.hideTips",W5e=new Set(["coder-model(qwen-oauth)"]);function nC(e){return!W5e.has(e.id)}function B4(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const ZO=new Set(["clear","stop","off","reset","none","cancel"]);function G5e(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return ZO.has(t)}function K5e(e){const t=e;return t.source!=="goal"?null:d1(t.data)??d1(t.text)}function Y5e(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=K5e(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const rC={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},eL="qwen-code-web-shell-chat-width",X5e=1e3,Q5e=40;function J5e(){if(typeof window>"u")return"1000";try{return window.localStorage.getItem(eL)==="wide"?"wide":"1000"}catch{return"1000"}}function Z5e(e){try{window.localStorage.setItem(eL,e)}catch{}}function tL(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:X5e}function eke(e,t){const n=`${tL(t)}px`,r=`calc(${n} + ${Q5e}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 sC(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function tke(e){if(typeof window>"u")return;const t=new URL(window.location.href);t.pathname=`/session/${encodeURIComponent(e)}`,t.searchParams.delete("token"),t.searchParams.delete("daemon"),window.history.replaceState(null,"",t)}function nke(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Wl(e.get("language")??e.get("lang")??navigator.language)}function rke(e,t){return e instanceof Error?e.message:t}function z4(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Xu(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function ske(e){e.length>0&&console.info("[web-shell] useSessionNotices()",{notices:e})}function ike(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function ake(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function $4(e){return typeof e=="object"&&e!==null}function oke(e){const t=e.trim();return t.startsWith("USE_")?t.slice(4).toLowerCase().replace(/_/g,"-"):t.toLowerCase()}function lke(e){if(!$4(e))return null;const t=e._meta;if(!$4(t))return null;const n=t.qwenModelSwitch;if(!$4(n))return null;const r=n.authType,s=n.modelId,i=n.baseUrl,a=n.apiKey;return typeof r!="string"||typeof s!="string"||typeof i!="string"||typeof a!="string"?null:{authType:r,modelId:s,baseUrl:i,apiKey:a,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function cke(e){return`● authType: ${oke(e.authType)}
  Using ${e.isRuntime?"runtime ":""}model: ${e.modelId}
  Base URL: ${e.baseUrl}
  API key: ${e.apiKey}`}function uke(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function dke(e){var n;if(!e.startsWith("● authType:"))return null;const t=e.match(/\n {2}Using (?:runtime )?model: ([^\n]+)/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())||null}function iC(e){const t=new Set;for(const n of e){if(n.role!=="system"||n.variant!=="info")continue;const r=dke(n.content);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=uke(n.content);return!r||!t.has(r)})}function hke(e){return e.some(t=>t.role==="system"&&t.variant==="info"&&rj(t.content)!==null)}function aC(e){return J1.includes(e)}function fke(e){return e.toolKind==="edit"}function mke(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Lu(e.toolName):!0}function pke(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 gke(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 yke(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)(UM(r)||gke(r))&&t.push(`${r.callId}:${r.status}`);return t.join("|")}function bke(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 vke(e,t){return e===Ir.NO_OUTPUT?t("copy.noOutput"):e===Ir.NO_TEXT?t("copy.noText"):e===Ir.CODE_MISSING?t("copy.codeMissing"):e===Ir.LATEX_MISSING?t("copy.latexMissing"):e===Ir.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Ir.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Ir.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Ir.CLIPBOARD_PREFIX.length)}`:e.endsWith(Ir.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Ir.COPIED_SUFFIX.length)}):e}function xke({prompts:e,t,onDelete:n,onInsert:r,onEditLast:s}){var a;if(e.length===0)return null;const i=(a=e[e.length-1])==null?void 0:a.id;return h.jsxs("div",{className:bn.queuedPrompts,children:[e.map(o=>{var d;const l=o.text.replace(/\s+/g," ").trim(),c=l.length>tC?`${l.slice(0,tC)}...`:l,u=((d=o.images)==null?void 0:d.length)??0;return h.jsxs("div",{className:bn.queuedPrompt,children:[h.jsxs("span",{className:bn.queuedPromptText,children:[c,u>0?` ${t("queue.imageCount",{count:u})}`:""]}),h.jsxs("span",{className:bn.queuedPromptActions,children:[h.jsxs("button",{type:"button",className:bn.queuedPromptAction,onClick:()=>n(o.id),children:[h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M3.5 4.5h9M6.5 2.5h3M5 4.5l.5 8h5l.5-8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),t("queue.delete")]}),u===0&&h.jsxs("button",{type:"button",className:bn.queuedPromptAction,onClick:()=>r(o.id),children:[h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M8 3.5v7M4.5 7 8 10.5 11.5 7M3.5 12.5h9",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),t("queue.insert")]}),o.id===i&&h.jsxs("button",{type:"button",className:bn.queuedPromptAction,onClick:s,children:[h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M3.5 11.5 4 9l6.7-6.7a1.1 1.1 0 0 1 1.6 0l1.4 1.4a1.1 1.1 0 0 1 0 1.6L7 12l-2.5.5h-1z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),t("queue.edit")]})]})]},o.id)}),h.jsx("div",{className:bn.queuedHint,children:t("queue.footer")})]})}function wke({onSessionIdChange:e,theme:t,onThemeChange:n,language:r,onLanguageChange:s,className:i,style:a,onConnectionChange:o,onStreamingStateChange:l,onError:c,onBugReport:u,hiddenSlashCommands:d,slashCommandCategoryOrder:f,renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:w,renderComposerToolbarEnd:v,renderFooter:g,chatMaxWidth:x,composerToolbarActions:k,compactThinking:A=!1,collapseCompletedTurns:T=!0,virtualScrollThreshold:C,markdown:j,onTranscriptChange:z,onToast:E,composerRef:P,onComposerReady:D,composerInput:H,composerInputVersion:W}={}){var ok;const[J,Y]=b.useState(J5e),[Z,Q]=b.useState(()=>r===void 0?nke():Wl(r)),L=b.useMemo(()=>VM(Z),[Z]),R=b.useMemo(()=>({renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:w,renderComposerToolbarEnd:v,renderFooter:g,compactThinking:A,collapseCompletedTurns:T,markdown:j}),[m,p,y,w,v,g,A,T,j]),$=g,I=X_(),M=ty(),G=Iu(),ne=J_(),{notices:fe,dismissNotice:Pe}=kU(),oe=fc(),Xe=b.useRef(E);Xe.current=E;const ht=b.useRef(0),[At,zt]=b.useState([]),Vt=b.useCallback(O=>{zt(V=>V.filter(ie=>ie.id!==O))},[]),gt=b.useCallback((O,V)=>{if(Xe.current){Xe.current(O,V);return}const ie={id:`web-shell-toast-${Date.now()}-${++ht.current}`,tone:O,message:V};zt(Ue=>[...Ue.filter(ze=>ze.tone!==O||ze.message!==V),ie].slice(-4))},[]),Le=a3e(L),qt=b.useRef(Le);qt.current=Le;const[tn,Mt]=b.useState(null),[Kt,$t]=b.useState(null),gn=b.useRef(1),Xt=b.useRef(1),Be=b.useRef(null),Qe=b.useRef(null),st=b.useRef(G.sessionId),te=b.useMemo(()=>{const O=[tn].filter(ie=>ie!==null);if(O.length===0)return iC(Le);const V=[...Le];for(const ie of O.sort((Ue,Ge)=>Ue.anchorIndex-Ge.anchorIndex)){const Ue=ie.anchorAfterId?V.findIndex(ze=>ze.id===ie.anchorAfterId):-1,Ge=Ue>=0?Ue+1:Math.min(ie.anchorIndex,V.length);V.splice(Ge,0,ie.message)}return iC(V)},[Le,tn]),ue=b.useMemo(()=>hke(te),[te]);b.useEffect(()=>{ue||window.dispatchEvent(new CustomEvent(k0,{detail:{active:!1}}))},[ue]);const re=N_e(M),ae=b.useMemo(()=>BU(re),[re]),pe=l3e(ae),wt=mke(pe)?pe:null,Je=pe&&!wt?pe:null,_t=b.useRef(pe);_t.current=pe;const fn=b.useMemo(()=>_le(Le),[Le]),Vn=b.useRef(null),de=b.useMemo(()=>{const O=Sle(Le),V=Vn.current;if(V&&V.signature===O)return V.timeline;const ie=kle(Le);return Vn.current={signature:O,timeline:ie},ie},[Le]),je=b.useRef(null),Te=b.useMemo(()=>{const O=Tle(Le),V=je.current;if(V&&V.signature===O)return V.details;const ie=Ile(Le);return je.current={signature:O,details:ie},ie},[Le]),Nt=c3e(fn.todos,O=>`${O.id}:${O.status}:${O.content}`),An=fn.allCompleted,[Tr,Ee]=b.useState("hidden"),it=G.catchingUp||Nt.length===0?"hidden":An?Tr==="hidden"?"hidden":"completed":"active";it!==Tr&&Ee(it);const bt=it!=="hidden",Is=b.useMemo(()=>yke(Le),[Le]),[ei,bc]=b.useState(0),pa=j_e(Is,G.status==="connected",ei),Xo=b.useMemo(()=>g?pa.map(bke):[],[pa,g]),Qo=b.useRef(null),to=b.useRef(null),_n=b.useRef(null),Rs=b.useRef(null),js=b.useRef(null),[Ds,Ln]=b.useState(!1),ft=b.useRef(null),ss=b.useRef(!1),Bn=b.useCallback((O="smooth")=>{Ln(!1),requestAnimationFrame(()=>{var V;(V=to.current)==null||V.scrollToBottom(O),requestAnimationFrame(()=>{var ie;(ie=to.current)==null||ie.scrollToBottom(O)})})},[]),Jo=b.useCallback(O=>{_n.current=O,sC(P,O??rC),O&&Rs.current!==O&&(Rs.current=O,D==null||D(O))},[P,D]);b.useEffect(()=>{sC(P,_n.current??rC)},[P]);const[Zo,Ji]=b.useState(null),el=b.useRef(null);el.current=Zo;const{followupState:vc,onAcceptFollowup:ga,onDismissFollowup:Si,clear:tl}=OU({onAccept:O=>{var V;(V=_n.current)==null||V.insertText(O)}}),nn=b.useCallback((O,V,ie)=>{tl();const Ue=!O.trimStart().startsWith("/");!(ie!=null&&ie.retry)&&Ue&&(ti.current=O,no.current=V,Os.current=null),rl(!1);const Ge={images:V,optimisticUserMessage:ie==null?void 0:ie.optimisticUserMessage,retry:ie==null?void 0:ie.retry};return ne.sendPrompt(O,Ge)},[tl,ne]),an=Q_(),Zi=b.useRef(an),nl=b.useRef(Date.now()),xc=b.useRef(an);xc.current==="idle"&&an!=="idle"&&(nl.current=Date.now()),xc.current=an;const wc=b.useMemo(()=>{if(an!=="idle"){for(let O=te.length-1;O>=0;O--){const V=te[O];if((V==null?void 0:V.role)==="user")return V.timestamp??nl.current}return nl.current}},[te,an]),ti=b.useRef(""),no=b.useRef(void 0),ni=b.useRef(null),Os=b.useRef(null),[ri,rl]=b.useState(!1),sl=b.useRef(ri);sl.current=ri;const tr=G.status==="connected",[ro,rt]=b.useState([]);b.useEffect(()=>{tr&&oe.loadSkillsStatus().then(O=>{rt(((O==null?void 0:O.skills)??[]).map(V=>({name:V.name,description:V.description??""})).sort((V,ie)=>V.name.localeCompare(ie.name)))}).catch(()=>{})},[tr,oe]);const[on,mr]=b.useState(null),[K,ee]=b.useState([]),[ye,_e]=b.useState(!1),[kt,at]=b.useState(!1),[ot,ut]=b.useState(!1),[jn,kn]=b.useState(!1),[ea,so]=b.useState(!1),[il,Nh]=b.useState(!1),[ya,Ih]=b.useState(!1),[_c,Rh]=b.useState(!1),[me,lt]=b.useState(!1),[yt,Et]=b.useState(null),[Ot,Bt]=b.useState(!1),[mn,Qn]=b.useState(!1),[Wr,Ti]=b.useState(!1),[kc,$u]=b.useState(0),[dm,Vy]=b.useState(0),Cr=Nu(),hm=b.useRef((Cr==null?void 0:Cr.extensionsVersion)??0);b.useEffect(()=>{const O=(Cr==null?void 0:Cr.extensionsVersion)??0;if(O!==hm.current){hm.current=O;const V=Cr==null?void 0:Cr.lastExtensionChange;if((V==null?void 0:V.status)==="failed"){I.dispatch([{type:"error",text:L("extensions.action.failed",{name:V.name??"",source:V.source??"",error:V.error??L("error.unknown")})}]);return}if((V==null?void 0:V.status)==="installed"){const ie=V.name??V.source??L("extensions.label");I.dispatch([{type:"status",text:V.version?L("extensions.install.installedWithVersion",{name:ie,version:V.version}):L("extensions.install.installed",{name:ie})}])}else if(V!=null&&V.status){const ie=V.name??V.source??L("extensions.label"),Ue=V.status==="updated"&&V.version?"extensions.manage.updatedWithVersion":`extensions.manage.${V.status}`;I.dispatch([{type:"status",text:L(Ue,{name:ie,version:V.version??""})}])}ne.refreshCommands().catch(()=>{I.dispatch([{type:"error",text:L("extensions.commands.refreshFailed")}])})}},[Cr==null?void 0:Cr.extensionsVersion,Cr==null?void 0:Cr.lastExtensionChange,ne,I,L]);const[Wy,iL]=b.useState("workspace"),[jh,Gy]=b.useState(null),[aL,Ky]=b.useState(!1),Dh=b.useRef(0),io=b.useRef(null),[Yy,fm]=b.useState(null),oL=G9(k0),lL=G9(th),[Xy,Qy]=b.useState(t??us.Dark),[Pu,Jy]=b.useState(""),q5=b.useRef(Pu);q5.current=Pu;const mm=b.useRef(G);mm.current=G;const cL=G.displayName,[al,Zy]=b.useState("default"),[Sc,ol]=b.useState([]),uL=b.useMemo(()=>Sc.map(O=>O.text),[Sc]),dL=b.useMemo(()=>(G.models??[]).filter(nC).map(O=>({id:O.id,label:O.label})),[G.models]),or=b.useRef([]),hL=b.useRef(1),pm=b.useRef(!1),fL=kt||ot||jn||ea||il||ya||_c||me||on!==null||ye||Yy!==null||yt!==null||jh!==null||Ot||mn||Wr,U5=oL||lL,Ci=fL||U5,Ze=b.useCallback((O,V)=>{if(z4(O))return;if(uM(O)){console.debug("[web-shell] turn error rendered in transcript",O);return}if(Xu(O)){console.debug("[web-shell] error already handled by notice",O);return}const ie=rke(O,V);console.error("[web-shell]",ie,O),gt("error",ie)},[gt]);b.useEffect(()=>{ske(fe);for(const O of fe)ike(O)?gt(ake(O),O.message):O.category==="lifecycle"?console.debug("[web-shell] daemon notice",O):console.warn("[web-shell] daemon notice",O),Pe(O.id)},[Pe,fe,gt]);const eb=b.useRef(u);eb.current=u,b.useEffect(()=>{var O;st.current=G.sessionId,(O=Be.current)==null||O.abort(),Be.current=null,Mt(null),$t(null),fm(null),bm.current=0},[G.sessionId]);const H5=b.useCallback(()=>{var Ge;const O=`local-recap-${gn.current++}`,V=Le.length,ie=(Ge=Le.at(-1))==null?void 0:Ge.id,Ue=G.sessionId;Mt({anchorAfterId:ie,anchorIndex:V,message:{id:O,role:"system",content:`※ recap: ${L("recap.loading")}`,variant:"info"}}),ne.recapSession().then(ze=>{st.current===Ue&&Mt({anchorAfterId:ie,anchorIndex:V,message:{id:O,role:"system",content:ze.recap?`※ recap: ${ze.recap}`:L("recap.empty"),variant:"info"}})},ze=>{st.current===Ue&&(Mt(null),!z4(ze)&&!Xu(ze)&&console.warn("[web-shell] unhandled recap failure",ze))})},[G.sessionId,Le,ne,L]),F5=b.useCallback(O=>{var ze;const V=O.trim();if(!V){gt("error",L("btw.empty"));return}const ie=`local-btw-${Xt.current++}`,Ue=G.sessionId;(ze=Be.current)==null||ze.abort();const Ge=new AbortController;Be.current=Ge,$t({id:ie,role:"btw",question:V,answer:"",isPending:!0}),ne.btwSession(V,{signal:Ge.signal}).then(xe=>{st.current===Ue&&Be.current===Ge&&(Be.current=null,$t({id:ie,role:"btw",question:V,answer:xe.answer||L("btw.emptyAnswer"),isPending:!1}))},xe=>{st.current===Ue&&Be.current===Ge&&(Be.current=null,$t(null),!z4(xe)&&!Xu(xe)&&console.warn("[web-shell] unhandled btw failure",xe))})},[G.sessionId,gt,ne,L]),V5=b.useCallback(()=>{var O;(O=Be.current)==null||O.abort(),Be.current=null,$t(null)},[]);b.useEffect(()=>{const O=V=>{var xe;if(Ci||pe)return;const ie=Kt;if(!ie||ie.role!=="btw")return;const Ue=V.key.toLowerCase(),Ge=V.key==="Escape"&&!V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey,ze=V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey&&(Ue==="c"||Ue==="d");if(ie.isPending){if(!Ge&&!ze)return}else{const be=((xe=_n.current)==null?void 0:xe.hasInput())??!1;if(!(!V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey&&(V.key==="Escape"||!be&&(V.key==="Enter"||V.key===" "))))return}V.preventDefault(),V.stopPropagation(),V5()};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[Ci,Kt,V5,pe]),b.useEffect(()=>{or.current=Sc},[Sc]);const Ar=b.useCallback((O,V,ie)=>{const Ue=O.trim();if(!Ue)return!0;const Ge={id:hL.current++,text:Ue,images:V?[...V]:void 0,onComplete:ie};return or.current=[...or.current,Ge],ol(or.current),!0},[]);b.useEffect(()=>{if(an!=="idle")return;const O=Qe.current;O&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),O.abort(),Qe.current=null)},[an]);const W5=b.useCallback(()=>{const[O,...V]=or.current;return O?(or.current=V,ol(V),O):null},[]),tb=b.useCallback(()=>{const O=or.current;if(O.length===0)return null;const V=O.slice(0,-1),ie=O[O.length-1];return or.current=V,ol(V),(ie==null?void 0:ie.text)??null},[]),mL=b.useCallback(O=>{const V=or.current.filter(ie=>ie.id!==O);V.length!==or.current.length&&(or.current=V,ol(V))},[]),pL=b.useCallback(async O=>{var ze;const V=or.current.find(xe=>xe.id===O);if(!V||(((ze=V.images)==null?void 0:ze.length)??0)>0)return;let ie=Qe.current;ie||(ie=new AbortController,Qe.current=ie);let Ue;try{Ue=await ne.enqueueMidTurnMessage(V.text,{signal:ie.signal})}catch(xe){Ze(xe,L("queue.insertFailed"));return}if(!Ue.accepted)return;const Ge=or.current.filter(xe=>xe.id!==O);or.current=Ge,ol(Ge)},[Ze,ne,L]),gL=b.useCallback(()=>{var Ue,Ge,ze;const O=tb();if(!O)return;const V=((Ue=_n.current)==null?void 0:Ue.getText())??"",ie=V.trim()?`${O}
${V}`:O;(Ge=_n.current)==null||Ge.setText(ie),(ze=_n.current)==null||ze.focus()},[tb]),nb=b.useCallback(()=>or.current.length===0?!1:(or.current=[],ol([]),I.dispatch([{type:"status",text:L("queue.cleared")}]),!0),[I,L]),{batches:Oh,consume:G5}=LU();b.useEffect(()=>{const O=G.sessionId;if(!O||Oh.length===0)return;G.clientId===void 0&&Oh.some(ie=>ie.sessionId===O&&ie.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const V=qU(or.current,Oh,O,G.clientId);V&&(or.current=V,ol(V)),G5(Oh.filter(ie=>ie.sessionId===O))},[Oh,G.sessionId,G.clientId,G5]);const gm=b.useCallback(O=>{Qy(O),n==null||n(O)},[n]),Lh=b.useCallback(O=>{Q(O),s==null||s(O)},[s]),K5=b.useCallback(()=>{Nh(!0)},[]),Y5=IU({autoLoad:!0}),{settings:Bh,setValue:X5,reload:Q5}=Y5,qu=Bh.find(O=>O.key===Fc),Uu=Bh.find(O=>O.key===V5e),Hu=Bh.find(O=>O.key===$f),yL=(()=>{var V;const O=(V=Bh.find(ie=>ie.key==="voiceModel"))==null?void 0:V.values.effective;return typeof O=="string"&&O.trim()?O.trim():void 0})(),bL=dce(Bh),[rb,J5]=b.useState(!1),sb=b.useRef(rb);sb.current=rb,b.useEffect(()=>{if(t){Qy(t);return}const O=s3(qu==null?void 0:qu.values.effective);O&&Qy(O)},[t,qu==null?void 0:qu.values.effective]),b.useEffect(()=>{if(r!==void 0){Q(Wl(r));return}const O=t3(Hu==null?void 0:Hu.values.effective);O&&Q(O)},[r,Hu==null?void 0:Hu.values.effective]);const vL=b.useCallback(O=>{const V=Z,ie=`/language ui ${O}`;Lh(O);const Ue=()=>Promise.all([ne.refreshCommands(),Q5()]);if(Zi.current!=="idle"){Ar(ie,void 0,Ue);return}nn(ie).then(Ue).catch(Ge=>{Lh(V),Ze(Ge,"Failed to sync /language command")})},[Ar,Lh,Q5,Ze,nn,Z,ne]),Z5=b.useCallback(()=>{if(Zi.current!=="idle"){I.dispatch([{type:"status",text:L("clear.blocked")}]);return}I.reset()},[I,L]),ek=b.useCallback(()=>{const O=sb.current,V=!sb.current;J5(V),X5("workspace",F5e,V).catch(ie=>{J5(O),Ze(ie,L("compact.saveFailed"))})},[Ze,X5,L]),Tc=b.useCallback(O=>{if(!aC(O)){Ze(new Error(`Unsupported approval mode: ${O}`),L("local.approvalMode"));return}ne.setApprovalMode(O).then(V=>{const ie=V.mode||O;Zy(ie);const Ue=_t.current;if(!Ue)return;if(O==="yolo"||O==="auto-edit"&&fke(Ue)){const ze=Ue.options.find(xe=>xe.kind==="allow_once");if(ze){const xe=Ue.title||"";I.dispatch([{type:"status",text:L("mode.autoApproved",{tool:xe})}]),ne.submitPermission(Ue.id,ze.id).catch(be=>{Ze(be,"Failed to auto-approve tool call")})}}}).catch(V=>{Ze(V,L("local.approvalMode"))})},[ne,Ze,I,L]);b.useEffect(()=>{Zi.current=an},[an]),b.useEffect(()=>{let O=null;for(let ie=M.length-1;ie>=0;ie--){const Ue=M[ie];if((Ue==null?void 0:Ue.kind)==="user")break;if((Ue==null?void 0:Ue.kind)==="error"&&Ue.source==="turn_error"){O=Ue.id;break}if((Ue==null?void 0:Ue.kind)!=="debug")break}const V=tr&&O!==null&&O!==Os.current&&ti.current.length>0;ni.current=V?O:null,rl(V)},[M,tr]),b.useEffect(()=>{l==null||l(an)},[an,l]),b.useEffect(()=>{o==null||o(G.status)},[G.status,o]),b.useEffect(()=>{z==null||z(M)},[M,z]),b.useEffect(()=>{if(G.error){const O=new Error(G.error);c==null||c(O)}},[G.error,c]),b.useEffect(()=>{Jy(G.currentModel??"")},[G.currentModel,G.sessionId]),b.useEffect(()=>{Zy(G.currentMode??"default")},[G.currentMode,G.sessionId]),b.useEffect(()=>{G.sessionId&&(Ji(null),e==null||e(G.sessionId),e||tke(G.sessionId))},[G.sessionId,e]),b.useEffect(()=>{const O=Y5e(M);Ji(V=>O?(V==null?void 0:V.condition)===O.condition&&V.setAt===O.setAt?V:O:V&&null)},[M]),b.useEffect(()=>{const O=V=>{const ie=V.detail;if(!(ie!=null&&ie.active)){Ji(null);return}ie.condition&&Ji({condition:ie.condition,setAt:ie.setAt??Date.now()})};return window.addEventListener($x,O),()=>window.removeEventListener($x,O)},[]);const ym=b.useRef(null),bm=b.useRef(0);b.useEffect(()=>{bm.current=0},[G.sessionId]),b.useEffect(()=>{function ie(){if(document.hidden){ym.current===null&&(ym.current=Date.now());return}const Ue=ym.current;if(ym.current=null,Ue===null||Date.now()-Ue<18e4||Zi.current!=="idle"||!G.sessionId)return;const Ge=I.getSnapshot().blocks.length;Ge-bm.current<4||(bm.current=Ge,ne.recapSession().then(ze=>{ze.recap&&I.dispatch([{type:"status",text:`※ recap: ${ze.recap}`}])},ze=>{console.error("[auto-recap] failed:",ze)}))}return document.addEventListener("visibilitychange",ie),()=>document.removeEventListener("visibilitychange",ie)},[G.sessionId,ne,I]);const ib=b.useCallback(()=>{const O=aC(al)?Tp.indexOf(al):-1,V=Tp[(O+1)%Tp.length];Tc(V)},[al,Tc]),zh=b.useCallback((O,V)=>{I.appendLocalUserMessage(O),ne.getContextUsage({detail:V}).then(ie=>{I.dispatch([{type:"status",text:fre(ie)}]),Bn("smooth")}).catch(ie=>{Ze(ie,"Failed to load context usage")})},[I,ne,Ze,Bn]),xL=b.useCallback(()=>{zh("/context detail",!0)},[zh]),vm=b.useCallback(O=>{ne.branchSession(O||void 0).then(V=>{I.dispatch([{type:"status",text:L("branch.success",{name:V.displayName})}])}).catch(V=>{Ze(V,L("branch.failed"))})},[Ze,ne,I,L]),wL=b.useCallback(()=>{vm()},[vm]),ab=b.useCallback(()=>{ne.createSession().then(O=>{if(e){e(O.sessionId);return}return ne.loadSession(O.sessionId)}).catch(O=>{Ze(O,"Failed to create a new session")})},[e,Ze,ne]),ob=b.useCallback(()=>{ne.getTasks().then(O=>{fm({snapshot:O})}).catch(O=>{Ze(O,"Failed to load tasks")})},[Ze,ne]),tk=b.useCallback((O,V)=>{Ji({condition:O,setAt:V}),I.dispatch([{type:"status",text:D7({kind:"set",condition:O,setAt:V})}])},[I]),nk=b.useCallback(O=>{O&&(I.dispatch([{type:"status",text:D7({kind:"cleared",condition:O.condition,durationMs:Date.now()-O.setAt})}]),Ji(null))},[I]),xm=b.useCallback(O=>(I.appendLocalUserMessage(O),ne.clearGoal().catch(V=>{Ze(V,"Failed to clear /goal")}),!0),[Ze,ne,I]),_L=b.useCallback(()=>ne.getRewindSnapshots(),[ne]),kL=b.useCallback(O=>ne.rewindSession(O,{rewindFiles:!1}).then(()=>{}),[ne]),SL=b.useCallback(O=>{if(Xu(O))return;const V=O instanceof Error?O.message:String(O);gt("error",L("rewind.failed",{reason:V}))},[gt,L]),rk=b.useCallback((O,V,ie)=>{const Ue=O.replace(/^\/goal\b/i,"").trim(),Ge=Ue.toLowerCase(),ze=(ie==null?void 0:ie.sendToDaemon)??!0;return Ue&&ZO.has(Ge)?ze?xm(O):(I.appendLocalUserMessage(O),nk(el.current),!0):Ue?(I.appendLocalUserMessage(O),ze?(nn(O,V,{optimisticUserMessage:!1}).catch(xe=>{Ze(xe,"Failed to send /goal command")}),!0):(tk(Ue,Date.now()),!0)):(I.appendLocalUserMessage(O),ze&&nn(O,V,{optimisticUserMessage:!1}).catch(xe=>Ze(xe,"Failed to send /goal command")),!0)},[nk,tk,xm,Ze,nn,I]),$h=b.useMemo(()=>new Set((d??[]).map(B4).filter(Boolean)),[d]),TL=$h.has("settings"),wm=b.useCallback((O,V)=>{var Ue;const ie=Zi.current!=="idle";if(O.startsWith("/")){const Ge=O.match(/^\/([\w-]+)/);if(Ge){const ze=Ge[1];if($h.has(B4(ze)))return ie?Ar(O,V):(nn(O,V).catch(xe=>Ze(xe,"Failed to send hidden slash command")),!0);if(ze==="help")return Nh(!0),!0;if(ze==="tasks")return ob(),!0;if(ze==="goal")return ie?G5e(O)?xm(O):Ar(O,V):rk(O,V);if(ze==="theme"){const xe=O.slice(Ge[0].length).trim().toLowerCase();return xe==="dark"||xe==="light"?gm(xe):xe?gt("error",L("error.unsupportedTheme")):Ih(!0),!0}if(ze==="language"){const xe=O.slice(Ge[0].length).trim(),[be,Qt]=xe.split(/\s+/);if(!xe)return I.dispatch([{type:"status",text:[L("language.current",{language:n3(Z)}),L("language.usage"),L("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((be==null?void 0:be.toLowerCase())==="ui"){if(!Qt)return I.dispatch([{type:"status",text:[L("language.set"),"",L("language.usage"),"",L("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const It=Qt.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(It))return gt("error",L("language.invalid")),!0;const pr=Wl(Qt);return Lh(pr),ie||nn(`/language ui ${pr}`).then(()=>ne.refreshCommands()).catch(Ai=>{Ze(Ai,"Failed to sync /language command")}),!0}}if(ze==="copy"){const xe=O.slice(Ge[0].length).trim();return b3e(qt.current,xe).then(be=>{I.dispatch([{type:be.status==="error"?"error":"status",text:vke(be.message,L)}])}).catch(be=>{Ze(be,L("copy.failedFallback"))}),!0}if(ze==="delete")return ut(!0),!0;if(ze==="release")return kn(!0),!0;if(ze==="rewind")return so(!0),!0;if(ze==="branch"){if(ie)return Ar(O,V);const xe=O.slice(Ge[0].length).trim();return vm(xe||void 0),!0}if(ze==="fork"){if(ie)return Ar(O,V);const xe=O.slice(Ge[0].length).trim();return xe?(ne.forkSession(xe).then(be=>{if(!be.launched){gt("warning",L("fork.notStarted"));return}bc(Qt=>Qt+1),gt("success",L("fork.started",{name:be.description}))}).catch(be=>{const Qt=be instanceof Error?be.message:String(be);Ze(be,L("fork.failed",{reason:Qt}))}),!0):(gt("error",L("fork.empty")),!0)}if(ze==="auth")return Ti(!0),!0;if(ze==="model"){const xe=O.slice(Ge[0].length).trim();return xe==="--fast"?(mr("fast"),!0):xe.startsWith("--fast ")?ie?Ar(O,V):(nn(O,V).catch(be=>Ze(be,"Failed to send /model --fast")),!0):xe==="--voice"?(I.appendLocalUserMessage(O),oe.loadProviders().then(be=>{ee(nhe(be)),mr("voice")}).catch(be=>Ze(be,L("model.setVoice"))),!0):xe.startsWith("--voice ")?ie?Ar(O,V):(nn(O,V).catch(be=>Ze(be,"Failed to send /model --voice")),!0):(xe?ne.setModel(xe).then(()=>{Jy(xe)}).catch(be=>{Ze(be,L("model.switch"))}):mr("main"),!0)}if(ze==="plan"){if(ie)return Ar(O,V);const xe=O.slice(Ge[0].length).trim();return ne.setApprovalMode("plan").then(()=>{Zy("plan"),xe&&nn(xe,V).catch(be=>Ze(be,"Failed to send plan prompt"))}).catch(be=>{Ze(be,L("mode.plan"))}),!0}if(ze==="approval-mode"){const xe=O.slice(Ge[0].length).trim();return xe?Tc(xe):_e(!0),!0}if(ze==="mcp"){const xe=O.slice(Ge[0].length).trim().toLowerCase();return oe.loadMcpStatus().then(async be=>{const Qt={};await Promise.all(((be==null?void 0:be.servers)??[]).map(async It=>{try{Qt[It.name]=await oe.loadMcpTools(It.name)}catch{}})),Et({status:be,toolsByServer:Qt,showDescriptions:xe==="desc",showSchema:xe==="schema",showTips:!xe})}).catch(be=>{Ze(be,"Failed to load MCP status")}),!0}if(ze==="skills"){if(O.slice(Ge[0].length).trim()){if(ie)return Ar(O,V);nn(O,V).catch(be=>Ze(be,"Failed to send /skills command"))}else I.appendLocalUserMessage(O),oe.loadSkillsStatus().then(be=>{const Qt=((be==null?void 0:be.skills)??[]).map(It=>({name:It.name,description:It.description??""})).sort((It,lr)=>It.name.localeCompare(lr.name));if(rt(Qt),Qt.length===0)I.dispatch([{type:"status",text:L("skills.none")}]);else{const It=Qt.map(lr=>`- ${lr.name}`).join(`
`);I.dispatch([{type:"status",text:`${L("skills.available")}

${It}`}])}Bn("smooth")}).catch(be=>{Ze(be,"Failed to load skills")});return!0}if(ze==="tools"){const xe=O.slice(Ge[0].length).trim().toLowerCase();return xe==="desc"||xe==="descriptions"?Rh(!0):(I.appendLocalUserMessage(O),oe.loadToolsStatus().then(be=>{const Qt=(be==null?void 0:be.tools)??[];if(Qt.length===0)I.dispatch([{type:"status",text:L("tools.none")}]);else{const It=Qt.map(lr=>`- ${lr.displayName||lr.name}`).join(`
`);I.dispatch([{type:"status",text:`${L("tools.available")}

${It}`}])}Bn("smooth")}).catch(be=>{Ze(be,"Failed to load tools")})),!0}if(ze==="settings")return Bt(!0),!0;if(ze==="context"){const xe=O.slice(Ge[0].length).trim().toLowerCase();if(xe===""||xe==="detail"||xe==="-d")return zh(O,xe==="detail"||xe==="-d"),!0}if(ze==="memory"){const xe=O.slice(Ge[0].length).trim().toLowerCase();if(xe==="refresh")$u(be=>be+1);else if(xe==="add"||xe.startsWith("add ")){const be=xe.slice(3).trim();iL(be==="user"||be==="global"?"global":"workspace"),Vy(Qt=>Qt+1)}return Qn(!0),!0}if(ze==="agents"){const xe=O.slice(Ge[0].length).trim().toLowerCase();let be="menu";return xe==="create"?be="create":xe==="create user"||xe==="create global"?be="create-user":xe==="create project"||xe==="create workspace"?be="create-project":xe==="manage"&&(be="manage"),Gy(be),!0}if(ze==="extensions"){const xe=O.slice(Ge[0].length).trim(),be=(Ue=xe.split(/\s+/)[0])==null?void 0:Ue.toLowerCase();if(!be||be==="manage")return lt(!0),!0;if(be==="install"){const Qt=xe.slice(7).trim().split(/\s+/);let It="",lr,pr,Ai,Ac,ba=null;for(let Ei=0;Ei<Qt.length;Ei++){const gs=Qt[Ei];if(gs)if(gs==="--auto-update")Ai=!0;else if(gs==="--pre-release"||gs==="--allow-pre-release")Ac=!0;else if(gs==="--ref"||gs==="--registry"){const Ec=Qt[Ei+1];if(!Ec||Ec.startsWith("--")){ba=L("extensions.install.missingOptionValue",{option:gs});break}gs==="--ref"?lr=Ec:pr=Ec,Ei+=1}else if(gs.startsWith("--")){ba=L("extensions.install.unknownOption",{option:gs});break}else if(!It)It=gs;else{ba=L("extensions.install.usage");break}}if(ba)return I.appendLocalUserMessage(O),I.dispatch([{type:"error",text:ba}]),!0;if(!It)return I.appendLocalUserMessage(O),I.dispatch([{type:"error",text:L("extensions.install.usage")}]),!0;if(ie)return I.appendLocalUserMessage(O),I.dispatch([{type:"error",text:L("extensions.install.waitForTurn")}]),!0;const va=mm.current.clientId;return va?(I.appendLocalUserMessage(O),I.dispatch([{type:"status",text:L("extensions.install.started",{source:It})}]),oe.installExtension({source:It,...lr?{ref:lr}:{},...pr?{registry:pr}:{},...Ai!==void 0?{autoUpdate:Ai}:{},...Ac!==void 0?{allowPreRelease:Ac}:{},consent:!0},va).then(()=>{}).catch(Ei=>{Ze(Ei,L("extensions.install.requestFailed"))}),!0):(I.appendLocalUserMessage(O),I.dispatch([{type:"error",text:L("extensions.install.waitForSession")}]),!0)}return I.appendLocalUserMessage(O),I.dispatch([{type:"error",text:L("extensions.install.usage")}]),!0}if(ze==="clear"||ze==="new"||ze==="reset")return ab(),!0;if(ze==="rename"){const xe=pke(O.slice(Ge[0].length));if(xe.type==="auto"||xe.type==="delegate")return ie?Ar(O,V):(nn(O,V).catch(Qt=>Ze(Qt,"Failed to send /rename command")),!0);const be=xe.displayName;return be?(ne.renameSession(be).then(()=>{I.dispatch([{type:"status",text:L("rename.success",{name:be})}])}).catch(Qt=>{Ze(Qt,"Failed to rename session")}),!0):(gt("error",L("rename.empty")),!0)}if(ze==="resume"){const xe=O.slice(Ge[0].length).trim();return xe?ne.loadSession(xe).catch(be=>{Ze(be,"Failed to load session")}):at(!0),!0}if(ze==="recap")return H5(),!0;if(ze==="btw")return F5(O.slice(Ge[0].length)),!0;if(ze==="stats"){const xe=O.slice(Ge[0].length).trim().toLowerCase();let be="overview";return xe==="model"?be="model":xe==="tools"&&(be="tools"),I.appendLocalUserMessage(O),ne.getStats().then(Qt=>{I.dispatch([{type:"status",text:Qre(Qt,be)}]),Bn("smooth")}).catch(()=>{}),!0}if(ze==="status"||ze==="about")return I.appendLocalUserMessage(O),Promise.all([oe.loadPreflight().catch(()=>null),oe.loadProviders().catch(()=>null),oe.loadEnv().catch(()=>null)]).then(([xe,be,Qt])=>{var Ec,lk,ck,uk,dk,hk;const It=Q9(xe,Qt);let lr=It.authSource;!lr&&((Ec=be==null?void 0:be.current)!=null&&Ec.authType)&&(lr=be.current.authType);const pr=[];It.nodeVersion&&pr.push(`Node.js v${It.nodeVersion}`),It.npmVersion&&pr.push(`npm ${It.npmVersion}`);let Ai="";lr&&(lr.startsWith("oauth")||lr==="qwen-oauth"?Ai="Qwen OAuth":Ai=`API Key - ${lr}`);const Ac=`${It.platform} ${It.arch}`.trim(),ba=q5.current,va=mm.current,gs={cliVersion:((lk=va.capabilities)==null?void 0:lk.qwenCodeVersion)||"",runtime:pr.join(" / "),platform:Ac,auth:Ai,baseUrl:((ck=be==null?void 0:be.current)==null?void 0:ck.baseUrl)||"",model:ba||va.currentModel||((uk=be==null?void 0:be.current)==null?void 0:uk.modelId)||"",fastModel:((dk=be==null?void 0:be.current)==null?void 0:dk.fastModelId)||ba||va.currentModel||((hk=be==null?void 0:be.current)==null?void 0:hk.modelId)||"",sessionId:va.sessionId||"",sandbox:It.sandbox,proxy:It.proxy,memoryUsage:It.memoryUsage};I.dispatch([{type:"status",text:mse(gs)}]),Bn("smooth")}),!0;if(ze==="bug"){const xe=O.slice(Ge[0].length).trim();return I.appendLocalUserMessage(O),Promise.all([oe.loadPreflight().catch(()=>null),oe.loadEnv().catch(()=>null)]).then(([be,Qt])=>{var Ai;const It=Q9(be,Qt),lr=((Ai=mm.current.capabilities)==null?void 0:Ai.qwenCodeVersion)||"",pr={};if(lr&&(pr.cliVersion=lr),It.nodeVersion&&(pr.nodeVersion=It.nodeVersion),It.npmVersion&&(pr.npmVersion=It.npmVersion),It.platform&&(pr.platform=It.platform),It.arch&&(pr.arch=It.arch),It.sandbox&&(pr.sandbox=It.sandbox),It.memoryUsage&&(pr.memoryUsage=It.memoryUsage),eb.current)eb.current({title:xe,systemInfo:pr}),I.dispatch([{type:"status",text:L("bug.submitted")}]);else{const Ac=Object.entries(pr).filter(([,Ei])=>Ei).map(([Ei,gs])=>`${Ei}: ${gs}`).join(`
`),ba=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(xe)}&info=${encodeURIComponent(`
`+Ac+`
`)}`,va=window.open(ba,"_blank");va?(va.opener=null,I.dispatch([{type:"status",text:L("bug.submitted")}])):gt("error",L("bug.popupBlocked"))}}).catch(be=>{Ze(be,L("bug.failed"))}),!0}}return ie?Ar(O,V):(nn(O,V).catch(ze=>Ze(ze,"Failed to send command")),!0)}else if(O.startsWith("!")){if(ie)return Ar(O,V);const Ge=O.slice(1).trim();return Ge?(ne.sendShellCommand(Ge).catch(ze=>{Ze(ze,"Failed to execute shell command")}),!0):!1}else return ie?Ar(O,V):(nn(O,V).catch(Ge=>Ze(Ge,"Failed to send message")),!0)},[nn,ne,I,Ar,vm,ab,xm,rk,gm,Tc,Lh,ob,$h,gt,Ze,H5,F5,Bn,Z,zh,L,oe]),CL=b.useCallback((O,V)=>{const ie=wm(O,V);return ie!==!1&&Bn("smooth"),ie},[wm,Bn]);b.useEffect(()=>{if(pm.current||!tr||an!=="idle"||Ci||pe||Sc.length===0)return;const O=W5();if(!O)return;pm.current=!0;let V=!1;const ie=window.setTimeout(()=>{var Ue;V=!0;try{wm(O.text,O.images),(Ue=O.onComplete)==null||Ue.call(O)}finally{pm.current=!1}},0);return()=>{V||(or.current=[O,...or.current],ol(or.current)),window.clearTimeout(ie),pm.current=!1}},[tr,Ci,wm,pe,W5,Sc,an]);const lb=b.useCallback((O,V,ie)=>{ne.submitPermission(O,V,ie).catch(Ue=>{Ze(Ue,"Failed to submit permission choice")})},[ne,Ze]),cb=b.useCallback(()=>{ne.cancel().catch(O=>{Ze(O,"Failed to cancel request")})},[ne,Ze]),AL=b.useCallback(()=>{var O;return Ci?!1:((O=Qo.current)==null?void 0:O.focusTaskPill())??!1},[Ci]),EL=b.useCallback(O=>{var V,ie;if(O){(V=_n.current)==null||V.insertText(O);return}(ie=_n.current)==null||ie.focus()},[]),ML=b.useCallback(O=>{Ln(!O)},[]),ub=b.useCallback(()=>{sl.current&&tr&&Zi.current==="idle"&&ni.current&&ti.current?(Os.current=ni.current,rl(!1),nn(ti.current,no.current,{optimisticUserMessage:!1,retry:!0}).catch(O=>Ze(O,"Failed to retry prompt"))):I.dispatch([{type:"status",text:L("retry.none")}])},[tr,nn,Ze,I,L]);b.useEffect(()=>{const O=V=>{if(!Ci&&V.ctrlKey&&!V.metaKey&&!V.altKey&&!V.shiftKey){if(V.key==="l"){V.preventDefault(),Z5();return}if(V.key==="o"){V.preventDefault(),ek();return}if(V.key==="y"){V.preventDefault(),ub();return}}};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[Ci,Z5,ek,ub,I,L]),b.useEffect(()=>{const O=()=>{Dh.current=0,Ky(!1),io.current&&(clearTimeout(io.current),io.current=null)},V=ie=>{var Ue,Ge;if(!(ie.defaultPrevented||ie.isComposing)){if(ie.key!=="Escape"){Dh.current>0&&O(),ie.key==="Tab"&&ie.shiftKey&&!Ci&&(ie.preventDefault(),ib());return}if(!(pe||Ci)){if(nb()){ie.preventDefault(),O();return}if((Ue=_n.current)!=null&&Ue.hasInput()){ie.preventDefault(),Dh.current===0?(Dh.current=1,Ky(!0),io.current&&clearTimeout(io.current),io.current=setTimeout(()=>{O()},500)):((Ge=_n.current)==null||Ge.clear(),O());return}if(an!=="idle"){ie.preventDefault(),cb(),O();return}}}};return window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V),Dh.current=0,Ky(!1),io.current&&(clearTimeout(io.current),io.current=null)}},[an,cb,ib,pe,Ci,nb]);const NL=!tr||G.catchingUp,db=b.useCallback(O=>{ne.setModel(O).then(V=>{const ie=lke(V);Jy((ie==null?void 0:ie.modelId)??O),ie&&I.dispatch({type:"debug",text:cke(ie)})}).catch(V=>{Ze(V,L("model.switch"))})},[ne,I,Ze,L]),IL=b.useCallback(O=>{if(an!=="idle"){Ar(`/model --fast ${O}`);return}nn(`/model --fast ${O}`).catch(V=>{Ze(V,"Failed to switch fast model")})},[Ar,nn,an,Ze]),RL=b.useCallback(O=>{if(an!=="idle"){Ar(`/model --voice ${O}`);return}nn(`/model --voice ${O}`).catch(V=>{Ze(V,L("model.setVoice"))})},[Ar,nn,an,Ze,L]),sk=b.useMemo(()=>{const O=new Set(G.skills??[]);return M_e(G.commands??[],E_e(L)).filter(V=>!$h.has(B4(V.name))).map(V=>O.has(V.name)?{...V,displayCategory:"skill",description:V.description||L("skills.run")}:V)},[G.commands,G.skills,$h,L]),Ph=b.useMemo(()=>{var O;return{version:((O=G.capabilities)==null?void 0:O.qwenCodeVersion)||"",cwd:G.workspaceCwd||"",currentModel:Pu,currentMode:al,hideTips:(Uu==null?void 0:Uu.values.effective)===!0}},[(ok=G.capabilities)==null?void 0:ok.qwenCodeVersion,G.workspaceCwd,Pu,al,Uu==null?void 0:Uu.values.effective]),jL=b.useMemo(()=>p?p(Ph):h.jsx(Hve,{...Ph}),[p,Ph]),ik=b.useMemo(()=>y==null?void 0:y(Ph),[y,Ph]),Cc=te.length===0&&!bt&&!pe&&!Kt,DL=tL(x),OL=[bn.app,bn.appChat,Cc?bn.appChatEmpty:void 0,Xy===us.Light?bn.themeLight:bn.themeDark,i].filter(Boolean).join(" "),LL=b.useMemo(()=>({...a,...eke(J,x)}),[x,J,a]),ak=b.useCallback(O=>{Y(O),Z5e(O)},[]);return b.useLayoutEffect(()=>{const O=js.current;if(!O)return;const V=ft.current,ie=ss.current,Ue=O.getBoundingClientRect();if(ie&&!Cc&&V){const Ge=V.top-Ue.top;Math.abs(Ge)>1&&(O.style.transition="width 320ms ease",O.style.transform=`translateY(${Ge}px)`,requestAnimationFrame(()=>{O.style.transition="width 320ms ease, transform 280ms ease",O.style.transform=""}),window.setTimeout(()=>{O.style.transition=""},320))}ft.current=Ue,ss.current=Cc},[Cc]),h.jsx(wH,{value:Xy,children:h.jsx(uH,{language:Z,children:h.jsxs("div",{className:OL,style:LL,"data-web-shell-root":!0,children:[!E&&h.jsx(ive,{toasts:At,onDismiss:Vt}),kt&&h.jsx(as,{title:L("resume.title"),size:"lg",onClose:()=>at(!1),children:h.jsx(t4e,{onSelect:O=>{ne.loadSession(O).catch(V=>{Ze(V,"Failed to load session")})},onClose:()=>at(!1)})}),on&&h.jsx(as,{title:L(on==="fast"?"model.setFast":on==="voice"?"model.setVoice":"model.select"),size:"lg",onClose:()=>mr(null),children:h.jsx(L4e,{mode:on,models:on==="voice"?K:void 0,currentModelId:on==="voice"?yL:void 0,onSelect:O=>{on==="fast"?IL(O):on==="voice"?RL(O):db(O),mr(null)}})}),ye&&h.jsx(as,{title:L("mode.select"),size:"sm",onClose:()=>_e(!1),children:h.jsx(Qve,{currentMode:al,onSelect:O=>{Tc(O),_e(!1)}})}),_c&&h.jsx(as,{title:L("tools.title"),size:"lg",onClose:()=>Rh(!1),children:h.jsx(Fxe,{})}),me&&h.jsx(as,{title:L("extensions.manage.title"),size:"lg",onClose:()=>lt(!1),children:h.jsx(Kxe,{})}),yt&&h.jsx(as,{title:L("mcp.manageServers"),size:"lg",onClose:()=>Et(null),children:h.jsx(b5e,{message:yt,onClose:()=>Et(null)})}),Yy&&h.jsx(as,{title:L("tasks.title"),size:"lg",onClose:()=>fm(null),children:h.jsx(aj,{message:Yy,embedded:!0,manageActiveEvent:!1,onClose:()=>fm(null)})}),jh&&h.jsx(as,{title:L(jh==="manage"?"agent.manage":jh==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>Gy(null),children:h.jsx(Y2e,{mode:jh,embedded:!0,onMessage:O=>I.dispatch([{type:"status",text:O}]),onClose:()=>Gy(null)})}),Ot&&h.jsx(as,{title:L("settings.title"),size:"lg",onClose:()=>Bt(!1),children:h.jsx(Dwe,{settingsState:Y5,embedded:!0,onLanguageChange:vL,onThemeChange:gm,chatWidthMode:J,onChatWidthModeChange:ak,onSubDialog:O=>{Bt(!1),O==="fastModel"?mr("fast"):O==="tools.approvalMode"&&_e(!0)}})}),mn&&h.jsx(as,{title:L("memory.menu"),size:"lg",onClose:()=>Qn(!1),children:h.jsx(pxe,{refreshSignal:kc,addSignal:dm,addScope:Wy,onMessage:(O,V="status")=>{I.dispatch([{type:V,text:O}])}})}),il&&h.jsx(as,{title:L("help.title"),size:"md",onClose:()=>Nh(!1),children:h.jsx(h_e,{commands:sk})}),ya&&h.jsx(as,{title:L("theme.title"),size:"sm",onClose:()=>Ih(!1),children:h.jsx(f_e,{currentTheme:Xy,onSelect:gm,onClose:()=>Ih(!1)})}),Wr&&h.jsx(as,{title:L("auth.title"),size:"lg",onClose:()=>Ti(!1),children:h.jsx(Uxe,{onMessage:(O,V="status")=>{I.dispatch([V==="error"?{type:"error",text:O}:{type:"status",text:O}])},onClose:()=>Ti(!1)})}),ot&&h.jsx(as,{title:L("delete.title"),size:"lg",onClose:()=>ut(!1),children:h.jsx(m_e,{onDeleted:O=>{I.dispatch([{type:"status",text:O.length===1?`${L("delete.deleted")} (${O[0].slice(0,8)})`:L("delete.deletedCount",{count:O.length})}])},onError:O=>{if(Xu(O))return;const V=O instanceof Error?O.message:String(O);gt("error",L("delete.failed",{reason:V}))},onClose:()=>ut(!1)})}),jn&&h.jsx(as,{title:L("release.title"),size:"lg",onClose:()=>kn(!1),children:h.jsx(p_e,{onReleased:O=>{I.dispatch([{type:"status",text:`${L("release.released")} (${O.slice(0,8)})`}])},onError:O=>{if(Xu(O))return;const V=O instanceof Error?O.message:String(O);gt("error",L("release.failed",{reason:V}))},onClose:()=>kn(!1)})}),ea&&h.jsx(as,{title:L("rewind.title"),subtitle:L("rewind.subtitle"),size:"lg",onClose:()=>so(!1),children:h.jsx(A_e,{blocks:M,loadSnapshots:_L,rewind:kL,onError:SL,onClose:()=>so(!1)})}),h.jsxs(iH,{value:R,children:[h.jsx(Mh.Provider,{value:rb,children:h.jsx(H5e,{timeline:de,details:Te,children:h.jsxs("div",{className:[bn.content,bt||te.length>0||pe?bn.contentHasMessages:void 0].filter(Boolean).join(" "),children:[h.jsx(ehe,{ref:to,messages:te,pendingApproval:Je,onConfirm:lb,onShowContextDetail:xL,catchingUp:G.catchingUp,isResponding:an!=="idle",activeTurnStartedAt:wc,workspaceCwd:G.workspaceCwd||"",shellOutputMaxLines:bL,showRetryHint:ri,onRetryClick:ub,onBranchSession:wL,welcomeHeader:Cc?jL:void 0,tailContent:void 0,tailKey:void 0,onFollowStateChange:ML,virtualScrollThreshold:C}),(Kt==null?void 0:Kt.role)==="btw"&&h.jsx("div",{className:bn.btwPanel,children:h.jsx(bj,{question:Kt.question,answer:Kt.answer,isPending:Kt.isPending})})]})})}),h.jsxs("div",{ref:js,className:U5?`${bn.footer} ${bn.footerHidden}`:bn.footer,children:[Ds&&h.jsx("div",{className:bt?`${bn.scrollToBottomLayer} ${bn.scrollToBottomLayerWithTodos}`:bn.scrollToBottomLayer,children:h.jsx("button",{type:"button",className:bn.scrollToBottomButton,"aria-label":L("chat.scrollToBottom"),onClick:()=>Bn("smooth"),children:h.jsx("svg",{className:bn.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"})})})}),bt&&h.jsx("div",{className:bn.bottomPanels,children:h.jsx(vve,{todos:Nt})}),Je&&h.jsx("div",{className:bn.approvalOverlay,children:h.jsx(jl,{request:Je,onConfirm:lb,variant:"floating"})}),wt&&h.jsx("div",{className:bn.approvalOverlay,children:h.jsx(xj,{request:wt,onConfirm:lb,variant:"floating"})}),h.jsxs("div",{className:bn.composer,children:[h.jsx(Ybe,{startedAt:wc}),h.jsx(xke,{prompts:Sc,t:L,onDelete:mL,onInsert:pL,onEditLast:gL}),h.jsx(dbe,{ref:Jo,onSubmit:CL,onCycleMode:ib,onToggleShortcuts:K5,onCancel:cb,isRunning:an!=="idle",disabled:NL||pe!==null,commands:sk,skills:ro,slashCommandCategoryOrder:f,queuedMessages:uL,onFocusFooter:AL,onPopQueuedMessages:tb,onClearQueuedMessages:nb,currentMode:al,currentModel:Pu,chatWidthMode:J,showChatWidthToggle:!Cc,chatWidthToggleMin:DL,visibleToolbarActions:k,availableModels:dL,onSelectMode:Tc,onSelectModel:db,onChatWidthModeChange:ak,sessionName:cL,dialogOpen:Ci,followupState:vc,onAcceptFollowup:ga,onDismissFollowup:Si,composerInput:H,composerInputVersion:W,placeholderText:!tr||G.catchingUp?L("common.loading"):L(an!=="idle"?"editor.processing":"editor.placeholder")})]}),$?h.jsx($,{connected:tr,mode:al,model:Pu,streamingState:an,contextUsageRatio:(G.contextWindow??0)>0?(G.tokenCount??0)/(G.contextWindow??0):0,activeGoal:Zo,tasks:Xo,availableModes:Tp,availableModels:(G.models??[]).filter(nC).map(O=>({id:O.id,label:O.label,contextWindow:O.contextWindow})),skills:ro,onSelectMode:Tc,onSelectModel:db}):h.jsx(zbe,{escapeHint:aL,onSelectMode:()=>_e(O=>!O),onSelectModel:()=>mr(O=>O?null:"main"),onShowContext:()=>zh("/context",!1),onOpenSettings:()=>Bt(!0),ref:Qo,onOpenTasks:()=>ob(),onReturnToInput:EL,tasks:pa,activeGoal:Zo,hideSettings:TL,onToggleShortcuts:K5,compact:!0}),Cc&&ik&&h.jsx("div",{className:bn.emptyWelcomeFooter,children:ik})]})]})]})})})}function _ke(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?Tke(e):""}let Cp;function kke(){return Cp||(typeof window>"u"?void 0:(Cp=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,Cp))}function Ske(){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 Tke(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 Cke=_ke(),Ake=kke();Ske();const nL="qwen-code-web-shell-language",rL="qwen-code-web-shell-theme";function sL(e){if(e===us.Dark||e===us.Light)return e}function Eke(){const e=new URLSearchParams(window.location.search).get("theme");return sL(e)}function Mke(){try{return sL(window.localStorage.getItem(rL))}catch{return}}function Nke(e){try{window.localStorage.setItem(rL,e)}catch{}}function Ike(){return Eke()??Mke()??us.Dark}function Rke(){try{const e=window.localStorage.getItem(nL);return e?Wl(e):void 0}catch{return}}function jke(e){try{window.localStorage.setItem(nL,e)}catch{}}function Dke(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Wl(t||(Rke()??navigator.language))}function Oke(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function Lke(e){const t=new URL(window.location.href);t.pathname=`/session/${encodeURIComponent(e)}`,t.searchParams.delete("token"),t.searchParams.delete("daemon"),window.history.replaceState(null,"",t)}function Bke(){const[e,t]=b.useState(()=>Ike()),[n,r]=b.useState(()=>Dke()),[s,i]=b.useState(()=>Oke()),a=Cke||window.location.origin,o=b.useCallback(u=>{t(u),Nke(u)},[]),l=b.useCallback(u=>{r(u),jke(u)},[]),c=b.useCallback(u=>{i(u),Lke(u)},[]);return h.jsx(rU,{baseUrl:a,token:Ake,children:h.jsx(yU,{initialSessionId:s,suppressOwnUserEcho:!0,children:h.jsx(wke,{theme:e,onThemeChange:o,language:n,onLanguageChange:l,onSessionIdChange:c,compactThinking:!0})},s??"new")})}L$.createRoot(document.getElementById("root")).render(h.jsx(rB.StrictMode,{children:h.jsx(Bke,{})}));export{q as _,lg as c,I1 as g,Pke as k};
