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 nP=Object.defineProperty;var rP=(e,t,n)=>t in e?nP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>rP(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var kg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var iA={exports:{}},K1={};/**
 * @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 sP=Symbol.for("react.transitional.element"),iP=Symbol.for("react.fragment");function oA(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:sP,type:e,key:r,ref:t!==void 0?t:null,props:n}}K1.Fragment=iP;K1.jsx=oA;K1.jsxs=oA;iA.exports=K1;var h=iA.exports,aA={exports:{}},Ut={};/**
 * @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 r3=Symbol.for("react.transitional.element"),oP=Symbol.for("react.portal"),aP=Symbol.for("react.fragment"),lP=Symbol.for("react.strict_mode"),cP=Symbol.for("react.profiler"),uP=Symbol.for("react.consumer"),dP=Symbol.for("react.context"),hP=Symbol.for("react.forward_ref"),fP=Symbol.for("react.suspense"),mP=Symbol.for("react.memo"),lA=Symbol.for("react.lazy"),pP=Symbol.for("react.activity"),H6=Symbol.iterator;function gP(e){return e===null||typeof e!="object"?null:(e=H6&&e[H6]||e["@@iterator"],typeof e=="function"?e:null)}var cA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uA=Object.assign,dA={};function ph(e,t,n){this.props=e,this.context=t,this.refs=dA,this.updater=n||cA}ph.prototype.isReactComponent={};ph.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")};ph.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function hA(){}hA.prototype=ph.prototype;function s3(e,t,n){this.props=e,this.context=t,this.refs=dA,this.updater=n||cA}var i3=s3.prototype=new hA;i3.constructor=s3;uA(i3,ph.prototype);i3.isPureReactComponent=!0;var V6=Array.isArray;function ew(){}var Kn={H:null,A:null,T:null,S:null},fA=Object.prototype.hasOwnProperty;function o3(e,t,n){var r=n.ref;return{$$typeof:r3,type:e,key:t,ref:r!==void 0?r:null,props:n}}function yP(e,t){return o3(e.type,t,e.props)}function a3(e){return typeof e=="object"&&e!==null&&e.$$typeof===r3}function bP(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var W6=/\/+/g;function Cb(e,t){return typeof e=="object"&&e!==null&&e.key!=null?bP(""+e.key):t.toString(36)}function wP(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ew,ew):(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 nd(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case r3:case oP:o=!0;break;case lA:return o=e._init,nd(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+Cb(e,0):r,V6(s)?(n="",o!=null&&(n=o.replace(W6,"$&/")+"/"),nd(s,t,n,"",function(c){return c})):s!=null&&(a3(s)&&(s=yP(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(W6,"$&/")+"/")+o)),t.push(s)),1;o=0;var a=r===""?".":r+":";if(V6(e))for(var l=0;l<e.length;l++)r=e[l],i=a+Cb(r,l),o+=nd(r,t,n,i,s);else if(l=gP(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=a+Cb(r,l++),o+=nd(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return nd(wP(e),t,n,r,s);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function jm(e,t,n){if(e==null)return e;var r=[],s=0;return nd(e,r,"","",function(i){return t.call(n,i,s++)}),r}function vP(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 G6=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)},xP={map:jm,forEach:function(e,t,n){jm(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return jm(e,function(){t++}),t},toArray:function(e){return jm(e,function(t){return t})||[]},only:function(e){if(!a3(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ut.Activity=pP;Ut.Children=xP;Ut.Component=ph;Ut.Fragment=aP;Ut.Profiler=cP;Ut.PureComponent=s3;Ut.StrictMode=lP;Ut.Suspense=fP;Ut.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Kn;Ut.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Kn.H.useMemoCache(e)}};Ut.cache=function(e){return function(){return e.apply(null,arguments)}};Ut.cacheSignal=function(){return null};Ut.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=uA({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!fA.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];r.children=o}return o3(e.type,s,r)};Ut.createContext=function(e){return e={$$typeof:dP,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:uP,_context:e},e};Ut.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)fA.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];s.children=a}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)s[r]===void 0&&(s[r]=o[r]);return o3(e,i,s)};Ut.createRef=function(){return{current:null}};Ut.forwardRef=function(e){return{$$typeof:hP,render:e}};Ut.isValidElement=a3;Ut.lazy=function(e){return{$$typeof:lA,_payload:{_status:-1,_result:e},_init:vP}};Ut.memo=function(e,t){return{$$typeof:mP,type:e,compare:t===void 0?null:t}};Ut.startTransition=function(e){var t=Kn.T,n={};Kn.T=n;try{var r=e(),s=Kn.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(ew,G6)}catch(i){G6(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Kn.T=t}};Ut.unstable_useCacheRefresh=function(){return Kn.H.useCacheRefresh()};Ut.use=function(e){return Kn.H.use(e)};Ut.useActionState=function(e,t,n){return Kn.H.useActionState(e,t,n)};Ut.useCallback=function(e,t){return Kn.H.useCallback(e,t)};Ut.useContext=function(e){return Kn.H.useContext(e)};Ut.useDebugValue=function(){};Ut.useDeferredValue=function(e,t){return Kn.H.useDeferredValue(e,t)};Ut.useEffect=function(e,t){return Kn.H.useEffect(e,t)};Ut.useEffectEvent=function(e){return Kn.H.useEffectEvent(e)};Ut.useId=function(){return Kn.H.useId()};Ut.useImperativeHandle=function(e,t,n){return Kn.H.useImperativeHandle(e,t,n)};Ut.useInsertionEffect=function(e,t){return Kn.H.useInsertionEffect(e,t)};Ut.useLayoutEffect=function(e,t){return Kn.H.useLayoutEffect(e,t)};Ut.useMemo=function(e,t){return Kn.H.useMemo(e,t)};Ut.useOptimistic=function(e,t){return Kn.H.useOptimistic(e,t)};Ut.useReducer=function(e,t,n){return Kn.H.useReducer(e,t,n)};Ut.useRef=function(e){return Kn.H.useRef(e)};Ut.useState=function(e){return Kn.H.useState(e)};Ut.useSyncExternalStore=function(e,t,n){return Kn.H.useSyncExternalStore(e,t,n)};Ut.useTransition=function(){return Kn.H.useTransition()};Ut.version="19.2.4";aA.exports=Ut;var g=aA.exports;const _P=G1(g);var mA={exports:{}},Y1={},pA={exports:{}},gA={};/**
 * @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(O,Y){var G=O.length;O.push(Y);e:for(;0<G;){var ee=G-1>>>1,L=O[ee];if(0<s(L,Y))O[ee]=Y,O[G]=L,G=ee;else break e}}function n(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var Y=O[0],G=O.pop();if(G!==Y){O[0]=G;e:for(var ee=0,L=O.length,F=L>>>1;ee<F;){var P=2*(ee+1)-1,A=O[P],ne=P+1,be=O[ne];if(0>s(A,G))ne<L&&0>s(be,A)?(O[ee]=be,O[ne]=G,ee=ne):(O[ee]=A,O[P]=G,ee=P);else if(ne<L&&0>s(be,G))O[ee]=be,O[ne]=G,ee=ne;else break e}}return Y}function s(O,Y){var G=O.sortIndex-Y.sortIndex;return G!==0?G:O.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,f=3,m=!1,p=!1,y=!1,x=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;function _(O){for(var Y=n(c);Y!==null;){if(Y.callback===null)r(c);else if(Y.startTime<=O)r(c),Y.sortIndex=Y.expirationTime,t(l,Y);else break;Y=n(c)}}function S(O){if(y=!1,_(O),!p)if(n(l)!==null)p=!0,C||(C=!0,M());else{var Y=n(c);Y!==null&&J(S,Y.startTime-O)}}var C=!1,E=-1,R=5,j=-1;function N(){return x?!0:!(e.unstable_now()-j<R)}function B(){if(x=!1,C){var O=e.unstable_now();j=O;var Y=!0;try{e:{p=!1,y&&(y=!1,w(E),E=-1),m=!0;var G=f;try{t:{for(_(O),d=n(l);d!==null&&!(d.expirationTime>O&&N());){var ee=d.callback;if(typeof ee=="function"){d.callback=null,f=d.priorityLevel;var L=ee(d.expirationTime<=O);if(O=e.unstable_now(),typeof L=="function"){d.callback=L,_(O),Y=!0;break t}d===n(l)&&r(l),_(O)}else r(l);d=n(l)}if(d!==null)Y=!0;else{var F=n(c);F!==null&&J(S,F.startTime-O),Y=!1}}break e}finally{d=null,f=G,m=!1}Y=void 0}}finally{Y?M():C=!1}}}var M;if(typeof v=="function")M=function(){v(B)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,H=$.port2;$.port1.onmessage=B,M=function(){H.postMessage(null)}}else M=function(){b(B,0)};function J(O,Y){E=b(function(){O(e.unstable_now())},Y)}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(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(O){switch(f){case 1:case 2:case 3:var Y=3;break;default:Y=f}var G=f;f=Y;try{return O()}finally{f=G}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(O,Y){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var G=f;f=O;try{return Y()}finally{f=G}},e.unstable_scheduleCallback=function(O,Y,G){var ee=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?ee+G:ee):G=ee,O){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=G+L,O={id:u++,callback:Y,priorityLevel:O,startTime:G,expirationTime:L,sortIndex:-1},G>ee?(O.sortIndex=G,t(c,O),n(l)===null&&O===n(c)&&(y?(w(E),E=-1):y=!0,J(S,G-ee))):(O.sortIndex=L,t(l,O),p||m||(p=!0,C||(C=!0,M()))),O},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(O){var Y=f;return function(){var G=f;f=Y;try{return O.apply(this,arguments)}finally{f=G}}}})(gA);pA.exports=gA;var kP=pA.exports,yA={exports:{}},$s={};/**
 * @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 SP=g;function bA(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 dl(){}var Os={d:{f:dl,r:function(){throw Error(bA(522))},D:dl,C:dl,L:dl,m:dl,X:dl,S:dl,M:dl},p:0,findDOMNode:null},TP=Symbol.for("react.portal");function CP(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:TP,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Rf=SP.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function X1(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}$s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Os;$s.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(bA(299));return CP(e,t,null,n)};$s.flushSync=function(e){var t=Rf.T,n=Os.p;try{if(Rf.T=null,Os.p=2,e)return e()}finally{Rf.T=t,Os.p=n,Os.d.f()}};$s.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Os.d.C(e,t))};$s.prefetchDNS=function(e){typeof e=="string"&&Os.d.D(e)};$s.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=X1(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Os.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Os.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};$s.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=X1(t.as,t.crossOrigin);Os.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&&Os.d.M(e)};$s.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=X1(n,t.crossOrigin);Os.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})}};$s.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=X1(t.as,t.crossOrigin);Os.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 Os.d.m(e)};$s.requestFormReset=function(e){Os.d.r(e)};$s.unstable_batchedUpdates=function(e,t){return e(t)};$s.useFormState=function(e,t,n){return Rf.H.useFormState(e,t,n)};$s.useFormStatus=function(){return Rf.H.useHostTransitionStatus()};$s.version="19.2.4";function wA(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wA)}catch(e){console.error(e)}}wA(),yA.exports=$s;var Q1=yA.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 $r=kP,vA=g,AP=Q1;function we(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 xA(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function G0(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 _A(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 kA(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 K6(e){if(G0(e)!==e)throw Error(we(188))}function EP(e){var t=e.alternate;if(!t){if(t=G0(e),t===null)throw Error(we(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 K6(s),e;if(i===r)return K6(s),t;i=i.sibling}throw Error(we(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(we(189))}}if(n.alternate!==r)throw Error(we(190))}if(n.tag!==3)throw Error(we(188));return n.stateNode.current===n?e:t}function SA(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=SA(e),t!==null)return t;e=e.sibling}return null}var Xn=Object.assign,MP=Symbol.for("react.element"),Lm=Symbol.for("react.transitional.element"),pf=Symbol.for("react.portal"),cd=Symbol.for("react.fragment"),TA=Symbol.for("react.strict_mode"),tw=Symbol.for("react.profiler"),CA=Symbol.for("react.consumer"),Ea=Symbol.for("react.context"),l3=Symbol.for("react.forward_ref"),nw=Symbol.for("react.suspense"),rw=Symbol.for("react.suspense_list"),c3=Symbol.for("react.memo"),bl=Symbol.for("react.lazy"),sw=Symbol.for("react.activity"),NP=Symbol.for("react.memo_cache_sentinel"),Y6=Symbol.iterator;function Hh(e){return e===null||typeof e!="object"?null:(e=Y6&&e[Y6]||e["@@iterator"],typeof e=="function"?e:null)}var IP=Symbol.for("react.client.reference");function iw(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===IP?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cd:return"Fragment";case tw:return"Profiler";case TA:return"StrictMode";case nw:return"Suspense";case rw:return"SuspenseList";case sw:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case pf:return"Portal";case Ea:return e.displayName||"Context";case CA:return(e._context.displayName||"Context")+".Consumer";case l3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case c3:return t=e.displayName||null,t!==null?t:iw(e.type)||"Memo";case bl:t=e._payload,e=e._init;try{return iw(e(t))}catch{}}return null}var gf=Array.isArray,Dt=vA.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,wn=AP.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,su={pending:!1,data:null,method:null,action:null},ow=[],ud=-1;function Xo(e){return{current:e}}function Yr(e){0>ud||(e.current=ow[ud],ow[ud]=null,ud--)}function Vn(e,t){ud++,ow[ud]=e.current,e.current=t}var Go=Xo(null),c0=Xo(null),$l=Xo(null),Sg=Xo(null);function Tg(e,t){switch(Vn($l,t),Vn(c0,e),Vn(Go,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?t8(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=t8(t),e=WM(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Yr(Go),Vn(Go,e)}function Ud(){Yr(Go),Yr(c0),Yr($l)}function aw(e){e.memoizedState!==null&&Vn(Sg,e);var t=Go.current,n=WM(t,e.type);t!==n&&(Vn(c0,e),Vn(Go,n))}function Cg(e){c0.current===e&&(Yr(Go),Yr(c0)),Sg.current===e&&(Yr(Sg),v0._currentValue=su)}var Ab,X6;function zc(e){if(Ab===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ab=t&&t[1]||"",X6=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ab+e+X6}var Eb=!1;function Mb(e,t){if(!e||Eb)return"";Eb=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var f=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){f=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){f=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&f&&typeof m.stack=="string")return[m.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var l=o.split(`
`),c=a.split(`
`);for(s=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;if(r===l.length||s===c.length)for(r=l.length-1,s=c.length-1;1<=r&&0<=s&&l[r]!==c[s];)s--;for(;1<=r&&0<=s;r--,s--)if(l[r]!==c[s]){if(r!==1||s!==1)do if(r--,s--,0>s||l[r]!==c[s]){var u=`
`+l[r].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=r&&0<=s);break}}}finally{Eb=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?zc(n):""}function RP(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 Mb(e.type,!1);case 11:return Mb(e.type.render,!1);case 1:return Mb(e.type,!0);case 31:return zc("Activity");default:return""}}function Q6(e){try{var t="",n=null;do t+=RP(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var lw=Object.prototype.hasOwnProperty,u3=$r.unstable_scheduleCallback,Nb=$r.unstable_cancelCallback,jP=$r.unstable_shouldYield,LP=$r.unstable_requestPaint,_i=$r.unstable_now,DP=$r.unstable_getCurrentPriorityLevel,AA=$r.unstable_ImmediatePriority,EA=$r.unstable_UserBlockingPriority,Ag=$r.unstable_NormalPriority,OP=$r.unstable_LowPriority,MA=$r.unstable_IdlePriority,BP=$r.log,PP=$r.unstable_setDisableYieldValue,K0=null,ki=null;function Nl(e){if(typeof BP=="function"&&PP(e),ki&&typeof ki.setStrictMode=="function")try{ki.setStrictMode(K0,e)}catch{}}var Si=Math.clz32?Math.clz32:qP,zP=Math.log,$P=Math.LN2;function qP(e){return e>>>=0,e===0?32:31-(zP(e)/$P|0)|0}var Dm=256,Om=262144,Bm=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 J1(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=r&134217727;return a!==0?(r=a&~i,r!==0?s=$c(r):(o&=a,o!==0?s=$c(o):n||(n=a&~e,n!==0&&(s=$c(n))))):(a=r&~i,a!==0?s=$c(a):o!==0?s=$c(o):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 Y0(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function FP(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 NA(){var e=Bm;return Bm<<=1,!(Bm&62914560)&&(Bm=4194304),e}function Ib(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function X0(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function UP(e,t,n,r,s,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var a=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Si(n),d=1<<u;a[u]=0,l[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var m=f[u];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&IA(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function IA(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Si(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function RA(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Si(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function jA(e,t){var n=t&-t;return n=n&42?1:d3(n),n&(e.suspendedLanes|t)?0:n}function d3(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 h3(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function LA(){var e=wn.p;return e!==0?e:(e=window.event,e===void 0?32:rN(e.type))}function J6(e,t){var n=wn.p;try{return wn.p=e,t()}finally{wn.p=n}}var mc=Math.random().toString(36).slice(2),os="__reactFiber$"+mc,si="__reactProps$"+mc,gh="__reactContainer$"+mc,cw="__reactEvents$"+mc,HP="__reactListeners$"+mc,VP="__reactHandles$"+mc,Z6="__reactResources$"+mc,Q0="__reactMarker$"+mc;function f3(e){delete e[os],delete e[si],delete e[cw],delete e[HP],delete e[VP]}function dd(e){var t=e[os];if(t)return t;for(var n=e.parentNode;n;){if(t=n[gh]||n[os]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=o8(e);e!==null;){if(n=e[os])return n;e=o8(e)}return t}e=n,n=e.parentNode}return null}function yh(e){if(e=e[os]||e[gh]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function yf(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(we(33))}function Ad(e){var t=e[Z6];return t||(t=e[Z6]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Gr(e){e[Q0]=!0}var DA=new Set,OA={};function Au(e,t){Hd(e,t),Hd(e+"Capture",t)}function Hd(e,t){for(OA[e]=t,e=0;e<t.length;e++)DA.add(t[e])}var WP=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]*$"),ek={},tk={};function GP(e){return lw.call(tk,e)?!0:lw.call(ek,e)?!1:WP.test(e)?tk[e]=!0:(ek[e]=!0,!1)}function Up(e,t,n){if(GP(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 Pm(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 ha(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 Pi(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function BA(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function KP(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function uw(e){if(!e._valueTracker){var t=BA(e)?"checked":"value";e._valueTracker=KP(e,t,""+e[t])}}function PA(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=BA(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Eg(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 YP=/[\n"\\]/g;function Hi(e){return e.replace(YP,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function dw(e,t,n,r,s,i,o,a){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pi(t)):e.value!==""+Pi(t)&&(e.value=""+Pi(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?hw(e,o,Pi(t)):n!=null?hw(e,o,Pi(n)):r!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Pi(a):e.removeAttribute("name")}function zA(e,t,n,r,s,i,o,a){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){uw(e);return}n=n!=null?""+Pi(n):"",t=t!=null?""+Pi(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}r=r??s,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=a?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),uw(e)}function hw(e,t,n){t==="number"&&Eg(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ed(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=""+Pi(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 $A(e,t,n){if(t!=null&&(t=""+Pi(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Pi(n):""}function qA(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(we(92));if(gf(r)){if(1<r.length)throw Error(we(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Pi(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),uw(e)}function Vd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var XP=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 nk(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||XP.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function FA(e,t,n){if(t!=null&&typeof t!="object")throw Error(we(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&&nk(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&nk(e,i,t[i])}function m3(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 QP=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"]]),JP=/^[\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 Hp(e){return JP.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ma(){}var fw=null;function p3(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hd=null,Md=null;function rk(e){var t=yh(e);if(t&&(e=t.stateNode)){var n=e[si]||null;e:switch(e=t.stateNode,t.type){case"input":if(dw(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="'+Hi(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[si]||null;if(!s)throw Error(we(90));dw(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&&PA(r)}break e;case"textarea":$A(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ed(e,!!n.multiple,t,!1)}}}var Rb=!1;function UA(e,t,n){if(Rb)return e(t,n);Rb=!0;try{var r=e(t);return r}finally{if(Rb=!1,(hd!==null||Md!==null)&&(uy(),hd&&(t=hd,e=Md,Md=hd=null,rk(t),e)))for(t=0;t<e.length;t++)rk(e[t])}}function u0(e,t){var n=e.stateNode;if(n===null)return null;var r=n[si]||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(we(231,t,typeof n));return n}var $a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mw=!1;if($a)try{var Vh={};Object.defineProperty(Vh,"passive",{get:function(){mw=!0}}),window.addEventListener("test",Vh,Vh),window.removeEventListener("test",Vh,Vh)}catch{mw=!1}var Il=null,g3=null,Vp=null;function HA(){if(Vp)return Vp;var e,t=g3,n=t.length,r,s="value"in Il?Il.value:Il.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Vp=s.slice(e,1<r?1-r:void 0)}function Wp(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 zm(){return!0}function sk(){return!1}function ai(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?zm:sk,this.isPropagationStopped=sk,this}return Xn(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=zm)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=zm)},persist:function(){},isPersistent:zm}),t}var Eu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Z1=ai(Eu),J0=Xn({},Eu,{view:0,detail:0}),ZP=ai(J0),jb,Lb,Wh,ey=Xn({},J0,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:y3,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!==Wh&&(Wh&&e.type==="mousemove"?(jb=e.screenX-Wh.screenX,Lb=e.screenY-Wh.screenY):Lb=jb=0,Wh=e),jb)},movementY:function(e){return"movementY"in e?e.movementY:Lb}}),ik=ai(ey),ez=Xn({},ey,{dataTransfer:0}),tz=ai(ez),nz=Xn({},J0,{relatedTarget:0}),Db=ai(nz),rz=Xn({},Eu,{animationName:0,elapsedTime:0,pseudoElement:0}),sz=ai(rz),iz=Xn({},Eu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),oz=ai(iz),az=Xn({},Eu,{data:0}),ok=ai(az),lz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cz={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"},uz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dz(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=uz[e])?!!t[e]:!1}function y3(){return dz}var hz=Xn({},J0,{key:function(e){if(e.key){var t=lz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Wp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cz[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:y3,charCode:function(e){return e.type==="keypress"?Wp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Wp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fz=ai(hz),mz=Xn({},ey,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ak=ai(mz),pz=Xn({},J0,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:y3}),gz=ai(pz),yz=Xn({},Eu,{propertyName:0,elapsedTime:0,pseudoElement:0}),bz=ai(yz),wz=Xn({},ey,{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}),vz=ai(wz),xz=Xn({},Eu,{newState:0,oldState:0}),_z=ai(xz),kz=[9,13,27,32],b3=$a&&"CompositionEvent"in window,jf=null;$a&&"documentMode"in document&&(jf=document.documentMode);var Sz=$a&&"TextEvent"in window&&!jf,VA=$a&&(!b3||jf&&8<jf&&11>=jf),lk=" ",ck=!1;function WA(e,t){switch(e){case"keyup":return kz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fd=!1;function Tz(e,t){switch(e){case"compositionend":return GA(t);case"keypress":return t.which!==32?null:(ck=!0,lk);case"textInput":return e=t.data,e===lk&&ck?null:e;default:return null}}function Cz(e,t){if(fd)return e==="compositionend"||!b3&&WA(e,t)?(e=HA(),Vp=g3=Il=null,fd=!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 VA&&t.locale!=="ko"?null:t.data;default:return null}}var Az={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 uk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Az[e.type]:t==="textarea"}function KA(e,t,n,r){hd?Md?Md.push(r):Md=[r]:hd=r,t=Wg(t,"onChange"),0<t.length&&(n=new Z1("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Lf=null,d0=null;function Ez(e){UM(e,0)}function ty(e){var t=yf(e);if(PA(t))return e}function dk(e,t){if(e==="change")return t}var YA=!1;if($a){var Ob;if($a){var Bb="oninput"in document;if(!Bb){var hk=document.createElement("div");hk.setAttribute("oninput","return;"),Bb=typeof hk.oninput=="function"}Ob=Bb}else Ob=!1;YA=Ob&&(!document.documentMode||9<document.documentMode)}function fk(){Lf&&(Lf.detachEvent("onpropertychange",XA),d0=Lf=null)}function XA(e){if(e.propertyName==="value"&&ty(d0)){var t=[];KA(t,d0,e,p3(e)),UA(Ez,t)}}function Mz(e,t,n){e==="focusin"?(fk(),Lf=t,d0=n,Lf.attachEvent("onpropertychange",XA)):e==="focusout"&&fk()}function Nz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ty(d0)}function Iz(e,t){if(e==="click")return ty(t)}function Rz(e,t){if(e==="input"||e==="change")return ty(t)}function jz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ei=typeof Object.is=="function"?Object.is:jz;function h0(e,t){if(Ei(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(!lw.call(t,s)||!Ei(e[s],t[s]))return!1}return!0}function mk(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pk(e,t){var n=mk(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=mk(n)}}function QA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?QA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function JA(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Eg(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=Eg(e.document)}return t}function w3(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 Lz=$a&&"documentMode"in document&&11>=document.documentMode,md=null,pw=null,Df=null,gw=!1;function gk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gw||md==null||md!==Eg(r)||(r=md,"selectionStart"in r&&w3(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}),Df&&h0(Df,r)||(Df=r,r=Wg(pw,"onSelect"),0<r.length&&(t=new Z1("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=md)))}function Nc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pd={animationend:Nc("Animation","AnimationEnd"),animationiteration:Nc("Animation","AnimationIteration"),animationstart:Nc("Animation","AnimationStart"),transitionrun:Nc("Transition","TransitionRun"),transitionstart:Nc("Transition","TransitionStart"),transitioncancel:Nc("Transition","TransitionCancel"),transitionend:Nc("Transition","TransitionEnd")},Pb={},ZA={};$a&&(ZA=document.createElement("div").style,"AnimationEvent"in window||(delete pd.animationend.animation,delete pd.animationiteration.animation,delete pd.animationstart.animation),"TransitionEvent"in window||delete pd.transitionend.transition);function Mu(e){if(Pb[e])return Pb[e];if(!pd[e])return e;var t=pd[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ZA)return Pb[e]=t[n];return e}var eE=Mu("animationend"),tE=Mu("animationiteration"),nE=Mu("animationstart"),Dz=Mu("transitionrun"),Oz=Mu("transitionstart"),Bz=Mu("transitioncancel"),rE=Mu("transitionend"),sE=new Map,yw="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(" ");yw.push("scrollEnd");function wo(e,t){sE.set(e,t),Au(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)},Bi=[],gd=0,v3=0;function ny(){for(var e=gd,t=v3=gd=0;t<e;){var n=Bi[t];Bi[t++]=null;var r=Bi[t];Bi[t++]=null;var s=Bi[t];Bi[t++]=null;var i=Bi[t];if(Bi[t++]=null,r!==null&&s!==null){var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}i!==0&&iE(n,s,i)}}function ry(e,t,n,r){Bi[gd++]=e,Bi[gd++]=t,Bi[gd++]=n,Bi[gd++]=r,v3|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function x3(e,t,n,r){return ry(e,t,n,r),Ng(e)}function Nu(e,t){return ry(e,null,null,t),Ng(e)}function iE(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-Si(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function Ng(e){if(50<Hf)throw Hf=0,Pw=null,Error(we(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var yd={};function Pz(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 bi(e,t,n,r){return new Pz(e,t,n,r)}function _3(e){return e=e.prototype,!(!e||!e.isReactComponent)}function La(e,t){var n=e.alternate;return n===null?(n=bi(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 oE(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 Gp(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")_3(e)&&(o=1);else if(typeof e=="string")o=U$(e,n,Go.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case sw:return e=bi(31,n,t,s),e.elementType=sw,e.lanes=i,e;case cd:return iu(n.children,s,i,t);case TA:o=8,s|=24;break;case tw:return e=bi(12,n,t,s|2),e.elementType=tw,e.lanes=i,e;case nw:return e=bi(13,n,t,s),e.elementType=nw,e.lanes=i,e;case rw:return e=bi(19,n,t,s),e.elementType=rw,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ea:o=10;break e;case CA:o=9;break e;case l3:o=11;break e;case c3:o=14;break e;case bl:o=16,r=null;break e}o=29,n=Error(we(130,e===null?"null":typeof e,"")),r=null}return t=bi(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function iu(e,t,n,r){return e=bi(7,e,r,t),e.lanes=n,e}function zb(e,t,n){return e=bi(6,e,null,t),e.lanes=n,e}function aE(e){var t=bi(18,null,null,0);return t.stateNode=e,t}function $b(e,t,n){return t=bi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var yk=new WeakMap;function Vi(e,t){if(typeof e=="object"&&e!==null){var n=yk.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Q6(t)},yk.set(e,t),t)}return{value:e,source:t,stack:Q6(t)}}var bd=[],wd=0,Ig=null,f0=0,zi=[],$i=0,Zl=null,$o=1,qo="";function _a(e,t){bd[wd++]=f0,bd[wd++]=Ig,Ig=e,f0=t}function lE(e,t,n){zi[$i++]=$o,zi[$i++]=qo,zi[$i++]=Zl,Zl=e;var r=$o;e=qo;var s=32-Si(r)-1;r&=~(1<<s),n+=1;var i=32-Si(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,$o=1<<32-Si(t)+s|n<<s|r,qo=i+e}else $o=1<<i|n<<s|r,qo=e}function k3(e){e.return!==null&&(_a(e,1),lE(e,1,0))}function S3(e){for(;e===Ig;)Ig=bd[--wd],bd[wd]=null,f0=bd[--wd],bd[wd]=null;for(;e===Zl;)Zl=zi[--$i],zi[$i]=null,qo=zi[--$i],zi[$i]=null,$o=zi[--$i],zi[$i]=null}function cE(e,t){zi[$i++]=$o,zi[$i++]=qo,zi[$i++]=Zl,$o=t.id,qo=t.overflow,Zl=e}var as=null,Gn=null,ln=!1,ql=null,Wi=!1,bw=Error(we(519));function ec(e){var t=Error(we(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw m0(Vi(t,e)),bw}function bk(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[os]=e,t[si]=r,n){case"dialog":Jt("cancel",t),Jt("close",t);break;case"iframe":case"object":case"embed":Jt("load",t);break;case"video":case"audio":for(n=0;n<b0.length;n++)Jt(b0[n],t);break;case"source":Jt("error",t);break;case"img":case"image":case"link":Jt("error",t),Jt("load",t);break;case"details":Jt("toggle",t);break;case"input":Jt("invalid",t),zA(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Jt("invalid",t);break;case"textarea":Jt("invalid",t),qA(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||VM(t.textContent,n)?(r.popover!=null&&(Jt("beforetoggle",t),Jt("toggle",t)),r.onScroll!=null&&Jt("scroll",t),r.onScrollEnd!=null&&Jt("scrollend",t),r.onClick!=null&&(t.onclick=Ma),t=!0):t=!1,t||ec(e,!0)}function wk(e){for(as=e.return;as;)switch(as.tag){case 5:case 31:case 13:Wi=!1;return;case 27:case 3:Wi=!0;return;default:as=as.return}}function Yu(e){if(e!==as)return!1;if(!ln)return wk(e),ln=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Uw(e.type,e.memoizedProps)),n=!n),n&&Gn&&ec(e),wk(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(we(317));Gn=i8(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(we(317));Gn=i8(e)}else t===27?(t=Gn,pc(e.type)?(e=Gw,Gw=null,Gn=e):Gn=t):Gn=as?Ji(e.stateNode.nextSibling):null;return!0}function pu(){Gn=as=null,ln=!1}function qb(){var e=ql;return e!==null&&(Xs===null?Xs=e:Xs.push.apply(Xs,e),ql=null),e}function m0(e){ql===null?ql=[e]:ql.push(e)}var ww=Xo(null),Iu=null,Na=null;function Sl(e,t,n){Vn(ww,t._currentValue),t._currentValue=n}function Da(e){e._currentValue=ww.current,Yr(ww)}function vw(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 xw(e,t,n,r){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var o=s.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=s;for(var l=0;l<t.length;l++)if(a.context===t[l]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),vw(i.return,n,e),r||(o=null);break e}i=a.next}}else if(s.tag===18){if(o=s.return,o===null)throw Error(we(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),vw(o,n,e),o=null}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}}function bh(e,t,n,r){e=null;for(var s=t,i=!1;s!==null;){if(!i){if(s.flags&524288)i=!0;else if(s.flags&262144)break}if(s.tag===10){var o=s.alternate;if(o===null)throw Error(we(387));if(o=o.memoizedProps,o!==null){var a=s.type;Ei(s.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(s===Sg.current){if(o=s.alternate,o===null)throw Error(we(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(v0):e=[v0])}s=s.return}e!==null&&xw(t,e,n,r),t.flags|=262144}function Rg(e){for(e=e.firstContext;e!==null;){if(!Ei(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function gu(e){Iu=e,Na=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ls(e){return uE(Iu,e)}function $m(e,t){return Iu===null&&gu(e),uE(e,t)}function uE(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Na===null){if(e===null)throw Error(we(308));Na=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Na=Na.next=t;return n}var zz=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()})}},$z=$r.unstable_scheduleCallback,qz=$r.unstable_NormalPriority,Tr={$$typeof:Ea,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function T3(){return{controller:new zz,data:new Map,refCount:0}}function Z0(e){e.refCount--,e.refCount===0&&$z(qz,function(){e.controller.abort()})}var Of=null,_w=0,Wd=0,Nd=null;function Fz(e,t){if(Of===null){var n=Of=[];_w=0,Wd=X3(),Nd={status:"pending",value:void 0,then:function(r){n.push(r)}}}return _w++,t.then(vk,vk),t}function vk(){if(--_w===0&&Of!==null){Nd!==null&&(Nd.status="fulfilled");var e=Of;Of=null,Wd=0,Nd=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Uz(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 xk=Dt.S;Dt.S=function(e,t){SM=_i(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Fz(e,t),xk!==null&&xk(e,t)};var ou=Xo(null);function C3(){var e=ou.current;return e!==null?e:zn.pooledCache}function Kp(e,t){t===null?Vn(ou,ou.current):Vn(ou,t.pool)}function dE(){var e=C3();return e===null?null:{parent:Tr._currentValue,pool:e}}var wh=Error(we(460)),A3=Error(we(474)),sy=Error(we(542)),jg={then:function(){}};function _k(e){return e=e.status,e==="fulfilled"||e==="rejected"}function hE(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ma,Ma),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Sk(e),e;default:if(typeof t.status=="string")t.then(Ma,Ma);else{if(e=zn,e!==null&&100<e.shellSuspendCounter)throw Error(we(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,Sk(e),e}throw au=t,wh}}function qc(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(au=n,wh):n}}var au=null;function kk(){if(au===null)throw Error(we(459));var e=au;return au=null,e}function Sk(e){if(e===wh||e===sy)throw Error(we(483))}var Id=null,p0=0;function qm(e){var t=p0;return p0+=1,Id===null&&(Id=[]),hE(Id,e,t)}function Gh(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Fm(e,t){throw t.$$typeof===MP?Error(we(525)):(e=Object.prototype.toString.call(t),Error(we(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function fE(e){function t(b,w){if(e){var v=b.deletions;v===null?(b.deletions=[w],b.flags|=16):v.push(w)}}function n(b,w){if(!e)return null;for(;w!==null;)t(b,w),w=w.sibling;return null}function r(b){for(var w=new Map;b!==null;)b.key!==null?w.set(b.key,b):w.set(b.index,b),b=b.sibling;return w}function s(b,w){return b=La(b,w),b.index=0,b.sibling=null,b}function i(b,w,v){return b.index=v,e?(v=b.alternate,v!==null?(v=v.index,v<w?(b.flags|=67108866,w):v):(b.flags|=67108866,w)):(b.flags|=1048576,w)}function o(b){return e&&b.alternate===null&&(b.flags|=67108866),b}function a(b,w,v,_){return w===null||w.tag!==6?(w=zb(v,b.mode,_),w.return=b,w):(w=s(w,v),w.return=b,w)}function l(b,w,v,_){var S=v.type;return S===cd?u(b,w,v.props.children,_,v.key):w!==null&&(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===bl&&qc(S)===w.type)?(w=s(w,v.props),Gh(w,v),w.return=b,w):(w=Gp(v.type,v.key,v.props,null,b.mode,_),Gh(w,v),w.return=b,w)}function c(b,w,v,_){return w===null||w.tag!==4||w.stateNode.containerInfo!==v.containerInfo||w.stateNode.implementation!==v.implementation?(w=$b(v,b.mode,_),w.return=b,w):(w=s(w,v.children||[]),w.return=b,w)}function u(b,w,v,_,S){return w===null||w.tag!==7?(w=iu(v,b.mode,_,S),w.return=b,w):(w=s(w,v),w.return=b,w)}function d(b,w,v){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=zb(""+w,b.mode,v),w.return=b,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Lm:return v=Gp(w.type,w.key,w.props,null,b.mode,v),Gh(v,w),v.return=b,v;case pf:return w=$b(w,b.mode,v),w.return=b,w;case bl:return w=qc(w),d(b,w,v)}if(gf(w)||Hh(w))return w=iu(w,b.mode,v,null),w.return=b,w;if(typeof w.then=="function")return d(b,qm(w),v);if(w.$$typeof===Ea)return d(b,$m(b,w),v);Fm(b,w)}return null}function f(b,w,v,_){var S=w!==null?w.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return S!==null?null:a(b,w,""+v,_);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Lm:return v.key===S?l(b,w,v,_):null;case pf:return v.key===S?c(b,w,v,_):null;case bl:return v=qc(v),f(b,w,v,_)}if(gf(v)||Hh(v))return S!==null?null:u(b,w,v,_,null);if(typeof v.then=="function")return f(b,w,qm(v),_);if(v.$$typeof===Ea)return f(b,w,$m(b,v),_);Fm(b,v)}return null}function m(b,w,v,_,S){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return b=b.get(v)||null,a(w,b,""+_,S);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Lm:return b=b.get(_.key===null?v:_.key)||null,l(w,b,_,S);case pf:return b=b.get(_.key===null?v:_.key)||null,c(w,b,_,S);case bl:return _=qc(_),m(b,w,v,_,S)}if(gf(_)||Hh(_))return b=b.get(v)||null,u(w,b,_,S,null);if(typeof _.then=="function")return m(b,w,v,qm(_),S);if(_.$$typeof===Ea)return m(b,w,v,$m(w,_),S);Fm(w,_)}return null}function p(b,w,v,_){for(var S=null,C=null,E=w,R=w=0,j=null;E!==null&&R<v.length;R++){E.index>R?(j=E,E=null):j=E.sibling;var N=f(b,E,v[R],_);if(N===null){E===null&&(E=j);break}e&&E&&N.alternate===null&&t(b,E),w=i(N,w,R),C===null?S=N:C.sibling=N,C=N,E=j}if(R===v.length)return n(b,E),ln&&_a(b,R),S;if(E===null){for(;R<v.length;R++)E=d(b,v[R],_),E!==null&&(w=i(E,w,R),C===null?S=E:C.sibling=E,C=E);return ln&&_a(b,R),S}for(E=r(E);R<v.length;R++)j=m(E,b,R,v[R],_),j!==null&&(e&&j.alternate!==null&&E.delete(j.key===null?R:j.key),w=i(j,w,R),C===null?S=j:C.sibling=j,C=j);return e&&E.forEach(function(B){return t(b,B)}),ln&&_a(b,R),S}function y(b,w,v,_){if(v==null)throw Error(we(151));for(var S=null,C=null,E=w,R=w=0,j=null,N=v.next();E!==null&&!N.done;R++,N=v.next()){E.index>R?(j=E,E=null):j=E.sibling;var B=f(b,E,N.value,_);if(B===null){E===null&&(E=j);break}e&&E&&B.alternate===null&&t(b,E),w=i(B,w,R),C===null?S=B:C.sibling=B,C=B,E=j}if(N.done)return n(b,E),ln&&_a(b,R),S;if(E===null){for(;!N.done;R++,N=v.next())N=d(b,N.value,_),N!==null&&(w=i(N,w,R),C===null?S=N:C.sibling=N,C=N);return ln&&_a(b,R),S}for(E=r(E);!N.done;R++,N=v.next())N=m(E,b,R,N.value,_),N!==null&&(e&&N.alternate!==null&&E.delete(N.key===null?R:N.key),w=i(N,w,R),C===null?S=N:C.sibling=N,C=N);return e&&E.forEach(function(M){return t(b,M)}),ln&&_a(b,R),S}function x(b,w,v,_){if(typeof v=="object"&&v!==null&&v.type===cd&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Lm:e:{for(var S=v.key;w!==null;){if(w.key===S){if(S=v.type,S===cd){if(w.tag===7){n(b,w.sibling),_=s(w,v.props.children),_.return=b,b=_;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===bl&&qc(S)===w.type){n(b,w.sibling),_=s(w,v.props),Gh(_,v),_.return=b,b=_;break e}n(b,w);break}else t(b,w);w=w.sibling}v.type===cd?(_=iu(v.props.children,b.mode,_,v.key),_.return=b,b=_):(_=Gp(v.type,v.key,v.props,null,b.mode,_),Gh(_,v),_.return=b,b=_)}return o(b);case pf:e:{for(S=v.key;w!==null;){if(w.key===S)if(w.tag===4&&w.stateNode.containerInfo===v.containerInfo&&w.stateNode.implementation===v.implementation){n(b,w.sibling),_=s(w,v.children||[]),_.return=b,b=_;break e}else{n(b,w);break}else t(b,w);w=w.sibling}_=$b(v,b.mode,_),_.return=b,b=_}return o(b);case bl:return v=qc(v),x(b,w,v,_)}if(gf(v))return p(b,w,v,_);if(Hh(v)){if(S=Hh(v),typeof S!="function")throw Error(we(150));return v=S.call(v),y(b,w,v,_)}if(typeof v.then=="function")return x(b,w,qm(v),_);if(v.$$typeof===Ea)return x(b,w,$m(b,v),_);Fm(b,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,w!==null&&w.tag===6?(n(b,w.sibling),_=s(w,v),_.return=b,b=_):(n(b,w),_=zb(v,b.mode,_),_.return=b,b=_),o(b)):n(b,w)}return function(b,w,v,_){try{p0=0;var S=x(b,w,v,_);return Id=null,S}catch(E){if(E===wh||E===sy)throw E;var C=bi(29,E,null,b.mode);return C.lanes=_,C.return=b,C}finally{}}}var yu=fE(!0),mE=fE(!1),wl=!1;function E3(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function kw(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 Fl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ul(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,yn&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=Ng(e),iE(e,null,n),t}return ry(e,r,t,n),Ng(e)}function Bf(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,RA(e,n)}}function Fb(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Sw=!1;function Pf(){if(Sw){var e=Nd;if(e!==null)throw e}}function zf(e,t,n,r){Sw=!1;var s=e.updateQueue;wl=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=s.baseState;o=0,u=c=l=null,a=i;do{var f=a.lane&-536870913,m=f!==a.lane;if(m?(rn&f)===f:(r&f)===f){f!==0&&f===Wd&&(Sw=!0),u!==null&&(u=u.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var p=e,y=a;f=t;var x=n;switch(y.tag){case 1:if(p=y.payload,typeof p=="function"){d=p.call(x,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(x,d,f):p,f==null)break e;d=Xn({},d,f);break e;case 2:wl=!0}}f=a.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=s.callbacks,m===null?s.callbacks=[f]:m.push(f))}else m={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=d):u=u.next=m,o|=f;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;m=a,a=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);u===null&&(l=d),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,i===null&&(s.shared.lanes=0),nc|=o,e.lanes=o,e.memoizedState=d}}function pE(e,t){if(typeof e!="function")throw Error(we(191,e));e.call(t)}function gE(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)pE(n[e],t)}var Gd=Xo(null),Lg=Xo(0);function Tk(e,t){e=Ha,Vn(Lg,e),Vn(Gd,t),Ha=e|t.baseLanes}function Tw(){Vn(Lg,Ha),Vn(Gd,Gd.current)}function M3(){Ha=Lg.current,Yr(Gd),Yr(Lg)}var Mi=Xo(null),Qi=null;function Tl(e){var t=e.alternate;Vn(pr,pr.current&1),Vn(Mi,e),Qi===null&&(t===null||Gd.current!==null||t.memoizedState!==null)&&(Qi=e)}function Cw(e){Vn(pr,pr.current),Vn(Mi,e),Qi===null&&(Qi=e)}function yE(e){e.tag===22?(Vn(pr,pr.current),Vn(Mi,e),Qi===null&&(Qi=e)):Cl()}function Cl(){Vn(pr,pr.current),Vn(Mi,Mi.current)}function yi(e){Yr(Mi),Qi===e&&(Qi=null),Yr(pr)}var pr=Xo(0);function Dg(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Vw(n)||Ww(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 qa=0,Vt=null,Nn=null,_r=null,Og=!1,Rd=!1,bu=!1,Bg=0,g0=0,jd=null,Hz=0;function or(){throw Error(we(321))}function N3(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ei(e[n],t[n]))return!1;return!0}function I3(e,t,n,r,s,i){return qa=i,Vt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Dt.H=e===null||e.memoizedState===null?KE:F3,bu=!1,i=n(r,s),bu=!1,Rd&&(i=wE(t,n,r,s)),bE(e),i}function bE(e){Dt.H=y0;var t=Nn!==null&&Nn.next!==null;if(qa=0,_r=Nn=Vt=null,Og=!1,g0=0,jd=null,t)throw Error(we(300));e===null||Cr||(e=e.dependencies,e!==null&&Rg(e)&&(Cr=!0))}function wE(e,t,n,r){Vt=e;var s=0;do{if(Rd&&(jd=null),g0=0,Rd=!1,25<=s)throw Error(we(301));if(s+=1,_r=Nn=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Dt.H=YE,i=t(n,r)}while(Rd);return i}function Vz(){var e=Dt.H,t=e.useState()[0];return t=typeof t.then=="function"?em(t):t,e=e.useState()[0],(Nn!==null?Nn.memoizedState:null)!==e&&(Vt.flags|=1024),t}function R3(){var e=Bg!==0;return Bg=0,e}function j3(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function L3(e){if(Og){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Og=!1}qa=0,_r=Nn=Vt=null,Rd=!1,g0=Bg=0,jd=null}function Ns(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _r===null?Vt.memoizedState=_r=e:_r=_r.next=e,_r}function gr(){if(Nn===null){var e=Vt.alternate;e=e!==null?e.memoizedState:null}else e=Nn.next;var t=_r===null?Vt.memoizedState:_r.next;if(t!==null)_r=t,Nn=e;else{if(e===null)throw Vt.alternate===null?Error(we(467)):Error(we(310));Nn=e,e={memoizedState:Nn.memoizedState,baseState:Nn.baseState,baseQueue:Nn.baseQueue,queue:Nn.queue,next:null},_r===null?Vt.memoizedState=_r=e:_r=_r.next=e}return _r}function iy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function em(e){var t=g0;return g0+=1,jd===null&&(jd=[]),e=hE(jd,e,t),t=Vt,(_r===null?t.memoizedState:_r.next)===null&&(t=t.alternate,Dt.H=t===null||t.memoizedState===null?KE:F3),e}function oy(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return em(e);if(e.$$typeof===Ea)return ls(e)}throw Error(we(438,String(e)))}function D3(e){var t=null,n=Vt.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Vt.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=iy(),Vt.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]=NP;return t.index++,n}function Fa(e,t){return typeof t=="function"?t(e):t}function Yp(e){var t=gr();return O3(t,Nn,e)}function O3(e,t,n){var r=e.queue;if(r===null)throw Error(we(311));r.lastRenderedReducer=n;var s=e.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}t.baseQueue=s=i,r.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var a=o=null,l=null,c=t,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(rn&d)===d:(qa&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===Wd&&(u=!0);else if((qa&f)===f){c=c.next,f===Wd&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=d,o=i):l=l.next=d,Vt.lanes|=f,nc|=f;d=c.action,bu&&n(i,d),i=c.hasEagerState?c.eagerState:n(i,d)}else f={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=f,o=i):l=l.next=f,Vt.lanes|=d,nc|=d;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!Ei(i,e.memoizedState)&&(Cr=!0,u&&(n=Nd,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=l,r.lastRenderedState=i}return s===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ub(e){var t=gr(),n=t.queue;if(n===null)throw Error(we(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Ei(i,t.memoizedState)||(Cr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function vE(e,t,n){var r=Vt,s=gr(),i=ln;if(i){if(n===void 0)throw Error(we(407));n=n()}else n=t();var o=!Ei((Nn||s).memoizedState,n);if(o&&(s.memoizedState=n,Cr=!0),s=s.queue,B3(kE.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||_r!==null&&_r.memoizedState.tag&1){if(r.flags|=2048,Kd(9,{destroy:void 0},_E.bind(null,r,s,n,t),null),zn===null)throw Error(we(349));i||qa&127||xE(r,t,n)}return n}function xE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Vt.updateQueue,t===null?(t=iy(),Vt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function _E(e,t,n,r){t.value=n,t.getSnapshot=r,SE(t)&&TE(e)}function kE(e,t,n){return n(function(){SE(t)&&TE(e)})}function SE(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ei(e,n)}catch{return!0}}function TE(e){var t=Nu(e,2);t!==null&&ni(t,e,2)}function Aw(e){var t=Ns();if(typeof e=="function"){var n=e;if(e=n(),bu){Nl(!0);try{n()}finally{Nl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:e},t}function CE(e,t,n,r){return e.baseState=n,O3(e,Nn,typeof r=="function"?r:Fa)}function Wz(e,t,n,r,s){if(ly(e))throw Error(we(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};Dt.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,AE(t,i)):(i.next=n.next,t.pending=n.next=i)}}function AE(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=Dt.T,o={};Dt.T=o;try{var a=n(s,r),l=Dt.S;l!==null&&l(o,a),Ck(e,t,a)}catch(c){Ew(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),Dt.T=i}}else try{i=n(s,r),Ck(e,t,i)}catch(c){Ew(e,t,c)}}function Ck(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){Ak(e,t,r)},function(r){return Ew(e,t,r)}):Ak(e,t,n)}function Ak(e,t,n){t.status="fulfilled",t.value=n,EE(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,AE(e,n)))}function Ew(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,EE(t),t=t.next;while(t!==r)}e.action=null}function EE(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ME(e,t){return t}function Ek(e,t){if(ln){var n=zn.formState;if(n!==null){e:{var r=Vt;if(ln){if(Gn){t:{for(var s=Gn,i=Wi;s.nodeType!==8;){if(!i){s=null;break t}if(s=Ji(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Gn=Ji(s.nextSibling),r=s.data==="F!";break e}}ec(r)}r=!1}r&&(t=n[0])}}return n=Ns(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ME,lastRenderedState:t},n.queue=r,n=VE.bind(null,Vt,r),r.dispatch=n,r=Aw(!1),i=q3.bind(null,Vt,!1,r.queue),r=Ns(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=Wz.bind(null,Vt,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function Mk(e){var t=gr();return NE(t,Nn,e)}function NE(e,t,n){if(t=O3(e,t,ME)[0],e=Yp(Fa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=em(t)}catch(o){throw o===wh?sy:o}else r=t;t=gr();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(Vt.flags|=2048,Kd(9,{destroy:void 0},Gz.bind(null,s,n),null)),[r,i,e]}function Gz(e,t){e.action=t}function Nk(e){var t=gr(),n=Nn;if(n!==null)return NE(t,n,e);gr(),t=t.memoizedState,n=gr();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Kd(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Vt.updateQueue,t===null&&(t=iy(),Vt.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 IE(){return gr().memoizedState}function Xp(e,t,n,r){var s=Ns();Vt.flags|=e,s.memoizedState=Kd(1|t,{destroy:void 0},n,r===void 0?null:r)}function ay(e,t,n,r){var s=gr();r=r===void 0?null:r;var i=s.memoizedState.inst;Nn!==null&&r!==null&&N3(r,Nn.memoizedState.deps)?s.memoizedState=Kd(t,i,n,r):(Vt.flags|=e,s.memoizedState=Kd(1|t,i,n,r))}function Ik(e,t){Xp(8390656,8,e,t)}function B3(e,t){ay(2048,8,e,t)}function Kz(e){Vt.flags|=4;var t=Vt.updateQueue;if(t===null)t=iy(),Vt.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function RE(e){var t=gr().memoizedState;return Kz({ref:t,nextImpl:e}),function(){if(yn&2)throw Error(we(440));return t.impl.apply(void 0,arguments)}}function jE(e,t){return ay(4,2,e,t)}function LE(e,t){return ay(4,4,e,t)}function DE(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 OE(e,t,n){n=n!=null?n.concat([e]):null,ay(4,4,DE.bind(null,t,e),n)}function P3(){}function BE(e,t){var n=gr();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&N3(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function PE(e,t){var n=gr();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&N3(t,r[1]))return r[0];if(r=e(),bu){Nl(!0);try{e()}finally{Nl(!1)}}return n.memoizedState=[r,t],r}function z3(e,t,n){return n===void 0||qa&1073741824&&!(rn&261930)?e.memoizedState=t:(e.memoizedState=n,e=CM(),Vt.lanes|=e,nc|=e,n)}function zE(e,t,n,r){return Ei(n,t)?n:Gd.current!==null?(e=z3(e,n,r),Ei(e,t)||(Cr=!0),e):!(qa&42)||qa&1073741824&&!(rn&261930)?(Cr=!0,e.memoizedState=n):(e=CM(),Vt.lanes|=e,nc|=e,t)}function $E(e,t,n,r,s){var i=wn.p;wn.p=i!==0&&8>i?i:8;var o=Dt.T,a={};Dt.T=a,q3(e,!1,t,n);try{var l=s(),c=Dt.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=Uz(l,r);$f(e,t,u,Ti(e))}else $f(e,t,r,Ti(e))}catch(d){$f(e,t,{then:function(){},status:"rejected",reason:d},Ti())}finally{wn.p=i,o!==null&&a.types!==null&&(o.types=a.types),Dt.T=o}}function Yz(){}function Mw(e,t,n,r){if(e.tag!==5)throw Error(we(476));var s=qE(e).queue;$E(e,s,t,su,n===null?Yz:function(){return FE(e),n(r)})}function qE(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:su,baseState:su,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:su},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function FE(e){var t=qE(e);t.next===null&&(t=e.alternate.memoizedState),$f(e,t.next.queue,{},Ti())}function $3(){return ls(v0)}function UE(){return gr().memoizedState}function HE(){return gr().memoizedState}function Xz(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ti();e=Fl(n);var r=Ul(t,e,n);r!==null&&(ni(r,t,n),Bf(r,t,n)),t={cache:T3()},e.payload=t;return}t=t.return}}function Qz(e,t,n){var r=Ti();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ly(e)?WE(t,n):(n=x3(e,t,n,r),n!==null&&(ni(n,e,r),GE(n,t,r)))}function VE(e,t,n){var r=Ti();$f(e,t,n,r)}function $f(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ly(e))WE(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Ei(a,o))return ry(e,t,s,0),zn===null&&ny(),!1}catch{}finally{}if(n=x3(e,t,s,r),n!==null)return ni(n,e,r),GE(n,t,r),!0}return!1}function q3(e,t,n,r){if(r={lane:2,revertLane:X3(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ly(e)){if(t)throw Error(we(479))}else t=x3(e,n,r,2),t!==null&&ni(t,e,2)}function ly(e){var t=e.alternate;return e===Vt||t!==null&&t===Vt}function WE(e,t){Rd=Og=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function GE(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,RA(e,n)}}var y0={readContext:ls,use:oy,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useLayoutEffect:or,useInsertionEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useSyncExternalStore:or,useId:or,useHostTransitionStatus:or,useFormState:or,useActionState:or,useOptimistic:or,useMemoCache:or,useCacheRefresh:or};y0.useEffectEvent=or;var KE={readContext:ls,use:oy,useCallback:function(e,t){return Ns().memoizedState=[e,t===void 0?null:t],e},useContext:ls,useEffect:Ik,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Xp(4194308,4,DE.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xp(4194308,4,e,t)},useInsertionEffect:function(e,t){Xp(4,2,e,t)},useMemo:function(e,t){var n=Ns();t=t===void 0?null:t;var r=e();if(bu){Nl(!0);try{e()}finally{Nl(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ns();if(n!==void 0){var s=n(t);if(bu){Nl(!0);try{n(t)}finally{Nl(!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=Qz.bind(null,Vt,e),[r.memoizedState,e]},useRef:function(e){var t=Ns();return e={current:e},t.memoizedState=e},useState:function(e){e=Aw(e);var t=e.queue,n=VE.bind(null,Vt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:P3,useDeferredValue:function(e,t){var n=Ns();return z3(n,e,t)},useTransition:function(){var e=Aw(!1);return e=$E.bind(null,Vt,e.queue,!0,!1),Ns().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Vt,s=Ns();if(ln){if(n===void 0)throw Error(we(407));n=n()}else{if(n=t(),zn===null)throw Error(we(349));rn&127||xE(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Ik(kE.bind(null,r,i,e),[e]),r.flags|=2048,Kd(9,{destroy:void 0},_E.bind(null,r,i,n,t),null),n},useId:function(){var e=Ns(),t=zn.identifierPrefix;if(ln){var n=qo,r=$o;n=(r&~(1<<32-Si(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Bg++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Hz++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:$3,useFormState:Ek,useActionState:Ek,useOptimistic:function(e){var t=Ns();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=q3.bind(null,Vt,!0,n),n.dispatch=t,[e,t]},useMemoCache:D3,useCacheRefresh:function(){return Ns().memoizedState=Xz.bind(null,Vt)},useEffectEvent:function(e){var t=Ns(),n={impl:e};return t.memoizedState=n,function(){if(yn&2)throw Error(we(440));return n.impl.apply(void 0,arguments)}}},F3={readContext:ls,use:oy,useCallback:BE,useContext:ls,useEffect:B3,useImperativeHandle:OE,useInsertionEffect:jE,useLayoutEffect:LE,useMemo:PE,useReducer:Yp,useRef:IE,useState:function(){return Yp(Fa)},useDebugValue:P3,useDeferredValue:function(e,t){var n=gr();return zE(n,Nn.memoizedState,e,t)},useTransition:function(){var e=Yp(Fa)[0],t=gr().memoizedState;return[typeof e=="boolean"?e:em(e),t]},useSyncExternalStore:vE,useId:UE,useHostTransitionStatus:$3,useFormState:Mk,useActionState:Mk,useOptimistic:function(e,t){var n=gr();return CE(n,Nn,e,t)},useMemoCache:D3,useCacheRefresh:HE};F3.useEffectEvent=RE;var YE={readContext:ls,use:oy,useCallback:BE,useContext:ls,useEffect:B3,useImperativeHandle:OE,useInsertionEffect:jE,useLayoutEffect:LE,useMemo:PE,useReducer:Ub,useRef:IE,useState:function(){return Ub(Fa)},useDebugValue:P3,useDeferredValue:function(e,t){var n=gr();return Nn===null?z3(n,e,t):zE(n,Nn.memoizedState,e,t)},useTransition:function(){var e=Ub(Fa)[0],t=gr().memoizedState;return[typeof e=="boolean"?e:em(e),t]},useSyncExternalStore:vE,useId:UE,useHostTransitionStatus:$3,useFormState:Nk,useActionState:Nk,useOptimistic:function(e,t){var n=gr();return Nn!==null?CE(n,Nn,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:D3,useCacheRefresh:HE};YE.useEffectEvent=RE;function Hb(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Xn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Nw={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ti(),s=Fl(r);s.payload=t,n!=null&&(s.callback=n),t=Ul(e,s,r),t!==null&&(ni(t,e,r),Bf(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ti(),s=Fl(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Ul(e,s,r),t!==null&&(ni(t,e,r),Bf(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ti(),r=Fl(n);r.tag=2,t!=null&&(r.callback=t),t=Ul(e,r,n),t!==null&&(ni(t,e,n),Bf(t,e,n))}};function Rk(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!h0(n,r)||!h0(s,i):!0}function jk(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&&Nw.enqueueReplaceState(t,t.state,null)}function wu(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=Xn({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function XE(e){Mg(e)}function QE(e){console.error(e)}function JE(e){Mg(e)}function Pg(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Lk(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 Iw(e,t,n){return n=Fl(n),n.tag=3,n.payload={element:null},n.callback=function(){Pg(e,t)},n}function ZE(e){return e=Fl(e),e.tag=3,e}function eM(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(){Lk(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Lk(t,n,r),typeof s!="function"&&(Hl===null?Hl=new Set([this]):Hl.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}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&&bh(t,n,s,!0),n=Mi.current,n!==null){switch(n.tag){case 31:case 13:return Qi===null?Ug():n.alternate===null&&lr===0&&(lr=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===jg?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),t2(e,r,s)),!1;case 22:return n.flags|=65536,r===jg?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)),t2(e,r,s)),!1}throw Error(we(435,n.tag))}return t2(e,r,s),Ug(),!1}if(ln)return t=Mi.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==bw&&(e=Error(we(422),{cause:r}),m0(Vi(e,n)))):(r!==bw&&(t=Error(we(423),{cause:r}),m0(Vi(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=Vi(r,n),s=Iw(e.stateNode,r,s),Fb(e,s),lr!==4&&(lr=2)),!1;var i=Error(we(520),{cause:r});if(i=Vi(i,n),Uf===null?Uf=[i]:Uf.push(i),lr!==4&&(lr=2),t===null)return!0;r=Vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=Iw(n.stateNode,r,e),Fb(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"&&(Hl===null||!Hl.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=ZE(s),eM(s,e,n,r),Fb(n,s),!1}n=n.return}while(n!==null);return!1}var U3=Error(we(461)),Cr=!1;function rs(e,t,n,r){t.child=e===null?mE(t,null,n,r):yu(t,e.child,n,r)}function Dk(e,t,n,r,s){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var a in r)a!=="ref"&&(o[a]=r[a])}else o=r;return gu(t),r=I3(e,t,n,o,i,s),a=R3(),e!==null&&!Cr?(j3(e,t,s),Ua(e,t,s)):(ln&&a&&k3(t),t.flags|=1,rs(e,t,r,s),t.child)}function Ok(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!_3(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,tM(e,t,i,r,s)):(e=Gp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!H3(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:h0,n(o,r)&&e.ref===t.ref)return Ua(e,t,s)}return t.flags|=1,e=La(i,r),e.ref=t.ref,e.return=t,t.child=e}function tM(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(h0(i,r)&&e.ref===t.ref)if(Cr=!1,t.pendingProps=r=i,H3(e,s))e.flags&131072&&(Cr=!0);else return t.lanes=e.lanes,Ua(e,t,s)}return Rw(e,t,n,r,s)}function nM(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 Bk(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Kp(t,i!==null?i.cachePool:null),i!==null?Tk(t,i):Tw(),yE(t);else return r=t.lanes=536870912,Bk(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(Kp(t,i.cachePool),Tk(t,i),Cl(),t.memoizedState=null):(e!==null&&Kp(t,null),Tw(),Cl());return rs(e,t,s,n),t.child}function bf(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bk(e,t,n,r,s){var i=C3();return i=i===null?null:{parent:Tr._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&Kp(t,null),Tw(),yE(t),e!==null&&bh(e,t,r,!0),t.childLanes=s,null}function Qp(e,t){return t=zg({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Pk(e,t,n){return yu(t,e.child,null,n),e=Qp(t,t.pendingProps),e.flags|=2,yi(t),t.memoizedState=null,e}function Zz(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ln){if(r.mode==="hidden")return e=Qp(t,r),t.lanes=536870912,bf(null,e);if(Cw(t),(e=Gn)?(e=KM(e,Wi),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zl!==null?{id:$o,overflow:qo}:null,retryLane:536870912,hydrationErrors:null},n=aE(e),n.return=t,t.child=n,as=t,Gn=null)):e=null,e===null)throw ec(t);return t.lanes=536870912,null}return Qp(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(Cw(t),s)if(t.flags&256)t.flags&=-257,t=Pk(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(we(558));else if(Cr||bh(e,t,n,!1),s=(n&e.childLanes)!==0,Cr||s){if(r=zn,r!==null&&(o=jA(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Nu(e,o),ni(r,e,o),U3;Ug(),t=Pk(e,t,n)}else e=i.treeContext,Gn=Ji(o.nextSibling),as=t,ln=!0,ql=null,Wi=!1,e!==null&&cE(t,e),t=Qp(t,r),t.flags|=4096;return t}return e=La(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Jp(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(we(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Rw(e,t,n,r,s){return gu(t),n=I3(e,t,n,r,void 0,s),r=R3(),e!==null&&!Cr?(j3(e,t,s),Ua(e,t,s)):(ln&&r&&k3(t),t.flags|=1,rs(e,t,n,s),t.child)}function zk(e,t,n,r,s,i){return gu(t),t.updateQueue=null,n=wE(t,r,n,s),bE(e),r=R3(),e!==null&&!Cr?(j3(e,t,i),Ua(e,t,i)):(ln&&r&&k3(t),t.flags|=1,rs(e,t,n,i),t.child)}function $k(e,t,n,r,s){if(gu(t),t.stateNode===null){var i=yd,o=n.contextType;typeof o=="object"&&o!==null&&(i=ls(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Nw,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},E3(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?ls(o):yd,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(Hb(t,n,o,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&Nw.enqueueReplaceState(i,i.state,null),zf(t,r,i,s),Pf(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,l=wu(n,a);i.props=l;var c=i.context,u=n.contextType;o=yd,typeof u=="object"&&u!==null&&(o=ls(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||c!==o)&&jk(t,i,r,o),wl=!1;var f=t.memoizedState;i.state=f,zf(t,r,i,s),Pf(),c=t.memoizedState,a||f!==c||wl?(typeof d=="function"&&(Hb(t,n,d,r),c=t.memoizedState),(l=wl||Rk(t,n,l,r,f,c,o))?(u||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=o,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,kw(e,t),o=t.memoizedProps,u=wu(n,o),i.props=u,d=t.pendingProps,f=i.context,c=n.contextType,l=yd,typeof c=="object"&&c!==null&&(l=ls(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==d||f!==l)&&jk(t,i,r,l),wl=!1,f=t.memoizedState,i.state=f,zf(t,r,i,s),Pf();var m=t.memoizedState;o!==d||f!==m||wl||e!==null&&e.dependencies!==null&&Rg(e.dependencies)?(typeof a=="function"&&(Hb(t,n,a,r),m=t.memoizedState),(u=wl||Rk(t,n,u,r,f,m,l)||e!==null&&e.dependencies!==null&&Rg(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,m,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,m,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),i.props=r,i.state=m,i.context=l,r=u):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Jp(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=yu(t,e.child,null,s),t.child=yu(t,null,n,s)):rs(e,t,n,s),t.memoizedState=i.state,e=t.child):e=Ua(e,t,s),e}function qk(e,t,n,r){return pu(),t.flags|=256,rs(e,t,n,r),t.child}var Vb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wb(e){return{baseLanes:e,cachePool:dE()}}function Gb(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=vi),e}function rM(e,t,n){var r=t.pendingProps,s=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(pr.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(ln){if(s?Tl(t):Cl(),(e=Gn)?(e=KM(e,Wi),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zl!==null?{id:$o,overflow:qo}:null,retryLane:536870912,hydrationErrors:null},n=aE(e),n.return=t,t.child=n,as=t,Gn=null)):e=null,e===null)throw ec(t);return Ww(e)?t.lanes=32:t.lanes=536870912,null}var a=r.children;return r=r.fallback,s?(Cl(),s=t.mode,a=zg({mode:"hidden",children:a},s),r=iu(r,s,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Wb(n),r.childLanes=Gb(e,o,n),t.memoizedState=Vb,bf(null,r)):(Tl(t),jw(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(Tl(t),t.flags&=-257,t=Kb(e,t,n)):t.memoizedState!==null?(Cl(),t.child=e.child,t.flags|=128,t=null):(Cl(),a=r.fallback,s=t.mode,r=zg({mode:"visible",children:r.children},s),a=iu(a,s,n,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,yu(t,e.child,null,n),r=t.child,r.memoizedState=Wb(n),r.childLanes=Gb(e,o,n),t.memoizedState=Vb,t=bf(null,r));else if(Tl(t),Ww(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,r=Error(we(419)),r.stack="",r.digest=o,m0({value:r,source:null,stack:null}),t=Kb(e,t,n)}else if(Cr||bh(e,t,n,!1),o=(n&e.childLanes)!==0,Cr||o){if(o=zn,o!==null&&(r=jA(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Nu(e,r),ni(o,e,r),U3;Vw(a)||Ug(),t=Kb(e,t,n)}else Vw(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Gn=Ji(a.nextSibling),as=t,ln=!0,ql=null,Wi=!1,e!==null&&cE(t,e),t=jw(t,r.children),t.flags|=4096);return t}return s?(Cl(),a=r.fallback,s=t.mode,l=e.child,c=l.sibling,r=La(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=La(c,a):(a=iu(a,s,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,bf(null,r),r=t.child,a=e.child.memoizedState,a===null?a=Wb(n):(s=a.cachePool,s!==null?(l=Tr._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=dE(),a={baseLanes:a.baseLanes|n,cachePool:s}),r.memoizedState=a,r.childLanes=Gb(e,o,n),t.memoizedState=Vb,bf(e.child,r)):(Tl(t),n=e.child,e=n.sibling,n=La(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function jw(e,t){return t=zg({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zg(e,t){return e=bi(22,e,null,t),e.lanes=0,e}function Kb(e,t,n){return yu(t,e.child,null,n),e=jw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),vw(e.return,t,n)}function Yb(e,t,n,r,s,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s,o.treeForkCount=i)}function sM(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=pr.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Vn(pr,o),rs(e,t,r,n),r=ln?f0:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fk(e,n,t);else if(e.tag===19)Fk(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&&Dg(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Yb(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&&Dg(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Yb(t,!0,n,null,i,r);break;case"together":Yb(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ua(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),nc|=t.lanes,!(n&t.childLanes))if(e!==null){if(bh(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(we(153));if(t.child!==null){for(e=t.child,n=La(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=La(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function H3(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Rg(e)))}function e$(e,t,n){switch(t.tag){case 3:Tg(t,t.stateNode.containerInfo),Sl(t,Tr,e.memoizedState.cache),pu();break;case 27:case 5:aw(t);break;case 4:Tg(t,t.stateNode.containerInfo);break;case 10:Sl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Cw(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Tl(t),t.flags|=128,null):n&t.child.childLanes?rM(e,t,n):(Tl(t),e=Ua(e,t,n),e!==null?e.sibling:null);Tl(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(bh(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return sM(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Vn(pr,pr.current),r)break;return null;case 22:return t.lanes=0,nM(e,t,n,t.pendingProps);case 24:Sl(t,Tr,e.memoizedState.cache)}return Ua(e,t,n)}function iM(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Cr=!0;else{if(!H3(e,n)&&!(t.flags&128))return Cr=!1,e$(e,t,n);Cr=!!(e.flags&131072)}else Cr=!1,ln&&t.flags&1048576&&lE(t,f0,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=qc(t.elementType),t.type=e,typeof e=="function")_3(e)?(r=wu(e,r),t.tag=1,t=$k(null,t,e,r,n)):(t.tag=0,t=Rw(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===l3){t.tag=11,t=Dk(null,t,e,r,n);break e}else if(s===c3){t.tag=14,t=Ok(null,t,e,r,n);break e}}throw t=iw(e)||e,Error(we(306,t,""))}}return t;case 0:return Rw(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=wu(r,t.pendingProps),$k(e,t,r,s,n);case 3:e:{if(Tg(t,t.stateNode.containerInfo),e===null)throw Error(we(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,kw(e,t),zf(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Sl(t,Tr,r),r!==i.cache&&xw(t,[Tr],n,!0),Pf(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=qk(e,t,r,n);break e}else if(r!==s){s=Vi(Error(we(424)),t),m0(s),t=qk(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(Gn=Ji(e.firstChild),as=t,ln=!0,ql=null,Wi=!0,n=mE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(pu(),r===s){t=Ua(e,t,n);break e}rs(e,t,r,n)}t=t.child}return t;case 26:return Jp(e,t),e===null?(n=l8(t.type,null,t.pendingProps,null))?t.memoizedState=n:ln||(n=t.type,e=t.pendingProps,r=Gg($l.current).createElement(n),r[os]=t,r[si]=e,us(r,n,e),Gr(r),t.stateNode=r):t.memoizedState=l8(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return aw(t),e===null&&ln&&(r=t.stateNode=YM(t.type,t.pendingProps,$l.current),as=t,Wi=!0,s=Gn,pc(t.type)?(Gw=s,Gn=Ji(r.firstChild)):Gn=s),rs(e,t,t.pendingProps.children,n),Jp(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ln&&((s=r=Gn)&&(r=N$(r,t.type,t.pendingProps,Wi),r!==null?(t.stateNode=r,as=t,Gn=Ji(r.firstChild),Wi=!1,s=!0):s=!1),s||ec(t)),aw(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,Uw(s,i)?r=null:o!==null&&Uw(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=I3(e,t,Vz,null,null,n),v0._currentValue=s),Jp(e,t),rs(e,t,r,n),t.child;case 6:return e===null&&ln&&((e=n=Gn)&&(n=I$(n,t.pendingProps,Wi),n!==null?(t.stateNode=n,as=t,Gn=null,e=!0):e=!1),e||ec(t)),null;case 13:return rM(e,t,n);case 4:return Tg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=yu(t,null,r,n):rs(e,t,r,n),t.child;case 11:return Dk(e,t,t.type,t.pendingProps,n);case 7:return rs(e,t,t.pendingProps,n),t.child;case 8:return rs(e,t,t.pendingProps.children,n),t.child;case 12:return rs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Sl(t,t.type,r.value),rs(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,gu(t),s=ls(s),r=r(s),t.flags|=1,rs(e,t,r,n),t.child;case 14:return Ok(e,t,t.type,t.pendingProps,n);case 15:return tM(e,t,t.type,t.pendingProps,n);case 19:return sM(e,t,n);case 31:return Zz(e,t,n);case 22:return nM(e,t,n,t.pendingProps);case 24:return gu(t),r=ls(Tr),e===null?(s=C3(),s===null&&(s=zn,i=T3(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},E3(t),Sl(t,Tr,s)):(e.lanes&n&&(kw(e,t),zf(t,null,null,n),Pf()),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),Sl(t,Tr,r)):(r=i.cache,Sl(t,Tr,r),r!==s.cache&&xw(t,[Tr],n,!0))),rs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(we(156,t.tag))}function fa(e){e.flags|=4}function Xb(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(MM())e.flags|=8192;else throw au=jg,A3}else e.flags&=-16777217}function Uk(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!JM(t))if(MM())e.flags|=8192;else throw au=jg,A3}function Um(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?NA():536870912,e.lanes|=t,Yd|=t)}function Kh(e,t){if(!ln)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 Wn(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 t$(e,t,n){var r=t.pendingProps;switch(S3(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(t),null;case 1:return Wn(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Da(Tr),Ud(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Yu(t)?fa(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,qb())),Wn(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(fa(t),i!==null?(Wn(t),Uk(t,i)):(Wn(t),Xb(t,s,null,r,n))):i?i!==e.memoizedState?(fa(t),Wn(t),Uk(t,i)):(Wn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&fa(t),Wn(t),Xb(t,s,e,r,n)),null;case 27:if(Cg(t),n=$l.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&fa(t);else{if(!r){if(t.stateNode===null)throw Error(we(166));return Wn(t),null}e=Go.current,Yu(t)?bk(t):(e=YM(s,r,n),t.stateNode=e,fa(t))}return Wn(t),null;case 5:if(Cg(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&fa(t);else{if(!r){if(t.stateNode===null)throw Error(we(166));return Wn(t),null}if(i=Go.current,Yu(t))bk(t);else{var o=Gg($l.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(s,{is:r.is}):o.createElement(s)}}i[os]=t,i[si]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(us(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&&fa(t)}}return Wn(t),Xb(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&fa(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(we(166));if(e=$l.current,Yu(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=as,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[os]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||VM(e.nodeValue,n)),e||ec(t,!0)}else e=Gg(e).createTextNode(r),e[os]=t,t.stateNode=e}return Wn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Yu(t),n!==null){if(e===null){if(!r)throw Error(we(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(we(557));e[os]=t}else pu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wn(t),e=!1}else n=qb(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(yi(t),t):(yi(t),null);if(t.flags&128)throw Error(we(558))}return Wn(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Yu(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(we(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(we(317));s[os]=t}else pu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wn(t),s=!1}else s=qb(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(yi(t),t):(yi(t),null)}return yi(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),Um(t,t.updateQueue),Wn(t),null);case 4:return Ud(),e===null&&Q3(t.stateNode.containerInfo),Wn(t),null;case 10:return Da(t.type),Wn(t),null;case 19:if(Yr(pr),r=t.memoizedState,r===null)return Wn(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)Kh(r,!1);else{if(lr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Dg(e),i!==null){for(t.flags|=128,Kh(r,!1),e=i.updateQueue,t.updateQueue=e,Um(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oE(n,e),n=n.sibling;return Vn(pr,pr.current&1|2),ln&&_a(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&_i()>qg&&(t.flags|=128,s=!0,Kh(r,!1),t.lanes=4194304)}else{if(!s)if(e=Dg(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Um(t,e),Kh(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!ln)return Wn(t),null}else 2*_i()-r.renderingStartTime>qg&&n!==536870912&&(t.flags|=128,s=!0,Kh(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=_i(),e.sibling=null,n=pr.current,Vn(pr,s?n&1|2:n&1),ln&&_a(t,r.treeForkCount),e):(Wn(t),null);case 22:case 23:return yi(t),M3(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Wn(t),t.subtreeFlags&6&&(t.flags|=8192)):Wn(t),n=t.updateQueue,n!==null&&Um(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&&Yr(ou),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Da(Tr),Wn(t),null;case 25:return null;case 30:return null}throw Error(we(156,t.tag))}function n$(e,t){switch(S3(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Da(Tr),Ud(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Cg(t),null;case 31:if(t.memoizedState!==null){if(yi(t),t.alternate===null)throw Error(we(340));pu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(yi(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(we(340));pu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yr(pr),null;case 4:return Ud(),null;case 10:return Da(t.type),null;case 22:case 23:return yi(t),M3(),e!==null&&Yr(ou),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Da(Tr),null;case 25:return null;default:return null}}function oM(e,t){switch(S3(t),t.tag){case 3:Da(Tr),Ud();break;case 26:case 27:case 5:Cg(t);break;case 4:Ud();break;case 31:t.memoizedState!==null&&yi(t);break;case 13:yi(t);break;case 19:Yr(pr);break;case 10:Da(t.type);break;case 22:case 23:yi(t),M3(),e!==null&&Yr(ou);break;case 24:Da(Tr)}}function tm(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==s)}}catch(a){En(t,t.return,a)}}function tc(e,t,n){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var i=s.next;r=i;do{if((r.tag&e)===e){var o=r.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,s=t;var l=n,c=a;try{c()}catch(u){En(s,l,u)}}}r=r.next}while(r!==i)}}catch(u){En(t,t.return,u)}}function aM(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{gE(t,n)}catch(r){En(e,e.return,r)}}}function lM(e,t,n){n.props=wu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){En(e,t,r)}}function qf(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){En(e,t,s)}}function Fo(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){En(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){En(e,t,s)}else n.current=null}function cM(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){En(e,e.return,s)}}function Qb(e,t,n){try{var r=e.stateNode;S$(r,e.type,n,t),r[si]=t}catch(s){En(e,e.return,s)}}function uM(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pc(e.type)||e.tag===4}function Jb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uM(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&&pc(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 Lw(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=Ma));else if(r!==4&&(r===27&&pc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Lw(e,t,n),e=e.sibling;e!==null;)Lw(e,t,n),e=e.sibling}function $g(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&&pc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($g(e,t,n),e=e.sibling;e!==null;)$g(e,t,n),e=e.sibling}function dM(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);us(t,r,n),t[os]=e,t[si]=n}catch(i){En(e,e.return,i)}}var Ta=!1,kr=!1,Zb=!1,Hk=typeof WeakSet=="function"?WeakSet:Set,Wr=null;function r$(e,t){if(e=e.containerInfo,qw=Qg,e=JA(e),w3(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var m;d!==n||s!==0&&d.nodeType!==3||(a=o+s),d!==i||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++c===s&&(a=o),f===i&&++u===r&&(l=o),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Fw={focusedElem:e,selectionRange:n},Qg=!1,Wr=t;Wr!==null;)if(t=Wr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Wr=e;else for(;Wr!==null;){switch(t=Wr,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=wu(n.type,s);e=r.getSnapshotBeforeUpdate(p,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(y){En(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Hw(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Hw(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(we(163))}if(e=t.sibling,e!==null){e.return=t.return,Wr=e;break}Wr=t.return}}function hM(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:pa(e,n),r&4&&tm(5,n);break;case 1:if(pa(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){En(n,n.return,o)}else{var s=wu(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){En(n,n.return,o)}}r&64&&aM(n),r&512&&qf(n,n.return);break;case 3:if(pa(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{gE(e,t)}catch(o){En(n,n.return,o)}}break;case 27:t===null&&r&4&&dM(n);case 26:case 5:pa(e,n),t===null&&r&4&&cM(n),r&512&&qf(n,n.return);break;case 12:pa(e,n);break;case 31:pa(e,n),r&4&&pM(e,n);break;case 13:pa(e,n),r&4&&gM(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=h$.bind(null,n),R$(e,n))));break;case 22:if(r=n.memoizedState!==null||Ta,!r){t=t!==null&&t.memoizedState!==null||kr,s=Ta;var i=kr;Ta=r,(kr=t)&&!i?xa(e,n,(n.subtreeFlags&8772)!==0):pa(e,n),Ta=s,kr=i}break;case 30:break;default:pa(e,n)}}function fM(e){var t=e.alternate;t!==null&&(e.alternate=null,fM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&f3(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 Qn=null,Ks=!1;function ma(e,t,n){for(n=n.child;n!==null;)mM(e,t,n),n=n.sibling}function mM(e,t,n){if(ki&&typeof ki.onCommitFiberUnmount=="function")try{ki.onCommitFiberUnmount(K0,n)}catch{}switch(n.tag){case 26:kr||Fo(n,t),ma(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:kr||Fo(n,t);var r=Qn,s=Ks;pc(n.type)&&(Qn=n.stateNode,Ks=!1),ma(e,t,n),Vf(n.stateNode),Qn=r,Ks=s;break;case 5:kr||Fo(n,t);case 6:if(r=Qn,s=Ks,Qn=null,ma(e,t,n),Qn=r,Ks=s,Qn!==null)if(Ks)try{(Qn.nodeType===9?Qn.body:Qn.nodeName==="HTML"?Qn.ownerDocument.body:Qn).removeChild(n.stateNode)}catch(i){En(n,t,i)}else try{Qn.removeChild(n.stateNode)}catch(i){En(n,t,i)}break;case 18:Qn!==null&&(Ks?(e=Qn,r8(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Zd(e)):r8(Qn,n.stateNode));break;case 4:r=Qn,s=Ks,Qn=n.stateNode.containerInfo,Ks=!0,ma(e,t,n),Qn=r,Ks=s;break;case 0:case 11:case 14:case 15:tc(2,n,t),kr||tc(4,n,t),ma(e,t,n);break;case 1:kr||(Fo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&lM(n,t,r)),ma(e,t,n);break;case 21:ma(e,t,n);break;case 22:kr=(r=kr)||n.memoizedState!==null,ma(e,t,n),kr=r;break;default:ma(e,t,n)}}function pM(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zd(e)}catch(n){En(t,t.return,n)}}}function gM(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zd(e)}catch(n){En(t,t.return,n)}}function s$(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hk),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hk),t;default:throw Error(we(435,e.tag))}}function Hm(e,t){var n=s$(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=f$.bind(null,e,r);r.then(s,s)}})}function Us(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(pc(a.type)){Qn=a.stateNode,Ks=!1;break e}break;case 5:Qn=a.stateNode,Ks=!1;break e;case 3:case 4:Qn=a.stateNode.containerInfo,Ks=!0;break e}a=a.return}if(Qn===null)throw Error(we(160));mM(i,o,s),Qn=null,Ks=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)yM(t,e),t=t.sibling}var fo=null;function yM(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Us(t,e),Hs(e),r&4&&(tc(3,e,e.return),tm(3,e),tc(5,e,e.return));break;case 1:Us(t,e),Hs(e),r&512&&(kr||n===null||Fo(n,n.return)),r&64&&Ta&&(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=fo;if(Us(t,e),Hs(e),r&512&&(kr||n===null||Fo(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[Q0]||i[os]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),us(i,r,n),i[os]=e,Gr(i),r=i;break e;case"link":var o=u8("link","href",s).get(r+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(i=o[a],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}i=s.createElement(r),us(i,r,n),s.head.appendChild(i);break;case"meta":if(o=u8("meta","content",s).get(r+(n.content||""))){for(a=0;a<o.length;a++)if(i=o[a],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}i=s.createElement(r),us(i,r,n),s.head.appendChild(i);break;default:throw Error(we(468,r))}i[os]=e,Gr(i),r=i}e.stateNode=r}else d8(s,e.type,e.stateNode);else e.stateNode=c8(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?d8(s,e.type,e.stateNode):c8(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Qb(e,e.memoizedProps,n.memoizedProps)}break;case 27:Us(t,e),Hs(e),r&512&&(kr||n===null||Fo(n,n.return)),n!==null&&r&4&&Qb(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Us(t,e),Hs(e),r&512&&(kr||n===null||Fo(n,n.return)),e.flags&32){s=e.stateNode;try{Vd(s,"")}catch(p){En(e,e.return,p)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,Qb(e,s,n!==null?n.memoizedProps:s)),r&1024&&(Zb=!0);break;case 6:if(Us(t,e),Hs(e),r&4){if(e.stateNode===null)throw Error(we(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(p){En(e,e.return,p)}}break;case 3:if(tg=null,s=fo,fo=Kg(t.containerInfo),Us(t,e),fo=s,Hs(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Zd(t.containerInfo)}catch(p){En(e,e.return,p)}Zb&&(Zb=!1,bM(e));break;case 4:r=fo,fo=Kg(e.stateNode.containerInfo),Us(t,e),Hs(e),fo=r;break;case 12:Us(t,e),Hs(e);break;case 31:Us(t,e),Hs(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Hm(e,r)));break;case 13:Us(t,e),Hs(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(cy=_i()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Hm(e,r)));break;case 22:s=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=Ta,u=kr;if(Ta=c||s,kr=u||l,Us(t,e),kr=u,Ta=c,Hs(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||l||Ta||kr||Fc(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,s)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var d=l.memoizedProps.style,f=d!=null&&d.hasOwnProperty("display")?d.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(p){En(l,l.return,p)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(p){En(l,l.return,p)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;s?s8(m,!0):s8(l.stateNode,!1)}catch(p){En(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,Hm(e,n))));break;case 19:Us(t,e),Hs(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Hm(e,r)));break;case 30:break;case 21:break;default:Us(t,e),Hs(e)}}function Hs(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(uM(r)){n=r;break}r=r.return}if(n==null)throw Error(we(160));switch(n.tag){case 27:var s=n.stateNode,i=Jb(e);$g(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&(Vd(o,""),n.flags&=-33);var a=Jb(e);$g(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=Jb(e);Lw(e,c,l);break;default:throw Error(we(161))}}catch(u){En(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function bM(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;bM(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)hM(e,t.alternate,t),t=t.sibling}function Fc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:tc(4,t,t.return),Fc(t);break;case 1:Fo(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&lM(t,t.return,n),Fc(t);break;case 27:Vf(t.stateNode);case 26:case 5:Fo(t,t.return),Fc(t);break;case 22:t.memoizedState===null&&Fc(t);break;case 30:Fc(t);break;default:Fc(t)}e=e.sibling}}function xa(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,s=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:xa(s,i,n),tm(4,i);break;case 1:if(xa(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){En(r,r.return,c)}if(r=i,s=r.updateQueue,s!==null){var a=r.stateNode;try{var l=s.shared.hiddenCallbacks;if(l!==null)for(s.shared.hiddenCallbacks=null,s=0;s<l.length;s++)pE(l[s],a)}catch(c){En(r,r.return,c)}}n&&o&64&&aM(i),qf(i,i.return);break;case 27:dM(i);case 26:case 5:xa(s,i,n),n&&r===null&&o&4&&cM(i),qf(i,i.return);break;case 12:xa(s,i,n);break;case 31:xa(s,i,n),n&&o&4&&pM(s,i);break;case 13:xa(s,i,n),n&&o&4&&gM(s,i);break;case 22:i.memoizedState===null&&xa(s,i,n),qf(i,i.return);break;case 30:break;default:xa(s,i,n)}t=t.sibling}}function V3(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&&Z0(n))}function W3(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Z0(e))}function lo(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wM(e,t,n,r),t=t.sibling}function wM(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:lo(e,t,n,r),s&2048&&tm(9,t);break;case 1:lo(e,t,n,r);break;case 3:lo(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&&Z0(e)));break;case 12:if(s&2048){lo(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,a=i.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){En(t,t.return,l)}}else lo(e,t,n,r);break;case 31:lo(e,t,n,r);break;case 13:lo(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?lo(e,t,n,r):Ff(e,t):i._visibility&2?lo(e,t,n,r):(i._visibility|=2,rd(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&V3(o,t);break;case 24:lo(e,t,n,r),s&2048&&W3(t.alternate,t);break;default:lo(e,t,n,r)}}function rd(e,t,n,r,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,l=r,c=o.flags;switch(o.tag){case 0:case 11:case 15:rd(i,o,a,l,s),tm(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState!==null?u._visibility&2?rd(i,o,a,l,s):Ff(i,o):(u._visibility|=2,rd(i,o,a,l,s)),s&&c&2048&&V3(o.alternate,o);break;case 24:rd(i,o,a,l,s),s&&c&2048&&W3(o.alternate,o);break;default:rd(i,o,a,l,s)}t=t.sibling}}function Ff(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:Ff(n,r),s&2048&&V3(r.alternate,r);break;case 24:Ff(n,r),s&2048&&W3(r.alternate,r);break;default:Ff(n,r)}t=t.sibling}}var wf=8192;function Xu(e,t,n){if(e.subtreeFlags&wf)for(e=e.child;e!==null;)vM(e,t,n),e=e.sibling}function vM(e,t,n){switch(e.tag){case 26:Xu(e,t,n),e.flags&wf&&e.memoizedState!==null&&H$(n,fo,e.memoizedState,e.memoizedProps);break;case 5:Xu(e,t,n);break;case 3:case 4:var r=fo;fo=Kg(e.stateNode.containerInfo),Xu(e,t,n),fo=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wf,wf=16777216,Xu(e,t,n),wf=r):Xu(e,t,n));break;default:Xu(e,t,n)}}function xM(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 Yh(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Wr=r,kM(r,e)}xM(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)_M(e),e=e.sibling}function _M(e){switch(e.tag){case 0:case 11:case 15:Yh(e),e.flags&2048&&tc(9,e,e.return);break;case 3:Yh(e);break;case 12:Yh(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Zp(e)):Yh(e);break;default:Yh(e)}}function Zp(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Wr=r,kM(r,e)}xM(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:tc(8,t,t.return),Zp(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Zp(t));break;default:Zp(t)}e=e.sibling}}function kM(e,t){for(;Wr!==null;){var n=Wr;switch(n.tag){case 0:case 11:case 15:tc(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:Z0(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Wr=r;else e:for(n=e;Wr!==null;){r=Wr;var s=r.sibling,i=r.return;if(fM(r),r===n){Wr=null;break e}if(s!==null){s.return=i,Wr=s;break e}Wr=i}}}var i$={getCacheForType:function(e){var t=ls(Tr),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ls(Tr).controller.signal}},o$=typeof WeakMap=="function"?WeakMap:Map,yn=0,zn=null,Zt=null,rn=0,Cn=0,pi=null,Rl=!1,vh=!1,G3=!1,Ha=0,lr=0,nc=0,lu=0,K3=0,vi=0,Yd=0,Uf=null,Xs=null,Dw=!1,cy=0,SM=0,qg=1/0,Fg=null,Hl=null,Pr=0,Vl=null,Xd=null,Oa=0,Ow=0,Bw=null,TM=null,Hf=0,Pw=null;function Ti(){return yn&2&&rn!==0?rn&-rn:Dt.T!==null?X3():LA()}function CM(){if(vi===0)if(!(rn&536870912)||ln){var e=Om;Om<<=1,!(Om&3932160)&&(Om=262144),vi=e}else vi=536870912;return e=Mi.current,e!==null&&(e.flags|=32),vi}function ni(e,t,n){(e===zn&&(Cn===2||Cn===9)||e.cancelPendingCommit!==null)&&(Qd(e,0),jl(e,rn,vi,!1)),X0(e,n),(!(yn&2)||e!==zn)&&(e===zn&&(!(yn&2)&&(lu|=n),lr===4&&jl(e,rn,vi,!1)),Qo(e))}function AM(e,t,n){if(yn&6)throw Error(we(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Y0(e,t),s=r?c$(e,t):e2(e,t,!0),i=r;do{if(s===0){vh&&!r&&jl(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!a$(n)){s=e2(e,t,!1),i=!1;continue}if(s===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;s=Uf;var l=a.current.memoizedState.isDehydrated;if(l&&(Qd(a,o).flags|=256),o=e2(a,o,!1),o!==2){if(G3&&!l){a.errorRecoveryDisabledLanes|=i,lu|=i,s=4;break e}i=Xs,Xs=s,i!==null&&(Xs===null?Xs=i:Xs.push.apply(Xs,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){Qd(e,0),jl(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(we(345));case 4:if((t&4194048)!==t)break;case 6:jl(r,t,vi,!Rl);break e;case 2:Xs=null;break;case 3:case 5:break;default:throw Error(we(329))}if((t&62914560)===t&&(s=cy+300-_i(),10<s)){if(jl(r,t,vi,!Rl),J1(r,0,!0)!==0)break e;Oa=t,r.timeoutHandle=GM(Vk.bind(null,r,n,Xs,Fg,Dw,t,vi,lu,Yd,Rl,i,"Throttled",-0,0),s);break e}Vk(r,n,Xs,Fg,Dw,t,vi,lu,Yd,Rl,i,null,-0,0)}}break}while(!0);Qo(e)}function Vk(e,t,n,r,s,i,o,a,l,c,u,d,f,m){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ma},vM(t,i,d);var p=(i&62914560)===i?cy-_i():(i&4194048)===i?SM-_i():0;if(p=V$(d,p),p!==null){Oa=i,e.cancelPendingCommit=p(Gk.bind(null,e,t,i,n,r,s,o,a,l,u,d,null,f,m)),jl(e,i,o,!c);return}}Gk(e,t,i,n,r,s,o,a,l)}function a$(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(!Ei(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 jl(e,t,n,r){t&=~K3,t&=~lu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-Si(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&IA(e,n,t)}function uy(){return yn&6?!0:(nm(0),!1)}function Y3(){if(Zt!==null){if(Cn===0)var e=Zt.return;else e=Zt,Na=Iu=null,L3(e),Id=null,p0=0,e=Zt;for(;e!==null;)oM(e.alternate,e),e=e.return;Zt=null}}function Qd(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,A$(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Oa=0,Y3(),zn=e,Zt=n=La(e.current,null),rn=t,Cn=0,pi=null,Rl=!1,vh=Y0(e,t),G3=!1,Yd=vi=K3=lu=nc=lr=0,Xs=Uf=null,Dw=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-Si(r),i=1<<s;t|=e[s],r&=~i}return Ha=t,ny(),n}function EM(e,t){Vt=null,Dt.H=y0,t===wh||t===sy?(t=kk(),Cn=3):t===A3?(t=kk(),Cn=4):Cn=t===U3?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,pi=t,Zt===null&&(lr=1,Pg(e,Vi(t,e.current)))}function MM(){var e=Mi.current;return e===null?!0:(rn&4194048)===rn?Qi===null:(rn&62914560)===rn||rn&536870912?e===Qi:!1}function NM(){var e=Dt.H;return Dt.H=y0,e===null?y0:e}function IM(){var e=Dt.A;return Dt.A=i$,e}function Ug(){lr=4,Rl||(rn&4194048)!==rn&&Mi.current!==null||(vh=!0),!(nc&134217727)&&!(lu&134217727)||zn===null||jl(zn,rn,vi,!1)}function e2(e,t,n){var r=yn;yn|=2;var s=NM(),i=IM();(zn!==e||rn!==t)&&(Fg=null,Qd(e,t)),t=!1;var o=lr;e:do try{if(Cn!==0&&Zt!==null){var a=Zt,l=pi;switch(Cn){case 8:Y3(),o=6;break e;case 3:case 2:case 9:case 6:Mi.current===null&&(t=!0);var c=Cn;if(Cn=0,pi=null,vd(e,a,l,c),n&&vh){o=0;break e}break;default:c=Cn,Cn=0,pi=null,vd(e,a,l,c)}}l$(),o=lr;break}catch(u){EM(e,u)}while(!0);return t&&e.shellSuspendCounter++,Na=Iu=null,yn=r,Dt.H=s,Dt.A=i,Zt===null&&(zn=null,rn=0,ny()),o}function l$(){for(;Zt!==null;)RM(Zt)}function c$(e,t){var n=yn;yn|=2;var r=NM(),s=IM();zn!==e||rn!==t?(Fg=null,qg=_i()+500,Qd(e,t)):vh=Y0(e,t);e:do try{if(Cn!==0&&Zt!==null){t=Zt;var i=pi;t:switch(Cn){case 1:Cn=0,pi=null,vd(e,t,i,1);break;case 2:case 9:if(_k(i)){Cn=0,pi=null,Wk(t);break}t=function(){Cn!==2&&Cn!==9||zn!==e||(Cn=7),Qo(e)},i.then(t,t);break e;case 3:Cn=7;break e;case 4:Cn=5;break e;case 7:_k(i)?(Cn=0,pi=null,Wk(t)):(Cn=0,pi=null,vd(e,t,i,7));break;case 5:var o=null;switch(Zt.tag){case 26:o=Zt.memoizedState;case 5:case 27:var a=Zt;if(o?JM(o):a.stateNode.complete){Cn=0,pi=null;var l=a.sibling;if(l!==null)Zt=l;else{var c=a.return;c!==null?(Zt=c,dy(c)):Zt=null}break t}}Cn=0,pi=null,vd(e,t,i,5);break;case 6:Cn=0,pi=null,vd(e,t,i,6);break;case 8:Y3(),lr=6;break e;default:throw Error(we(462))}}u$();break}catch(u){EM(e,u)}while(!0);return Na=Iu=null,Dt.H=r,Dt.A=s,yn=n,Zt!==null?0:(zn=null,rn=0,ny(),lr)}function u$(){for(;Zt!==null&&!jP();)RM(Zt)}function RM(e){var t=iM(e.alternate,e,Ha);e.memoizedProps=e.pendingProps,t===null?dy(e):Zt=t}function Wk(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=zk(n,t,t.pendingProps,t.type,void 0,rn);break;case 11:t=zk(n,t,t.pendingProps,t.type.render,t.ref,rn);break;case 5:L3(t);default:oM(n,t),t=Zt=oE(t,Ha),t=iM(n,t,Ha)}e.memoizedProps=e.pendingProps,t===null?dy(e):Zt=t}function vd(e,t,n,r){Na=Iu=null,L3(t),Id=null,p0=0;var s=t.return;try{if(Jz(e,s,t,n,rn)){lr=1,Pg(e,Vi(n,e.current)),Zt=null;return}}catch(i){if(s!==null)throw Zt=s,i;lr=1,Pg(e,Vi(n,e.current)),Zt=null;return}t.flags&32768?(ln||r===1?e=!0:vh||rn&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Mi.current,r!==null&&r.tag===13&&(r.flags|=16384))),jM(t,e)):dy(t)}function dy(e){var t=e;do{if(t.flags&32768){jM(t,Rl);return}e=t.return;var n=t$(t.alternate,t,Ha);if(n!==null){Zt=n;return}if(t=t.sibling,t!==null){Zt=t;return}Zt=t=e}while(t!==null);lr===0&&(lr=5)}function jM(e,t){do{var n=n$(e.alternate,e);if(n!==null){n.flags&=32767,Zt=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Zt=e;return}Zt=e=n}while(e!==null);lr=6,Zt=null}function Gk(e,t,n,r,s,i,o,a,l){e.cancelPendingCommit=null;do hy();while(Pr!==0);if(yn&6)throw Error(we(327));if(t!==null){if(t===e.current)throw Error(we(177));if(i=t.lanes|t.childLanes,i|=v3,UP(e,n,i,o,a,l),e===zn&&(Zt=zn=null,rn=0),Xd=t,Vl=e,Oa=n,Ow=i,Bw=s,TM=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,m$(Ag,function(){return PM(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=Dt.T,Dt.T=null,s=wn.p,wn.p=2,o=yn,yn|=4;try{r$(e,t,n)}finally{yn=o,wn.p=s,Dt.T=r}}Pr=1,LM(),DM(),OM()}}function LM(){if(Pr===1){Pr=0;var e=Vl,t=Xd,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Dt.T,Dt.T=null;var r=wn.p;wn.p=2;var s=yn;yn|=4;try{yM(t,e);var i=Fw,o=JA(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&QA(a.ownerDocument.documentElement,a)){if(l!==null&&w3(a)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(u,a.value.length);else{var d=a.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var m=f.getSelection(),p=a.textContent.length,y=Math.min(l.start,p),x=l.end===void 0?y:Math.min(l.end,p);!m.extend&&y>x&&(o=x,x=y,y=o);var b=pk(a,y),w=pk(a,x);if(b&&w&&(m.rangeCount!==1||m.anchorNode!==b.node||m.anchorOffset!==b.offset||m.focusNode!==w.node||m.focusOffset!==w.offset)){var v=d.createRange();v.setStart(b.node,b.offset),m.removeAllRanges(),y>x?(m.addRange(v),m.extend(w.node,w.offset)):(v.setEnd(w.node,w.offset),m.addRange(v))}}}}for(d=[],m=a;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<d.length;a++){var _=d[a];_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}Qg=!!qw,Fw=qw=null}finally{yn=s,wn.p=r,Dt.T=n}}e.current=t,Pr=2}}function DM(){if(Pr===2){Pr=0;var e=Vl,t=Xd,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Dt.T,Dt.T=null;var r=wn.p;wn.p=2;var s=yn;yn|=4;try{hM(e,t.alternate,t)}finally{yn=s,wn.p=r,Dt.T=n}}Pr=3}}function OM(){if(Pr===4||Pr===3){Pr=0,LP();var e=Vl,t=Xd,n=Oa,r=TM;t.subtreeFlags&10256||t.flags&10256?Pr=5:(Pr=0,Xd=Vl=null,BM(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Hl=null),h3(n),t=t.stateNode,ki&&typeof ki.onCommitFiberRoot=="function")try{ki.onCommitFiberRoot(K0,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=Dt.T,s=wn.p,wn.p=2,Dt.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var a=r[o];i(a.value,{componentStack:a.stack})}}finally{Dt.T=t,wn.p=s}}Oa&3&&hy(),Qo(e),s=e.pendingLanes,n&261930&&s&42?e===Pw?Hf++:(Hf=0,Pw=e):Hf=0,nm(0)}}function BM(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Z0(t)))}function hy(){return LM(),DM(),OM(),PM()}function PM(){if(Pr!==5)return!1;var e=Vl,t=Ow;Ow=0;var n=h3(Oa),r=Dt.T,s=wn.p;try{wn.p=32>n?32:n,Dt.T=null,n=Bw,Bw=null;var i=Vl,o=Oa;if(Pr=0,Xd=Vl=null,Oa=0,yn&6)throw Error(we(331));var a=yn;if(yn|=4,_M(i.current),wM(i,i.current,o,n),yn=a,nm(0,!1),ki&&typeof ki.onPostCommitFiberRoot=="function")try{ki.onPostCommitFiberRoot(K0,i)}catch{}return!0}finally{wn.p=s,Dt.T=r,BM(e,t)}}function Kk(e,t,n){t=Vi(n,t),t=Iw(e.stateNode,t,2),e=Ul(e,t,2),e!==null&&(X0(e,2),Qo(e))}function En(e,t,n){if(e.tag===3)Kk(e,e,n);else for(;t!==null;){if(t.tag===3){Kk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Hl===null||!Hl.has(r))){e=Vi(n,e),n=ZE(2),r=Ul(t,n,2),r!==null&&(eM(n,r,t,e),X0(r,2),Qo(r));break}}t=t.return}}function t2(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new o$;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)||(G3=!0,s.add(n),e=d$.bind(null,e,t,n),t.then(e,e))}function d$(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zn===e&&(rn&n)===n&&(lr===4||lr===3&&(rn&62914560)===rn&&300>_i()-cy?!(yn&2)&&Qd(e,0):K3|=n,Yd===rn&&(Yd=0)),Qo(e)}function zM(e,t){t===0&&(t=NA()),e=Nu(e,t),e!==null&&(X0(e,t),Qo(e))}function h$(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zM(e,n)}function f$(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(we(314))}r!==null&&r.delete(t),zM(e,n)}function m$(e,t){return u3(e,t)}var Hg=null,sd=null,zw=!1,Vg=!1,n2=!1,Ll=0;function Qo(e){e!==sd&&e.next===null&&(sd===null?Hg=sd=e:sd=sd.next=e),Vg=!0,zw||(zw=!0,g$())}function nm(e,t){if(!n2&&Vg){n2=!0;do for(var n=!1,r=Hg;r!==null;){if(e!==0){var s=r.pendingLanes;if(s===0)var i=0;else{var o=r.suspendedLanes,a=r.pingedLanes;i=(1<<31-Si(42|e)+1)-1,i&=s&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,Yk(r,i))}else i=rn,i=J1(r,r===zn?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||Y0(r,i)||(n=!0,Yk(r,i));r=r.next}while(n);n2=!1}}function p$(){$M()}function $M(){Vg=zw=!1;var e=0;Ll!==0&&C$()&&(e=Ll);for(var t=_i(),n=null,r=Hg;r!==null;){var s=r.next,i=qM(r,t);i===0?(r.next=null,n===null?Hg=s:n.next=s,s===null&&(sd=n)):(n=r,(e!==0||i&3)&&(Vg=!0)),r=s}Pr!==0&&Pr!==5||nm(e),Ll!==0&&(Ll=0)}function qM(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Si(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=FP(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=zn,n=rn,n=J1(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Cn===2||Cn===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Nb(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Y0(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Nb(r),h3(n)){case 2:case 8:n=EA;break;case 32:n=Ag;break;case 268435456:n=MA;break;default:n=Ag}return r=FM.bind(null,e),n=u3(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Nb(r),e.callbackPriority=2,e.callbackNode=null,2}function FM(e,t){if(Pr!==0&&Pr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(hy()&&e.callbackNode!==n)return null;var r=rn;return r=J1(e,e===zn?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(AM(e,r,t),qM(e,_i()),e.callbackNode!=null&&e.callbackNode===n?FM.bind(null,e):null)}function Yk(e,t){if(hy())return null;AM(e,t,!0)}function g$(){E$(function(){yn&6?u3(AA,p$):$M()})}function X3(){if(Ll===0){var e=Wd;e===0&&(e=Dm,Dm<<=1,!(Dm&261888)&&(Dm=256)),Ll=e}return Ll}function Xk(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Hp(""+e)}function Qk(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 y$(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=Xk((s[si]||null).action),o=r.submitter;o&&(t=(t=o[si]||null)?Xk(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new Z1("action","action",null,r,s);e.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ll!==0){var l=o?Qk(s,o):new FormData(s);Mw(n,{pending:!0,data:l,method:s.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?Qk(s,o):new FormData(s),Mw(n,{pending:!0,data:l,method:s.method,action:i},i,l))},currentTarget:s}]})}}for(var r2=0;r2<yw.length;r2++){var s2=yw[r2],b$=s2.toLowerCase(),w$=s2[0].toUpperCase()+s2.slice(1);wo(b$,"on"+w$)}wo(eE,"onAnimationEnd");wo(tE,"onAnimationIteration");wo(nE,"onAnimationStart");wo("dblclick","onDoubleClick");wo("focusin","onFocus");wo("focusout","onBlur");wo(Dz,"onTransitionRun");wo(Oz,"onTransitionStart");wo(Bz,"onTransitionCancel");wo(rE,"onTransitionEnd");Hd("onMouseEnter",["mouseout","mouseover"]);Hd("onMouseLeave",["mouseout","mouseover"]);Hd("onPointerEnter",["pointerout","pointerover"]);Hd("onPointerLeave",["pointerout","pointerover"]);Au("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Au("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Au("onBeforeInput",["compositionend","keypress","textInput","paste"]);Au("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Au("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Au("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var b0="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(" "),v$=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(b0));function UM(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=c;try{i(s)}catch(u){Mg(u)}s.currentTarget=null,i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=c;try{i(s)}catch(u){Mg(u)}s.currentTarget=null,i=l}}}}function Jt(e,t){var n=t[cw];n===void 0&&(n=t[cw]=new Set);var r=e+"__bubble";n.has(r)||(HM(t,e,2,!1),n.add(r))}function i2(e,t,n){var r=0;t&&(r|=4),HM(n,e,r,t)}var Vm="_reactListening"+Math.random().toString(36).slice(2);function Q3(e){if(!e[Vm]){e[Vm]=!0,DA.forEach(function(n){n!=="selectionchange"&&(v$.has(n)||i2(n,!1,e),i2(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Vm]||(t[Vm]=!0,i2("selectionchange",!1,t))}}function HM(e,t,n,r){switch(rN(t)){case 2:var s=K$;break;case 8:s=Y$;break;default:s=t_}n=s.bind(null,t,n,e),s=void 0,!mw||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 o2(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===s)return;o=o.return}for(;a!==null;){if(o=dd(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=i=o;continue e}a=a.parentNode}}r=r.return}UA(function(){var c=i,u=p3(n),d=[];e:{var f=sE.get(e);if(f!==void 0){var m=Z1,p=e;switch(e){case"keypress":if(Wp(n)===0)break e;case"keydown":case"keyup":m=fz;break;case"focusin":p="focus",m=Db;break;case"focusout":p="blur",m=Db;break;case"beforeblur":case"afterblur":m=Db;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=ik;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=tz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=gz;break;case eE:case tE:case nE:m=sz;break;case rE:m=bz;break;case"scroll":case"scrollend":m=ZP;break;case"wheel":m=vz;break;case"copy":case"cut":case"paste":m=oz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=ak;break;case"toggle":case"beforetoggle":m=_z}var y=(t&4)!==0,x=!y&&(e==="scroll"||e==="scrollend"),b=y?f!==null?f+"Capture":null:f;y=[];for(var w=c,v;w!==null;){var _=w;if(v=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||v===null||b===null||(_=u0(w,b),_!=null&&y.push(w0(w,_,v))),x)break;w=w.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!==fw&&(p=n.relatedTarget||n.fromElement)&&(dd(p)||p[gh]))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?dd(p):null,p!==null&&(x=G0(p),y=p.tag,p!==x||y!==5&&y!==27&&y!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=ik,_="onMouseLeave",b="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(y=ak,_="onPointerLeave",b="onPointerEnter",w="pointer"),x=m==null?f:yf(m),v=p==null?f:yf(p),f=new y(_,w+"leave",m,n,u),f.target=x,f.relatedTarget=v,_=null,dd(u)===c&&(y=new y(b,w+"enter",p,n,u),y.target=v,y.relatedTarget=x,_=y),x=_,m&&p)t:{for(y=x$,b=m,w=p,v=0,_=b;_;_=y(_))v++;_=0;for(var S=w;S;S=y(S))_++;for(;0<v-_;)b=y(b),v--;for(;0<_-v;)w=y(w),_--;for(;v--;){if(b===w||w!==null&&b===w.alternate){y=b;break t}b=y(b),w=y(w)}y=null}else y=null;m!==null&&Jk(d,f,m,y,!1),p!==null&&x!==null&&Jk(d,x,p,y,!0)}}e:{if(f=c?yf(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var C=dk;else if(uk(f))if(YA)C=Rz;else{C=Nz;var E=Mz}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&m3(c.elementType)&&(C=dk):C=Iz;if(C&&(C=C(e,c))){KA(d,C,n,u);break e}E&&E(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&hw(f,"number",f.value)}switch(E=c?yf(c):window,e){case"focusin":(uk(E)||E.contentEditable==="true")&&(md=E,pw=c,Df=null);break;case"focusout":Df=pw=md=null;break;case"mousedown":gw=!0;break;case"contextmenu":case"mouseup":case"dragend":gw=!1,gk(d,n,u);break;case"selectionchange":if(Lz)break;case"keydown":case"keyup":gk(d,n,u)}var R;if(b3)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else fd?WA(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(VA&&n.locale!=="ko"&&(fd||j!=="onCompositionStart"?j==="onCompositionEnd"&&fd&&(R=HA()):(Il=u,g3="value"in Il?Il.value:Il.textContent,fd=!0)),E=Wg(c,j),0<E.length&&(j=new ok(j,e,null,n,u),d.push({event:j,listeners:E}),R?j.data=R:(R=GA(n),R!==null&&(j.data=R)))),(R=Sz?Tz(e,n):Cz(e,n))&&(j=Wg(c,"onBeforeInput"),0<j.length&&(E=new ok("onBeforeInput","beforeinput",null,n,u),d.push({event:E,listeners:j}),E.data=R)),y$(d,e,c,n,u)}UM(d,t)})}function w0(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wg(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=u0(e,n),s!=null&&r.unshift(w0(e,s,i)),s=u0(e,t),s!=null&&r.push(w0(e,s,i))),e.tag===3)return r;e=e.return}return[]}function x$(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Jk(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===r)break;a!==5&&a!==26&&a!==27||c===null||(l=c,s?(c=u0(n,i),c!=null&&o.unshift(w0(n,c,l))):s||(c=u0(n,i),c!=null&&o.push(w0(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var _$=/\r\n?/g,k$=/\u0000|\uFFFD/g;function Zk(e){return(typeof e=="string"?e:""+e).replace(_$,`
`).replace(k$,"")}function VM(e,t){return t=Zk(t),Zk(e)===t}function Mn(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Vd(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Vd(e,""+r);break;case"className":Pm(e,"class",r);break;case"tabIndex":Pm(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Pm(e,n,r);break;case"style":FA(e,r,i);break;case"data":if(t!=="object"){Pm(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=Hp(""+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"&&Mn(e,t,"name",s.name,s,null),Mn(e,t,"formEncType",s.formEncType,s,null),Mn(e,t,"formMethod",s.formMethod,s,null),Mn(e,t,"formTarget",s.formTarget,s,null)):(Mn(e,t,"encType",s.encType,s,null),Mn(e,t,"method",s.method,s,null),Mn(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Hp(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Ma);break;case"onScroll":r!=null&&Jt("scroll",e);break;case"onScrollEnd":r!=null&&Jt("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(we(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(we(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=Hp(""+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":Jt("beforetoggle",e),Jt("toggle",e),Up(e,"popover",r);break;case"xlinkActuate":ha(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ha(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ha(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ha(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ha(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ha(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ha(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ha(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ha(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Up(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=QP.get(n)||n,Up(e,n,r))}}function $w(e,t,n,r,s,i){switch(n){case"style":FA(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(we(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(we(60));e.innerHTML=n}}break;case"children":typeof r=="string"?Vd(e,r):(typeof r=="number"||typeof r=="bigint")&&Vd(e,""+r);break;case"onScroll":r!=null&&Jt("scroll",e);break;case"onScrollEnd":r!=null&&Jt("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Ma);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!OA.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[si]||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,""):Up(e,n,r)}}}function us(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Jt("error",e),Jt("load",e);var r=!1,s=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(we(137,t));default:Mn(e,t,i,o,n,null)}}s&&Mn(e,t,"srcSet",n.srcSet,n,null),r&&Mn(e,t,"src",n.src,n,null);return;case"input":Jt("invalid",e);var a=i=o=s=null,l=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":s=u;break;case"type":o=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":i=u;break;case"defaultValue":a=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(we(137,t));break;default:Mn(e,t,r,u,n,null)}}zA(e,i,a,l,c,o,s,!1);return;case"select":Jt("invalid",e),r=o=i=null;for(s in n)if(n.hasOwnProperty(s)&&(a=n[s],a!=null))switch(s){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:Mn(e,t,s,a,n,null)}t=i,n=o,e.multiple=!!r,t!=null?Ed(e,!!r,t,!1):n!=null&&Ed(e,!!r,n,!0);return;case"textarea":Jt("invalid",e),i=s=r=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":r=a;break;case"defaultValue":s=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(we(91));break;default:Mn(e,t,o,a,n,null)}qA(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:Mn(e,t,l,r,n,null)}return;case"dialog":Jt("beforetoggle",e),Jt("toggle",e),Jt("cancel",e),Jt("close",e);break;case"iframe":case"object":Jt("load",e);break;case"video":case"audio":for(r=0;r<b0.length;r++)Jt(b0[r],e);break;case"image":Jt("error",e),Jt("load",e);break;case"details":Jt("toggle",e);break;case"embed":case"source":case"link":Jt("error",e),Jt("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(we(137,t));default:Mn(e,t,c,r,n,null)}return;default:if(m3(t)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&$w(e,t,u,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&Mn(e,t,a,r,n,null))}function S$(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,o=null,a=null,l=null,c=null,u=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(m)||Mn(e,t,m,null,r,d)}}for(var f in r){var m=r[f];if(d=n[f],r.hasOwnProperty(f)&&(m!=null||d!=null))switch(f){case"type":i=m;break;case"name":s=m;break;case"checked":c=m;break;case"defaultChecked":u=m;break;case"value":o=m;break;case"defaultValue":a=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(we(137,t));break;default:m!==d&&Mn(e,t,f,m,r,d)}}dw(e,o,a,l,c,u,i,s);return;case"select":m=o=a=f=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":m=l;default:r.hasOwnProperty(i)||Mn(e,t,i,null,r,l)}for(s in r)if(i=r[s],l=n[s],r.hasOwnProperty(s)&&(i!=null||l!=null))switch(s){case"value":f=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&Mn(e,t,s,i,r,l)}t=a,n=o,r=m,f!=null?Ed(e,!!n,f,!1):!!r!=!!n&&(t!=null?Ed(e,!!n,t,!0):Ed(e,!!n,n?[]:"",!1));return;case"textarea":m=f=null;for(a in n)if(s=n[a],n.hasOwnProperty(a)&&s!=null&&!r.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:Mn(e,t,a,null,r,s)}for(o in r)if(s=r[o],i=n[o],r.hasOwnProperty(o)&&(s!=null||i!=null))switch(o){case"value":f=s;break;case"defaultValue":m=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(we(91));break;default:s!==i&&Mn(e,t,o,s,r,i)}$A(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:Mn(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:Mn(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)&&Mn(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(we(137,t));break;default:Mn(e,t,c,f,r,m)}return;default:if(m3(t)){for(var x in n)f=n[x],n.hasOwnProperty(x)&&f!==void 0&&!r.hasOwnProperty(x)&&$w(e,t,x,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||$w(e,t,u,f,r,m);return}}for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!=null&&!r.hasOwnProperty(b)&&Mn(e,t,b,null,r,f);for(d in r)f=r[d],m=n[d],!r.hasOwnProperty(d)||f===m||f==null&&m==null||Mn(e,t,d,f,r,m)}function e8(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function T$(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var s=n[r],i=s.transferSize,o=s.initiatorType,a=s.duration;if(i&&a&&e8(o)){for(o=0,a=s.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>a)break;var u=l.transferSize,d=l.initiatorType;u&&e8(d)&&(l=l.responseEnd,o+=u*(l<a?1:(a-c)/(l-c)))}if(--r,t+=8*(i+o)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var qw=null,Fw=null;function Gg(e){return e.nodeType===9?e:e.ownerDocument}function t8(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 WM(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 Uw(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 a2=null;function C$(){var e=window.event;return e&&e.type==="popstate"?e===a2?!1:(a2=e,!0):(a2=null,!1)}var GM=typeof setTimeout=="function"?setTimeout:void 0,A$=typeof clearTimeout=="function"?clearTimeout:void 0,n8=typeof Promise=="function"?Promise:void 0,E$=typeof queueMicrotask=="function"?queueMicrotask:typeof n8<"u"?function(e){return n8.resolve(null).then(e).catch(M$)}:GM;function M$(e){setTimeout(function(){throw e})}function pc(e){return e==="head"}function r8(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),Zd(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Vf(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Vf(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[Q0]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Vf(e.ownerDocument.body);n=s}while(n);Zd(t)}function s8(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 Hw(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":Hw(n),f3(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function N$(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[Q0])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=Ji(e.nextSibling),e===null)break}return null}function I$(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ji(e.nextSibling),e===null))return null;return e}function KM(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ji(e.nextSibling),e===null))return null;return e}function Vw(e){return e.data==="$?"||e.data==="$~"}function Ww(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function R$(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 Ji(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 Gw=null;function i8(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ji(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function o8(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 YM(e,t,n){switch(t=Gg(n),e){case"html":if(e=t.documentElement,!e)throw Error(we(452));return e;case"head":if(e=t.head,!e)throw Error(we(453));return e;case"body":if(e=t.body,!e)throw Error(we(454));return e;default:throw Error(we(451))}}function Vf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);f3(e)}var eo=new Map,a8=new Set;function Kg(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ya=wn.d;wn.d={f:j$,r:L$,D:D$,C:O$,L:B$,m:P$,X:$$,S:z$,M:q$};function j$(){var e=Ya.f(),t=uy();return e||t}function L$(e){var t=yh(e);t!==null&&t.tag===5&&t.type==="form"?FE(t):Ya.r(e)}var xh=typeof document>"u"?null:document;function XM(e,t,n){var r=xh;if(r&&typeof t=="string"&&t){var s=Hi(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),a8.has(s)||(a8.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),us(t,"link",e),Gr(t),r.head.appendChild(t)))}}function D$(e){Ya.D(e),XM("dns-prefetch",e,null)}function O$(e,t){Ya.C(e,t),XM("preconnect",e,t)}function B$(e,t,n){Ya.L(e,t,n);var r=xh;if(r&&e&&t){var s='link[rel="preload"][as="'+Hi(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Hi(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Hi(n.imageSizes)+'"]')):s+='[href="'+Hi(e)+'"]';var i=s;switch(t){case"style":i=Jd(e);break;case"script":i=_h(e)}eo.has(i)||(e=Xn({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),eo.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(rm(i))||t==="script"&&r.querySelector(sm(i))||(t=r.createElement("link"),us(t,"link",e),Gr(t),r.head.appendChild(t)))}}function P$(e,t){Ya.m(e,t);var n=xh;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Hi(r)+'"][href="'+Hi(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=_h(e)}if(!eo.has(i)&&(e=Xn({rel:"modulepreload",href:e},t),eo.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(sm(i)))return}r=n.createElement("link"),us(r,"link",e),Gr(r),n.head.appendChild(r)}}}function z$(e,t,n){Ya.S(e,t,n);var r=xh;if(r&&e){var s=Ad(r).hoistableStyles,i=Jd(e);t=t||"default";var o=s.get(i);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(rm(i)))a.loading=5;else{e=Xn({rel:"stylesheet",href:e,"data-precedence":t},n),(n=eo.get(i))&&J3(e,n);var l=o=r.createElement("link");Gr(l),us(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,eg(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:a},s.set(i,o)}}}function $$(e,t){Ya.X(e,t);var n=xh;if(n&&e){var r=Ad(n).hoistableScripts,s=_h(e),i=r.get(s);i||(i=n.querySelector(sm(s)),i||(e=Xn({src:e,async:!0},t),(t=eo.get(s))&&Z3(e,t),i=n.createElement("script"),Gr(i),us(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function q$(e,t){Ya.M(e,t);var n=xh;if(n&&e){var r=Ad(n).hoistableScripts,s=_h(e),i=r.get(s);i||(i=n.querySelector(sm(s)),i||(e=Xn({src:e,async:!0,type:"module"},t),(t=eo.get(s))&&Z3(e,t),i=n.createElement("script"),Gr(i),us(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function l8(e,t,n,r){var s=(s=$l.current)?Kg(s):null;if(!s)throw Error(we(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Jd(n.href),n=Ad(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=Jd(n.href);var i=Ad(s).hoistableStyles,o=i.get(e);if(o||(s=s.ownerDocument||s,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=s.querySelector(rm(e)))&&!i._p&&(o.instance=i,o.state.loading=5),eo.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},eo.set(e,n),i||F$(s,e,n,o.state))),t&&r===null)throw Error(we(528,""));return o}if(t&&r!==null)throw Error(we(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=_h(n),n=Ad(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(we(444,e))}}function Jd(e){return'href="'+Hi(e)+'"'}function rm(e){return'link[rel="stylesheet"]['+e+"]"}function QM(e){return Xn({},e,{"data-precedence":e.precedence,precedence:null})}function F$(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}),us(t,"link",n),Gr(t),e.head.appendChild(t))}function _h(e){return'[src="'+Hi(e)+'"]'}function sm(e){return"script[async]"+e}function c8(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Hi(n.href)+'"]');if(r)return t.instance=r,Gr(r),r;var s=Xn({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Gr(r),us(r,"style",s),eg(r,n.precedence,e),t.instance=r;case"stylesheet":s=Jd(n.href);var i=e.querySelector(rm(s));if(i)return t.state.loading|=4,t.instance=i,Gr(i),i;r=QM(n),(s=eo.get(s))&&J3(r,s),i=(e.ownerDocument||e).createElement("link"),Gr(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),us(i,"link",r),t.state.loading|=4,eg(i,n.precedence,e),t.instance=i;case"script":return i=_h(n.src),(s=e.querySelector(sm(i)))?(t.instance=s,Gr(s),s):(r=n,(s=eo.get(i))&&(r=Xn({},n),Z3(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),Gr(s),us(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(we(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,eg(r,n.precedence,e));return t.instance}function eg(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=r.length?r[r.length-1]:null,i=s,o=0;o<r.length;o++){var a=r[o];if(a.dataset.precedence===t)i=a;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function J3(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Z3(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var tg=null;function u8(e,t,n){if(tg===null){var r=new Map,s=tg=new Map;s.set(n,r)}else s=tg,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[Q0]||i[os]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=r.get(o);a?a.push(i):r.set(o,[i])}}return r}function d8(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function U$(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 JM(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function H$(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=Jd(r.href),i=t.querySelector(rm(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Yg.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Gr(i);return}i=t.ownerDocument||t,r=QM(r),(s=eo.get(s))&&J3(r,s),i=i.createElement("link"),Gr(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),us(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=Yg.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var l2=0;function V$(e,t){return e.stylesheets&&e.count===0&&ng(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ng(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&l2===0&&(l2=62500*T$());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ng(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>l2?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function Yg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ng(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xg=null;function ng(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xg=new Map,t.forEach(W$,e),Xg=null,Yg.call(e))}function W$(e,t){if(!(t.state.loading&4)){var n=Xg.get(e);if(n)var r=n.get(null);else{n=new Map,Xg.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var o=s[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}s=t.instance,o=s.getAttribute("data-precedence"),i=n.get(o)||r,i===r&&n.set(null,s),n.set(o,s),this.count++,r=Yg.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 v0={$$typeof:Ea,Provider:null,Consumer:null,_currentValue:su,_currentValue2:su,_threadCount:0};function G$(e,t,n,r,s,i,o,a,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ib(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ib(0),this.hiddenUpdates=Ib(null),this.identifierPrefix=r,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function ZM(e,t,n,r,s,i,o,a,l,c,u,d){return e=new G$(e,t,n,o,l,c,u,d,a),t=1,i===!0&&(t|=24),i=bi(3,null,null,t),e.current=i,i.stateNode=e,t=T3(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},E3(i),e}function eN(e){return e?(e=yd,e):yd}function tN(e,t,n,r,s,i){s=eN(s),r.context===null?r.context=s:r.pendingContext=s,r=Fl(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Ul(e,r,t),n!==null&&(ni(n,e,t),Bf(n,e,t))}function h8(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function e_(e,t){h8(e,t),(e=e.alternate)&&h8(e,t)}function nN(e){if(e.tag===13||e.tag===31){var t=Nu(e,67108864);t!==null&&ni(t,e,67108864),e_(e,67108864)}}function f8(e){if(e.tag===13||e.tag===31){var t=Ti();t=d3(t);var n=Nu(e,t);n!==null&&ni(n,e,t),e_(e,t)}}var Qg=!0;function K$(e,t,n,r){var s=Dt.T;Dt.T=null;var i=wn.p;try{wn.p=2,t_(e,t,n,r)}finally{wn.p=i,Dt.T=s}}function Y$(e,t,n,r){var s=Dt.T;Dt.T=null;var i=wn.p;try{wn.p=8,t_(e,t,n,r)}finally{wn.p=i,Dt.T=s}}function t_(e,t,n,r){if(Qg){var s=Kw(r);if(s===null)o2(e,t,r,Jg,n),m8(e,r);else if(Q$(s,e,t,n,r))r.stopPropagation();else if(m8(e,r),t&4&&-1<X$.indexOf(e)){for(;s!==null;){var i=yh(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=$c(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Si(o);a.entanglements[1]|=l,o&=~l}Qo(i),!(yn&6)&&(qg=_i()+500,nm(0))}}break;case 31:case 13:a=Nu(i,2),a!==null&&ni(a,i,2),uy(),e_(i,2)}if(i=Kw(r),i===null&&o2(e,t,r,Jg,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else o2(e,t,r,null,n)}}function Kw(e){return e=p3(e),n_(e)}var Jg=null;function n_(e){if(Jg=null,e=dd(e),e!==null){var t=G0(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=_A(t),e!==null)return e;e=null}else if(n===31){if(e=kA(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 Jg=e,null}function rN(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(DP()){case AA:return 2;case EA:return 8;case Ag:case OP:return 32;case MA:return 268435456;default:return 32}default:return 32}}var Yw=!1,Wl=null,Gl=null,Kl=null,x0=new Map,_0=new Map,Al=[],X$="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 m8(e,t){switch(e){case"focusin":case"focusout":Wl=null;break;case"dragenter":case"dragleave":Gl=null;break;case"mouseover":case"mouseout":Kl=null;break;case"pointerover":case"pointerout":x0.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_0.delete(t.pointerId)}}function Xh(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=yh(t),t!==null&&nN(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Q$(e,t,n,r,s){switch(t){case"focusin":return Wl=Xh(Wl,e,t,n,r,s),!0;case"dragenter":return Gl=Xh(Gl,e,t,n,r,s),!0;case"mouseover":return Kl=Xh(Kl,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return x0.set(i,Xh(x0.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,_0.set(i,Xh(_0.get(i)||null,e,t,n,r,s)),!0}return!1}function sN(e){var t=dd(e.target);if(t!==null){var n=G0(t);if(n!==null){if(t=n.tag,t===13){if(t=_A(n),t!==null){e.blockedOn=t,J6(e.priority,function(){f8(n)});return}}else if(t===31){if(t=kA(n),t!==null){e.blockedOn=t,J6(e.priority,function(){f8(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 rg(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Kw(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);fw=r,n.target.dispatchEvent(r),fw=null}else return t=yh(n),t!==null&&nN(t),e.blockedOn=n,!1;t.shift()}return!0}function p8(e,t,n){rg(e)&&n.delete(t)}function J$(){Yw=!1,Wl!==null&&rg(Wl)&&(Wl=null),Gl!==null&&rg(Gl)&&(Gl=null),Kl!==null&&rg(Kl)&&(Kl=null),x0.forEach(p8),_0.forEach(p8)}function Wm(e,t){e.blockedOn===t&&(e.blockedOn=null,Yw||(Yw=!0,$r.unstable_scheduleCallback($r.unstable_NormalPriority,J$)))}var Gm=null;function g8(e){Gm!==e&&(Gm=e,$r.unstable_scheduleCallback($r.unstable_NormalPriority,function(){Gm===e&&(Gm=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(n_(r||n)===null)continue;break}var i=yh(n);i!==null&&(e.splice(t,3),t-=3,Mw(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function Zd(e){function t(l){return Wm(l,e)}Wl!==null&&Wm(Wl,e),Gl!==null&&Wm(Gl,e),Kl!==null&&Wm(Kl,e),x0.forEach(t),_0.forEach(t);for(var n=0;n<Al.length;n++){var r=Al[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Al.length&&(n=Al[0],n.blockedOn===null);)sN(n),n.blockedOn===null&&Al.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var s=n[r],i=n[r+1],o=s[si]||null;if(typeof i=="function")o||g8(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[si]||null)a=o.formAction;else if(n_(s)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),g8(n)}}}function iN(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return s=o})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function r_(e){this._internalRoot=e}fy.prototype.render=r_.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(we(409));var n=t.current,r=Ti();tN(n,r,e,t,null,null)};fy.prototype.unmount=r_.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;tN(e.current,2,null,e,null,null),uy(),t[gh]=null}};function fy(e){this._internalRoot=e}fy.prototype.unstable_scheduleHydration=function(e){if(e){var t=LA();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Al.length&&t!==0&&t<Al[n].priority;n++);Al.splice(n,0,e),n===0&&sN(e)}};var y8=vA.version;if(y8!=="19.2.4")throw Error(we(527,y8,"19.2.4"));wn.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(we(188)):(e=Object.keys(e).join(","),Error(we(268,e)));return e=EP(t),e=e!==null?SA(e):null,e=e===null?null:e.stateNode,e};var Z$={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Dt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Km=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Km.isDisabled&&Km.supportsFiber)try{K0=Km.inject(Z$),ki=Km}catch{}}Y1.createRoot=function(e,t){if(!xA(e))throw Error(we(299));var n=!1,r="",s=XE,i=QE,o=JE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ZM(e,1,!1,null,null,n,r,null,s,i,o,iN),e[gh]=t.current,Q3(e),new r_(t)};Y1.hydrateRoot=function(e,t,n){if(!xA(e))throw Error(we(299));var r=!1,s="",i=XE,o=QE,a=JE,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=ZM(e,1,!0,t,n??null,r,s,l,i,o,a,iN),t.context=eN(null),n=t.current,r=Ti(),r=d3(r),s=Fl(r),s.callback=null,Ul(n,s,r),n=r,t.current.lanes=n,X0(t,n),Qo(t),e[gh]=t.current,Q3(e),new fy(t)};Y1.version="19.2.4";function oN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oN)}catch(e){console.error(e)}}oN(),mA.exports=Y1;var eq=mA.exports;const tq=G1(eq);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const nq="agent";function rq(e){return e===nq}var sq=3e4,iq=new Set(["authorized","expired","error","cancelled"]),oq=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 aq(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 aq(e,t,n,r){return await lq(e,t,n,r)}async function b8(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof vu&&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 w8(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function lq(e,t,n,r){var u;let s=r.signal,i=w8(r.timeoutMs,{allowZero:!0}),o=w8(r.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+sq,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(s!=null&&s.aborted)throw Xw(s);if(Date.now()>=a)return await b8(e,t,n,s);let d=await b8(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)),iq.has(d.status))return d;await cq(l,s)}}async function cq(e,t){if(t!=null&&t.aborted)throw Xw(t);await new Promise((n,r)=>{let s=setTimeout(()=>{o(),n()},e),i=()=>{o(),r(Xw(t))};function o(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function Xw(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var vu=class extends Error{constructor(n,r,s){super(s);le(this,"status");le(this,"body");this.name="DaemonHttpError",this.status=n,this.body=r}},v8=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},uq=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},x8=16*1024*1024;async function*dq(e,t){let n=e.getReader(),r=new TextDecoder,s="",i;t&&(i=()=>{n.cancel().catch(()=>{})},t.aborted?i():t.addEventListener("abort",i,{once:!0}));try{for(;;){if(t!=null&&t.aborted)return;let o,a;try{({value:o,done:a}=await n.read())}catch(c){if(t!=null&&t.aborted)return;throw c}if(a){if(s+=r.decode(),s.length>0){let c=_8(s);for(let u of c.frames){let d=c2(u);d&&(yield d)}if(c.tail.length>0){let u=c2(c.tail);u&&(yield u)}}return}if(s+=r.decode(o,{stream:!0}),s.length>x8)throw new uq(`parseSseStream: unread buffer exceeded ${x8} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=_8(s);if(l.frames.length>0)for(let c of l.frames){let u=c2(c);u&&(yield u)}s=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function _8(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 c2(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 hq=class{constructor(e,t,n){le(this,"baseUrl");le(this,"token");le(this,"_fetch");le(this,"_disposed",!1);le(this,"type","rest");le(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 v8;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var u;if(this._disposed)throw new v8;let n={Accept:"text/event-stream"};this.token&&(n.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(n["Last-Event-ID"]=String(t.lastEventId));let r=new AbortController,s,i=t.connectTimeoutMs;i&&Number.isFinite(i)&&(s=setTimeout(()=>r.abort(new DOMException("Initial connect timed out","TimeoutError")),i),typeof s=="object"&&s&&"unref"in s&&s.unref());let o=t.signal?fq([t.signal,r.signal]):r.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let l;try{l=await this._fetch(a,{headers:n,signal:o})}finally{s!==void 0&&clearTimeout(s)}if(!l.ok){let d;try{let m=await l.text();try{d=JSON.parse(m)}catch{d=m}}catch{}let f=d&&typeof d=="object"&&"error"in d?String(d.error):`HTTP ${l.status}`;throw new vu(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 vu(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*dq(l.body,t.signal)}dispose(){this._disposed=!0}};function fq(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}var Ym="/workspace/memory/remember",k8=20,mq=3e4,pq=65e3,gq=9e4,yq=5,Qh=33e4,bq="X-Qwen-Client-Id";function S8(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function aN(e){if(e===void 0)return yq;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 wq(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function vq(){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 T8=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 lN(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var cN=class{constructor(e){le(this,"baseUrl");le(this,"token");le(this,"_fetch");le(this,"fetchTimeoutMs");le(this,"promptLimit");le(this,"promptCounts",Object.create(null));le(this,"transport");le(this,"_authFlow");this.baseUrl=wq(e.baseUrl),this.token=e.token??vq(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??mq;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=aN(e.maxPendingPromptsPerSession),this.transport=e.transport??new hq(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new oq(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 T8(e,t,r);n[e]=r+1;let s;return()=>{s||(s=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,r,s="transport"){let i=this.fetchTimeoutMs;if(r!==void 0&&Number.isFinite(r)&&r>=0&&(i=r),!i||!Number.isFinite(i)){let u=s==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(u):u}let o=new AbortController,a=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let l=t.signal??void 0,c=l?C8([l,o.signal]):o.signal;try{let u=s==="rest"?await this._fetch(e,{...t,signal:c}):await this.transport.fetch(e,{...t,signal:c});return n?await n(u):u}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[bq]=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 T8(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new vu(e.status,r,`${t}: ${s}`)}async jsonRequest(e,t,n={}){let r=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(r?{"Content-Type":"application/json"}:{},n.clientId),...r?{body:JSON.stringify(n.body)}:{}},async s=>{if(!s.ok)throw await this.failOnError(s,t);return await s.json()},n.timeoutMs)}async health(){return await this.fetchWithTimeout(`${this.baseUrl}/health`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /health");return await e.json()})}async capabilities(){return await this.fetchWithTimeout(`${this.baseUrl}/capabilities`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /capabilities");return await e.json()})}async workspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/mcp");return await e.json()})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(e)}/tools`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/tools");return await t.json()})}async workspaceMcpResources(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(e)}/resources`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/resources");return await t.json()})}async workspaceSkills(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/skills");return await e.json()})}async workspaceProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/providers");return await e.json()})}async workspaceHooks(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/hooks`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/hooks");return await e.json()})}async sessionHooks(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/hooks`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/hooks");return await t.json()})}async workspaceExtensions(){return await this.jsonRequest("/workspace/extensions","GET /workspace/extensions")}async installExtension(e,t){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:e,clientId:t})}async extensionOperationStatus(e){return await this.jsonRequest(`/workspace/extensions/operations/${encodeURIComponent(e)}`,"GET /workspace/extensions/operations/:operationId")}async checkExtensionUpdates(e){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:e})}async refreshExtensions(e){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:e})}async enableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t})}async readWorkspaceFile(e,t={},n){let r=new URL(`${this.baseUrl}/file`);return r.searchParams.set("path",e),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&r.searchParams.set("line",String(t.line)),t.limit!==void 0&&r.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file");return await s.json()})}async readWorkspaceFileBytes(e,t={},n){let r=new URL(`${this.baseUrl}/file/bytes`);return r.searchParams.set("path",e),t.offset!==void 0&&r.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file/bytes");return await s.json()})}async fileStat(e){let t=new URL(`${this.baseUrl}/stat`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(e){let t=new URL(`${this.baseUrl}/list`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async glob(e){let t=new URL(`${this.baseUrl}/glob`);return t.searchParams.set("pattern",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /glob");return await n.json()})}async writeWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/write`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/write");return await n.json()})}async editWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/edit`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/edit");return await n.json()})}async workspaceMemory(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/memory");return await e.json()})}async writeWorkspaceMemory(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/memory");return await n.json()})}async rememberWorkspaceMemory(e,t={}){return await this.jsonRequest(Ym,`POST ${Ym}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${Ym}/${encodeURIComponent(e)}`,`GET ${Ym}/:taskId`,{clientId:t==null?void 0:t.clientId})}async listWorkspaceAgents(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/agents");return await e.json()})}async createWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents");return await n.json()})}async generateWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({description:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents/generate");return await n.json()},Qh)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/agents/:agentType");return await t.json()})}async updateWorkspaceAgent(e,t,n={},r){let s=n.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}?scope=${encodeURIComponent(n.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`;return await this.fetchWithTimeout(s,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t)},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/agents/:agentType");return await i.json()})}async deleteWorkspaceAgent(e,t={},n){let r=t.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}?scope=${encodeURIComponent(t.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`;return await this.fetchWithTimeout(r,{method:"DELETE",headers:this.headers({},n)},async s=>{var i;if(s.status===204){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return}if(s.status===404){let o=await this.failOnError(s,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(s,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/env");return await e.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/preflight");return await e.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/tools");return await e.json()})}async createOrAttachSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({cwd:e.workspaceCwd,...e.modelServiceId?{modelServiceId:e.modelServiceId}:{},...e.sessionScope!==void 0?{sessionScope:e.sessionScope}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(e,t){let n=(t==null?void 0:t.pageSize)??k8,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:k8))),s=new URLSearchParams({size:String(r)});return(t==null?void 0:t.archiveState)!==void 0&&s.set("archiveState",t.archiveState),(await this.jsonRequest(`/workspace/${encodeURIComponent(e)}/sessions?${s.toString()}`,"GET /workspace/sessions")).sessions}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/branch");return await r.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/fork");return await r.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/context`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/context");return await n.json()})}async sessionContextUsage(e,t={},n){let r=new URLSearchParams;t.detail===!0&&r.set("detail","true");let s=r.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/context-usage${s?`?${s}`:""}`,{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /session/:id/context-usage");return await i.json()})}async sessionSupportedCommands(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/supported-commands`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/supported-commands");return await n.json()})}async sessionTasks(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/tasks`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/tasks");return await n.json()})}async sessionLspStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/lsp`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/lsp");return await n.json()})}async sessionTaskCancel(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({kind:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/tasks/:taskId/cancel");return await s.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/goal/clear`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/goal/clear");return await n.json()})}async sessionStats(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/stats`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({cwd:n.workspaceCwd})},async s=>{if(!s.ok)throw await this.failOnError(s,`POST /session/:id/${e}`);return await s.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:t,...(n==null?void 0:n.persist)===!0?{persist:!0}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/approval-mode");return await r.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/rewind/snapshots`,{method:"GET",headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/rewind/snapshots");return await t.json()})}async rewindSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:t,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/rewind");return await r.json()})}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/recap`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}",signal:t==null?void 0:t.signal});if(!n.ok)throw await this.failOnError(n,"POST /session/:id/recap");return await n.json()}async btwSession(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/btw");return await r.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:t}),signal:n==null?void 0:n.signal},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/mid-turn-message");return await r.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/pending-prompts`,{method:"GET",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/pending-prompts");return await n.json()})}async removePendingPrompt(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/pending-prompts/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async r=>{if(!r.ok)throw await this.failOnError(r,"DELETE /session/:id/pending-prompts/:promptId");return await r.json()})}async shellCommand(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/shell");return await r.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${encodeURIComponent(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/tools/:name/enable");return await r.json()})}async workspaceSettings(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/settings");return await t.json()})}async setWorkspaceSetting(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r==null?void 0:r.clientId),body:JSON.stringify({scope:e,key:t,value:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/settings");return await s.json()})}async workspaceVoice(e){return await this.jsonRequest("/workspace/voice","GET /workspace/voice",{clientId:e})}async setWorkspaceVoice(e,t){return await this.jsonRequest("/workspace/voice","POST /workspace/voice",{method:"POST",body:e,clientId:t})}async transcribeWorkspaceVoice(e,t){let n=t.voiceModel?`?${new URLSearchParams({voiceModel:t.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/voice/transcribe${n}`,{method:"POST",headers:this.headers({"Content-Type":t.mimeType},t.clientId),body:e},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/voice/transcribe");return await r.json()},pq,"rest")}async workspaceTrust(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/trust");return await t.json()})}async requestWorkspaceTrustChange(e,t){return await this.jsonRequest("/workspace/trust/request","POST /workspace/trust/request",{method:"POST",body:e,clientId:t})}async workspacePermissions(e){return await this.jsonRequest("/workspace/permissions","GET /workspace/permissions",{clientId:e==null?void 0:e.clientId})}async setWorkspacePermissionRules(e,t,n,r){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:r==null?void 0:r.clientId})}async addWorkspacePermissionRule(e,t,n,r){let s=S8(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?i:await this.setWorkspacePermissionRules(e,t,[...o,s],r)}async removeWorkspacePermissionRule(e,t,n,r){let s=S8(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==s),r):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${encodeURIComponent(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/restart");return await r.json()},(t==null?void 0:t.timeoutMs)??Qh)}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)??Qh)}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)??Qh)}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)??Qh)}async initWorkspace(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/init`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:JSON.stringify((e==null?void 0:e.force)===!0?{force:!0}:{})},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/init");return await t.json()})}async setupGithub(e,t){return await this.jsonRequest("/workspace/setup-github","POST /workspace/setup-github",{method:"POST",body:e,clientId:t,timeoutMs:gq})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/model");return await r.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:t,syncOutputLanguage:(n==null?void 0:n.syncOutputLanguage)??!1})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/language");return await r.json()})}async prompt(e,t,n,r){n==null||n.throwIfAborted();let s=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t),signal:n});if(o.status===202){let a=await o.json();i=!1;try{return await this._awaitTurnComplete(e,a.promptId,a.lastEventId,n,r)}finally{s()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&s()}}async promptNonBlocking(e,t,n,r){let s=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t),signal:n});if(s.status===202)return await s.json();if(!s.ok)throw await this.failOnError(s,"POST /session/:id/prompt",e);return await s.json()}async _awaitTurnComplete(e,t,n,r,s){let i=new AbortController,o=r?C8([r,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=s_(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(a){throw r!=null&&r.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,s).catch(()=>{}),a}finally{i.signal.aborted||i.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/heartbeat`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/heartbeat");return await n.json()})}async cancel(e,t){await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var r;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((r=n.body)==null?void 0:r.cancel())}catch{}})}async*subscribeEvents(e,t={}){yield*this.transport.subscribeEvents(e,{lastEventId:t.lastEventId,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${encodeURIComponent(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{var s,i;if(r.status===200){try{await((s=r.body)==null?void 0:s.cancel())}catch{}return!0}if(r.status===404){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/permission/${encodeURIComponent(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(n)},async s=>{var i,o;if(s.status===200){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!0}if(s.status===404){try{await((o=s.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${encodeURIComponent(e)}`,{headers:this.headers({},t.clientId),signal:t.signal},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/auth/device-flow/:id");return await n.json()})}async cancelDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${encodeURIComponent(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /workspace/auth/device-flow/:id")})}async getAuthStatus(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/status");return await t.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/providers");return await e.json()})}async installAuthProvider(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/auth/provider");return await t.json()})}dispose(){this.transport.dispose()}async 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 C8(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}function s_(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 vu(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function A8(e){return"promptId"in e&&"lastEventId"in e}var Xm=class sg{constructor(t){le(this,"client");le(this,"session");le(this,"state");le(this,"replaySnapshot");le(this,"hasActivePrompt");le(this,"lastSeenEventId");le(this,"subscriptionActive",!1);le(this,"reattaching");le(this,"promptLimit");le(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=Qm(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:aN(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 sg({client:t,session:s,hasActivePrompt:s.hasActivePrompt,lastEventId:i})}static async load(t,n,r={},s){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:l,lastEventId:c,...u}=await t.loadSession(n,r,s);return new sg({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:c??0,replaySnapshot:{compactedReplay:a??[],liveJournal:l??[]}})}static async resume(t,n,r={},s){let{state:i,hasActivePrompt:o,lastEventId:a,...l}=await t.resumeSession(n,r,s);return new sg({client:t,session:l,hasActivePrompt:o,state:i,lastEventId:a??0})}get sessionId(){return this.session.sessionId}get workspaceCwd(){return this.session.workspaceCwd}get attached(){return this.session.attached}get clientId(){return this.session.clientId}get lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=Qm(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)),!A8(s))return r(),s;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw r(),i}return new Promise((i,o)=>{let a=()=>{let c=this._pendingPrompts.get(s.promptId);c&&this._pendingPrompts.delete(s.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),c.reject(n.reason??new DOMException("Aborted","AbortError")))},l=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(s.promptId,{resolve:c=>{l(),r(),i(c)},reject:c=>{l(),r(),o(c)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!A8(r))throw new Error("Expected non-blocking prompt acceptance");return r}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!xq(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 getPendingPrompts(){return await this.client.getPendingPrompts(this.sessionId,{...this.clientId?{clientId:this.clientId}:{}})}async removePendingPrompt(t){return await this.client.removePendingPrompt(this.sessionId,t,{...this.clientId?{clientId:this.clientId}:{}})}async shellCommand(t,n){return await this.client.shellCommand(this.sessionId,t,{...n?{signal:n}:{},...this.clientId?{clientId:this.clientId}:{}})}async context(){return await this.client.sessionContext(this.sessionId,this.clientId)}async contextUsage(t={}){return await this.client.sessionContextUsage(this.sessionId,t,this.clientId)}async supportedCommands(){return await this.client.sessionSupportedCommands(this.sessionId,this.clientId)}async tasks(){return await this.client.sessionTasks(this.sessionId,this.clientId)}async lspStatus(){return await this.client.sessionLspStatus(this.sessionId,this.clientId)}async cancelTask(t,n){return await this.client.sessionTaskCancel(this.sessionId,t,n,this.clientId)}async clearGoal(){return await this.client.sessionGoalClear(this.sessionId,this.clientId)}async stats(){return await this.client.sessionStats(this.sessionId,this.clientId)}async respondToPermission(t,n){return await this.client.respondToPermission(t,n,this.clientId)}async respondToSessionPermission(t,n){return await this.client.respondToSessionPermission(this.sessionId,t,n,this.clientId)}async close(){return await this.client.closeSession(this.sessionId,this.clientId)}async 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=Qm(t.lastEventId),r=!1,s=!1,i=()=>{s||(s=!0,this.subscriptionActive=!1)},o=()=>{if(!r){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,r=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async l=>(s||o(),await a.next(l)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async l=>{try{return await a.throw(l)}finally{i()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(t,n){try{let{resume:r=!0,...s}=t,i=s.lastEventId??(r?this.lastSeenEventId:void 0);for await(let o of this.client.subscribeEvents(this.sessionId,{...s,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,Qm(o.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var s;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(s=t.data)==null?void 0:s.promptId;if(!n)return;let r=this._pendingPrompts.get(n);if(r){this._pendingPrompts.delete(n);try{let i=s_(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 Qm(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function xq(e){return e instanceof vu&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var uN="mid_turn_message_injected",i_="pending_prompt_added",o_="pending_prompt_started",a_="pending_prompt_completed",_q=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated",uN,i_,o_,a_,"client_evicted","slow_client_warning","stream_error","state_resync_required","mcp_budget_warning","mcp_child_refused_batch","memory_changed","agent_changed","auth_device_flow_started","auth_device_flow_throttled","auth_device_flow_authorized","auth_device_flow_failed","auth_device_flow_cancelled","approval_mode_changed","tool_toggled","settings_changed","trust_change_requested","workspace_initialized","github_setup_completed","mcp_server_restarted","mcp_server_restart_refused","settings_reloaded","mcp_server_added","mcp_server_removed","extensions_changed","permission_partial_vote","permission_forbidden","prompt_cancelled","replay_complete","followup_suggestion","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot"];new Set(_q);var kq=["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"],my=["plan","default","auto-edit","auto","yolo"],Qw="daemon-plan";function mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e,t){if(!mt(e))return;let n=e[t];return typeof n=="string"?n:void 0}function pn(e,t){if(mt(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function rc(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 Va(e){return rc(Ia(e))}function Ia(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Ia(n,t+1)):mt(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,dN(n)?"[redacted]":Ia(r,t+1)])):e}function dN(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 u2(e){if(typeof e=="string")return e;if(!mt(e))return"";let t=e.text;return typeof t=="string"?t:""}function Sq(e){if(typeof e=="string")return{kind:"text",text:e};if(!mt(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=mt(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=mt(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 Tq=64;function Zg(e,t=0){if(t>Tq)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(!mt(e))return e===void 0?"":rc(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 rc(e)}var Cq=new Set(kq),hN=new Set(["qwen","qwen-oauth"]),Aq=new Set(["in_flight","disabled","budget_would_exceed"]),E8="malformed memory_changed payload",M8=4096;function Eq(e,t={}){let n=Lq(e,t);switch(e.type){case"session_update":return Dq(e,n,t);case"shell_output":{let r=Zg(e.data),s=Zw(e.data),i=ev(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return Uq(e,n);case"permission_resolved":case"permission_already_resolved":return Hq(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:Te(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Te(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=I8(Te(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:Te(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Te(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Te(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=I8(Te(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:Te(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=Te(e.data,"code"),s=Te(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{promptId:s}:{},text:Te(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return Mq(e,n);case"session_rewound":return Nq(e,n);case"session_branched":return Iq(e,n);case"prompt_cancelled":{let r=pF(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return Rq(e,n);case"mid_turn_message_injected":return jq(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let r=Te(e.data,"command"),s=Te(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=Zn(e.data,"exitCode"),s=mt(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=Zn(e.data,"replayedCount")??0,s=Zn(e.data,"lastReplayedEventId")??Zn(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return Yq(e,n);case"approval_mode_changed":return Xq(e,n);case"memory_changed":return Qq(e,n);case"agent_changed":return Jq(e,n);case"tool_toggled":return Zq(e,n);case"settings_changed":return eF(e,n);case"trust_change_requested":return nF(e,n);case"workspace_initialized":return tF(e,n);case"github_setup_completed":return rF(e,n);case"mcp_budget_warning":return sF(e,n);case"mcp_child_refused_batch":return iF(e,n);case"mcp_server_restarted":return oF(e,n);case"mcp_server_restart_refused":return aF(e,n);case"extensions_changed":return lF(e,n);case"auth_device_flow_started":return cF(e,n);case"auth_device_flow_throttled":return uF(e,n);case"auth_device_flow_authorized":return dF(e,n);case"auth_device_flow_failed":return hF(e,n);case"auth_device_flow_cancelled":return mF(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${Va(e.data)}`}]}}function Mq(e,t){let n=Te(e.data,"reason"),r=Zn(e.data,"lastDeliveredId"),s=Zn(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?Rn(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function Nq(e,t){let n=Te(e.data,"promptId"),r=Zn(e.data,"targetTurnIndex");if(!n||r===void 0)return Rn(e,t,"malformed session_rewound payload");let s=Te(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function Iq(e,t){let n=Te(e.data,"sourceSessionId"),r=Te(e.data,"newSessionId"),s=Te(e.data,"displayName");return!n||!r||!s?Rn(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function Rq(e,t){let n=Te(e.data,"sessionId"),r=Te(e.data,"suggestion"),s=Te(e.data,"promptId");return!n||!r||!s?Rn(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function jq(e,t){if(!mt(e.data))return Rn(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?Rn(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function Lq(e,t){let n=fN(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Ia(e.data)}}:{}}}function fN(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(mt(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(mt(e.data)){let r=e.data._meta;if(mt(r)){let i=r.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let s=e.data.update;if(mt(s)){let i=s._meta;if(mt(i)){let o=i.serverTimestamp;if(typeof o=="number"&&Number.isFinite(o))return o;let a=i.timestamp;if(typeof a=="number"&&Number.isFinite(a))return a}}}}function Dq(e,t,n){let r=Vq(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${Va(e.data)}`}];let s=Te(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=r.content,o=Sq(i);if(o){if(o.kind==="image"){let l=o.source.data,c=o.mediaType||"image/*";if(c==="image/*"&&l){let u=(l.startsWith("data:")?l.split(",")[1]??"":l).slice(0,10);u.startsWith("iVBORw0KGg")?c="image/png":u.startsWith("/9j/")?c="image/jpeg":u.startsWith("R0lGOD")?c="image/gif":u.startsWith("UklGR")&&(c="image/webp")}return l?[{...t,type:"user.image.delta",data:l,mimeType:c}]:[]}return o.kind==="text"?o.text?[{...t,type:"user.text.delta",text:o.text}]:[]:[]}let a=u2(i);return a?[{...t,type:"user.text.delta",text:a}]:[]}case"agent_message_chunk":{let i=u2(r.content),o=N8(r),a=Oq(r),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=Bq(r);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=u2(r.content);if(!i)return[];let o=N8(r);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[Pq(r,t)];case"shell_output":case"tool_output":{let i=Zg(r),o=Zw(r)??Zw(e.data),a=ev(r)??ev(e.data);return i?[{...t,type:a==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(r.availableCommands)?r.availableCommands:[]).filter(mt);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[zq(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${Va(r)}`}]}}function N8(e){let t=mt(e._meta)?e._meta:void 0;return t?Te(t,"parentToolCallId"):void 0}function Oq(e){let t=mt(e._meta)?e._meta:void 0;return t?{...t}:void 0}function Bq(e){let t=mt(e._meta)?e._meta:void 0,n=t&&mt(t.usage)?t.usage:void 0;if(!n)return;let r=Zn(n,"inputTokens"),s=Zn(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=Zn(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function Pq(e,t){let n=mt(e._meta)?e._meta:void 0,r=Te(e,"toolName")??Te(e,"name")??(n?Te(n,"toolName"):void 0)??(n?Te(n,"name"):void 0),s=Te(e,"kind"),i=Te(e,"title")??r??s,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?Ia(o):void 0,c=a!==void 0?Ia(a):void 0,u=e.content!==void 0?Ia(e.content):void 0,d=e.locations!==void 0?Ia(e.locations):void 0,f=Te(e,"toolCallId"),m=Te(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}=Fq(e,r),x=Te(e,"parentToolCallId")??(n?Te(n,"parentToolCallId"):void 0),b=x&&x!==f?x:void 0,w=Te(e,"subagentType")??(n?Te(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:f,...m?{status:m}:{},...i?{title:i}:{},...r?{toolName:r}:{},...s?{toolKind:s}:{},...u!==void 0?{content:u}:{},...d!==void 0?{locations:d}:{},...p?{provenance:p}:{},...y?{serverId:y}:{},...b?{parentToolCallId:b}:{},...w?{subagentType:w}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:Jw(Va(l))}:c!==void 0?{details:Jw(Va(c))}:{}}}function zq(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=Jw($q(n)),s=t.eventId!==void 0?`${Qw}-${t.eventId}`:Qw,i=mt(e._meta)?e._meta:void 0,o=i&&mt(i.stats)?i.stats:void 0;return{...t,type:"tool.update",toolCallId:s,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:r}}],rawOutput:o?{entries:n,stats:o}:{entries:n}}}function $q(e){return e.flatMap(t=>{if(!mt(t))return[];let n=Te(t,"content");return n?[`- [${qq(Te(t,"status"))}] ${n}`]:[]}).join(`
`)}function qq(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function Fq(e,t){let n=Te(e,"provenance"),r=Te(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 I8(e){if(e)return Cq.has(e)?e:void 0}function Jw(e){return e.length<=M8?e:`${e.slice(0,M8)}... [truncated]`}function Uq(e,t){if(!mt(e.data))return[{...t,type:"debug",text:`permission_request: ${Va(e.data)}`}];let n=Te(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Va(e.data)}`}];let r=e.data.toolCall!==void 0?Ia(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:Te(e.data,"sessionId"),title:Kq(r),options:Wq(e.data.options),toolCall:r}]}function Hq(e,t){let n=Te(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Va(e.data)}`}];let r=Te(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:Gq(e.data),...r?{voterClientId:r}:{}}]}function Vq(e){if(!mt(e))return;let t=e.update;return mt(t)?t:e}function Wq(e){return Array.isArray(e)?e.flatMap(t=>{if(!mt(t))return[];let n=Te(t,"optionId");return n?[{optionId:n,label:Te(t,"label")??Te(t,"title")??Te(t,"name")??n,...Te(t,"description")?{description:Te(t,"description")}:{},raw:t}]:[]}):[]}function Gq(e){if(!mt(e))return rc(e);let t=e.outcome;if(typeof t=="string")return t;if(mt(t)){let n=Te(t,"outcome")??"selected",r=Te(t,"optionId");return r?`${n}:${r}`:n}return pn(e,["status","reason"])??rc(e)}function Kq(e){return mt(e)?Te(e,"title")??Te(e,"name")??Te(e,"kind")??Te(e,"toolName")??"Tool permission":"Tool permission"}function Zw(e){let t=Te(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function ev(e){if(!mt(e))return;let t=Te(e,"source");if(t)return t;let n=e._meta;return mt(n)?Te(n,"source"):void 0}function Rn(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function Yq(e,t){let n=Te(e.data,"sessionId");if(!n)return Rn(e,t,"missing sessionId");let r=Te(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function Xq(e,t){let n=Te(e.data,"sessionId"),r=Te(e.data,"previous"),s=Te(e.data,"next");if(!n||!r||!s)return Rn(e,t,"missing sessionId / previous / next");let i=mt(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 Qq(e,t){var o;let n=Te(e.data,"scope");if(n==="managed"){let a=Te(e.data,"source"),l=Te(e.data,"taskId"),c=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(c))||c.some(u=>u!=="user"&&u!=="project")?Rn(e,t,E8):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:c}]}let r=Te(e.data,"filePath"),s=Te(e.data,"mode"),i=Zn(mt(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?Rn(e,t,E8):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function Jq(e,t){let n=Te(e.data,"change"),r=Te(e.data,"name"),s=Te(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?Rn(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function Zq(e,t){let n=Te(e.data,"toolName"),r=mt(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?Rn(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function eF(e,t){let n=Te(e.data,"key"),r=Te(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:mt(e.data)?e.data.value:void 0}]:Rn(e,t,"malformed settings_changed payload")}function tF(e,t){let n=Te(e.data,"path"),r=Te(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?Rn(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function nF(e,t){let n=Te(e.data,"workspaceCwd"),r=Te(e.data,"desiredState"),s=Te(e.data,"reason");return!n||r!=="trusted"&&r!=="untrusted"?Rn(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:r,...s!==void 0?{reason:s}:{}}]}function rF(e,t){let n=Te(e.data,"releaseTag"),r=Te(e.data,"readmeUrl");if(!n||!r||!mt(e.data))return Rn(e,t,"malformed github_setup_completed payload");let s=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:r,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(s)?s:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function sF(e,t){if(!mt(e.data))return Rn(e,t,"non-object payload");let n=Zn(e.data,"liveCount"),r=Zn(e.data,"reservedCount"),s=Zn(e.data,"budget"),i=Zn(e.data,"thresholdRatio"),o=Te(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Rn(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:o}]}function iF(e,t){if(!mt(e.data))return Rn(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(mt).map(o=>{let a=Te(o,"name"),l=Te(o,"transport"),c=Te(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],r=Zn(e.data,"budget"),s=Zn(e.data,"liveCount"),i=Zn(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?Rn(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function oF(e,t){let n=Te(e.data,"serverName"),r=Zn(e.data,"durationMs");return!n||r===void 0?Rn(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function aF(e,t){let n=Te(e.data,"serverName"),r=Te(e.data,"reason");return!n||!r||!Aq.has(r)?Rn(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function lF(e,t){let n=Zn(e.data,"refreshed"),r=Zn(e.data,"failed"),s=Te(e.data,"status"),i=Te(e.data,"source"),o=Te(e.data,"name"),a=Te(e.data,"version"),l=Te(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"?Rn(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:r,...s?{status:s}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...l?{error:l}:{}}]}function cF(e,t){let n=Te(e.data,"deviceFlowId"),r=Te(e.data,"providerId"),s=Zn(e.data,"expiresAt");return!n||!r||!hN.has(r)||s===void 0?Rn(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function uF(e,t){let n=Te(e.data,"deviceFlowId"),r=Zn(e.data,"intervalMs");return!n||r===void 0?Rn(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function dF(e,t){let n=Te(e.data,"deviceFlowId"),r=Te(e.data,"providerId");if(!n||!r||!hN.has(r))return Rn(e,t,"malformed auth_device_flow_authorized payload");let s=Zn(e.data,"expiresAt"),i=Te(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function hF(e,t){let n=Te(e.data,"deviceFlowId"),r=Te(e.data,"errorKind");if(!n||!fF(r))return Rn(e,t,"malformed auth_device_flow_failed payload");let s=Te(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function fF(e){return typeof e=="string"&&e.trim().length>0}function mF(e,t){let n=Te(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Rn(e,t,"malformed auth_device_flow_cancelled payload")}function Zn(e,t){if(!mt(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function pF(e,t){if(!mt(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var gF=8;function e1(e,t={},n=0){if(n>gF){let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(mt(e)){let p=e.rawInput??e.input??e.args;if(p!==void 0&&p!==e){let y=e1(p,{title:t.title??pn(e,["title"]),toolName:t.toolName??pn(e,["toolName","name"]),toolKind:t.toolKind??pn(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let r=xF(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=vF(e,t);if(s)return s;let i=TF(e,t);if(i)return i;let o=CF(e,t);if(o)return o;let a=AF(e,t);if(a)return a;let l=yF(e,t);if(l)return l;let c=bF(e,t);if(c)return c;let u=wF(e);if(u)return u;let d=EF(e,t);if(d)return d;let f=MF(e);if(f)return f;if(mt(e)){let p=pn(e,["command","cmd"]);if(p){let x=pn(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...x?{cwd:x}:{}}}let y=kF(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 yF(e,t={}){if(!mt(e))return;let n=pn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=pn(e,["oldText","old_text","old_str","oldString"]),s=pn(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!r,a=s===void 0&&o?pn(e,["content"]):void 0,l=s??a,c=pn(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 bF(e,t){if(!mt(e))return;let n=pn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??pn(e,["toolName","name"]),s=r!==void 0&&/read|view|cat/i.test(r),i=e.lineRange??e.line_range??e.range,o;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")o=[i[0],i[1]];else{let a=e.offset,l=e.limit;typeof a=="number"&&typeof l=="number"&&l>0&&(o=[a+1,a+l])}if(!(!s&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function wF(e){if(!mt(e))return;let t=pn(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=pn(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function vF(e,t){let n=t.toolName??(mt(e)?pn(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let r=n.slice(5),s=r.indexOf("__");if(s<=0)return;let i=r.slice(0,s),o=r.slice(s+2),a;if(mt(e)){let l=e.arguments??e.args??e;if(mt(l)){let c=Object.entries(l).filter(([u])=>u!=="name"&&u!=="toolName").slice(0,1).map(([u,d])=>{let f=typeof d=="string"?d:JSON.stringify(d),m=f.length>60?`${f.slice(0,60)}…`:f;return`${u}=${m}`})[0];c&&(a=c)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function xF(e){return!mt(e)||!Array.isArray(e.questions)?[]:e.questions.filter(mt).map(t=>{let n=pn(t,["header","title","label"]),r=pn(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(mt).map(_F):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function _F(e){let t=pn(e,["label","title","value"])??"Option",n=pn(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function kF(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=pn(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)||mt(s)||t.push({label:r,value:dN(r)?"[redacted]":Va(s)});return t}var R8=50,SF=5;function TF(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!mt(e))return;let r=pn(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=pn(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=pn(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function CF(e,t){if(!mt(e))return;let n=pn(e,["query","pattern","search","q"]);if(!n)return;let r=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(r)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let s=typeof e.resultCount=="number"?e.resultCount:typeof e.total=="number"?e.total:Array.isArray(e.results)?e.results.length:Array.isArray(e.matches)?e.matches.length:void 0,i,o=e.results??e.matches;return Array.isArray(o)&&(i=o.slice(0,SF).map(a=>typeof a=="string"?a:mt(a)?pn(a,["path","file","name","title","text"])??rc(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...s!==void 0?{resultCount:s}:{},...i?{top:i}:{}}}function AF(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!mt(e))return;let r=pn(e,["prompt","description","query"]);if(!r)return;let s=pn(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=pn(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function EF(e,t){if(!mt(e))return;let n=pn(e,["code","snippet","source"]);if(!n)return;let r=pn(e,["language","lang","codeLanguage","syntax"]),s=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(s);if(!r&&!i)return;let o=pn(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...o?{origin:o}:{}}}function MF(e){if(!mt(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let s=t.filter(o=>typeof o=="string").slice(0,30);if(s.length===0)return;let i=n.slice(0,R8).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:rc(a).slice(0,80)):[]);return{kind:"tabular",columns:s,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let r=e.data??e.records;if(Array.isArray(r)&&r.length>0&&mt(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,R8).map(o=>{let a=o;return s.map(l=>{let c=a[l];return typeof c=="string"?c:rc(c).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var NF=1e3,cu="__trimmed_tool_block__",py="__trimmed_permission_block__",tv=1e5,j8=`
[truncated]
`,IF=16;function RF(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??NF}}var l_=new Set(["pending","confirming","running","in_progress"]),jF=new Set(["completed","success","failed","error","canceled","cancelled"]),LF=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function DF(e,t,n={}){let r=yN(e,n);h_(r);let s=f_(r,"user",t);return n.images&&n.images.length>0&&(s.images=[...n.images]),Jo(r,s),r.activeUserBlockId=s.id,bN(r)}function OF(e,t,n={}){if(t.length===0)return e;let r=yN(e,n);for(let i of t)BF(r,i);let s=bN(r);return Object.freeze(s.blocks),s}function c_(e){let t={};return e.forEach((n,r)=>{t[n.id]=r}),t}function BF(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!LF.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),d2(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let r=to(e,e.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:t.data,mimeType:t.mimeType}])}else{let r=f_(e,"user","");r.images=[{data:t.data,mimeType:t.mimeType}],Jo(e,r),e.activeUserBlockId=r.id}break}case"assistant.text.delta":d2(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":h_(e,t),(t.reason==="cancelled"||t.reason==="error")&&nv(e);break;case"assistant.usage":$F(e,t);break;case"thought.text.delta":d2(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":gN(e,t);break;case"shell.output":UF(e,t);break;case"user.shell.output":HF(e,t);break;case"permission.request":VF(e,t);break;case"permission.resolved":WF(e,t);break;case"model.changed":Wf(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Wf(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":PF(e,t);break;case"prompt.cancelled":nv(e),t.reason!=="forward_failed"&&GF(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":YF(e,t.targetTurnIndex);break;case"session.branched":Wf(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function PF(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},nv(e),Wf(e,"error",`State resync required: ${zF(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function zF(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 gy(e,t,n){let r=to(e,t);((r==null?void 0:r.kind)==="assistant"||(r==null?void 0:r.kind)==="thought")&&(r.streaming=!1,r.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(r.eventId=n.eventId),r.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(r.serverTimestamp=n.serverTimestamp))}function mN(e,t){gy(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function $F(e,t){let n=to(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 pN(e,t){gy(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function u_(e,t,n){gy(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function d_(e,t,n){gy(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function d2(e,t,n,r,s){let i=t!=="user"&&"parentToolCallId"in s?s.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,a=o&&i!=null?o[i]:e[n],l=to(e,a);if(l&&l.kind===t&&qF(l,s)){l.text=p_(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=f_(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),Jo(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&d_(e,i),t==="thought"&&u_(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&mN(e),t!=="thought"&&pN(e))}function qF(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 h_(e,t){mN(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))u_(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))d_(e,n,t);pN(e,t)}function gN(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===cu){if(KF(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],gN(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Wf(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let r=to(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=e1(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId),t.details&&(r.details=t.details),t.content!==void 0&&(r.content=t.content),t.locations!==void 0&&(r.locations=t.locations),t.rawInput!==void 0&&(r.rawInput=t.rawInput),t.rawOutput!==void 0&&(r.rawOutput=t.rawOutput),t.toolName&&(r.toolName=t.toolName),t.toolKind&&(r.toolKind=t.toolKind),t.parentToolCallId&&!r.parentToolCallId&&(r.parentToolCallId=t.parentToolCallId),r.parentToolCallId&&!r.parentBlockId){let o=e.toolBlockByCallId[r.parentToolCallId];o&&o!==cu&&(r.parentBlockId=o)}t.subagentType&&!r.subagentType&&(r.subagentType=t.subagentType),L8(e,t.toolCallId,t.status);return}let s=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==cu?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:gc(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:e1(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}:{}};Jo(e,i),e.toolBlockByCallId[t.toolCallId]=i.id;for(let o of e.blocks)if(o.kind==="tool"&&o.parentToolCallId===t.toolCallId&&!o.parentBlockId){let a=to(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}L8(e,t.toolCallId,t.status??"pending"),Ru(e,t.parentToolCallId)}function L8(e,t,n){if(n!==void 0){if(l_.has(n)){e.currentToolCallId=t;return}if(jF.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=FF(e));return}}}function FF(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"&&l_.has(n.status))return n.toolCallId}}function nv(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===cu)continue;let n=to(e,t);!n||n.kind!=="tool"||l_.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function UF(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=to(e,n.id);(s==null?void 0:s.kind)==="shell"&&(s.text=p_(s.text,t.text),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId));return}let r={id:gc(e,"shell"),kind:"shell",text:im(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}:{}};Jo(e,r),Ru(e)}function HF(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===t.stream&&!e.pendingUserShellCommand){let o=to(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=p_(o.text,t.text),o.updatedAt=e.now,t.eventId!==void 0&&(o.eventId=t.eventId));return}let r=e.pendingUserShellCommand,s=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:gc(e,"user-shell"),kind:"user_shell",text:im(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,Jo(e,i),Ru(e)}function VF(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===py)return;let r=to(e,n),s=e1(t.toolCall,{title:t.title});if((r==null?void 0:r.kind)==="permission"){r.title=t.title,r.options=t.options.map(o=>({...o})),r.toolCall=t.toolCall,r.preview=s,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let i={id:gc(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:s,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCall!==void 0?{toolCall:t.toolCall}:{}};Jo(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,Ru(e)}function WF(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===py)return;let r=to(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:gc(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}:{}};Jo(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,Ru(e)}function Wf(e,t,n,r,s={}){let i={id:gc(e,t),kind:t,text:im(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}}:{}};Jo(e,i),s.clearActiveText!==!1&&Ru(e)}function GF(e,t){let n={id:gc(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}:{}};Jo(e,n),Ru(e)}function f_(e,t,n,r,s,i){return{id:gc(e,t),kind:t,text:im(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...i?{meta:{...i}}:{}}}function yN(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 bN(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=c_(t),t1.set(e,e.blocks);for(let[r,s]of Object.entries(e.toolBlockByCallId))n.has(s)||(e.toolBlockByCallId[r]=cu);JF(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==cu&&delete e.trimmedToolNotificationByCallId[r];for(let[r,s]of Object.entries(e.permissionBlockByRequestId))n.has(s)||(e.permissionBlockByRequestId[r]=py);ZF(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let s=to(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 KF(e){return e.toolCallId===Qw||e.toolKind==="updated_plan"}var t1=new WeakMap;function m_(e){t1.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},t1.set(e,e.blocks))}function YF(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){D8(e,i);return}n+=1}r>=0&&t>=n&&D8(e,r)}function D8(e,t){m_(e),e.blocks=e.blocks.slice(0,t),t1.set(e,e.blocks),XF(e)}function XF(e){e.blockIndexById=c_(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 Jo(e,t){m_(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function to(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=QF(r);return m_(e),e.blocks[n]=s,s}function QF(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Lo(t)),toolCall:Lo(e.toolCall),preview:Lo(e.preview)}:e.kind==="tool"?{...e,preview:Lo(e.preview),content:Lo(e.content),locations:Lo(e.locations),rawInput:Lo(e.rawInput),rawOutput:Lo(e.rawOutput)}:{...e}}function gc(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function Ru(e,t){t?(u_(e,t),d_(e,t)):(h_(e),e.activeUserBlockId=void 0)}function p_(e,t){return e.length>=tv?e:im(e+t)}function im(e){if(e.length<=tv)return e;let t=Math.max(0,tv-j8.length);return`${e.slice(0,t)}${j8}`}function JF(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===cu).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 ZF(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===py).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function Lo(e,t=0){return t>IF?e:Array.isArray(e)?e.map(n=>Lo(n,t+1)):mt(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Lo(r,t+1)])):e}function eU(e={}){let t=O8(e),n=new Set,r=!1,s=()=>{for(let o of n)try{o()}catch(a){tU(a)}},i=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,s()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let a=Array.isArray(o)?o:[o];a.length!==0&&(t=OF(t,a),i())},appendLocalUserMessage(o,a){t=DF(t,o,{images:a}),i()},reset(o={}){t=O8({maxBlocks:o.maxBlocks??t.maxBlocks,...o}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function tU(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 O8(e){let t=e.blocks?[...e.blocks]:[];return{...RF({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:c_(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 nU="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function rU(e,t){var n;if(!e)return{models:[]};const r=new Set,s=[];let i=(n=e.current)==null?void 0:n.modelId,o;for(const a of e.providers)for(const l of a.models){!i&&l.isCurrent&&(i=l.modelId),o===void 0&&(i?l.modelId===i:l.isCurrent)&&(o=l.contextLimit);const c=[a.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:a.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:o}}function sU(e){var t;const n=ys((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=Sr(n,"currentModelId")??Sr(n,"currentModel"),s=n.availableModels,i=[];let o;if(Array.isArray(s))for(const a of s){const l=ys(a),c=Sr(l,"modelId")??Sr(l,"id")??Sr(l,"value");if(!c)continue;const u=ys(l==null?void 0:l._meta),d=vf(u,"contextLimit")??vf(u,"contextWindow")??vf(l,"contextLimit")??vf(l,"contextWindow");o===void 0&&r!==void 0&&c===r&&(o=d),i.push({id:c,baseModelId:Sr(l,"baseModelId")??uU(c),label:Sr(l,"name")??Sr(l,"label")??c,...d!==void 0?{contextWindow:d}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:o}}function wN(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}:{},..._N(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:vN(t,n),skills:e.availableSkills}}function vN(...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 iU(e,t){var n;if(e.type==="session_update"){const r=ys((n=ys(e.data))==null?void 0:n.update),s=xN(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:g_(s)})),Sr(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=cU(r);t(a=>({...a,commands:i.length>0?i:a.commands,skills:o}))}return}switch(e.type){case"session_metadata_updated":{const r=ys(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:Sr(r,"displayName")}));break}case"model_switched":{const r=Sr(ys(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=ys(e.data),s=Sr(r,"next")??Sr(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function oU(e){const t=Sr(e,"displayName");return t!=null&&t.trim()?t:void 0}function aU(e){var t;const n=ys((t=e==null?void 0:e.state)==null?void 0:t.modes);return Sr(n,"currentModeId")??Sr(n,"currentMode")}function g_(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 lU(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=ys((t=ys(r.data))==null?void 0:t.update),i=xN(s);if(i)return i}catch{}}function xN(e){const t=ys(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=ys(t==null?void 0:t.usage),r={...Jh(n,"inputTokens"),...Jh(n,"outputTokens"),...Jh(n,"totalTokens"),...Jh(n,"thoughtTokens"),...Jh(n,"cachedReadTokens")};return g_(r)!==void 0?r:void 0}function Jh(e,t){const n=vf(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function cU(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=ys(i),l=Sr(a,"name");if(!l)return[];const c=ys(a==null?void 0:a.input),u={name:l,description:Sr(a,"description")??"",input:c?{hint:Sr(c,"hint")??""}:null,_meta:ys(a==null?void 0:a._meta)??null};return[{name:l,description:u.description??"",...(o=u.input)!=null&&o.hint?{argumentHint:u.input.hint}:{},..._N(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:vN(n,s),skills:r}}function _N(e){const n=Sr(e??void 0,"source");return{...n?{source:n}:{}}}function ys(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Sr(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function vf(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function uU(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 B8(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 dU=3e4;function hU(e,t,n){const r=Number.isFinite(t)&&t>0?t:1e3,s=Number.isFinite(n)&&n>0?Math.max(r,n):r,i=r*2**Math.max(0,e-1),o=Math.min(i,s),a=.8+Math.random()*.4;return Math.min(s,Math.max(1,Math.round(o*a)))}async function nt(e,t,n=dU){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 fU(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 vr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function mU(e,t,n="replay",r=80,s){vr(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 pU="qwen-code-webui-client-id:session:";function P8(e,t){if(e)return e;if(typeof window>"u")return h2();try{if(t){const n=window.sessionStorage.getItem(kN(t));if(n)return n}return h2()}catch{return h2()}}function rv(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(kN(t),e)}catch{}}async function z8(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${gU(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,r=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(r.status===204||r.status===404))throw new Error(`Detach client failed (${r.status})`)}function h2(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function kN(e){return`${pU}${encodeURIComponent(e)}`}function gU(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 yU({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,passiveAssistantDoneTimerRef:a,getCreateSessionRequest:l,hasSessionActivePrompt:c,resetCurrentSessionActivePrompt:u,addNotice:d,setConnection:f,setPromptStatus:m,setRestoreSessionId:p,setRestoreMode:y,setRestoreSessionNonce:x,setNewSessionNonce:b}){function w(v,_,S){var C,E;const R=i.current+1;i.current=R,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${_} superseded by a newer request`,"AbortError")));const j=new Promise((M,$)=>{const H=setTimeout(()=>{var J;((J=s.current)==null?void 0:J.id)===R&&(s.current=void 0,$(Tn(d,`${_U(_)} session failed`,new Error(`Session ${_} timed out`),_==="load"?"load_session":"resume_session")))},3e4);s.current={id:R,sessionId:v,mode:_,timeout:H,resolve:M,reject:$}}),N=(C=t.current)==null?void 0:C.sessionId,B=N?n.current.get(N):void 0;return(E=B==null?void 0:B.reject)==null||E.call(B,new DOMException("Session switch interrupted prompt wait","AbortError")),N&&n.current.delete(N),u(),f(M=>({...M,status:"connecting",error:void 0,catchingUp:!0})),m("idle"),r.current.clear(),vr(a),S!=null&&S.deferTranscriptReset||e.reset(),y(_),p(v),x(M=>M+1),S!=null&&S.deferTranscriptReset?j.catch(M=>{if(!xf(M)){e.reset();const $=M instanceof Error?M.message:String(M);f(H=>({...H,status:"disconnected",error:$,catchingUp:void 0}))}throw M}):j}return{async sendPrompt(v,_){var S,C,E;const R=Un(d,t.current,"Prompt failed","send_prompt"),j=R.sessionId;if(n.current.has(j))throw Tn(d,"Prompt failed","A prompt is already in progress","send_prompt");vr(a),m("waiting");const N=new AbortController;n.current.set(j,{controller:N});try{const B=((_==null?void 0:_.images)??[]).map(H=>({data:H.data,mimeType:H.mimeType||H.mediaType||H.media_type||"image/*"}));(_==null?void 0:_.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(v,B);const M={prompt:B8(v,B)};_!=null&&_.retry&&(M.retry=!0);const $=await R.submitPrompt(M,N.signal);return await bU(n.current,r.current,j,N,$.promptId)}catch(B){if(xf(B))return((S=t.current)==null?void 0:S.sessionId)===j&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw lN(B)?B:(((C=t.current)==null?void 0:C.sessionId)===j&&e.dispatch({type:"assistant.done",reason:"error"}),Tn(d,"Prompt failed",B,"send_prompt"))}finally{const B=n.current.get(j);(B==null?void 0:B.controller)===N&&n.current.delete(j),((E=t.current)==null?void 0:E.sessionId)===j&&!c()&&m("idle")}},async submitPrompt(v,_){var S;const C=Un(d,t.current,"Prompt failed","send_prompt");if(_!=null&&_.sessionId&&C.sessionId!==_.sessionId)throw new Error("Session changed before prompt submission");const E=((_==null?void 0:_.images)??[]).map(N=>({data:N.data,mimeType:N.mimeType||N.mediaType||N.media_type||"image/*"}));(_==null?void 0:_.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(v,E);const R={prompt:B8(v,E)};_!=null&&_.retry&&(R.retry=!0);const j=await C.submitPrompt(R);if((S=_==null?void 0:_.signal)!=null&&S.aborted)throw await C.removePendingPrompt(j.promptId).catch(N=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",N),d({severity:"error",category:"user_action",operation:"send_prompt",code:"daemon.send_prompt.pending_cleanup_failed",message:"Prompt was accepted after cancellation but could not be removed from the queue.",debugMessage:N instanceof Error?N.message:String(N),recoverable:!0})}),_.signal.reason??new DOMException("Aborted","AbortError");return{promptId:j.promptId}},async cancel(){var v,_;const S=Un(d,t.current,"Cancel failed","cancel_prompt"),C=n.current.get(S.sessionId);C==null||C.controller.abort(),vr(a);const E=C?new AbortController:void 0;E&&n.current.set(S.sessionId,{controller:E});try{await nt(S.cancel(),"Cancel timed out")}catch(R){throw Tn(d,"Cancel failed",R,"cancel_prompt")}finally{E&&((v=n.current.get(S.sessionId))==null?void 0:v.controller)===E&&n.current.delete(S.sessionId),((_=t.current)==null?void 0:_.sessionId)===S.sessionId&&!c()&&m("idle")}},async setModel(v){const _=Un(d,t.current,"Set model failed","switch_model");try{const S=await nt(_.setModel(v),"Set model timed out");return f(C=>({...C,currentModel:v})),S}catch(S){throw Tn(d,"Set model failed",S,"switch_model")}},async setApprovalMode(v,_){const S=Un(d,t.current,"Set approval mode failed","set_approval_mode");try{const C=await nt(S.client.setSessionApprovalMode(S.sessionId,v,{persist:_==null?void 0:_.persist,clientId:S.clientId}),"Set approval mode timed out");return f(E=>({...E,currentMode:C.mode||v})),C}catch(C){throw Tn(d,"Set approval mode failed",C,"set_approval_mode")}},async respondToPermission(v,_){const S=Un(d,t.current,"Permission response failed","submit_permission");try{return await nt(S.respondToSessionPermission(v,_),"Permission response timed out")}catch(C){throw Tn(d,"Permission response failed",C,"submit_permission")}},async submitPermission(v,_,S){const C=Un(d,t.current,"Permission response failed","submit_permission"),E=_!==void 0&&_.length>0?{outcome:{outcome:"selected",optionId:_},...S?{answers:S}:{}}:{outcome:{outcome:"cancelled"},...S?{answers:S}:{}};try{return await nt(C.respondToSessionPermission(v,E),"Permission response timed out")}catch(R){throw Tn(d,"Permission response failed",R,"submit_permission")}},async heartbeat(){const v=t.current;if(!(!v||!o.current))return nt(v.heartbeat(),"Heartbeat timed out")},async listSessions(v){const _=t.current;if(!_)return[];try{return await nt(_.client.listWorkspaceSessions(_.workspaceCwd,v),"List sessions timed out")}catch(S){throw Tn(d,"List sessions failed",S,"list_sessions")}},async loadSession(v,_){return w(v,"load",_)},async resumeSession(v,_){return w(v,"resume",_)},async createSession(){const v=Un(d,t.current,"Create session failed","create_session"),_=await nt(v.client.createOrAttachSession(l()),"Create session timed out");return rv(_.clientId,_.sessionId),_},async newSession(){for(const[,v]of n.current)v.controller.abort();n.current.clear(),r.current.clear(),m("idle"),vr(a),s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException("New session requested","AbortError")),s.current=void 0),e.reset(),p(void 0),b(v=>v+1)},async releaseSession(v){try{const _=Un(d,t.current,"Release session failed","release_session");await nt(_.client.closeSession(v),"Release session timed out")}catch(_){throw Tn(d,"Release session failed",_,"release_session")}},async closeSession(){const v=Un(d,t.current,"Close session failed","close_session");try{await nt(v.close(),"Close session timed out")}catch(_){throw Tn(d,"Close session failed",_,"close_session")}},async refreshCommands(){const v=Un(d,t.current,"Refresh commands failed","refresh_commands");try{const _=await nt(v.supportedCommands(),"Refresh commands timed out"),{commands:S,skills:C}=wN(_);f(E=>({...E,commands:S,skills:C,supportedCommands:_}))}catch(_){throw Tn(d,"Refresh commands failed",_,"refresh_commands")}},async getContext(){const v=Un(d,t.current,"Load context failed","load_context");try{const _=await nt(v.context(),"Load context timed out");return f(S=>({...S,context:_,currentMode:wU(_)??S.currentMode,currentModel:vU(_)??S.currentModel})),_}catch(_){throw Tn(d,"Load context failed",_,"load_context")}},async getContextUsage(v){const _=Un(d,t.current,"Load context usage failed","load_context_usage");try{return await nt(_.contextUsage(v),"Load context usage timed out")}catch(S){throw Tn(d,"Load context usage failed",S,"load_context_usage")}},async renameSession(v){const _=Un(d,t.current,"Rename session failed","rename_session");try{return await nt(_.updateMetadata({displayName:v}),"Rename session timed out")}catch(S){throw Tn(d,"Rename session failed",S,"rename_session")}},async recapSession(){const v=Un(d,t.current,"Recap session failed","recap_session");try{return await nt(v.recap(),"Recap session timed out")}catch(_){throw Tn(d,"Recap session failed",_,"recap_session")}},async getRewindSnapshots(){const v=Un(d,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await nt(v.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(_){throw Tn(d,"Load rewind snapshots failed",_,"rewind_snapshots")}},async rewindSession(v,_){const S=Un(d,t.current,"Rewind session failed","rewind_session");try{return await nt(S.rewind(v,_),"Rewind session timed out")}catch(C){throw Tn(d,"Rewind session failed",C,"rewind_session")}},async btwSession(v,_){var S;const C=Un(d,t.current,"Side question failed","btw_session");try{return await nt(C.btw(v,_),"Side question timed out")}catch(E){throw(S=_==null?void 0:_.signal)!=null&&S.aborted||xf(E)?E:Tn(d,"Side question failed",E,"btw_session")}},async enqueueMidTurnMessage(v,_){const S=t.current;if(!S)return{accepted:!1};try{return await S.enqueueMidTurnMessage(v,_)}catch(C){return C instanceof DOMException&&C.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",C),{accepted:!1}}},async getPendingPrompts(v){const _=t.current;if(!_)return{pendingPrompts:[]};if(v!=null&&v.sessionId&&_.sessionId!==v.sessionId)throw new Error("Session changed before pending prompts refresh");return await _.getPendingPrompts()},async removePendingPrompt(v,_){const S=t.current;return S?_!=null&&_.sessionId&&S.sessionId!==_.sessionId?await S.client.removePendingPrompt(_.sessionId,v):await S.removePendingPrompt(v):{removed:!1}},async sendShellCommand(v){var _,S;const C=Un(d,t.current,"Shell command failed","send_shell_command"),E=`${C.sessionId}:shell`;m("waiting");const R=new AbortController;n.current.set(E,{controller:R});try{return await C.shellCommand(v,R.signal)}catch(j){throw Tn(d,"Shell command failed",j,"send_shell_command")}finally{((_=n.current.get(E))==null?void 0:_.controller)===R&&n.current.delete(E),((S=t.current)==null?void 0:S.sessionId)===C.sessionId&&!c()&&m("idle")}},async getTasks(){const v=Un(d,t.current,"Get tasks failed","load_tasks");try{return await nt(v.tasks(),"Get tasks timed out")}catch(_){throw Tn(d,"Get tasks failed",_,"load_tasks")}},async cancelTask(v,_){const S=Un(d,t.current,"Cancel task failed","cancel_task");try{return await nt(S.cancelTask(v,_),"Cancel task timed out")}catch(C){throw Tn(d,"Cancel task failed",C,"cancel_task")}},async clearGoal(){const v=Un(d,t.current,"Clear goal failed","clear_goal");try{return await nt(v.clearGoal(),"Clear goal timed out")}catch(_){throw Tn(d,"Clear goal failed",_,"clear_goal")}},async getStats(){const v=Un(d,t.current,"Load stats failed","load_stats");try{return await nt(v.stats(),"Load stats timed out")}catch(_){throw Tn(d,"Load stats failed",_,"load_stats")}},async respondToGlobalPermission(v,_){const S=Un(d,t.current,"Global permission response failed","submit_permission");try{return await nt(S.client.respondToPermission(v,_),"Global permission response timed out")}catch(C){throw Tn(d,"Global permission response failed",C,"submit_permission")}},async branchSession(v){const _=Un(d,t.current,"Branch session failed","branch_session");try{const S=await nt(_.client.branchSession(_.sessionId,{name:v},_.clientId),"Branch session timed out");return rv(S.clientId,S.sessionId),w(S.sessionId,"load").catch(C=>{xf(C)||Tn(d,"Branch session failed",C,"branch_session")}),{sessionId:S.sessionId,displayName:S.displayName}}catch(S){throw Tn(d,"Branch session failed",S,"branch_session")}},async forkSession(v){const _=Un(d,t.current,"Fork session failed","fork_session");try{return await nt(_.fork(v),"Fork session timed out")}catch(S){throw Tn(d,"Fork session failed",S,"fork_session")}}}}function bU(e,t,n,r,s){return new Promise((i,o)=>{const a=sv(n,s),l=t.get(a);if(l){t.delete(a),l.status==="resolved"?i(l.result):o(l.error);return}const c=e.get(n);if((c==null?void 0:c.controller)!==r){o(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==s){o(new Error(`Prompt accepted with unexpected id ${s}`));return}if(r.signal.aborted){e.delete(n),o(r.signal.reason??new DOMException("Aborted","AbortError"));return}const u=()=>{r.signal.removeEventListener("abort",d)},d=()=>{const f=e.get(n);(f==null?void 0:f.controller)===r&&e.delete(n),u(),o(r.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:s,resolve:f=>{u(),i(f)},reject:f=>{u(),o(f)}}),r.signal.addEventListener("abort",d,{once:!0})})}function sv(e,t){return JSON.stringify([e,t])}function wU(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 vU(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 Un(e,t,n,r){if(!t)throw Tn(e,n,"Daemon session is not connected",r);return t}function Tn(e,t,n,r){if(xf(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",o=new Error(i);return o.name="AbortError",o}const s=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:r,code:`daemon.${r}.failed`,message:`${t}: ${s}`,debugMessage:s,recoverable:!0}),xU(n instanceof Error?n:new Error(s))}function xf(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function xU(e){return Object.assign(e,{_alreadyDispatched:!0})}function _U(e){return e.charAt(0).toUpperCase()+e.slice(1)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const kU=33e4;function SU({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(s){const i=Ot(e,"List sessions failed"),o=t();return o?nt(i.listWorkspaceSessions(o,s),"List sessions timed out"):[]},async deleteSession(s){const i=Ot(e,"Delete session failed"),o=await nt(i.deleteSessionsData([s]),"Delete session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.removed.length>0||o.notFound.length>0},async deleteSessions(s){const i=Ot(e,"Delete sessions failed");return nt(i.deleteSessionsData(s),"Delete sessions timed out")},async loadMcpStatus(){const s=Ot(e,"Load MCP status failed");return nt(s.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(s){const i=Ot(e,"Load MCP tools failed");try{return await nt(i.workspaceMcpTools(s),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(s){const i=Ot(e,"Load MCP resources failed");try{return await nt(i.workspaceMcpResources(s),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(s){const i=Ot(e,"Restart MCP server failed");return nt(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const o=Ot(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return nt(o.manageMcpServer(s,i),"Manage MCP server timed out",a)},async loadSkillsStatus(){const s=Ot(e,"Load skills failed");return nt(s.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const s=Ot(e,"Load extensions failed");return nt(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=Ot(e,"Load tools failed");return nt(s.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(s,i){const o=Ot(e,"Set tool enabled failed");return nt(o.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=Ot(e,"Load settings failed");return nt(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,o){const a=Ot(e,"Set setting failed");return nt(a.setWorkspaceSetting(s,i,o),"Set setting timed out")},async loadMemoryStatus(){const s=Ot(e,"Load memory failed");return nt(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=Ot(e,"Read workspace file failed");return nt(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=Ot(e,"Write memory failed");return nt(i.writeWorkspaceMemory(s),"Write memory timed out")},async listAgents(){const s=Ot(e,"List agents failed");return nt(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s){const i=Ot(e,"Get agent failed");return nt(i.getWorkspaceAgent(s),"Get agent timed out")},async createAgent(s){const i=Ot(e,"Create agent failed");return nt(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=Ot(e,"Generate agent failed");return nt(i.generateWorkspaceAgent(s),"Generate agent timed out",kU)},async deleteAgent(s,i){const o=Ot(e,"Delete agent failed");return nt(o.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){Ot(e,"Glob workspace failed");const o=m2(n,"/glob");o.searchParams.set("pattern",s),(i==null?void 0:i.maxResults)!==void 0&&o.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&o.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&o.searchParams.set("cwd",i.cwd);const a=await nt(fetch(p2(o,n),{headers:f2(r)}),"Glob workspace timed out");if(!a.ok)throw new Error(await g2(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const s=Ot(e,"Load providers failed");return nt(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const o=Ot(e,"Read file bytes failed");return nt(o.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=Ot(e,"Write file failed");return nt(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=Ot(e,"Edit file failed");return nt(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){Ot(e,"Stat file failed");const i=m2(n,"/stat");i.searchParams.set("path",s);const o=await nt(fetch(p2(i,n),{headers:f2(r)}),"Stat file timed out");if(!o.ok)throw new Error(await g2(o,"GET /stat"));return await o.json()},async listDirectory(s){Ot(e,"List directory failed");const i=m2(n,"/list");i.searchParams.set("path",s);const o=await nt(fetch(p2(i,n),{headers:f2(r)}),"List directory timed out");if(!o.ok)throw new Error(await g2(o,"GET /list"));return await o.json()},async loadEnv(){const s=Ot(e,"Load env failed");return nt(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=Ot(e,"Load preflight failed");return nt(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=Ot(e,"Init workspace failed");return nt(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,o){const a=Ot(e,"Update agent failed");return nt(a.updateWorkspaceAgent(s,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(s,i){const o=Ot(e,"Install extension failed");return nt(o.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=Ot(e,"Load extension operation failed");return nt(i.extensionOperationStatus(s),"Load extension operation timed out")},async checkExtensionUpdates(s){const i=Ot(e,"Check extension updates failed");return nt(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=Ot(e,"Refresh extensions failed");return nt(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,o){const a=Ot(e,"Enable extension failed");return nt(a.enableExtension(s,i,o),"Enable extension timed out")},async disableExtension(s,i,o){const a=Ot(e,"Disable extension failed");return nt(a.disableExtension(s,i,o),"Disable extension timed out")},async updateExtension(s,i){const o=Ot(e,"Update extension failed");return nt(o.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const o=Ot(e,"Uninstall extension failed");return nt(o.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=Ot(e,"Start device flow failed");return nt(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const o=Ot(e,"Get device flow failed");return nt(o.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=Ot(e,"Cancel device flow failed");return nt(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=Ot(e,"Get auth status failed");return nt(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=Ot(e,"Get auth providers failed");return nt(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=Ot(e,"Install auth provider failed");return nt(i.installAuthProvider(s),"Install auth provider timed out")}}}function Ot(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function f2(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function m2(e,t){const n=SN(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function p2(e,t){return SN(t)?e.toString():`${e.pathname}${e.search}`}function SN(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 g2(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 y_=g.createContext(void 0);let Zh;function TU({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const o=g.useMemo(()=>r?new cN({baseUrl:e,token:t,transport:s}):void 0,[r,e,t,s]),a=g.useRef(o);a.current=o;const l=g.useRef(void 0),c=g.useRef(void 0),u=g.useRef(n),[d,f]=g.useState(void 0),[m,p]=g.useState(r?"connecting":"idle"),[y,x]=g.useState(void 0),b=g.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==o&&(l.current=o,c.current=void 0),!c.current){const _=o.capabilities().catch(S=>{throw c.current===_&&(c.current=void 0),S});c.current=_}return c.current},[o]);g.useEffect(()=>{if(!o)return;p("connecting"),x(void 0),f(void 0),Zh===o&&(Zh=void 0);let _=!1;return b().then(S=>{_||(f(S),p("connected"))}).catch(S=>{_||(x(S instanceof Error?S:new Error(String(S))),p("error"))}),()=>{_=!0,Zh=o,queueMicrotask(()=>{Zh===o&&(Zh=void 0,o.dispose())})}},[o,b]),u.current=(d==null?void 0:d.workspaceCwd)??n;const w=g.useMemo(()=>SU({getClient:()=>a.current,getWorkspaceCwd:()=>u.current,baseUrl:e,token:t}),[e,t]),v=g.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(d==null?void 0:d.workspaceCwd)??n,status:m,error:y,capabilities:d,getCapabilities:b,actions:w}},[o,t,e,n,m,y,d,b,w]);return h.jsx(y_.Provider,{value:v,children:i})}function b_(){const e=g.useContext(y_);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function yc(){return b_().actions}function TN(){return g.useContext(y_)}function CU(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&$8(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&$8(t)||(t==null?void 0:t.kind)==="tool"&&q8(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"&&q8(r))return"responding"}return"idle"}function AU(e,t){const n=CU(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function $8(e){return e.streaming===!0}function q8(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const iv=new Set;let n1;function F8(){return n1}function EU(e){return iv.add(e),()=>{iv.delete(e)}}function MU(e){n1={...e},CN()}function Jm(){n1!==void 0&&(n1=void 0,CN())}function CN(){for(const e of iv)e()}function NU(e){if(!e||typeof e!="object")return;const t=e;if(t.type!=="followup_suggestion")return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.suggestion,o=r.promptId;if(!(typeof s!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:s,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ov=new Set,AN=Object.freeze([]),y2=64;let Dl=AN;function U8(){return Dl}function IU(e){return ov.add(e),()=>{ov.delete(e)}}function RU(e){const t=[...Dl,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>y2){const n=t.length-y2;console.debug(`[mid-turn] sidechannel buffer over ${y2}; evicting ${n} oldest batch(es)`),Dl=t.slice(n)}else Dl=t;EN()}function jU(e){if(e.length===0||Dl.length===0)return;const t=new Set(e),n=Dl.filter(r=>!t.has(r));n.length!==Dl.length&&(Dl=n.length===0?AN:n,EN())}function EN(){for(const e of ov)e()}function LU(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==uN)return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.messages;if(typeof s!="string"||!Array.isArray(i))return;const o=i.filter(l=>typeof l=="string"&&l.length>0);if(o.length===0)return;const a=t.originatorClientId;return{sessionId:s,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const av=new Set,lv=new Set;let MN=0,Ld=[];function DU(){return MN}function H8(){return Ld}function OU(e){return av.add(e),()=>{av.delete(e)}}function BU(e){return lv.add(e),()=>{lv.delete(e)}}function PU(){MN++;for(const e of av)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function NN(){for(const e of lv)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function zU(e){if(e.length===0)return;const t=new Set(e),n=Ld.filter(r=>!t.has(r));n.length!==Ld.length&&(Ld=n,NN())}function $U(e){const t=IN(e);return t?(Ld=[...Ld,t].slice(-200),NN(),(t.type===i_||t.type===o_||t.type===a_)&&PU(),!0):!1}function qU(e){return IN(e)!==void 0}function IN(e){if(!e||typeof e!="object")return;const t=e,n=t.type,r=t.data;if(!r||typeof r!="object")return;const s=r;if(typeof s.sessionId=="string"&&((n===i_||n===o_||n===a_)&&typeof s.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof s.promptId=="string"))return e}function vl(e,t){const n=fN(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const RN=g.createContext(void 0),jN=g.createContext(void 0),w_=g.createContext(void 0),LN=g.createContext(void 0),DN=g.createContext(void 0),ON=g.createContext(void 0),FU=new Set([401,403,404,410]),UU=2e5,HU={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},VU=new Set([401,403]);function WU({baseUrl:e,token:t,workspaceCwd:n,initialSessionId:r,clientId:s,createSessionRequest:i,maxQueued:o=1024,maxBlocks:a=UU,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:x=3,loadWarnings:b,children:w}){const v=TN(),_=e??(v==null?void 0:v.baseUrl),S=t??(v==null?void 0:v.token),C=n??(v==null?void 0:v.workspaceCwd),E=g.useRef(v==null?void 0:v.client);E.current=v==null?void 0:v.client;const R=g.useRef(v==null?void 0:v.capabilities);R.current=v==null?void 0:v.capabilities;const j=g.useRef(v==null?void 0:v.getCapabilities);j.current=v==null?void 0:v.getCapabilities;const N=g.useRef(C);N.current=C;const B=g.useMemo(()=>eU({maxBlocks:a}),[a]),M=g.useRef(void 0),$=g.useRef(void 0),H=g.useRef(new Map),J=g.useRef(new Map),O=g.useRef(void 0),Y=g.useRef(0),G=g.useRef(void 0),ee=g.useRef(!1),L=g.useRef(new WeakSet),F=g.useRef({suppressOwnUserEcho:l,includeRawEvent:c}),P=g.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),A=g.useRef(b),ne=g.useRef(void 0);(!ne.current||s)&&(ne.current=P8(s)),F.current={suppressOwnUserEcho:l,includeRawEvent:c},P.current={reconnectDelayMs:m,maxReconnectDelayMs:p},A.current=b;const be=i==null?void 0:i.modelServiceId,he=i==null?void 0:i.sessionScope,ye=g.useRef(i);ye.current=i;const[me,se]=g.useState("idle"),[re,oe]=g.useState(r),[ke,He]=g.useState("load"),[Ve,ce]=g.useState(0),[xe,Me]=g.useState(0),[Re,ct]=g.useState({status:u?"connecting":"idle"}),Ct=g.useRef(0),[vt,Rt]=g.useState([]),Ke=g.useCallback(ht=>{const ft={...ht,id:ht.id??`daemon-notice-${Date.now()}-${++Ct.current}`,createdAt:ht.createdAt??Date.now()};return Rt(pe=>[...pe.slice(-49),ft]),ft},[]),pt=g.useCallback(ht=>{Rt(ft=>ft.filter(pe=>pe.id!==ht))},[]),yt=g.useCallback(()=>{Rt([])},[]),ae=g.useMemo(()=>({notices:vt,dismissNotice:pt,clearNotices:yt}),[yt,pt,vt]),[V,ue]=g.useState(HU),Ne=g.useRef(()=>!1);g.useEffect(()=>{if(!u)return;if(!E.current&&!_){ct({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const ht=new AbortController;let ft=!1;return(async()=>{var Ae,te,K,ie,fe,We,Mt,_t,jn,ur;const Xr=E.current??new cN({baseUrl:_,token:S});let on,Be,gt=re,dn=!re&&xe>0,Ts=0,_o=()=>!1,rl=!1;for(;!ft&&!ht.signal.aborted;){try{let xn=!1,Fn=!1,Qr=!1,ds,ci;if(!on){ct(jr=>({...jr,status:"connecting",error:void 0}));const De=j.current,rt=R.current??(De?await De():await Xr.capabilities());if(ft||ht.signal.aborted)return;Be=rt,ee.current=Array.isArray(rt.features)&&rt.features.includes("client_heartbeat");const At=N.current??rt.workspaceCwd,tn=re&&ke==="resume"?Xm.resume:Xm.load,Gt=s?ne.current:P8(void 0,re??gt),fn=re?await tn(Xr,re,{workspaceCwd:At},Gt):gt?await Xm.load(Xr,gt,{workspaceCwd:At},Gt):await Xm.createOrAttach(Xr,{...be!==void 0?{modelServiceId:be}:{},...dn?{sessionScope:"thread"}:he!==void 0?{sessionScope:he}:{},workspaceCwd:At},Gt);if(!s&&fn.clientId&&(ne.current=fn.clientId,rv(fn.clientId,fn.sessionId)),ft||ht.signal.aborted){z8({baseUrl:_,token:S,sessionId:fn.sessionId,clientId:fn.clientId}).catch(jr=>console.warn("[DaemonSessionProvider] detach failed:",jr));return}const fs=$.current;fs!==fn.sessionId&&yt(),fs!==void 0&&fn.sessionId!==fs?(se("idle"),vr(G),Qr=!0):fs!==void 0&&(fn.replaySnapshot.compactedReplay.length+fn.replaySnapshot.liveJournal.length>0?(se("idle"),vr(G),Qr=!0):(B.dispatch({type:"assistant.done",reason:"reconnected"}),B.getSnapshot().awaitingResync&&B.clearAwaitingResync())),xn=fs!==void 0&&fs===fn.sessionId,Fn=fn.replaySnapshot.compactedReplay.length>0||fn.replaySnapshot.liveJournal.length>0;const Rr=[...fn.replaySnapshot.compactedReplay,...fn.replaySnapshot.liveJournal];ds=lU(Rr),ci=g_(ds),on=fn,gt=on.sessionId,dn=!1,$.current=on.sessionId,M.current=on}const Xt=on,ui=L.current.has(Xt);let Jr=Xt.hasActivePrompt===!0&&!ui;const ia=()=>{L.current.add(Xt),Jr=!1},Zr=()=>Jr||H.current.has(Xt.sessionId);_o=Zr,Ne.current=Zr,se(Zr()?"streaming":"idle");const[hs,oa,ji]=await Promise.allSettled([Xr.workspaceProviders(),Xt.supportedCommands(),Xt.context()]),aa=hs.status==="fulfilled"?hs.value:void 0,sl=oa.status==="fulfilled"?oa.value:void 0,la=ji.status==="fulfilled"?ji.value:void 0,il=[hs.status==="rejected"?(Ae=A.current)==null?void 0:Ae.models:void 0,oa.status==="rejected"?(te=A.current)==null?void 0:te.commands:void 0,ji.status==="rejected"?(K=A.current)==null?void 0:K.context:void 0].filter(De=>!!De),Nr=rU(aa),Fs=sU(la),ca=Fs&&Fs.models.length>0?Fs.models:Nr.models,Ir=(Fs==null?void 0:Fs.currentModel)??Nr.currentModel,di=Ir===Nr.currentModel?Nr.contextWindow:(ie=Nr.models.find(De=>De.id===Ir))==null?void 0:ie.contextWindow,zu=(Fs==null?void 0:Fs.contextWindow)??((fe=ca.find(De=>De.id===Ir))==null?void 0:fe.contextWindow)??di,{commands:Oh,skills:$u}=wN(sl),qu=aU(la);ct(De=>({status:"connected",sessionId:Xt.sessionId,...Xt.clientId?{clientId:Xt.clientId}:{},workspaceCwd:Xt.workspaceCwd,commands:Oh,skills:$u,models:ca,currentModel:Ir,currentMode:qu,displayName:oU(Xt.state)??(De.sessionId===Xt.sessionId?De.displayName:void 0),tokenUsage:ds!==void 0?ds:De.sessionId===Xt.sessionId?De.tokenUsage:void 0,tokenCount:ci!==void 0?ci:De.sessionId===Xt.sessionId?De.tokenCount??0:0,contextWindow:zu,providers:aa,supportedCommands:sl,context:la,capabilities:Be,catchingUp:xn||Xt.lastEventId!=null||void 0})),il.length>0&&B.dispatch(il.map(De=>({type:"status",text:De})));const Ln=O.current,Sn=(Ln==null?void 0:Ln.sessionId)===Xt.sessionId?Ln:void 0,{compactedReplay:io,liveJournal:Sc}=Xt.replaySnapshot,Q=[...io,...Sc];if(Qr&&!(Fn&&Q.length>0)&&B.reset(),Fn&&Q.length>0){const De={...F.current,suppressOwnUserEcho:!1},rt=[];for(const At of Q)try{const tn=W8(At,Xt.clientId,De,ct,{updateConnection:!1});if(rt.push(...G8(At,tn,Ke)),At.type==="turn_complete"){const nn=((We=At.data)==null?void 0:We.stopReason)??"end_turn";rt.push(vl(At,nn))}else At.type==="turn_error"&&rt.push(vl(At,"error"))}catch(tn){const nn=tn instanceof Error?tn.message:String(tn);Ke({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:nn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",tn)}Qr&&B.reset(),rt.length>0&&(B.dispatch(rt),Y8(rt,ue));for(const At of Q)V8(H.current,J.current,Xt.sessionId,At,B,se,G,{requireBoundPromptId:!0});ct(At=>({...At,catchingUp:void 0}))}Sn&&(O.current=void 0,clearTimeout(Sn.timeout),Sn.resolve());let de=!1,je=!1;const et=()=>{const De=H.current.get(Xt.sessionId);De==null||De.controller.abort(),H.current.delete(Xt.sessionId),Jr&&ia(),vr(G),se("idle"),B.reset(),Xt.setLastEventId(0),gt=Xt.sessionId,je=!0,on=void 0,M.current=void 0,Ne.current=()=>!1,ct(rt=>({...rt,status:"connecting",error:void 0}))};for await(const De of Xt.events({signal:ht.signal,maxQueued:o})){de||(de=!0,Ts=0);try{const rt=NU(De);if(rt){MU(rt);continue}const At=LU(De);At&&RU(At),qU(De)&&($U(De),De.type==="pending_prompt_started"&&(vr(G),se("waiting")));const tn=W8(De,Xt.clientId,F.current,ct),nn=G8(De,tn,Ke);if(De.type==="state_resync_required"&&(typeof De.data=="object"&&De.data!==null?De.data.reason:void 0)==="epoch_reset"){et();break}if(Y8(nn,ue),nn.length>0){const Dn=b2(nn);se(dr=>dr==="waiting"||dr==="idle"&&Dn?"streaming":dr)}const Gt=V8(H.current,J.current,Xt.sessionId,De,B,se,G);let fn=!1;if(!Gt&&Jr&&(De.type==="turn_complete"||De.type==="turn_error")){ia(),fn=!0,vr(G);const Dn=De.type==="turn_complete"?((Mt=De.data)==null?void 0:Mt.stopReason)??"end_turn":"error";B.dispatch(vl(De,Dn)),Zr()||se("idle")}const Rr=!Zr()&&B.getSnapshot().activeAssistantBlockId!=null?nn.filter(Dn=>Dn.type!=="debug"):nn;B.dispatch(Rr);for(const Dn of nn)if(Dn.type==="prompt.cancelled"&&(Jr||Dn.originatorClientId!==Xt.clientId)){B.dispatch(vl(De,"cancelled"));const dr=Jr;ia(),fn=!0,vr(G),dr||H.current.delete(Xt.sessionId),Zr()||se("idle")}else Dn.type==="session.replay_complete"&&(ct(dr=>({...dr,catchingUp:void 0})),B.getSnapshot().awaitingResync&&B.clearAwaitingResync(),Zr()||(vr(G),B.dispatch({type:"assistant.done",reason:"replay_complete"}),se("idle")));const jr=!Gt&&!fn&&!Zr();if(jr&&(nn.some(dr=>dr.type==="user.text.delta")?se("waiting"):b2(nn)&&se(dr=>dr==="idle"?"streaming":dr)),jr&&De.type==="turn_complete"){vr(G);const Dn=((_t=De.data)==null?void 0:_t.stopReason)??"end_turn";B.dispatch(vl(De,Dn)),se("idle")}else jr&&De.type==="turn_error"?(vr(G),B.dispatch(vl(De,"error")),se("idle")):jr&&b2(nn)&&mU(B,G,"passive_observer",3e3,()=>se("idle"));if(De.type==="state_resync_required"&&(typeof De.data=="object"&&De.data!==null?De.data.reason:void 0)!=="epoch_reset"){Zr()||(se("idle"),vr(G)),B.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",Xt.sessionId),je=!0,on=void 0,M.current=void 0,Ne.current=()=>!1,ct(dr=>({...dr,status:"connecting",error:void 0}));break}if(De.type==="session_closed"&&((jn=De.data)==null?void 0:jn.reason)==="client_close"){rl=!0;const Dn=Xt.sessionId,dr=H.current.get(Dn);dr==null||dr.controller.abort(),H.current.delete(Dn),on=void 0,M.current=void 0;break}}catch(rt){const At=rt instanceof Error?rt.message:String(rt);Ke({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:At,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",rt)}}if(rl){B.dispatch({type:"assistant.done",reason:"cancelled"}),se("idle"),vr(G),ct(De=>({...De,status:"disconnected",sessionId:void 0,error:void 0}));return}!ft&&!ht.signal.aborted&&!je&&(((ur=M.current)==null?void 0:ur.sessionId)===Xt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Zr()||(vr(G),se("idle"),B.dispatch({type:"assistant.done",reason:"stream_ended"}))),ct(De=>({...De,status:"disconnected",error:void 0})))}catch(xn){if(ft||ht.signal.aborted)return;const Fn=xn instanceof Error?xn.message:String(xn),Qr=on==null?void 0:on.sessionId,ds=nH(xn),ci=tH(xn),Xt=ci&&!ds&&f==="disconnect";if(Qr&&(ds||ci)){const Jr=H.current.get(Qr);Jr==null||Jr.controller.abort(),H.current.delete(Qr)}(ds||ci||!_o())&&(vr(G),se("idle"));const ui=O.current;if(ui&&(ui.sessionId===re||ui.sessionId===gt)&&(O.current=void 0,clearTimeout(ui.timeout),ui.reject(xn)),ds||ci){if(on=void 0,M.current=void 0,ds){ct({status:"error",error:Fn});return}if(Xt){ct(Jr=>({...Jr,status:"disconnected",sessionId:void 0,error:Fn,catchingUp:void 0}));return}gt=void 0,re&&oe(void 0)}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",on==null?void 0:on.sessionId);if(!d){on=void 0,M.current=void 0,ct({status:"error",error:Fn});return}ct(Jr=>({...Jr,status:"disconnected",error:Fn}))}if(!d){M.current=void 0,ct(xn=>({...xn,status:"disconnected",catchingUp:void 0}));return}Ts+=1;const _c=P.current,kc=hU(Ts,_c.reconnectDelayMs,_c.maxReconnectDelayMs);ct(xn=>({...xn,status:"disconnected",error:`Reconnecting in ${kc}ms`})),await fU(kc,ht.signal)}})(),()=>{const Ae=M.current;ft=!0,ht.abort(),Ne.current=()=>!1,se("idle"),vr(G),O.current&&(clearTimeout(O.current.timeout),O.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),O.current=void 0),Ae!=null&&Ae.clientId&&z8({baseUrl:_,token:S,sessionId:Ae.sessionId,clientId:Ae.clientId}).catch(te=>console.warn("[DaemonSessionProvider] detach failed:",te)),M.current=void 0}},[u,d,f,_,S,n,be,he,o,B,re,ke,Ve,xe,s,yt,Ke]),g.useEffect(()=>{if(!ee.current||y<=0||x<=0||!Re.sessionId)return;let ht=!1,ft=0;const pe=setInterval(()=>{const Ae=M.current;Ae&&Ae.heartbeat().then(()=>{ht||(ft>=x&&ct(te=>te.sessionId===Ae.sessionId?{...te,status:"connected",error:void 0}:te),ft=0)}).catch(te=>{if(ht||(ft+=1,ft<x))return;const K=te instanceof Error?te.message:"Session heartbeat failed";ct(ie=>ie.sessionId===Ae.sessionId?{...ie,status:"disconnected",error:K}:ie)})},y);return()=>{ht=!0,clearInterval(pe)}},[Re.sessionId,x,y]);const ut=g.useMemo(()=>yU({store:B,sessionRef:M,activePromptsRef:H,settledPromptsRef:J,pendingSessionLoadRef:O,pendingSessionLoadIdRef:Y,heartbeatSupportedRef:ee,passiveAssistantDoneTimerRef:G,hasSessionActivePrompt:()=>Ne.current(),resetCurrentSessionActivePrompt:()=>{Ne.current=()=>!1},getCreateSessionRequest:()=>{var ht;return{...ye.current,sessionScope:"thread",workspaceCwd:N.current??((ht=M.current)==null?void 0:ht.workspaceCwd)}},addNotice:Ke,setConnection:ct,setPromptStatus:se,setRestoreSessionId:oe,setRestoreMode:He,setRestoreSessionNonce:ce,setNewSessionNonce:Me}),[Ke,B]);return h.jsx(RN.Provider,{value:B,children:h.jsx(jN.Provider,{value:Re,children:h.jsx(LN.Provider,{value:me,children:h.jsx(DN.Provider,{value:ae,children:h.jsx(ON.Provider,{value:V,children:h.jsx(w_.Provider,{value:ut,children:w})})})})})})}function V8(e,t,n,r,s,i,o,a={}){var l;if(r.type!=="turn_complete"&&r.type!=="turn_error")return!1;const c=(l=r.data)==null?void 0:l.promptId;if(!c)return!1;const u=e.get(n);if(!u||a.requireBoundPromptId&&u.promptId===void 0||u.promptId!==void 0&&u.promptId!==c)return!1;vr(o);try{const d=s_(r,c);if(!d)return!1;s.dispatch(vl(r,d.stopReason)),i("idle"),u.resolve?(e.delete(n),u.resolve(d)):(e.delete(n),t.set(sv(n,c),{status:"resolved",result:d}))}catch(d){s.dispatch(vl(r,"error")),i("idle"),u.reject?(e.delete(n),u.reject(d)):(e.delete(n),t.set(sv(n,c),{status:"rejected",error:d}))}return!0}function GU(e){return e.type==="turn_complete"}function W8(e,t,n,r,s={}){s.updateConnection!==!1&&iU(e,r);const i=Eq(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=JU(e);return GU(e)?o?[o]:[]:o?[...i,o]:i}function G8(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(KU(e,s));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return r}function KU(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 v_(){const e=g.useContext(RN);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function yy(){const e=v_(),t=g.useCallback(()=>e.getSnapshot().blocks,[e]);return g.useSyncExternalStore(e.subscribe,t,t)}function x_(){const e=yy(),t=XU();return g.useMemo(()=>AU(e,t),[e,t])}function by(){const e=g.useContext(w_);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function YU(){return g.useContext(w_)}function ju(){return g.useContext(ON)}function XU(){const e=g.useContext(LN);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function Xa(){const e=g.useContext(jN);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function QU(){const e=g.useContext(DN);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function b2(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function JU(e){if(e.type!=="session_update")return null;const t=ka(e.data)?e.data:void 0,n=ka(t==null?void 0:t.update)?t.update:ka(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!ka(r))return null;const s=ZU(r.goalStatus);if(s)return K8(e,s);const i=eH(r.goalTerminal);if(i)return K8(e,i);const o=r.stopHookLoop;if(!ka(o))return null;const a=o.goal;return!ka(a)||!uu(a,"condition"),null}function K8(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function ZU(e){if(!ka(e))return null;const t=uu(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=uu(e,"condition");if(!n)return null;const r=Gf(e,"iterations"),s=Gf(e,"durationMs"),i=Gf(e,"setAt"),o=uu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function eH(e){if(!ka(e))return null;const t=uu(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=uu(e,"condition");if(!n)return null;const r=Gf(e,"iterations"),s=Gf(e,"durationMs"),i=uu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function uu(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Gf(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Y8(e,t){let n=0,r=0,s=0,i=0,o=0,a=0,l,c=0,u=0;for(const d of e)switch(d.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":r+=1;break;case"workspace.tool.toggled":s+=1;break;case"workspace.settings.changed":i+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":o+=1;break;case"workspace.extensions.changed":a+=1,l={...d.status?{status:d.status}:{},...d.source?{source:d.source}:{},...d.name?{name:d.name}:{},...d.version?{version:d.version}:{},...d.error?{error:d.error}:{},refreshed:d.refreshed,failed:d.failed};break;case"workspace.initialized":c+=1;break;case"auth.device_flow.started":case"auth.device_flow.throttled":case"auth.device_flow.authorized":case"auth.device_flow.failed":case"auth.device_flow.cancelled":u+=1;break}n+r+s+i+o+a+c+u!==0&&t(d=>({memoryVersion:d.memoryVersion+n,agentsVersion:d.agentsVersion+r,toolsVersion:d.toolsVersion+s,settingsVersion:d.settingsVersion+i,mcpVersion:d.mcpVersion+o,extensionsVersion:d.extensionsVersion+a,...l?{lastExtensionChange:l}:{},initVersion:d.initVersion+c,authVersion:d.authVersion+u}))}function tH(e){const t=BN(e);return t!==void 0&&FU.has(t)}function nH(e){const t=BN(e);return t!==void 0&&VU.has(t)}function BN(e){if(e instanceof vu||ka(e)&&typeof e.status=="number")return e.status}function ka(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kh(e,t){const{autoLoad:n=!1,enabled:r=!0}=t,[s,i]=g.useState({data:void 0,loading:!1,error:void 0}),o=g.useRef(0),a=g.useCallback(async()=>{if(!r)return;const l=++o.current;i(c=>({...c,loading:!0,error:void 0}));try{const c=await e();return l!==o.current?void 0:(i({data:c,loading:!1,error:void 0}),c)}catch(c){if(l!==o.current)return;const u=c instanceof Error?c:new Error(String(c));i(d=>({...d,loading:!1,error:u}));return}},[r,e]);return g.useEffect(()=>{!n||!r||a()},[n,r,a]),{...s,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function om(e,t,n){const r=g.useRef(!1);g.useEffect(()=>{if(!(e===void 0||!n)){if(!r.current){r.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function rH(e={}){var t;const n=yc(),r=g.useCallback(()=>n.listAgents(),[n]),s=kh(r,e),i=ju();return om(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 PN(e={}){const t=yc(),n=g.useCallback(()=>t.loadMcpStatus(),[t]),r=kh(n,e),s=ju();return om(s==null?void 0:s.mcpVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function sH(e={}){var t;const n=yc(),r=g.useCallback(()=>n.loadMemoryStatus(),[n]),s=kh(r,e),i=ju();return om(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 wy(e={}){const{pageSize:t,...n}=e,r=b_(),s=YU(),i=g.useCallback(()=>r.actions.listSessions({pageSize:t}),[t,r.actions]),o=!!r.workspaceCwd,a=kh(i,{...n,enabled:(n.enabled??!0)&&o}),{reload:l}=a,c=g.useCallback(async d=>{const f=await r.actions.deleteSession(d);return f&&l(),f},[r.actions,l]),u=g.useCallback(async d=>{const f=await r.actions.deleteSessions(d);return(f.removed.length>0||f.notFound.length>0)&&l(),f},[r.actions,l]);return{...a,sessions:a.data??[],loadSession:s==null?void 0:s.loadSession,resumeSession:s==null?void 0:s.resumeSession,newSession:s==null?void 0:s.newSession,releaseSession:s==null?void 0:s.releaseSession,deleteSession:c,deleteSessions:u}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zN(e={}){var t;const n=yc(),r=g.useCallback(()=>n.loadToolsStatus(),[n]),s=kh(r,e),i=ju();return om(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 iH(e={}){var t;const n=yc(),r=g.useCallback(()=>n.loadSettingsStatus(),[n]),s=kh(r,e),i=ju();return om(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 oH=300,aH=100,id=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function w2(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function lH(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=id,o=null,a=!1,l=null;function c(x){i=x,n(x)}function u(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:x=>{if(o&&(clearTimeout(o),o=null),!x){c(id);return}t&&(o=setTimeout(()=>{c({suggestion:x,isVisible:!0,shownAt:Date.now()})},oH))},accept:(x,b)=>{var w;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const v=i.suggestion,{shownAt:_}=i;if(!v){a=!1;return}try{(w=s())==null||w({outcome:"accepted",accept_method:x,time_ms:_>0?Date.now()-_:0,suggestion_length:v.length})}catch(S){console.error("[followup] onOutcome callback threw:",S)}c(id),queueMicrotask(()=>{var S;try{b!=null&&b.skipOnAccept||(S=r())==null||S(v)}catch(C){console.error("[followup] onAccept callback threw:",C)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},aH)}})},dismiss:()=>{var x;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(x=s())==null||x({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(b){console.error("[followup] onOutcome callback threw:",b)}c(id)}},clear:()=>{u(),a=!1,c(id)},cleanup:()=>{u(),a=!1}}}function cH(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=v_(),i=Xa().sessionId,[o,a]=g.useState(id),l=g.useRef(n);l.current=n;const c=g.useRef(r);c.current=r;const u=g.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),d=g.useSyncExternalStore(EU,F8,F8),f=(d==null?void 0:d.sessionId)===i?d:u,m=g.useMemo(()=>lH({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>c.current}),[t]),{setSuggestion:p}=m;g.useEffect(()=>(t||m.clear(),()=>m.cleanup()),[m,t]);const y=g.useRef(void 0),x=g.useRef(i);g.useEffect(()=>{const _=x.current;x.current=i,_!==void 0&&i!==void 0&&_!==i&&(m.clear(),Jm(),y.current=void 0)},[m,i]),g.useEffect(()=>{const _=f==null?void 0:f.promptId;_!==y.current&&(y.current=_,p((f==null?void 0:f.suggestion)??null))},[f,p]);const b=g.useCallback(()=>{m.clear(),w2(s),Jm(),y.current=void 0},[m,s]),w=g.useCallback((_,S)=>{m.accept(_,S),w2(s),Jm(),y.current=void 0},[m,s]),v=g.useCallback(()=>{m.dismiss(),w2(s),Jm(),y.current=void 0},[m,s]);return g.useMemo(()=>({followupState:o,onAcceptFollowup:w,onDismissFollowup:v,clear:b}),[o,w,v,b])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function uH(){const e=g.useSyncExternalStore(IU,U8,U8),t=g.useCallback(n=>jU(n),[]);return{batches:e,consume:t}}function dH(e){for(const t of e){if(!hH(t))continue;const n=t;if(n.resolved)continue;const r=xd(n.toolCall),s=typeof(r==null?void 0:r.toolCallId)=="string"?r.toolCallId:typeof(r==null?void 0:r.id)=="string"?r.id:void 0,i=typeof(r==null?void 0:r.kind)=="string"?r.kind:void 0,o=xd(r==null?void 0:r._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:s,title:n.title,toolKind:i,toolName:a,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(l=>({id:l.optionId,label:l.label,kind:mH(l.raw)})),rawInput:fH(n.toolCall)}}return null}function hH(e){return e.kind==="permission"}function fH(e){const t=xd(e);return t?xd(t.rawInput)??xd(t.input)??xd(t.args)??t:void 0}function xd(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function mH(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.kind;return t==="allow_once"||t==="allow_always"||t==="reject_once"||t==="reject_always"?t:void 0}function pH(e,t,n){const r=new Array(e);return new Proxy(r,{get(s,i,o){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&l<e){let c=s[l];if(!c){const u=t[l*2];c=s[l]={index:l,key:n(l),start:u,size:t[l*2+1],end:u+t[l*2+1],lane:0}}return c}}if(i==="length")return e}return Reflect.get(s,i,o)}})}function Qu(e,t,n){let r=n.initialDeps??[],s,i=!0;function o(){const a=e();return(a.length!==r.length||a.some((c,u)=>r[u]!==c))&&(r=a,s=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(s),i=!1),s}return o.updateDeps=a=>{r=a},o}function X8(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const gH=(e,t)=>Math.abs(e-t)<1.01,yH=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let ef;const v2=()=>{if(ef!==void 0)return ef;if(typeof navigator>"u")return ef=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ef=!0;const e=navigator.maxTouchPoints;return ef=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Q8=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},bH=e=>e,wH=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},vH=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(s(Q8(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(Q8(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},r1={passive:!0},xH=typeof window>"u"?!0:"onscrollend"in window,_H=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&xH;let o=0;const a=i?null:yH(s,()=>t(o,!1),e.options.isScrollingResetDelay),l=d=>()=>{o=n(r),a==null||a(),t(o,d)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,r1),i&&r.addEventListener("scrollend",u,r1),()=>{r.removeEventListener("scroll",c),i&&r.removeEventListener("scrollend",u)}},kH=(e,t)=>_H(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),SH=(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"]},TH=(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})},CH=TH;class AH{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const o=()=>{const a=i.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,u]of this.elementsCache)if(u===a){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{var r,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:bH,rangeExtractor:wH,onChange:()=>{},measureElement:SH,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const m=n[f];m!==void 0&&(i[f]=m)}const o=this.options;let a=null,l=null,c=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,m=i.count,p=this.getMeasurements(),y=f>0?((r=p[0])==null?void 0:r.key)??o.getItemKey(0):null,x=f>0?((s=p[f-1])==null?void 0:s.key)??o.getItemKey(f-1):null;if(m!==f||f>0&&m>0&&(i.getItemKey(0)!==y||i.getItemKey(m-1)!==x)){c=!0;const v=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;v&&(a=[v.key,this.getScrollOffset()-v.start]);const _=i.followOnAppend===!0?"auto":i.followOnAppend||null;_&&m>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||i.getItemKey(m-1)!==x)&&(l=_)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(a&&this.scrollOffset!==null){const[f,m]=a,p=this.getMeasurements(),{count:y,getItemKey:x}=this.options;let b=0;for(;b<y&&x(b)!==f;)b++;if(b<y){const w=p[b];if(w){const v=w.start+m;v!==this.scrollOffset&&(d=v-this.scrollOffset,this.scrollOffset=v,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?a[0]:null,u?a[1]:0,l,d])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Qu(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!v2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,r1),i.addEventListener("touchend",a,r1),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,o,a,l]=s;i!==null&&!a&&(v2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let o=r-1;o>=0;o--){const a=n[o];if(s.has(a.lane))continue;const l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.end<l.end&&s.set(a.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Qu(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,s,i,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Qu(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const u=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const p of this.laneAssignments.keys())p>=n&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const p=this.options.gap,y=n*2;let x=this._flatMeasurements;if(!x||x.length<y){const v=new Float64Array(y);x&&d>0&&v.set(x.subarray(0,d*2)),x=v,this._flatMeasurements=x}let b;if(d===0)b=r+s;else{const v=d-1;b=x[v*2]+x[v*2+1]+p}for(let v=d;v<n;v++){const _=i(v),S=u.get(_),C=typeof S=="number"?S:this.options.estimateSize(v);x[v*2]=b,x[v*2+1]=C,b+=C+p}const w=pH(n,x,i);return this.measurementsCache=w,w}const f=this.measurementsCache.slice(0,d),m=new Array(a).fill(void 0);for(let p=0;p<d;p++){const y=f[p];y&&(m[y.lane]=p)}for(let p=d;p<n;p++){const y=i(p),x=this.laneAssignments.get(p);let b,w;const v=l==="estimate"||u.has(y);if(x!==void 0&&this.options.lanes>1){b=x;const E=m[b],R=E!==void 0?f[E]:void 0;w=R?R.end+this.options.gap:r+s}else{const E=this.options.lanes===1?f[p-1]:this.getFurthestMeasurement(f,p);w=E?E.end+this.options.gap:r+s,b=E?E.lane:p%this.options.lanes,this.options.lanes>1&&v&&this.laneAssignments.set(p,b)}const _=u.get(y),S=typeof _=="number"?_:this.options.estimateSize(p),C=w+S;f[p]={index:p,start:w,size:S,end:C,key:y,lane:b},m[b]=p}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Qu(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?EH({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=Qu(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,s-i),a=Math.min(this.options.count-1,s+i);return n>=o&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const r=this.indexFromElement(n),s=this.options.getItemKey(r),i=this.elementsCache.get(s);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s,i;if(n<0||n>=this.options.count)return;let o,a,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),a=c[n*2],o=c[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;l=f.key,a=f.start,o=f.size}const u=this.itemSizeCache.get(l)??o,d=r-u;if(d!==0){const f=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=f?this.getTotalSize():0,p=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:a,size:o,end:a+o,lane:0},d,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-m):p&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=Qu(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],l=r[a];s.push(l)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,i=this.options.lanes===1&&s!=null,o=$N(0,r.length-1,i?a=>s[a*2]:a=>X8(r[a]).start,n);return X8(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[o,a]=i,l=this.now();this.scrollState={index:n,align:a,behavior:s,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=this._flatMeasurements;o!=null?s=o[i*2]+o[i*2+1]:s=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(a=>a===null);){const a=r[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}s=Math.max(...i.filter(a=>a!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&n.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(v2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,i=1,o=s!==this.scrollState.lastTargetOffset;if(!o&&gH(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=s,c||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const $N=(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 EH({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const i=e.length-1,o=s?u=>s[u*2]:u=>e[u].start,a=s?u=>s[u*2]+s[u*2+1]:u=>e[u].end;if(e.length<=r)return{startIndex:0,endIndex:i};let l=$N(0,i,o,n),c=l;if(r===1)for(;c<i&&a(c)<n+t;)c++;else if(r>1){const u=Array(r).fill(0);for(;c<i&&u.some(f=>f<n+t);){const f=e[c];u[f.lane]=f.end,c++}const d=Array(r).fill(n+t);for(;l>=0&&d.some(f=>f>=n);){const f=e[l];d[f.lane]=f.start,l--}l=Math.max(0,l-l%r),c=Math.min(i,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}const x2=typeof document<"u"?g.useLayoutEffect:g.useEffect;function MH({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=g.useReducer(c=>c+1,0)[1],i=g.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=c=>{const u=i.current;if(!u.enabled)return;const d=c.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const b=c.options.horizontal?"width":"height";u.container.style[b]=`${d}px`}const f=!!c.options.horizontal,m=u.mode==="transform",p=f?"left":"top",y=c.options.scrollMargin,x=c.getVirtualItems();for(const b of x){const w=b.start-y,v=c.elementsCache.get(b.key);v&&u.lastPositions.get(v)!==w&&(u.lastPositions.set(v,w),m?v.style.transform=f?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:v.style[p]=`${w}px`)}},a={...r,onChange:(c,u)=>{var d;const f=i.current;let m=!0;if(f.enabled){o(c);const p=c.range,y=f.prevRange;m=!y||y.isScrolling!==c.isScrolling||y.startIndex!==(p==null?void 0:p.startIndex)||y.endIndex!==(p==null?void 0:p.endIndex),m&&(f.prevRange=p?{startIndex:p.startIndex,endIndex:p.endIndex,isScrolling:c.isScrolling}:null)}m&&(e&&u?Q1.flushSync(s):s()),(d=r.onChange)==null||d.call(r,c,u)}},[l]=g.useState(()=>{const c=new AH(a);return Object.assign(c,{containerRef:u=>{const d=i.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const f=c.getTotalSize();d.lastSize=f;const m=c.options.horizontal?"width":"height";u.style[m]=`${f}px`}}})});return l.setOptions(a),x2(()=>l._didMount(),[]),x2(()=>l._willUpdate()),x2(()=>{o(l)}),l}function NH(e){return MH({observeElementRect:vH,observeElementOffset:kH,scrollToFn:CH,...e})}function qN(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function IH(e){var t;return((t=qN(e))==null?void 0:t.type)==="task_execution"}function vy(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||IH(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function FN(e){var n;if(!vy(e))return!1;const t=qN(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const UN=g.createContext({}),RH=UN.Provider;function bc(){return g.useContext(UN)}const jH=["en","zh-CN"],__={"about.auth":"Auth","about.baseUrl":"Base URL","about.fastModel":"Fast Model","about.memoryUsage":"Memory Usage","about.model":"Model","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"OS","about.proxy":"Proxy","about.qwenCode":"Qwen Code","about.runtime":"Runtime","about.sandbox":"Sandbox","about.sessionId":"Session ID","about.title":"Status","agent.back":"Back","agent.builtInBadge":"(built-in)","agent.action.delete":"Delete Agent","agent.action.edit":"Edit Agent","agent.action.view":"View Agent","agent.chooseAction":e=>`Choose action for ${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"Choose Action","agent.colorLabel":"Color: ","agent.colorUpdated":e=>`Updated color for ${(e==null?void 0:e.name)??""}`,"agent.create":"Create a new subagent","agent.create.button":"Create Agent","agent.create.confirm":"Confirm and Save","agent.create.desc":"Create a new subagent","agent.create.descPlaceholder":"What does this agent do?","agent.create.describeAgent":"Describe Your Subagent","agent.create.description":"Description","agent.create.editAgain":"Edit","agent.create.enterDescription":"Enter Description","agent.create.enterName":"Enter Subagent Name","agent.create.enterPrompt":"Enter System Prompt","agent.create.generateFailed":e=>`Failed to generate subagent: ${(e==null?void 0:e.error)??"Unknown error"}`,"agent.create.generatingConfig":"Generating subagent configuration...","agent.create.loading":"Creating...","agent.create.location":"Choose Location","agent.create.method":"Choose Generation Method","agent.create.method.manual":"Manual Creation","agent.create.method.qwen":"Generate with Qwen Code","agent.create.method.qwen.recommended":"Generate with Qwen Code (Recommended)","agent.create.method.qwen.desc":"LLM generates name, prompt, and description","agent.create.name":"Name","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"Enter a clear, unique name for this subagent.","agent.create.project":"Project","agent.create.project.cli":"Project-level (.qwen/agents/)","agent.create.project.desc":"Create a project-level subagent","agent.create.prompt":"System prompt","agent.create.promptPlaceholder":"You are a specialized agent that...","agent.create.promptPlaceholder.cli":"e.g., You are an expert code reviewer...","agent.create.promptHelp":"Write the system prompt that defines this subagent's behavior. Be comprehensive for best results.","agent.create.preview":"Preview","agent.create.qwenHint":"Describe what this subagent should do and when it should be used. (Be comprehensive for best results)","agent.create.qwenPlaceholder":"> e.g., Expert code reviewer that reviews code based on best practices...","agent.create.required":"Name, description, and system prompt are required.","agent.create.save":"Save Agent","agent.create.scope":"Choose where to save the subagent","agent.create.manualDescHelp":"Describe when and how this subagent should be used.","agent.create.manualDescPlaceholder":"e.g., Reviews code for best practices and potential bugs.","agent.create.toolsSelection":"Select Tools","agent.create.tools.all":"All Tools","agent.create.tools.allDefault":"All Tools (Default)","agent.create.tools.allInfo":"All tools selected, including MCP tools","agent.create.tools.allInfoFallback":"All tools selected, including MCP tools","agent.create.tools.editLabel":"• Edit tools:","agent.create.tools.executionLabel":"• Execution tools:","agent.create.tools.none":"(none)","agent.create.tools.readEdit":"Read & Edit Tools","agent.create.tools.readEditExecute":"Read & Edit & Execution Tools","agent.create.tools.readOnlyLabel":"• Read-only tools:","agent.create.tools.readOnly":"Read-only Tools","agent.create.tools.selected":"Selected tools:","agent.create.user":"User","agent.create.user.cli":"User-level (~/.qwen/agents/)","agent.create.user.desc":"Create a user-level subagent","agent.createFirstHint":"Use '/agents create' to create your first subagent.","agent.created":e=>`Created ${(e==null?void 0:e.name)??""}`,"agent.delete":"Delete","agent.delete.confirm":e=>`Are you sure you want to delete "${(e==null?void 0:e.name)??""}"?`,"agent.delete.loading":"Deleting...","agent.delete.no":"No","agent.delete.title":e=>`Delete ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"Yes, delete","agent.deleted":e=>`Deleted ${(e==null?void 0:e.name)??""}`,"agent.edit":"Edit","agent.edit.color":"Edit Color","agent.edit.tools":"Edit Tools","agent.editColorTitle":e=>`Edit Color: ${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`Edit ${(e==null?void 0:e.name)??""}`,"agent.empty":"No subagents found.","agent.footer.back":"Esc to go back","agent.footer.cliBack":"Enter to select, ↑↓ to navigate, Esc to go back","agent.footer.cliSelect":"Enter to select, ↑↓ to navigate, Esc to close","agent.footer.close":"Esc to close","agent.footer.deleteConfirm":"Enter to confirm, Esc to cancel","agent.footer.enterNext":"Press Enter to continue, Esc to go back","agent.footer.generating":"Esc to cancel","agent.footer.createLocation":"Press Enter to continue, ↑↓ to navigate, Esc to cancel","agent.footer.createContinue":"Press Enter to continue, ↑↓ to navigate, Esc to go back","agent.footer.final":"Press Enter to save, e to save and edit, Esc to go back","agent.footer.nav":"↑↓ navigate · Enter select · Esc back","agent.footer.navBack":"↑↓ navigate · Enter select · Esc back","agent.footer.navSelect":"↑↓ navigate · Enter select · Esc close","agent.footer.viewerBack":"Esc to go back","agent.filePathLabel":"File Path: ","agent.label":"Agent","agent.location":"Location","agent.level.builtin":"Built-in","agent.level.extension":"Extension","agent.level.project":"Project","agent.level.user":"User","agent.manage":"Manage","agent.manage.desc":"Manage existing subagents","agent.modelLabel":"Model: ","agent.overriddenBadge":"(overridden by project level agent)","agent.readonly":"This agent is read-only.","agent.select":"Select an agent.","agent.selectAction":"Select an action","agent.descriptionLabel":"Description:","agent.systemPromptLabel":"System Prompt:","agent.step":e=>`Step ${(e==null?void 0:e.n)??""}`,"agent.tools":"Tools","agent.toolsLabel":"Tools: ","agent.toolsUpdated":e=>`Updated tools for ${(e==null?void 0:e.name)??""}`,"agent.usingCount":e=>`Using: ${(e==null?void 0:e.count)??0} agents`,"agent.view":"View","agents.closed":"Agents panel closed.","agents.title":"Agents","subagent.toggleStream":"Toggle agent stream details","toast.dismiss":"Dismiss notification","toast.dismissShort":"Dismiss","insight.ready":"Insight report generated successfully!","request.cancelled":"Request cancelled.","approval.execQuestion":e=>`Allow execution of: '${(e==null?void 0:e.tool)??""}'?`,"approval.changeQuestion":"Apply this change?","approval.launchAgentQuestion":"Launch this agent?","approval.option.allowOnce":"Yes, allow once","approval.option.rejectOnce":"Reject","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","approval.option.allowAlwaysServer":"Always allow for this server","approval.option.allowAlwaysTool":"Always allow for this tool","assistant.branch":"Branch","assistant.copy":"Copy","common.back":"back","common.cancel":"cancel","common.close":"close","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.navigate":"↑↓ to navigate","common.next":"next","common.previous":"previous","common.refresh":"refresh","common.search":"Search","common.valid":"valid","common.clients":e=>`${(e==null?void 0:e.count)??0} clients`,"agent.count":e=>`${(e==null?void 0:e.count)??0} agents`,"askUser.submit":"Submit","askUser.ignore":"Ignore","askUser.multiHint":"multiple choice","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} questions`,"askUser.selectAnswer":"Select an answer","askUser.typePlaceholder":"Type something...","copy.failedFallback":"Failed to copy to the clipboard","copy.inlineLatexMissing":"No matching inline LaTeX expression found in the last AI output.","copy.latexMissing":"No matching LaTeX block found in the last AI output.","copy.noOutput":"No output in history","copy.noText":"Last AI output contains no text to copy.","copy.codeMissing":"No matching code block found in the last AI output.","copy.outputCopied":"Last output copied to the clipboard","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"Selection"} copied to the clipboard`,"code.copy":"Copy","code.copied":"Copied!","markdownTable.blank":"(blank)","markdownTable.column":e=>`Column ${(e==null?void 0:e.index)??""}`,"markdownTable.rows":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} row${t===1?"":"s"}`},"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} rows`,"markdownTable.hint":"Click headers to sort, open filters from ▾.","markdownTable.filtersActive":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} filter${t===1?"":"s"}`},"markdownTable.cellsSelected":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} cell${t===1?"":"s"} selected`},"markdownTable.copyTsv":"Copy TSV","markdownTable.copyVisible":"Quick copy","markdownTable.hideColumn":"Hide column","markdownTable.showHiddenColumns":e=>{const t=Number((e==null?void 0:e.count)??0);return`Show ${t} hidden column${t===1?"":"s"}`},"markdownTable.rowDetails":"Details","markdownTable.rowDetailsAria":e=>`View details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.closeRowDetailsAria":e=>`Hide details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.detailsHeader":"Row details","markdownTable.actions":"Actions","markdownTable.sortByColumn":e=>`Sort by ${(e==null?void 0:e.column)??""}`,"markdownTable.sortByColumnAsc":e=>`Sort by ${(e==null?void 0:e.column)??""}, ascending`,"markdownTable.sortByColumnDesc":e=>`Sort by ${(e==null?void 0:e.column)??""}, descending`,"markdownTable.filterColumn":e=>`Filter ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"This table has no data.","markdownTable.emptyFiltered":"No rows match the filters.","markdownTable.sort.asc":"Sort ascending","markdownTable.sort.desc":"Sort descending","markdownTable.sort.clear":"Clear sort","markdownTable.filter.searchPlaceholder":"Search filter values","markdownTable.filter.searchAria":e=>`Search ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"Select current results","markdownTable.filter.optionLimit":e=>`Showing first ${(e==null?void 0:e.count)??0} items. Search to narrow results.`,"markdownTable.filter.noOptions":"No matches","markdownTable.filter.custom":"Custom filter","markdownTable.filter.numberAria":e=>`Number filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`Text filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"Value","markdownTable.filter.toPlaceholder":"To","markdownTable.filter.textPlaceholder":"Enter filter condition","markdownTable.filter.reset":"Reset","markdownTable.filter.cancel":"Cancel","markdownTable.filter.confirm":"Confirm","markdownTable.filter.text.contains":"Contains","markdownTable.filter.text.equals":"Equals","markdownTable.filter.text.notEquals":"Does not equal","markdownTable.filter.text.startsWith":"Starts with","markdownTable.filter.text.endsWith":"Ends with","markdownTable.filter.number.gt":"Greater than","markdownTable.filter.number.gte":"Greater than or equal to","markdownTable.filter.number.lt":"Less than","markdownTable.filter.number.lte":"Less than or equal to","markdownTable.filter.number.between":"Between","mermaid.rendering":"Rendering diagram...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"active","contextUsage.autocompactBuffer":"Autocompact buffer","contextUsage.bodyLoaded":"body loaded","contextUsage.builtinTools":"Built-in tools","contextUsage.contextWindow":"Context window","contextUsage.detailHint":"Run /context detail for per-item breakdown.","contextUsage.estimatedOverhead":"Estimated pre-conversation overhead","contextUsage.free":"Free","contextUsage.memoryFiles":"Memory files","contextUsage.messages":"Messages","contextUsage.mcpTools":"MCP tools","contextUsage.model":"Model","contextUsage.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":"Set theme","quickActions.auth":"Auth","quickActions.settings":"Settings","quickActions.new":"New session","quickActions.resume":"Switch session","quickActions.delete":"Delete session","quickActions.branch":"Copy session","quickActions.rewind":"Rewind session","quickActions.historyQuestion":"Question history","quickActions.recap":"Generate recap","quickActions.copy":"Copy output","quickActions.shellMode":"Shell mode","quickActions.exitShellMode":"Exit Shell","quickActions.setGoal":"Set goal","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.project":"Project","sidebar.projectFallback":"Project","sidebar.settings":"Settings","sidebar.collapse":"Collapse","sidebar.expand":"Expand","sidebar.collapseProject":"Collapse project","sidebar.expandProject":"Expand project","sidebar.search":"Search sessions","sidebar.searchPlaceholder":"Search sessions","sidebar.searchEmpty":"No matching sessions.","sidebar.rename":"Rename","sidebar.renameCurrentOnly":"Only the current session can be renamed","sidebar.delete":"Delete","sidebar.loadingSessions":"Loading sessions...","sidebar.loadFailed":"Failed to load sessions. Click to retry.","sidebar.renameFailed":"Failed to rename session","sidebar.deleteFailed":"Failed to delete session","sidebar.newSessionFailed":"Failed to create a new chat","sidebar.switchFailed":"Failed to switch session","sidebar.currentDeleteDisabled":"Current session cannot be deleted","sidebar.deleteConfirmDescription":e=>`Delete "${(e==null?void 0:e.name)??""}"? This cannot be undone.`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} client(s)`,"sidebar.running":"Running","sidebar.completedUnread":"Finished","quickKeys.cursor":"Move cursor","quickKeys.escape":"Cancel run","quickKeys.history":"History","quickKeys.retry":"Retry failed","quickKeys.searchHistory":"Search history","quickKeys.tab":"Accept completion","error.unsupportedTheme":"Unsupported theme. Use /theme light or /theme dark.","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.insertTip":"Insert this message into the current session; it takes effect on the next model call.","queue.inserted":"Inserted. It takes effect on the next model call.","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.submitting":"Submitting...","queue.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellBlocked":"Shell commands can't be queued while a turn is running.","queue.queueFailed":"Failed to queue message","queue.insertFailed":"Failed to insert queued message","queue.deleteFailed":"Failed to move message out of queue","queue.editFailed":"Failed to edit queued message","queue.footer":"Press ↑ to edit the latest queued message · Esc to clear queue","queue.imageCount":e=>`(+${(e==null?void 0:e.count)??0} images)`,"queue.more":e=>`... (+${(e==null?void 0:e.count)??0} more)`,"midTurn.inserted":e=>`Inserted message: ${(e==null?void 0:e.message)??""}`,"help.builtIn":"Built-in commands","help.commandCount":e=>`${(e==null?void 0:e.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} subcommands`,"help.commandsIntro":"Browse built-in commands:","help.customGroup":"Custom, skills, plugins, MCP","help.customIntro":"Browse custom, skill, plugin, and MCP commands:","help.empty":"No commands are currently available.","help.emptyCustom":"No custom commands are currently available.","help.footer":"Tab/Shift+Tab to switch tabs · ↑/↓ or PgUp/PgDn to scroll · Esc to close","help.intro":"Qwen Code understands your codebase, makes edits with your permission, and executes commands right from your terminal.","help.section.shortcuts":"Shortcuts","help.search":"Search commands","help.shortcut.addContext":"Add files or folders as context","help.shortcut.altWords":"Jump through words","help.shortcut.clear":"Clear the screen","help.shortcut.commandMenu":"Open command menu","help.shortcut.completion":"Accept completion or switch help tabs","help.shortcut.history":"Cycle prompt history or scroll lists","help.shortcut.searchHistory":"Search prompt history","help.shortcut.newline":"Insert a newline","help.shortcut.pasteImages":"Paste images","help.shortcut.shell":"Run shell commands","help.shortcut.togglePanel":"Toggle this panel","help.shortcut.retry":"Retry last request","help.shortcut.compact":"Toggle compact mode","retry.hint":"Press Ctrl+Y to retry or click to retry","retry.none":"No failed request to retry.","branch.failed":"Failed to branch session.","branch.success":e=>`Copied session. New session name: "${(e==null?void 0:e.name)??""}". Switched to the new session.`,"fork.empty":"Please provide a directive. Usage: /fork <directive>","fork.failed":e=>`Failed to launch fork: ${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"Background agent was not launched.","fork.started":e=>`Started background agent: "${(e==null?void 0:e.name)??""}". Track it in background tasks.`,"command.hidden":"This command is not available.","help.shortcut.approvals":"Cycle approval modes","help.shortcut.cancel":"Close dialogs or cancel operation","bug.failed":"Failed to load system info for bug report.","bug.popupBlocked":"Popup blocked — please allow popups and try again.","bug.submitted":"Bug report opened in a new tab.","clear.blocked":"Cannot clear while streaming — cancel first (Esc).","error.unknown":"Unknown error","shell.command":"Shell Command","compact.enabled":"Compact mode enabled","compact.disabled":"Compact mode disabled","compact.hint":"Press Ctrl+O to show full tool output","compact.saveFailed":"Failed to save compact mode","help.subcommands":"subcommands","help.tab.commands":"Built-in commands","help.tab.custom":"custom-commands","help.tab.general":"shortcuts","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":e=>`UI language changed to ${(e==null?void 0:e.language)??""}`,"language.current":e=>`Current UI language: ${(e==null?void 0:e.language)??""}`,"language.invalid":"Invalid language. Available: en, zh-CN","language.options":"Available options:","language.set":"Set UI language","language.usage":"Usage: /language ui [en|zh-CN]","local.agents":"Manage subagents","local.approvalMode":"Change approval mode","local.auth":"Connect an LLM provider","auth.title":"Connect a Provider","auth.step.group":"Type","auth.step.provider":"Provider","auth.step.protocol":"Protocol","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"Model IDs","auth.step.advanced":"Advanced Config","auth.apiKeyRequired":"API key cannot be empty.","auth.baseUrlInvalid":"Base URL must start with http:// or https://.","auth.baseUrlPrompt":"Enter the API endpoint for this protocol.","auth.baseUrlRequired":"Base URL cannot be empty.","auth.documentation":"Documentation","auth.modelsRequired":"Model IDs cannot be empty.","auth.review":"Review","auth.reviewText":"The following JSON will be saved to settings.json:","auth.save":"Save","auth.saving":"Saving...","auth.termsTitle":"Terms of Services and Privacy Notice","auth.continue":"Continue","auth.modelsPrompt":e=>`Enter model IDs separated by commas. Examples: ${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"Optional: configure advanced generation settings.","auth.advanced.thinking":"Enable thinking","auth.advanced.thinkingDesc":"Allows the model to perform extended reasoning before responding.","auth.advanced.modality":"Enable modality","auth.advanced.modalityDesc":"Enables multimodal input capabilities (image, video, etc.).","auth.advanced.modalityImage":"Image","auth.advanced.modalityVideo":"Video","auth.advanced.modalityAudio":"Audio","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"Context window","auth.advanced.contextDesc":"Max input tokens (leave empty to auto-detect from model name).","auth.advanced.contextPlaceholder":"Context window (optional)","local.btw":"Ask a quick side question without affecting the main conversation. Usage: /btw <your question>","btw.empty":"Please provide a question. Usage: /btw <your question>","btw.emptyAnswer":"No response received.","btw.failed":"Failed to answer btw question","btw.answering":"+ Answering...","btw.shortcuts.pending":"Press Escape, Ctrl+C, or Ctrl+D to cancel","btw.shortcuts.done":"Press Space, Enter, or Escape to dismiss","local.clear":"Start a new session with empty context; previous session stays on disk (resumable with /resume)","local.context":'Show context window usage breakdown. Use "/context detail" for per-item breakdown.',"local.copy":"Copy last output or snippet","local.delete":"Delete a session permanently","local.release":"Release a live session","local.rewind":"Rewind the current conversation","local.branch":"Fork the current conversation into a new session","local.fork":"Start a background agent from this conversation","local.help":"Show help and commands","local.language":"Change UI language","local.mcp":"Manage MCP servers","local.memory":"Manage memory","local.model":"Switch model or set fast model","local.new":"Start a new conversation","local.plan":"Enter Plan mode","local.goal":"Set a goal and keep working until it is met","local.recap":"Generate a session recap","recap.label":"Recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","rewind.action":"Rewind","rewind.confirm":"Confirm rewind","rewind.empty":"No rewind snapshots are available for this session.","rewind.failed":e=>`Failed to rewind session: ${(e==null?void 0:e.reason)??""}`,"rewind.loading":"Loading rewind snapshots...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"Rewinding...","rewind.subtitle":"Only the conversation is rewound. Files are not changed.","rewind.title":"Rewind Conversation","rewind.turn":e=>`Prompt ${(e==null?void 0:e.turn)??0}`,"local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":e=>`Session renamed to ${(e==null?void 0:e.name)??""}`,"local.reset":"Reset current conversation","local.resume":"Resume a previous session","local.skills":"View available skills","local.stats":"Show session statistics","local.tasks":"View background tasks","local.status":"Show version info","local.theme":"Change theme","local.settings":"View and edit settings","local.extensions":"Manage extensions. Usage: /extensions manage|install <source>","extensions.label":"extension","extensions.action.failed":e=>`Extension action failed${e!=null&&e.name?` for "${e.name}"`:e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.commands.refreshFailed":"Failed to refresh extension commands.","extensions.install.failed":e=>`Failed to install extension${e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.manage.agents":"Agents:","extensions.manage.checkingUpdates":"Checking for updates...","extensions.manage.commands":"Commands:","extensions.manage.contextFiles":"Context files:","extensions.manage.count":e=>`${(e==null?void 0:e.count)??0} extensions installed`,"extensions.manage.detailsTitle":"Extension Details","extensions.manage.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.empty":"No extensions installed.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" enabled.`,"extensions.manage.footer.back":"Esc to go back","extensions.manage.footer.confirm":"Enter confirm · Esc cancel","extensions.manage.footer.list":"↑↓ to navigate · Enter select · r refresh · Esc close","extensions.manage.footer.select":"↑↓ to navigate · Enter select · Esc back","extensions.manage.loading":"Loading extensions...","extensions.manage.mcpServers":"MCP servers:","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.path":"Path:","extensions.manage.queued":e=>`Extension action queued for "${(e==null?void 0:e.name)??"extension"}".`,"extensions.manage.refreshed":e=>`Extensions refreshed in ${(e==null?void 0:e.refreshed)??0} session(s), ${(e==null?void 0:e.failed)??0} failed.`,"extensions.manage.settings":"Settings:","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","extensions.manage.status":"Status:","extensions.manage.status.disabled":"disabled","extensions.manage.status.enabled":"enabled","extensions.manage.title":"Manage Extensions","extensions.manage.unknownUpdate":"unknown","extensions.manage.uninstalled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" uninstalled.`,"extensions.manage.uninstallAction":"Uninstall Extension","extensions.manage.uninstallConfirm":e=>`Uninstall extension "${(e==null?void 0:e.name)??"extension"}"?`,"extensions.manage.upToDate":"up to date","extensions.manage.update":"Update Extension","extensions.manage.updateAvailable":"update available","extensions.manage.updateError":"update check failed","extensions.manage.updated":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated.`,"extensions.manage.updatedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated to v${(e==null?void 0:e.version)??""}.`,"extensions.manage.version":"Version:","extensions.manage.viewDetails":"View Details","extensions.install.installed":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" installed.`,"extensions.install.installedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" v${(e==null?void 0:e.version)??""} installed.`,"extensions.install.missingOptionValue":e=>`Missing value for ${(e==null?void 0:e.option)??"option"}`,"extensions.install.requestFailed":"Failed to install extension","extensions.install.started":e=>`Installing extension from "${(e==null?void 0:e.source)??""}"...`,"extensions.install.unknownOption":e=>`Unknown option ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"Usage: /extensions manage|install <source>","extensions.install.waitForSession":"Wait for the session to connect before installing an extension.","local.tools":"List available tools. Usage: /tools [desc]","loadWarning.commands":"Failed to load command list; slash commands may be incomplete.","loadWarning.context":"Failed to load session context; current mode may be inaccurate.","loadWarning.models":"Failed to load model list; some model details may be unavailable.","mcp.action.auth":"Authenticate","mcp.action.authHint":"Not exposed by daemon yet","mcp.action.authMessage":"Daemon serve does not expose MCP authentication yet.","mcp.action.clearAuth":"Clear Authentication","mcp.action.disable":"Disable","mcp.action.done":e=>`${(e==null?void 0:e.action)??"Action"} complete.`,"mcp.action.enable":"Enable","mcp.action.enableMessage":"Daemon serve does not expose MCP enable/disable yet.","mcp.action.failed":e=>`Failed: ${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"Action"}...`,"mcp.action.reauth":"Re-authenticate","mcp.annotation.destructive":"destructive","mcp.annotation.idempotent":"idempotent","mcp.annotation.openWorld":"open-world","mcp.annotation.readOnly":"read-only","mcp.annotations":"Annotations","mcp.oauth.server":"Server","mcp.oauth.starting":e=>`Starting OAuth authentication for MCP server '${(e==null?void 0:e.name)??""}'...`,"mcp.oauth.title":"OAuth Authentication","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} clients · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"Command","mcp.description":"Description:","mcp.action.reconnect":"Reconnect","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","mcp.emptyTools":"No tools discovered.","mcp.expand":"Expand MCP server","mcp.collapse":"Collapse MCP server","mcp.inputSchema":"Input schema","mcp.loadingStatus":"Loading MCP status...","mcp.loadingTools":"Loading tools...","mcp.name":"Name","mcp.noDescription":"No description","mcp.noSchema":"No input schema.","mcp.serverTool":"Server tool","mcp.servers":e=>`${(e==null?void 0:e.count)??0} servers`,"mcp.configuredServers":"Configured MCP servers:","mcp.fromExtension":e=>`(from ${(e==null?void 0:e.name)??""})`,"mcp.extensionMcp":"Extension MCP","mcp.invalidReason":e=>`invalid: ${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"Reason:","mcp.invalidToolHelp":"Tools must have both name and description to be used by the LLM.","mcp.invalidToolWarning":"Warning: This tool cannot be called by the LLM","mcp.manageServers":"Manage MCP servers","mcp.parameters":"Parameters:","mcp.required":" required","mcp.resources":"Resources","mcp.resourcesUnavailable":"Resource details unavailable.","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"resource":"resources"}`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"prompt":"prompts"}`,"mcp.resource.uriLabel":"URI:","mcp.resource.nameLabel":"Name:","mcp.resource.mimeTypeLabel":"MIME Type:","mcp.resource.sizeLabel":"Size:","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"byte":"bytes"}`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc to back","mcp.shortcut.close":"Esc to close","mcp.shortcut.selectBack":"↑↓ to navigate · Enter to select · Esc to back","mcp.shortcut.selectClose":"↑↓ to navigate · Enter to select · Esc to close","mcp.settings":"Settings","mcp.extension":e=>`Extension: ${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP servers are starting up (${(e==null?void 0:e.count)??0} initializing)...`,"mcp.startingNote":"Note: First startup may take longer. Tool availability will update automatically.","mcp.restartSkipped":e=>`Skipped ${(e==null?void 0:e.name)??""}: ${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`Restarted ${(e==null?void 0:e.name)??""} in ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`Restarted ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} ${(e==null?void 0:e.name)??""} entries${e!=null&&e.failedReasons?` (failed: ${e.failedReasons})`:""}`,"mcp.source":"Source","mcp.source.extension":"Extension","mcp.source.project":"Workspace Settings","mcp.source.user":"User Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","mcp.status.connected":"connected","mcp.status.connecting":"connecting","mcp.status.disconnected":"disconnected","mcp.status.disconnectedTitle":"Disconnected","mcp.status.disabled":"disabled","mcp.status.ready":"Ready","mcp.status.starting":"Starting... (first startup may take longer)","mcp.status.unknown":"unknown","mcp.tipDesc":"to show server and tool descriptions","mcp.tipNodesc":"to hide descriptions","mcp.tipSchema":"to show tool parameter schemas","mcp.tips":"💡 Tips:","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} tool`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"mcp.toolsLabel":"Tools:","mcp.title":"MCP Servers","mcp.toolDetail":"Tool Detail","mcp.tools":"Tools","mcp.toolsForServer":e=>`Tools for ${(e==null?void 0:e.name)??"Server"}`,"mcp.transport":"Transport","mcp.use":"Use","mcp.userMcp":"User MCP","mcp.workingDirectory":"Working Directory","goal.aborted":"Goal aborted","goal.achieved":"Goal achieved","goal.check":"Goal check","goal.cleared":"Goal cleared","goal.failed":"Goal could not be achieved","goal.judge":"Judge","goal.label":"Goal","goal.lastCheck":"Last check","goal.notYetMet":"not yet met","goal.set":"Goal set","goal.statusActive":"/goal active","goal.turn":e=>`${(e==null?void 0:e.count)??0} turn`,"goal.turnLabel":e=>`turn ${(e==null?void 0:e.count)??0}`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} turns`,"memory.add":"Add","memory.add.desc":"Write a durable memory","memory.autoDream":e=>`Auto-dream: ${(e==null?void 0:e.status)??"unknown"} · ${(e==null?void 0:e.lastDream)??"never"} · /dream to run`,"memory.autoDreamUnsupported":"Auto-dream settings are not available from web-shell yet.","memory.autoFolder":"Open auto-memory folder","memory.autoMemory":e=>`Auto-memory: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoMemoryUnsupported":"Auto-memory settings are not available from web-shell yet.","memory.autoSkill":e=>`Auto-skill: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoSkillUnsupported":"Auto-skill settings are not available from web-shell yet.","memory.chooseScope":"Choose where to save the memory","memory.closed":"Memory panel closed.","memory.contentEmpty":"Memory content is empty.","memory.file":"Memory file","memory.fileOpen":"Memory file opened.","memory.fileTruncated":"Memory file opened. Content is truncated.","memory.files":"Memory Files","memory.footer":"Enter to confirm · Esc to cancel","memory.footer.back":"Esc to go back","memory.global":"User","memory.global.desc":"Saved to the global user memory file","memory.globalReadUnsupported":"Global memory is outside the bound workspace, so the current daemon file-read API cannot open its content.","memory.loading":"Loading memory...","memory.loadingFile":"Loading memory file...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"never","memory.noFiles":"No memory files found.","memory.on":"on","memory.openFolderUnsupported":"Opening the auto-memory folder is not available from web-shell yet.","memory.placeholder":e=>`Write ${(e==null?void 0:e.scope)??"memory"} content...`,"memory.project":"Project","memory.project.desc":"Saved to this workspace memory file","memory.refresh":"Refresh","memory.refresh.desc":"Reload memory file information","memory.refreshed":"Memory refreshed.","memory.save":"Save Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} saved: ${(e==null?void 0:e.bytes)??0} bytes -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"Saving...","memory.show":"Show","memory.show.desc":"Show configured memory files","memory.status":"Workspace and user memory files","memory.unknown":"unknown","memory.write":"Write memory content","mode.auto":"Classifier Approval","mode.auto.desc":"Uses a classifier to approve safe tool calls and block or ask for risky ones","mode.auto.notice":"Auto mode enabled. An LLM classifier evaluates each tool call and auto-approves safe actions, blocks risky ones. To exit: Shift+Tab or /approval-mode default.","mode.footer":"(Use Enter to select, Esc to cancel)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"Plan","mode.label.default":"Ask Approval","mode.label.auto-edit":"Auto Edit","mode.label.auto":"Classifier Approval","mode.label.yolo":"Full Access","mode.listLabel.plan":"Plan (plan)","mode.listLabel.default":"Ask Approval (default)","mode.listLabel.auto-edit":"Auto Edit (auto-edit)","mode.listLabel.auto":"Classifier Approval (auto)","mode.listLabel.yolo":"Full Access (yolo)","mode.desc.plan":"Analyze only, do not modify files or execute commands","mode.desc.default":"Ask before running commands, editing files, or accessing external resources","mode.desc.auto-edit":"Automatically approve file edits and ask before command execution or other sensitive actions","mode.desc.auto":"Evaluate tool risk automatically, run safe actions, and confirm risky ones","mode.desc.yolo":"Automatically approve all tool calls in trusted contexts","mode.select":"Approval Mode","mode.autoApproved":e=>e!=null&&e.tool?`Auto-approved: ${e.tool}`:"Pending tool call auto-approved by mode switch.","mode.auto-edit":"Auto-accept edits","mode.auto-edit.desc":"Automatically approve file read/write operations","mode.default":"Default mode","mode.default.desc":"Ask before each tool call","mode.plan":"Plan mode","mode.plan.desc":"Analyze and plan without running tools","mode.unknown":"unknown mode","mode.yolo":"YOLO mode","mode.yolo.desc":"Automatically approve all operations","plan.title":"Plan","model.contextWindow":"Context Window","model.contextWindow.unknown":"(unknown)","model.current":e=>`current: ${(e==null?void 0:e.model)??"unknown"}`,"model.modality":"Modality","model.modality.text":"text","model.modality.textOnly":"text-only","model.modality.image":"image","model.modality.pdf":"pdf","model.modality.audio":"audio","model.modality.video":"video","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"(default)","model.notSet":"(not set)","model.footer":"Enter select, ↑↓ navigate, Esc close","model.searchHint":"Press / to search","model.fastHint":"for suggestions and side tasks","model.noMatch":e=>`No model matching "${(e==null?void 0:e.query)??""}"`,"model.none":"No models available","model.select":"Select Model","model.setFast":"Set Fast Model","model.setVoice":"Set Voice Model","model.switch":"Switch Model","model.unknown":"unknown","resume.current":"current","resume.activePrompt":"active prompt","resume.filter":"Filter","resume.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"resume.none":"No sessions to resume","resume.pressSearch":"Press / to search","resume.search":"Search","resume.title":"Resume Session","parallelAgents.title":"Parallel agents","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} done`,"skills.available":"Available skills:","skills.none":"No skills are currently available.","skills.empty":"No skills available.","skills.footer":e=>e!=null&&e.name?`Use /skills ${e.name} to invoke · r to refresh · Esc to close`:"r to refresh · Esc to close","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} invocable`,"skills.loading":"Loading skills...","skills.run":"Run skill","skills.status.disabled":"disabled","skills.title":"Skills","stats.accepted":"Accepted:","stats.agreementRate":"Overall Agreement Rate:","stats.api":"API","stats.apiTime":"API Time","stats.avgDuration":"Avg Duration","stats.avgLatency":"Avg Latency","stats.cached":"Cached","stats.cacheDesc":"of input tokens were served from the cache, reducing costs.","stats.calls":"Calls","stats.codeChanges":"Code Changes","stats.decisionSummary":"User Decision Summary","stats.duration":"Duration","stats.errors":"Errors","stats.inputTokens":"Input Tokens","stats.metric":"Metric","stats.modelStats":"Model Stats","stats.modelTip":"Tip: For a full token breakdown, run /stats model.","stats.modelUsage":"Model Usage","stats.modified":"Modified:","stats.noApiCalls":"No API calls have been made in this session.","stats.noToolCalls":"No tool calls have been made in this session.","stats.output":"Output","stats.outputTokens":"Output Tokens","stats.overview":"Session Overview","stats.performance":"Performance","stats.prompt":"Prompt","stats.prompts":"Prompts","stats.rejected":"Rejected:","stats.reqs":"Reqs","stats.requests":"Requests","stats.savingsHighlight":"Savings Highlight:","stats.successRate":"Success Rate","stats.thoughts":"Thoughts","stats.title":"Session Stats","stats.tokens":"Tokens","stats.toolCalls":"Tool Calls","stats.toolName":"Tool Name","stats.toolStats":"Tool Stats","stats.toolTime":"Tool Time","stats.total":"Total","stats.totalReviewed":"Total Reviewed Suggestions:","status.contextUsed":e=>`${(e==null?void 0:e.pct)??"0.0"}% context used`,"status.disconnected":"Disconnected","status.modeHint":"(shift + tab or click to switch)","status.shortcuts":"? for shortcuts","stream.cancel":"esc to cancel","stream.cancelArmed":"Press Esc again to stop","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`current: ${(e==null?void 0:e.theme)??""}`,"theme.auto":"Auto","theme.dark":"Dark","theme.dark.desc":"Terminal-style dark skin.","theme.light":"Light","theme.light.desc":"Terminal-style light skin.","theme.title":"Theme","todo.allDone":"All tasks completed","todo.collapse":"Collapse task list","todo.completedAbove":e=>`✓ ${(e==null?void 0:e.count)??0} completed`,"todo.detail.api":"API","todo.detail.cached":"Cached","todo.detail.end":"End","todo.detail.hide":"Hide task detail","todo.detail.input":"Input","todo.detail.noResources":"Token & time usage wasn't captured for this task.","todo.detail.output":"Output","todo.detail.sectionSpent":"Time spent","todo.detail.sectionTime":"Time","todo.detail.sectionTokens":"Tokens","todo.detail.show":"Show task detail","todo.detail.start":"Start","todo.detail.tool":"Tool","todo.expand":"Expand task list","todo.more":e=>`... ${(e==null?void 0:e.count)??0} more`,"todo.moreAbove":e=>`... ${(e==null?void 0:e.count)??0} earlier`,"todo.showLess":"Show less","todo.stepProgress":e=>`Step ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"Current tasks","chat.scrollToBottom":"Scroll to bottom","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","turn.processed":"Processed","turn.processing":"Processing","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":e=>{const t=(e==null?void 0:e.count)??0;return`${t} step${t===1?"":"s"}`},"turn.toolCalls":e=>{const t=(e==null?void 0:e.count)??0;return`${t} tool call${t===1?"":"s"}`},"turn.thinkingCount":e=>{const t=(e==null?void 0:e.count)??0;return`${t} thought${t===1?"":"s"}`},"turn.stopped":"You cancelled this request","message.renderError":"This message could not be displayed.","tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":e=>`^ ${(e==null?void 0:e.count)??0} more above`,"tasks.moreBelow":e=>`v ${(e==null?void 0:e.count)??0} more below`,"tasks.running":"Running","tasks.completed":"Completed","tasks.failed":"Failed","tasks.cancelled":"Stopped","tasks.paused":"Paused","tasks.kind.shell":"Shell","tasks.kind.monitor":"Monitor","tasks.action.stop":"Stop","tasks.action.abandon":"Abandon","tasks.action.confirmStop":"Confirm stop","tasks.action.confirmAbandon":"Confirm abandon","tasks.action.confirmHint":"This will end the blocking turn.","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} local agent`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} local agents`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} local agent paused`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} local agents paused`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} task done`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} tasks done`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} monitor`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} monitors`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} shells`,"tasks.confirmStop":"x again to confirm stop · ends the blocking turn","tasks.shortcut.select":"↑/↓ select","tasks.shortcut.view":"Enter view","tasks.shortcut.stop":"x stop","tasks.shortcut.abandon":"x abandon","tasks.shortcut.listClose":"←/Esc close","tasks.shortcut.detailBack":"← go back","tasks.shortcut.detailClose":"Esc/Enter/Space close","tasks.shortcut.close":"Esc close","tasks.shortcut.cancelConfirm":"Esc cancel","tasks.detail.workingDir":"Working dir","tasks.detail.outputFile":"Output file","tasks.detail.command":"Command","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} events`,"tasks.detail.exit":e=>`exit ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} dropped`,"tasks.detail.error":"Error","tasks.detail.stoppedBecause":"Stopped because","tasks.detail.resumeBlocked":"Resume blocked","tasks.detail.progress":"Progress","tasks.detail.prompt":"Prompt","tasks.detail.type":"Type","tasks.detail.runtime":"Time","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"Tool calls","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool calls`,"tips.items":"Type / to see all available commands.|Use @ to reference file paths.|Press Esc to cancel an in-flight request.|Use Shift+Enter for a newline.|Press ↑↓ to browse message history.","tools.available":"Available tools:","tools.none":"No tools available.","tools.empty":"No built-in tools available. Open a session first.","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space for details · ":""}t to toggle ${e.name} · r to refresh · Esc to close`:"r to refresh · Esc to close","tools.details.hide":"Hide details","tools.details.show":"Show details","tools.loading":"Loading tools...","tools.status.disabled":"disabled","tools.status.enabled":"enabled","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.status.failed":"Failed","tool.showAll":e=>`▼ Show all (${(e==null?void 0:e.count)??0} lines)`,"tool.showLess":"▲ Show less","tool.showFullLines":"▼ Show full lines","tool.linesTotal":e=>`▼ ${(e==null?void 0:e.count)??0} lines total`,"toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`Ran ${(e==null?void 0:e.count)??0} tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.running":e=>`Running ${(e==null?void 0:e.name)??"tool"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · ${(e==null?void 0:e.count)??0} tools`:""}`,"thinking.expand":"Expand thinking","thinking.collapse":"Collapse thinking","thinking.running":e=>`Thinking${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.done":e=>e!=null&&e.duration?`Thought for ${e.duration}`:"Done thinking","settings.title":"Settings","settings.loading":"Loading settings...","settings.empty":"No settings available.","settings.footer":"↑↓ Navigate  Enter Toggle  Tab Scope  r Reload  ESC Close","settings.footer.edit":"Enter Save  ESC Cancel","settings.footer.theme":"↑↓ Navigate  Enter Select  ESC Back","settings.scope.user":"User","settings.scope.workspace":"Workspace","settings.value.on":"ON","settings.value.off":"OFF","settings.action.edit":"Edit","settings.action.save":"Save","settings.modifiedIn":e=>`(Modified in ${(e==null?void 0:e.scope)??""})`,"settings.alsoModifiedIn":e=>`(Also modified in ${(e==null?void 0:e.scope)??""})`,"settings.invalidNumber":"Invalid number","settings.readOnly":"User-scope settings are read-only in daemon mode.","settings.requiresRestart":"This change requires a restart to take effect.","settings.corrupted":e=>`Settings file was corrupted${(e==null?void 0:e.recovered)==="true"?" (recovered from backup)":""}`,"settings.label.ui.chatWidth":"Chat width","settings.description.ui.chatWidth":"Frontend-only chat content width. Stored in this browser.","settings.option.ui.chatWidth.1000":"Regular","settings.option.ui.chatWidth.wide":"Ultra wide","welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.prompt":"What would you like to do?","welcome.titlePrefix":"Welcome to","welcome.tipLabel":"Tips:"},LH={...__,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep_search":"Grep","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","toolName.save_memory":"保存记忆","toolName.agent":"Agent","toolName.skill":"技能","toolName.enter_plan_mode":"进入计划模式","toolName.exit_plan_mode":"退出计划模式","toolName.web_fetch":"网络搜索","toolName.webfetch":"网络搜索","toolName.fetch":"网络搜索","toolName.web_search":"网络搜索","toolName.list_directory":"列出文件","toolName.lsp":"LSP","toolName.ask_user_question":"询问用户","toolName.cron_create":"创建定时任务","toolName.cron_list":"定时任务列表","toolName.cron_delete":"删除定时任务","toolName.task_create":"创建任务","toolName.task_update":"更新任务","toolName.task_list":"任务列表","toolName.task_stop":"停止任务","toolName.team_create":"创建团队","toolName.team_delete":"删除团队","toolName.send_message":"发送消息","toolName.structured_output":"结构化输出","toolName.monitor":"监控","toolName.notebook_edit":"编辑 Notebook","toolName.tool_search":"工具搜索","toolName.enter_worktree":"进入 Worktree","toolName.exit_worktree":"退出 Worktree","toolName.workflow":"工作流","toolName.bash":"运行命令","toolName.shell":"Shell 命令","toolName.read":"读取文件","toolName.readfile":"读取文件","toolName.write":"写入文件","toolName.writefile":"写入文件","toolName.search":"Grep","toolName.todowrite":"任务清单","toolName.savememory":"保存记忆","toolName.askuserquestion":"询问用户","toolName.toolsearch":"工具搜索","about.auth":"认证","about.baseUrl":"Base URL","about.fastModel":"快速模型","about.memoryUsage":"内存使用","about.model":"模型","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"操作系统","about.proxy":"代理","about.qwenCode":"Qwen Code","about.runtime":"运行环境","about.sandbox":"沙箱","about.sessionId":"会话 ID","about.title":"状态","agent.back":"返回","agent.builtInBadge":"（内置）","agent.action.delete":"删除智能体","agent.action.edit":"编辑智能体","agent.action.view":"查看智能体","agent.chooseAction":e=>`选择操作：${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"选择操作","agent.colorLabel":"颜色：","agent.colorUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的颜色`,"agent.create":"创建新的智能体","agent.create.button":"创建智能体","agent.create.confirm":"确认并保存","agent.create.desc":"创建新的智能体","agent.create.descPlaceholder":"这个智能体做什么？","agent.create.describeAgent":"描述您的子智能体","agent.create.description":"描述","agent.create.editAgain":"编辑","agent.create.enterDescription":"输入描述","agent.create.enterName":"输入子智能体名称","agent.create.enterPrompt":"输入系统提示词","agent.create.generateFailed":e=>`生成子智能体失败：${(e==null?void 0:e.error)??"未知错误"}`,"agent.create.generatingConfig":"正在生成子智能体配置...","agent.create.loading":"创建中...","agent.create.location":"选择位置","agent.create.method":"选择生成方式","agent.create.method.manual":"手动创建","agent.create.method.qwen":"使用 Qwen Code 生成","agent.create.method.qwen.recommended":"使用 Qwen Code 生成（推荐）","agent.create.method.qwen.desc":"LLM 生成名称、提示词和描述","agent.create.name":"名称","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"输入此子智能体清晰且唯一的名称。","agent.create.project":"项目","agent.create.project.cli":"项目级 (.qwen/agents/)","agent.create.project.desc":"创建项目级智能体","agent.create.prompt":"系统提示词","agent.create.promptPlaceholder":"你是一个专门的智能体...","agent.create.promptPlaceholder.cli":"例如：你是一名专业的代码审查员...","agent.create.promptHelp":"编写定义此子智能体行为的系统提示词。为了获得最佳效果，请全面描述。","agent.create.preview":"预览","agent.create.qwenHint":"描述此子智能体应该做什么以及何时使用它。（为了获得最佳效果，请全面描述）","agent.create.qwenPlaceholder":"> 例如：专业的代码审查员，根据最佳实践审查代码...","agent.create.required":"名称、描述和系统提示词均为必填项。","agent.create.save":"保存智能体","agent.create.scope":"选择智能体的保存位置","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","agent.create.toolsSelection":"选择工具","agent.create.tools.all":"所有工具","agent.create.tools.allDefault":"所有工具（默认）","agent.create.tools.allInfo":"已选择所有工具，包括 MCP 工具","agent.create.tools.allInfoFallback":"已选择所有工具，包括 MCP 工具","agent.create.tools.editLabel":"• 编辑工具:","agent.create.tools.executionLabel":"• 执行工具:","agent.create.tools.none":"（无）","agent.create.tools.readEdit":"读取和编辑工具","agent.create.tools.readEditExecute":"读取、编辑和执行工具","agent.create.tools.readOnlyLabel":"• 只读工具:","agent.create.tools.readOnly":"只读工具","agent.create.tools.selected":"已选择的工具:","agent.create.user":"用户","agent.create.user.cli":"用户级 (~/.qwen/agents/)","agent.create.user.desc":"创建用户级智能体","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"agent.delete":"删除","agent.delete.confirm":e=>`确定要删除 "${(e==null?void 0:e.name)??""}" 吗？`,"agent.delete.loading":"删除中...","agent.delete.no":"否","agent.delete.title":e=>`删除 ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"是，删除","agent.deleted":e=>`已删除 ${(e==null?void 0:e.name)??""}`,"agent.edit":"编辑","agent.edit.color":"编辑颜色","agent.edit.tools":"编辑工具","agent.editColorTitle":e=>`编辑颜色：${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`编辑 ${(e==null?void 0:e.name)??""}`,"agent.empty":"未找到智能体。","agent.footer.back":"Esc 返回","agent.footer.cliBack":"Enter 选择 · ↑↓ 导航 · Esc 返回","agent.footer.cliSelect":"Enter 选择 · ↑↓ 导航 · Esc 关闭","agent.footer.close":"Esc 关闭","agent.footer.deleteConfirm":"Enter 确认，Esc 取消","agent.footer.enterNext":"按 Enter 继续，Esc 返回","agent.footer.generating":"Esc 取消","agent.footer.createLocation":"按 Enter 继续，↑↓ 导航，Esc 取消","agent.footer.createContinue":"按 Enter 继续，↑↓ 导航，Esc 返回","agent.footer.final":"按 Enter 保存，e 保存并编辑，Esc 返回","agent.footer.nav":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navBack":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navSelect":"↑↓ 导航 · Enter 选择 · Esc 关闭","agent.footer.viewerBack":"Esc 返回","agent.filePathLabel":"文件路径：","agent.label":"智能体","agent.location":"位置","agent.level.builtin":"内置","agent.level.extension":"扩展","agent.level.project":"项目","agent.level.user":"用户","agent.manage":"管理","agent.manage.desc":"管理已有智能体","agent.modelLabel":"模型：","agent.overriddenBadge":"（已被项目级智能体覆盖）","agent.readonly":"该智能体是只读的。","agent.select":"请选择一个智能体。","agent.selectAction":"选择操作","agent.descriptionLabel":"描述：","agent.systemPromptLabel":"系统提示词：","agent.step":e=>`步骤 ${(e==null?void 0:e.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","agent.toolsUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的工具`,"agent.usingCount":e=>`使用中：${(e==null?void 0:e.count)??0} 个智能体`,"agent.view":"查看","agents.closed":"智能体面板已关闭。","agents.title":"智能体","subagent.toggleStream":"展开/收起子智能体详情","toast.dismiss":"关闭通知","toast.dismissShort":"关闭","insight.ready":"Insight 报告已生成！","request.cancelled":"请求已取消。","approval.execQuestion":e=>`允许执行：'${(e==null?void 0:e.tool)??""}'？`,"approval.changeQuestion":"是否继续？","approval.launchAgentQuestion":"启动这个 agent？","approval.option.allowOnce":"是，允许一次","approval.option.rejectOnce":"拒绝","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"项目内始终允许","approval.option.allowAlwaysUser":"对此用户始终允许","approval.option.allowAlwaysServer":"对此服务始终允许","approval.option.allowAlwaysTool":"对此工具始终允许","assistant.branch":"分叉","assistant.copy":"复制","common.back":"返回","common.cancel":"取消","common.close":"关闭","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.navigate":"↑↓ 导航","common.next":"下一步","common.previous":"上一步","common.refresh":"刷新","common.search":"搜索","common.valid":"有效","common.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"agent.count":e=>`${(e==null?void 0:e.count)??0} 个智能体`,"askUser.submit":"提交","askUser.ignore":"忽略","askUser.multiHint":"可多选","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} 个问题`,"askUser.selectAnswer":"选择一个答案","askUser.typePlaceholder":"输入内容...","copy.failedFallback":"复制到剪贴板失败","copy.inlineLatexMissing":"最后一条 AI 输出中没有匹配的行内 LaTeX 表达式。","copy.latexMissing":"最后一条 AI 输出中没有匹配的 LaTeX 块。","copy.noOutput":"历史记录中没有可复制的输出","copy.noText":"最后一条 AI 输出没有可复制的文本。","copy.codeMissing":"最后一条 AI 输出中没有匹配的代码块。","copy.outputCopied":"已复制最后一条输出到剪贴板","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"内容"} 已复制到剪贴板`,"code.copy":"复制","code.copied":"已复制！","markdownTable.blank":"(空白)","markdownTable.column":e=>`第 ${(e==null?void 0:e.index)??""} 列`,"markdownTable.rows":e=>`${(e==null?void 0:e.count)??0} 行`,"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} 行`,"markdownTable.hint":"点击表头排序，点击 ▾ 打开筛选。","markdownTable.filtersActive":e=>`${(e==null?void 0:e.count)??0} 个筛选`,"markdownTable.cellsSelected":e=>`${(e==null?void 0:e.count)??0} 个单元格已选中`,"markdownTable.copyTsv":"复制 TSV","markdownTable.copyVisible":"快捷复制","markdownTable.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"markdownTable.rowDetails":"详情","markdownTable.rowDetailsAria":e=>`查看第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.closeRowDetailsAria":e=>`收起第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.detailsHeader":"单行详情","markdownTable.actions":"操作","markdownTable.sortByColumn":e=>`按 ${(e==null?void 0:e.column)??""} 排序`,"markdownTable.sortByColumnAsc":e=>`${(e==null?void 0:e.column)??""} 已升序排序`,"markdownTable.sortByColumnDesc":e=>`${(e==null?void 0:e.column)??""} 已降序排序`,"markdownTable.filterColumn":e=>`筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"此表格没有数据。","markdownTable.emptyFiltered":"没有符合筛选条件的行。","markdownTable.sort.asc":"升序排序","markdownTable.sort.desc":"降序排序","markdownTable.sort.clear":"清除排序","markdownTable.filter.searchPlaceholder":"搜索筛选值","markdownTable.filter.searchAria":e=>`搜索 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"全选当前结果","markdownTable.filter.optionLimit":e=>`已显示前 ${(e==null?void 0:e.count)??0} 项，请搜索缩小范围`,"markdownTable.filter.noOptions":"没有匹配项","markdownTable.filter.custom":"自定义筛选","markdownTable.filter.numberAria":e=>`数字筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`文本筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"数值","markdownTable.filter.toPlaceholder":"到","markdownTable.filter.textPlaceholder":"输入筛选条件","markdownTable.filter.reset":"重置","markdownTable.filter.cancel":"取消","markdownTable.filter.confirm":"确认","markdownTable.filter.text.contains":"包含","markdownTable.filter.text.equals":"等于","markdownTable.filter.text.notEquals":"不等于","markdownTable.filter.text.startsWith":"开头是","markdownTable.filter.text.endsWith":"结尾是","markdownTable.filter.number.gt":"大于","markdownTable.filter.number.gte":"大于等于","markdownTable.filter.number.lt":"小于","markdownTable.filter.number.lte":"小于等于","markdownTable.filter.number.between":"区间","mermaid.rendering":"正在渲染图表...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"已激活","contextUsage.autocompactBuffer":"自动压缩缓冲区","contextUsage.bodyLoaded":"已加载正文","contextUsage.builtinTools":"内置工具","contextUsage.contextWindow":"上下文窗口","contextUsage.detailHint":"运行 /context detail 查看逐项明细。","contextUsage.estimatedOverhead":"预估的对话前开销","contextUsage.free":"空闲","contextUsage.memoryFiles":"Memory 文件","contextUsage.messages":"消息","contextUsage.mcpTools":"MCP 工具","contextUsage.model":"模型","contextUsage.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":"设置目标","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.project":"项目","sidebar.projectFallback":"项目","sidebar.settings":"设置","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.delete":"删除","sidebar.loadingSessions":"正在加载会话...","sidebar.loadFailed":"会话加载失败，点击重试。","sidebar.renameFailed":"重命名会话失败","sidebar.deleteFailed":"删除会话失败","sidebar.newSessionFailed":"创建新对话失败","sidebar.switchFailed":"切换会话失败","sidebar.currentDeleteDisabled":"不能删除当前会话","sidebar.deleteConfirmDescription":e=>`确定删除“${(e==null?void 0:e.name)??""}”吗？删除后不可恢复。`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"sidebar.running":"运行中","sidebar.completedUnread":"刚完成","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.insertTip":"将信息插入当前会话，下次模型调用生效。","queue.inserted":"已插入，下次模型调用生效。","queue.insertCommandDisabled":"命令无法插入当前回合。","queue.submitting":"提交中...","queue.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellBlocked":"当前回合运行时，Shell 命令不能进入排队。","queue.queueFailed":"排队消息失败","queue.insertFailed":"插入排队消息失败","queue.deleteFailed":"移出队列失败","queue.editFailed":"编辑排队消息失败","queue.footer":"按 ↑ 编辑最后一条排队消息 · Esc 清空队列","queue.imageCount":e=>`（+${(e==null?void 0:e.count)??0} 张图片）`,"queue.more":e=>`...（还有 ${(e==null?void 0:e.count)??0} 条）`,"midTurn.inserted":e=>`已插入消息：${(e==null?void 0:e.message)??""}`,"help.builtIn":"内置命令","help.commandCount":e=>`${(e==null?void 0:e.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} 个子命令`,"help.commandsIntro":"浏览内置命令：","help.customGroup":"自定义、skills、plugins、MCP","help.customIntro":"浏览自定义、skill、plugin 和 MCP 命令：","help.empty":"当前没有可用命令。","help.emptyCustom":"当前没有可用的自定义命令。","help.footer":"Tab/Shift+Tab 切换标签 · ↑/↓ 或 PgUp/PgDn 滚动 · Esc 关闭","help.intro":"Qwen Code 可以理解代码库，在你的许可下修改文件，并直接执行命令。","help.section.shortcuts":"快捷键","help.search":"搜索命令","help.shortcut.addContext":"添加文件或目录作为上下文","help.shortcut.altWords":"按词跳转","help.shortcut.clear":"清屏","help.shortcut.commandMenu":"打开命令菜单","help.shortcut.completion":"接受补全或切换帮助标签","help.shortcut.history":"切换历史 prompt 或滚动列表","help.shortcut.searchHistory":"搜索历史 prompt","help.shortcut.newline":"插入换行","help.shortcut.pasteImages":"粘贴图片","help.shortcut.shell":"运行 shell 命令","help.shortcut.togglePanel":"切换此面板","help.shortcut.retry":"重试上次请求","help.shortcut.compact":"切换紧凑模式","retry.hint":"按 Ctrl+Y 重试或点击重试","retry.none":"没有可重试的失败请求。","branch.failed":"分支会话失败。","branch.success":e=>`已复制会话，新会话名称为： "${(e==null?void 0:e.name)??""}"，当前已切换到新的会话。`,"fork.empty":"请提供任务指令。用法：/fork <指令>","fork.failed":e=>`启动后台智能体失败：${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"后台智能体未启动。","fork.started":e=>`已启动后台智能体："${(e==null?void 0:e.name)??""}"，可在后台任务中查看。`,"command.hidden":"该命令不可用。","help.shortcut.approvals":"切换审批模式","help.shortcut.cancel":"关闭弹窗或取消操作","bug.failed":"加载系统信息失败，无法提交 Bug 报告。","bug.popupBlocked":"弹窗被拦截，请允许弹窗后重试。","bug.submitted":"Bug 报告已在新标签页中打开。","clear.blocked":"流式输出中无法清屏 — 先按 Esc 取消。","error.unknown":"未知错误","shell.command":"Shell 命令","compact.enabled":"紧凑模式已开启","compact.disabled":"紧凑模式已关闭","compact.hint":"按 Ctrl+O 显示完整工具输出","compact.saveFailed":"保存紧凑模式失败","help.subcommands":"子命令","help.tab.commands":"内置命令","help.tab.custom":"自定义命令","help.tab.general":"快捷键","help.title":"帮助","slash.category.custom":"自定义","slash.category.skill":"Skill","slash.category.system":"系统","language.changed":e=>`UI 语言已切换为 ${(e==null?void 0:e.language)??""}`,"language.current":e=>`当前 UI 语言：${(e==null?void 0:e.language)??""}`,"language.invalid":"语言无效。可用值：en, zh-CN","language.options":"可用选项：","language.set":"设置 UI 语言","language.usage":"用法：/language ui [en|zh-CN]","local.agents":"管理智能体","local.approvalMode":"切换审批模式","local.auth":"连接 LLM provider","auth.title":"连接 Provider","auth.step.group":"类型","auth.step.provider":"供应商","auth.step.protocol":"协议","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"模型 ID","auth.step.advanced":"高级配置","auth.apiKeyRequired":"API key 不能为空。","auth.baseUrlInvalid":"Base URL 必须以 http:// 或 https:// 开头。","auth.baseUrlPrompt":"输入此协议的 API endpoint。","auth.baseUrlRequired":"Base URL 不能为空。","auth.documentation":"文档","auth.modelsRequired":"模型 ID 不能为空。","auth.review":"确认","auth.reviewText":"以下 JSON 将保存到 settings.json：","auth.save":"保存","auth.saving":"正在保存...","auth.termsTitle":"服务条款和隐私声明","auth.continue":"继续","auth.modelsPrompt":e=>`输入以逗号分隔的模型 ID。例如：${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"可选：配置高级生成设置。","auth.advanced.thinking":"启用 thinking","auth.advanced.thinkingDesc":"允许模型在回复前进行扩展推理。","auth.advanced.modality":"启用多模态","auth.advanced.modalityDesc":"启用图片、视频等多模态输入能力。","auth.advanced.modalityImage":"图片","auth.advanced.modalityVideo":"视频","auth.advanced.modalityAudio":"音频","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"上下文窗口","auth.advanced.contextDesc":"最大输入 token 数（留空则根据模型名称自动检测）。","auth.advanced.contextPlaceholder":"上下文窗口（可选）","local.btw":"快速问一个不影响主对话的侧边问题。用法：/btw <your question>","btw.empty":"请提供一个问题。用法：/btw <你的问题>","btw.emptyAnswer":"未收到回答。","btw.failed":"回答 btw 问题失败","btw.answering":"+ 正在回答...","btw.shortcuts.pending":"按 Escape、Ctrl+C 或 Ctrl+D 取消","btw.shortcuts.done":"按 Space、Enter 或 Escape 关闭","local.clear":"以空上下文开始新会话；之前的会话会保留在磁盘上（可用 /resume 恢复）","local.context":'显示上下文窗口使用情况明细。使用 "/context detail" 查看逐项明细',"local.copy":"复制最后输出或代码片段","local.delete":"永久删除会话","local.release":"释放 live session","local.rewind":"回退当前会话","local.branch":"将当前对话分叉到新会话","local.fork":"基于当前对话启动后台智能体","local.help":"查看帮助和可用命令","local.language":"切换 UI 语言","local.mcp":"管理 MCP servers","local.memory":"管理 memory","local.model":"切换模型或设置 fast model","local.new":"开始新对话","local.plan":"进入 Plan 模式","local.goal":"设置目标并持续工作直到完成","local.recap":"生成会话摘要","recap.label":"回顾","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","rewind.action":"回退","rewind.confirm":"确认回退","rewind.empty":"当前会话没有可回退的快照。","rewind.failed":e=>`回退会话失败：${(e==null?void 0:e.reason)??""}`,"rewind.loading":"正在加载可回退的 prompt...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"回退中...","rewind.subtitle":"仅回退会话，不涉及文件。","rewind.title":"回退会话","rewind.turn":e=>`第 ${(e==null?void 0:e.turn)??0} 个 prompt`,"local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":e=>`会话已重命名为 ${(e==null?void 0:e.name)??""}`,"local.reset":"重置当前对话","local.resume":"恢复历史会话","local.skills":"查看可用 skills","local.stats":"查看会话统计","local.tasks":"查看后台任务","local.status":"查看版本信息","local.theme":"切换主题","local.settings":"查看和编辑设置","local.extensions":"管理扩展。用法: /extensions manage|install <source>","extensions.label":"扩展","extensions.action.failed":e=>`扩展操作失败${e!=null&&e.name?`（${e.name}）`:e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.commands.refreshFailed":"刷新扩展命令失败。","extensions.install.failed":e=>`安装扩展失败${e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.manage.agents":"智能体：","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.detailsTitle":"扩展详情","extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.empty":"未安装扩展。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已启用。`,"extensions.manage.footer.back":"Esc 返回","extensions.manage.footer.confirm":"Enter 确认 · Esc 取消","extensions.manage.footer.list":"↑↓ 导航 · Enter 选择 · r 刷新 · Esc 关闭","extensions.manage.footer.select":"↑↓ 导航 · Enter 选择 · Esc 返回","extensions.manage.loading":"正在加载扩展...","extensions.manage.mcpServers":"MCP servers：","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.path":"路径：","extensions.manage.queued":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshed":e=>`已刷新 ${(e==null?void 0:e.refreshed)??0} 个 session，${(e==null?void 0:e.failed)??0} 个失败。`,"extensions.manage.settings":"设置：","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","extensions.manage.status":"状态：","extensions.manage.status.disabled":"已禁用","extensions.manage.status.enabled":"已启用","extensions.manage.title":"管理扩展","extensions.manage.unknownUpdate":"未知","extensions.manage.uninstalled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已卸载。`,"extensions.manage.uninstallAction":"卸载扩展","extensions.manage.uninstallConfirm":e=>`确定卸载扩展 "${(e==null?void 0:e.name)??"扩展"}"？`,"extensions.manage.upToDate":"已是最新","extensions.manage.update":"更新扩展","extensions.manage.updateAvailable":"有可用更新","extensions.manage.updateError":"检查更新失败","extensions.manage.updated":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新。`,"extensions.manage.updatedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新到 v${(e==null?void 0:e.version)??""}。`,"extensions.manage.version":"版本：","extensions.manage.viewDetails":"查看详情","extensions.install.installed":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已安装。`,"extensions.install.installedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" v${(e==null?void 0:e.version)??""} 已安装。`,"extensions.install.missingOptionValue":e=>`${(e==null?void 0:e.option)??"选项"} 缺少值`,"extensions.install.requestFailed":"安装扩展失败","extensions.install.started":e=>`正在从 "${(e==null?void 0:e.source)??""}" 安装扩展...`,"extensions.install.unknownOption":e=>`未知选项 ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"用法: /extensions manage|install <source>","extensions.install.waitForSession":"等待会话连接后再安装扩展。","local.tools":"列出可用工具。用法: /tools [desc]","loadWarning.commands":"命令列表加载失败，斜杠命令可能不完整。","loadWarning.context":"会话上下文加载失败，当前模式可能不准确。","loadWarning.models":"模型列表加载失败，部分模型详情可能不可用。","mcp.action.auth":"认证","mcp.action.authHint":"daemon 尚未暴露","mcp.action.authMessage":"daemon serve 尚未暴露 MCP 认证能力。","mcp.action.clearAuth":"清空认证","mcp.action.disable":"禁用","mcp.action.done":e=>`${(e==null?void 0:e.action)??"操作"}完成。`,"mcp.action.enable":"启用","mcp.action.enableMessage":"daemon serve 尚未暴露 MCP 启用/禁用能力。","mcp.action.failed":e=>`失败：${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"操作"}中...`,"mcp.action.reauth":"重新认证","mcp.annotation.destructive":"破坏性","mcp.annotation.idempotent":"幂等","mcp.annotation.openWorld":"开放世界","mcp.annotation.readOnly":"只读","mcp.annotations":"注解","mcp.oauth.server":"服务器","mcp.oauth.starting":e=>`正在为 MCP server '${(e==null?void 0:e.name)??""}' 启动 OAuth 认证...`,"mcp.oauth.title":"OAuth 认证","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} 个客户端 · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"命令","mcp.description":"描述：","mcp.action.reconnect":"重新连接","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyTools":"没有发现工具。","mcp.expand":"展开 MCP server","mcp.collapse":"收起 MCP server","mcp.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noSchema":"没有输入 schema。","mcp.serverTool":"服务器工具","mcp.servers":e=>`${(e==null?void 0:e.count)??0} 个服务器`,"mcp.configuredServers":"已配置的 MCP 服务器：","mcp.fromExtension":e=>`（来自 ${(e==null?void 0:e.name)??""}）`,"mcp.extensionMcp":"扩展 MCP","mcp.invalidReason":e=>`无效：${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"原因：","mcp.invalidToolHelp":"工具必须同时包含 name 和 description 才能被 LLM 使用。","mcp.invalidToolWarning":"警告：这个工具不能被 LLM 调用","mcp.manageServers":"管理 MCP servers","mcp.parameters":"参数：","mcp.required":" 必填","mcp.resources":"资源","mcp.resourcesUnavailable":"无法加载资源详情。","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} 个资源`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} 个提示词`,"mcp.resource.uriLabel":"URI：","mcp.resource.nameLabel":"名称：","mcp.resource.mimeTypeLabel":"MIME 类型：","mcp.resource.sizeLabel":"大小：","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} 字节`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc 返回","mcp.shortcut.close":"Esc 关闭","mcp.shortcut.selectBack":"↑↓ 导航 · Enter 选择 · Esc 返回","mcp.shortcut.selectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","mcp.settings":"设置","mcp.extension":e=>`扩展：${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP 服务器正在启动（${(e==null?void 0:e.count)??0} 个初始化中）...`,"mcp.startingNote":"注意：首次启动可能需要更长时间。工具可用性会自动更新。","mcp.restartSkipped":e=>`已跳过 ${(e==null?void 0:e.name)??""}：${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`已重启 ${(e==null?void 0:e.name)??""}，耗时 ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`已重启 ${(e==null?void 0:e.name)??""} 的 ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} 个条目${e!=null&&e.failedReasons?`（失败：${e.failedReasons}）`:""}`,"mcp.source":"来源","mcp.source.extension":"扩展","mcp.source.project":"工作区设置","mcp.source.user":"用户设置","mcp.status":"状态","mcp.status.blocked":"已阻止","mcp.status.connected":"已连接","mcp.status.connecting":"连接中","mcp.status.disconnected":"未连接","mcp.status.disconnectedTitle":"已断开","mcp.status.disabled":"已禁用","mcp.status.ready":"就绪","mcp.status.starting":"启动中...（首次启动可能需要更长时间）","mcp.status.unknown":"未知","mcp.tipDesc":"显示 server 和工具描述","mcp.tipNodesc":"隐藏描述","mcp.tipSchema":"显示工具参数 schema","mcp.tips":"💡 提示：","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsLabel":"工具：","mcp.title":"MCP Servers","mcp.toolDetail":"工具详情","mcp.tools":"工具","mcp.toolsForServer":e=>`${(e==null?void 0:e.name)??"Server"} 的工具`,"mcp.transport":"传输","mcp.use":"使用","mcp.userMcp":"用户 MCP","mcp.workingDirectory":"工作目录","goal.aborted":"目标已中止","goal.achieved":"目标已达成","goal.check":"目标检查","goal.cleared":"目标已清除","goal.failed":"目标未能达成","goal.judge":"判断","goal.label":"目标","goal.lastCheck":"上次检查","goal.notYetMet":"尚未满足","goal.set":"目标已设置","goal.statusActive":"/goal 运行中","goal.turn":e=>`${(e==null?void 0:e.count)??0} 轮`,"goal.turnLabel":e=>`第 ${(e==null?void 0:e.count)??0} 轮`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} 轮`,"memory.add":"添加","memory.add.desc":"写入一条持久 memory","memory.autoDream":e=>`自动整理：${(e==null?void 0:e.status)??"未知"} · ${(e==null?void 0:e.lastDream)??"从未"} · /dream 立即运行`,"memory.autoDreamUnsupported":"web-shell 暂不支持修改自动整理设置。","memory.autoFolder":"打开自动记忆文件夹","memory.autoMemory":e=>`自动记忆：${(e==null?void 0:e.status)??"未知"}`,"memory.autoMemoryUnsupported":"web-shell 暂不支持修改自动记忆设置。","memory.autoSkill":e=>`自动技能：${(e==null?void 0:e.status)??"未知"}`,"memory.autoSkillUnsupported":"web-shell 暂不支持修改自动技能设置。","memory.chooseScope":"选择 memory 的保存位置","memory.closed":"Memory 面板已关闭。","memory.contentEmpty":"Memory 内容为空。","memory.file":"Memory 文件","memory.fileOpen":"Memory 文件已打开。","memory.fileTruncated":"Memory 文件已打开，内容已截断。","memory.files":"Memory 文件","memory.footer":"Enter 确认 · Esc 取消","memory.footer.back":"Esc 返回","memory.global":"用户级","memory.global.desc":"保存到全局用户 memory 文件","memory.globalReadUnsupported":"全局 memory 位于当前 workspace 之外，当前 daemon 文件读取接口不能打开它的内容。","memory.loading":"正在加载 memory...","memory.loadingFile":"正在加载 memory 文件...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"从未","memory.noFiles":"未找到 memory 文件。","memory.on":"开","memory.openFolderUnsupported":"web-shell 暂不支持打开自动记忆文件夹。","memory.placeholder":e=>`写入${(e==null?void 0:e.scope)??"memory"}内容...`,"memory.project":"项目级","memory.project.desc":"保存到当前 workspace memory 文件","memory.refresh":"刷新","memory.refresh.desc":"重新加载 memory 文件信息","memory.refreshed":"Memory 已刷新。","memory.save":"保存 Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} 已保存：${(e==null?void 0:e.bytes)??0} 字节 -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"保存中...","memory.show":"查看","memory.show.desc":"查看已配置的 memory 文件","memory.status":"Workspace 和用户 memory 文件","memory.unknown":"未知","memory.write":"写入 memory 内容","mode.auto":"智能审批","mode.auto.desc":"使用分类器评估工具调用，安全操作自动批准，风险操作阻止或请求确认","mode.auto.notice":"Auto 模式已启用。LLM 分类器会评估每个工具调用，自动批准安全操作，拦截危险操作。退出方式：Shift+Tab 或 /approval-mode default。","mode.footer":"(Enter 选择，Esc 取消)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"计划","mode.label.default":"请求批准","mode.label.auto-edit":"自动编辑","mode.label.auto":"智能审批","mode.label.yolo":"完全访问权限","mode.listLabel.plan":"计划（plan）","mode.listLabel.default":"请求批准（default）","mode.listLabel.auto-edit":"自动编辑（auto-edit）","mode.listLabel.auto":"智能审批（auto）","mode.listLabel.yolo":"完全访问权限（yolo）","mode.desc.plan":"仅分析，不修改文件或执行命令","mode.desc.default":"执行命令、编辑文件或访问外部资源前请求确认","mode.desc.auto-edit":"自动批准文件编辑，命令执行等敏感操作仍会询问","mode.desc.auto":"自动评估工具风险，安全操作直接执行，风险操作再确认","mode.desc.yolo":"自动批准所有工具调用，适合可信任务环境","mode.select":"审批模式","mode.autoApproved":e=>e!=null&&e.tool?`已自动批准：${e.tool}`:"切换模式后自动批准了待处理的工具调用。","mode.auto-edit":"自动编辑","mode.auto-edit.desc":"自动批准文件读写操作","mode.default":"默认模式","mode.default.desc":"每次工具调用都需要确认","mode.plan":"Plan 模式","mode.plan.desc":"仅分析和规划，不执行工具","mode.unknown":"未知模式","mode.yolo":"YOLO 模式","mode.yolo.desc":"自动批准所有操作","plan.title":"计划","model.contextWindow":"上下文窗口","model.contextWindow.unknown":"（未知）","model.current":e=>`当前：${(e==null?void 0:e.model)??"未知"}`,"model.modality":"模态","model.modality.text":"文本","model.modality.textOnly":"仅文本","model.modality.image":"图片","model.modality.pdf":"PDF","model.modality.audio":"音频","model.modality.video":"视频","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"（默认）","model.notSet":"（未设置）","model.footer":"Enter 选择，↑↓ 导航，Esc 关闭","model.searchHint":"按 / 搜索","model.fastHint":"用于建议和旁路任务","model.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的模型`,"model.none":"没有可用模型","model.select":"选择模型","model.setFast":"设置 Fast Model","model.setVoice":"设置语音模型","model.switch":"切换模型","model.unknown":"未知","resume.current":"当前","resume.activePrompt":"正在运行","resume.filter":"筛选","resume.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"resume.none":"没有可恢复的会话","resume.pressSearch":"按 / 搜索","resume.search":"搜索","resume.title":"恢复会话","parallelAgents.title":"并行智能体","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} 完成`,"skills.available":"可用 skills:","skills.none":"当前没有可用 skill。","skills.empty":"没有可用 skill。","skills.footer":e=>e!=null&&e.name?`使用 /skills ${e.name} 调用 · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 可调用`,"skills.loading":"正在加载 skills...","skills.run":"运行 skill","skills.status.disabled":"已禁用","skills.title":"Skills","stats.accepted":"已接受：","stats.agreementRate":"总体同意率：","stats.api":"API","stats.apiTime":"API 耗时","stats.avgDuration":"平均耗时","stats.avgLatency":"平均延迟","stats.cached":"缓存","stats.cacheDesc":"的输入 Token 来自缓存，降低了成本。","stats.calls":"调用次数","stats.codeChanges":"代码变更","stats.decisionSummary":"用户决策摘要","stats.duration":"时长","stats.errors":"错误数","stats.inputTokens":"输入 Token","stats.metric":"指标","stats.modelStats":"模型统计（技术细节）","stats.modelTip":"提示：运行 /stats model 查看完整 Token 明细。","stats.modelUsage":"模型使用","stats.modified":"已修改：","stats.noApiCalls":"本次会话暂无 API 调用。","stats.noToolCalls":"本次会话暂无工具调用。","stats.output":"输出","stats.outputTokens":"输出 Token","stats.overview":"会话概览","stats.performance":"性能","stats.prompt":"提示","stats.prompts":"对话轮次","stats.rejected":"已拒绝：","stats.reqs":"请求","stats.requests":"请求数","stats.savingsHighlight":"节省亮点：","stats.successRate":"成功率","stats.thoughts":"思考","stats.title":"会话统计","stats.tokens":"Token","stats.toolCalls":"工具调用","stats.toolName":"工具名称","stats.toolStats":"工具统计（技术细节）","stats.toolTime":"工具耗时","stats.total":"总计","stats.totalReviewed":"已审核建议总数：","status.contextUsed":e=>`上下文已用 ${(e==null?void 0:e.pct)??"0.0"}%`,"status.disconnected":"断开连接","status.modeHint":"(shift + tab 或点击切换)","status.shortcuts":"? 查看快捷键","stream.cancel":"esc 取消","stream.cancelArmed":"再按一次 Esc 停止","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`当前：${(e==null?void 0:e.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":e=>`✓ 已完成 ${(e==null?void 0:e.count)??0} 项`,"todo.detail.api":"API","todo.detail.cached":"缓存","todo.detail.end":"结束","todo.detail.hide":"收起任务明细","todo.detail.input":"输入","todo.detail.noResources":"未采集到该任务的 Token 与耗时明细。","todo.detail.output":"输出","todo.detail.sectionSpent":"耗时","todo.detail.sectionTime":"时间","todo.detail.sectionTokens":"Token","todo.detail.show":"查看任务明细","todo.detail.start":"开始","todo.detail.tool":"工具","todo.expand":"展开任务列表","todo.more":e=>`... 还有 ${(e==null?void 0:e.count)??0} 项`,"todo.moreAbove":e=>`... 前面还有 ${(e==null?void 0:e.count)??0} 项`,"todo.showLess":"收起","todo.stepProgress":e=>`第 ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0} 步`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"当前任务","chat.scrollToBottom":"回到底部","userMessage.showMore":"显示更多","userMessage.showLess":"收起","turn.processed":"已处理","turn.processing":"处理中","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":e=>`${(e==null?void 0:e.count)??0} 步`,"turn.toolCalls":e=>`工具 ${(e==null?void 0:e.count)??0} 次`,"turn.thinkingCount":e=>`思考 ${(e==null?void 0:e.count)??0} 次`,"turn.stopped":"你已取消请求","message.renderError":"此消息无法显示。","tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":e=>`^ 上方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.moreBelow":e=>`v 下方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.action.stop":"停止","tasks.action.abandon":"放弃","tasks.action.confirmStop":"确认停止","tasks.action.confirmAbandon":"确认放弃","tasks.action.confirmHint":"这会终结当前阻塞轮次。","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.confirmStop":"再按 x 确认停止 · 会终结当前阻塞轮次","tasks.shortcut.select":"↑/↓ 选择","tasks.shortcut.view":"Enter 查看","tasks.shortcut.stop":"x 停止","tasks.shortcut.abandon":"x 放弃","tasks.shortcut.listClose":"←/Esc 关闭","tasks.shortcut.detailBack":"← 返回","tasks.shortcut.detailClose":"Esc/Enter/Space 关闭","tasks.shortcut.close":"Esc 关闭","tasks.shortcut.cancelConfirm":"Esc 取消","tasks.detail.workingDir":"工作目录","tasks.detail.outputFile":"输出文件","tasks.detail.command":"命令","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} 个事件`,"tasks.detail.exit":e=>`退出码 ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.runtime":"时间","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"工具数量","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} 次工具调用`,"tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space 查看详情 · ":""}t 切换 ${e.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.loading":"正在加载工具...","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.status.failed":"执行失败","tool.showAll":e=>`▼ 显示全部（${(e==null?void 0:e.count)??0} 行）`,"tool.showLess":"▲ 显示更少","tool.showFullLines":"▼ 显示完整行","tool.linesTotal":e=>`▼ 共 ${(e==null?void 0:e.count)??0} 行`,"toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.running":e=>`正在执行 ${(e==null?void 0:e.name)??"工具"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · 共 ${(e==null?void 0:e.count)??0} 个工具`:""}`,"thinking.expand":"展开思考","thinking.collapse":"收起思考","thinking.running":e=>`正在思考${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.done":e=>e!=null&&e.duration?`已思考 ${e.duration}`:"思考完成","welcome.changeModel":"(/model 切换)","welcome.defaultModel":"未知模型","settings.title":"设置","settings.loading":"正在加载设置...","settings.empty":"暂无可用设置。","settings.footer":"↑↓ 导航  Enter 切换  Tab 切换作用域  r 刷新  ESC 关闭","settings.footer.edit":"Enter 保存  ESC 取消","settings.footer.theme":"↑↓ 导航  Enter 选择  ESC 返回","settings.scope.user":"用户","settings.scope.workspace":"工作区","settings.value.on":"开","settings.value.off":"关","settings.action.edit":"编辑","settings.action.save":"保存","settings.modifiedIn":e=>`（已在${(e==null?void 0:e.scope)??""}中修改）`,"settings.alsoModifiedIn":e=>`（同时在${(e==null?void 0:e.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.readOnly":"User 级别设置在 daemon 模式下为只读。","settings.requiresRestart":"此更改需要重启后才能生效。","settings.corrupted":e=>`设置文件已损坏${(e==null?void 0:e.recovered)==="true"?"（已从备份恢复）":""}`,"settings.label.ui.chatWidth":"屏宽","settings.description.ui.chatWidth":"纯前端的聊天内容宽度设置，保存在当前浏览器中。","settings.option.ui.chatWidth.1000":"常规","settings.option.ui.chatWidth.wide":"超宽","settings.category.General":"通用","settings.category.UI":"界面","settings.category.Privacy":"隐私","settings.category.Model":"模型","settings.category.Context":"上下文","settings.category.Tools":"工具","settings.category.Daemon":"守护进程","settings.category.Experimental":"实验性","settings.category.Advanced":"高级","settings.label.general.enableAutoUpdate":"启用自动更新","settings.description.general.enableAutoUpdate":"启动时自动检查并安装更新。","settings.label.general.showSessionRecap":"显示会话回顾","settings.description.general.showSessionRecap":"离开终端一段时间后返回时，自动显示一行“上次停在这里”的回顾。默认关闭。也可以随时使用 /recap 手动触发。","settings.label.general.sessionRecapAwayThresholdMinutes":"会话回顾离开阈值（分钟）","settings.description.general.sessionRecapAwayThresholdMinutes":"终端失焦多少分钟后，下一次重新聚焦时触发自动回顾。默认与 Claude Code 一致为 5 分钟；如果只是短暂切换窗口，可以调高。","settings.label.general.cleanupPeriodDays":"清理周期（天）","settings.description.general.cleanupPeriodDays":"~/.qwen/file-history/ 中用于 /rewind 的会话备份保留天数。后台清理最多每天运行一次。设为 0 表示最小保留（约 1 小时），仍会保护最近一小时触碰过的会话和当前活动会话。","settings.label.general.gitCoAuthor.commit":"归因：commit","settings.description.general.gitCoAuthor.commit":"通过 Qwen Code 创建 commit 时，添加 Co-authored-by trailer，并写入逐文件 AI 归因 git note。关闭后两者都会跳过。","settings.label.general.gitCoAuthor.pr":"归因：PR","settings.description.general.gitCoAuthor.pr":"运行 gh pr create 时，在 PR 描述中追加 Qwen Code 归因行。","settings.label.general.language":"语言：界面","settings.description.general.language":"用户界面的语言。使用 auto 可根据系统设置自动检测；也可以在 ~/.qwen/locales/ 中放置 JS 语言文件来使用自定义语言代码。","settings.label.general.dynamicCommandTranslation":"语言：动态命令翻译","settings.description.general.dynamicCommandTranslation":"为动态 slash command 描述启用 AI 翻译。关闭后动态命令使用原始描述，也不会触发翻译模型调用。","settings.label.general.preventSystemSleep":"运行时防止系统睡眠","settings.description.general.preventSystemSleep":"当 Qwen Code 正在流式生成模型回复或执行工具时防止系统睡眠。空闲输入状态和权限确认状态不会阻止睡眠。","settings.label.ui.theme":"主题","settings.description.ui.theme":"界面的颜色主题。","settings.label.ui.hideTips":"隐藏提示","settings.description.ui.hideTips":"隐藏界面中的帮助提示。","settings.label.ui.enableWelcomeBack":"显示欢迎回来对话框","settings.description.ui.enableWelcomeBack":"回到有历史会话的项目时显示欢迎回来对话框。选择“开始新的聊天会话”后，在项目摘要变化前不会再次显示。","settings.label.ui.enableUserFeedback":"启用用户反馈","settings.description.ui.enableUserFeedback":"对话结束后显示可选反馈对话框，帮助改进 Qwen 表现。","settings.label.ui.enableFollowupSuggestions":"启用后续建议","settings.description.ui.enableFollowupSuggestions":"任务完成后显示上下文相关的后续建议。按 Tab 或右方向键接受，按 Enter 接受并提交。","settings.label.ui.compactMode":"紧凑模式","settings.description.ui.compactMode":"隐藏工具输出和思考内容，显示更简洁的视图（可用 Ctrl+O 切换）。","settings.label.ui.compactInline":"紧凑内联","settings.description.ui.compactInline":"在每个分组内紧凑显示工具内容，而不是跨分组合并。需要先启用紧凑模式。","settings.label.ui.shellOutputMaxLines":"Shell 输出最大行数","settings.description.ui.shellOutputMaxLines":"内联显示的 shell 输出最大行数。设为 0 可取消限制并显示完整输出；隐藏行数仍会通过 +N lines 指示器展示。","settings.label.privacy.usageStatisticsEnabled":"启用使用统计","settings.description.privacy.usageStatisticsEnabled":"启用使用统计收集。","settings.label.fastModel":"快速模型","settings.description.fastModel":"用于生成提示建议和推测执行的模型。留空则使用主模型。较小/更快的模型（例如 qwen3-coder-flash）可以降低延迟和成本。","settings.label.context.fileFiltering.respectGitIgnore":"遵守 .gitignore","settings.description.context.fileFiltering.respectGitIgnore":"搜索时遵守 .gitignore 文件。","settings.label.context.fileFiltering.respectQwenIgnore":"遵守 .qwenignore","settings.description.context.fileFiltering.respectQwenIgnore":"搜索时遵守 .qwenignore 文件。","settings.label.context.fileFiltering.enableFuzzySearch":"启用模糊搜索","settings.description.context.fileFiltering.enableFuzzySearch":"搜索文件时启用模糊搜索。","settings.label.tools.toolSearch.enabled":"启用 ToolSearch","settings.description.tools.toolSearch.enabled":"启用后，MCP 工具会通过 ToolSearch 按需加载，以减少提示词大小。对于依赖前缀 KV 缓存的模型（如 DeepSeek），可关闭此项来保持提示词前缀稳定并提高缓存命中率。","settings.label.tools.shell.enableInteractiveShell":"交互式 Shell（PTY）","settings.description.tools.shell.enableInteractiveShell":"使用 node-pty 提供交互式 shell 体验。PTY 不可用时回退到 child_process。","settings.label.tools.computerUse.enabled":"启用 Computer Use","settings.description.tools.computerUse.enabled":"启用后（默认），会注册 9 个 computer_use__* 延迟内置工具。","settings.label.policy.permissionStrategy":"权限协调策略","settings.description.policy.permissionStrategy":"多个客户端连接时权限请求的决策方式。first-responder 表示任意客户端先响应者生效；designated 表示仅提示发起方决策；consensus 表示需要 N-of-M 投票同意；local-only 表示只有 loopback 客户端可决策。需要重启 daemon 后生效。","settings.option.policy.permissionStrategy.first-responder":"先响应者","settings.option.policy.permissionStrategy.designated":"指定发起方","settings.option.policy.permissionStrategy.consensus":"共识法定人数","settings.option.policy.permissionStrategy.local-only":"仅本机","settings.label.experimental.enableCronTools":"启用 Cron/Loop 工具","settings.description.experimental.enableCronTools":"启用会话内 cron/loop 工具（实验性）。启用后，模型可以用 cron_create、cron_list 和 cron_delete 创建周期性提示。也可通过 QWEN_CODE_ENABLE_CRON=1 环境变量启用。","settings.label.experimental.emitToolUseSummaries":"工具使用摘要","settings.description.experimental.emitToolUseSummaries":"每个工具批次完成后生成一个简短的 LLM 标签。紧凑模式下会替代通用的 Tool × N 标题；完整模式下显示为工具组下方的弱化 ● <label> 行。需要配置快速模型。","settings.label.agents.arena.preserveArtifacts":"保留 Arena 产物","settings.description.agents.arena.preserveArtifacts":"启用后，Arena worktree 和会话状态文件会在会话结束或主智能体退出后保留。","welcome.modeHint":"Shift+Tab 或 /approval-mode","welcome.prompt":"你想构建什么？","welcome.titlePrefix":"欢迎使用","welcome.tipLabel":"提示："},DH={en:__,"zh-CN":LH},OH={en:"English [en]","zh-CN":"中文 [zh-CN]"},HN=g.createContext({language:"en",t:e=>e});function Yl(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function k_(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Yl(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 S_(e){return OH[e]}function VN(e){const t=DH[e];return(n,r)=>{const s=t[n]??__[n]??n;return typeof s=="function"?s(r):s}}function BH({language:e,children:t}){const n=g.useMemo(()=>({language:e,t:VN(e)}),[e]);return h.jsx(HN.Provider,{value:n,children:t})}function at(){return g.useContext(HN)}const J8=[];function PH(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,r)=>!Object.is(n,t[r]))}class WN extends g.Component{constructor(){super(...arguments);le(this,"state",{error:null,resetKeys:this.props.resetKeys??J8});le(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){const s=n.resetKeys??J8;return PH(r.resetKeys,s)?{error:null,resetKeys:s}:null}componentDidCatch(n,r){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,r.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:r}=this.props;return typeof r=="function"?r(n,this.reset):r}}const zH="_row_19m4s_1",$H="_tip_19m4s_13",qH="_chatRow_19m4s_35",FH="_chatTip_19m4s_43",UH="_chatActions_19m4s_56",HH="_copyButton_19m4s_71",hl={row:zH,tip:$H,chatRow:qH,chatTip:FH,chatActions:UH,copyButton:HH};function cv({timestamp:e,children:t,chatMode:n=!1,copyText:r,copyTitle:s="Copy"}){const[i,o]=g.useState(!1),a=g.useCallback(()=>{var c;r&&((c=navigator.clipboard)==null||c.writeText(r).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[r]);if(e===void 0&&!r)return h.jsx(h.Fragment,{children:t});const l=r?h.jsx("button",{type:"button",className:hl.copyButton,title:s,"aria-label":s,onClick:a,children:i?h.jsx(WH,{}):h.jsx(VH,{})}):null;return e===void 0?h.jsxs("div",{className:n?hl.chatRow:hl.row,children:[t,l]}):h.jsxs("div",{className:n?hl.chatRow:hl.row,children:[t,n?h.jsxs("span",{className:hl.chatActions,children:[h.jsx("span",{className:hl.chatTip,"aria-hidden":"true",children:eh(e)}),l]}):h.jsx("span",{className:hl.tip,"aria-hidden":"true",children:eh(e)})]})}function VH(){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 WH(){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 eh(e,t=new Date){const n=new Date(e),r=o=>String(o).padStart(2,"0"),s=`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?s:`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())} ${s}`}const GH="modulepreload",KH=function(e){return"/"+e},Z8={},q=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=KH(l),l in Z8)return;Z8[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":GH,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},bs={Dark:"dark",Light:"light"},GN=[bs.Dark,bs.Light],KN=g.createContext(bs.Dark),YH=KN.Provider;function T_(){return g.useContext(KN)}const Wc="ui.theme",Kf="general.language";function C_(e,t){return e===bs.Light||e==="Qwen Light"?bs.Light:e===bs.Dark||e==="Qwen Dark"?bs.Dark:t}function XH(e){return e===bs.Light?"Qwen Light":"Qwen Dark"}function eS(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(s,r).trim();(o||!i)&&t.push(o),s=r+1,r=n.indexOf(",",s)}return t}function YN(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const QH=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JH=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZH={};function tS(e,t){return(ZH.jsx?JH:QH).test(e)}const eV=/[ \t\n\f\r]/g;function xy(e){return typeof e=="object"?e.type==="text"?nS(e.value):!1:nS(e)}function nS(e){return e.replace(eV,"")===""}class am{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}am.prototype.normal={};am.prototype.property={};am.prototype.space=void 0;function XN(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new am(n,r,t)}function k0(e){return e.toLowerCase()}class li{constructor(t,n){this.attribute=n,this.property=t}}li.prototype.attribute="";li.prototype.booleanish=!1;li.prototype.boolean=!1;li.prototype.commaOrSpaceSeparated=!1;li.prototype.commaSeparated=!1;li.prototype.defined=!1;li.prototype.mustUseProperty=!1;li.prototype.number=!1;li.prototype.overloadedBoolean=!1;li.prototype.property="";li.prototype.spaceSeparated=!1;li.prototype.space=void 0;let tV=0;const Pt=Lu(),xr=Lu(),uv=Lu(),ze=Lu(),Bn=Lu(),du=Lu(),fi=Lu();function Lu(){return 2**++tV}const dv=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pt,booleanish:xr,commaOrSpaceSeparated:fi,commaSeparated:du,number:ze,overloadedBoolean:uv,spaceSeparated:Bn},Symbol.toStringTag,{value:"Module"})),_2=Object.keys(dv);class A_ extends li{constructor(t,n,r,s){let i=-1;if(super(t,n),rS(this,"space",s),typeof r=="number")for(;++i<_2.length;){const o=_2[i];rS(this,_2[i],(r&dv[o])===dv[o])}}}A_.prototype.defined=!0;function rS(e,t,n){n&&(e[t]=n)}function Sh(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new A_(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[k0(r)]=r,n[k0(i.attribute)]=r}return new am(t,n,e.space)}const QN=Sh({properties:{ariaActiveDescendant:null,ariaAtomic:xr,ariaAutoComplete:null,ariaBusy:xr,ariaChecked:xr,ariaColCount:ze,ariaColIndex:ze,ariaColSpan:ze,ariaControls:Bn,ariaCurrent:null,ariaDescribedBy:Bn,ariaDetails:null,ariaDisabled:xr,ariaDropEffect:Bn,ariaErrorMessage:null,ariaExpanded:xr,ariaFlowTo:Bn,ariaGrabbed:xr,ariaHasPopup:null,ariaHidden:xr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Bn,ariaLevel:ze,ariaLive:null,ariaModal:xr,ariaMultiLine:xr,ariaMultiSelectable:xr,ariaOrientation:null,ariaOwns:Bn,ariaPlaceholder:null,ariaPosInSet:ze,ariaPressed:xr,ariaReadOnly:xr,ariaRelevant:null,ariaRequired:xr,ariaRoleDescription:Bn,ariaRowCount:ze,ariaRowIndex:ze,ariaRowSpan:ze,ariaSelected:xr,ariaSetSize:ze,ariaSort:null,ariaValueMax:ze,ariaValueMin:ze,ariaValueNow:ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function JN(e,t){return t in e?e[t]:t}function ZN(e,t){return JN(e,t.toLowerCase())}const nV=Sh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:du,acceptCharset:Bn,accessKey:Bn,action:null,allow:null,allowFullScreen:Pt,allowPaymentRequest:Pt,allowUserMedia:Pt,alpha:Pt,alt:null,as:null,async:Pt,autoCapitalize:null,autoComplete:Bn,autoFocus:Pt,autoPlay:Pt,blocking:Bn,capture:null,charSet:null,checked:Pt,cite:null,className:Bn,closedBy:null,colorSpace:null,cols:ze,colSpan:ze,command:null,commandFor:null,content:null,contentEditable:xr,controls:Pt,controlsList:Bn,coords:ze|du,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pt,defer:Pt,dir:null,dirName:null,disabled:Pt,download:uv,draggable:xr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pt,formTarget:null,headers:Bn,height:ze,hidden:uv,high:ze,href:null,hrefLang:null,htmlFor:Bn,httpEquiv:Bn,id:null,imageSizes:null,imageSrcSet:null,inert:Pt,inputMode:null,integrity:null,is:null,isMap:Pt,itemId:null,itemProp:Bn,itemRef:Bn,itemScope:Pt,itemType:Bn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pt,low:ze,manifest:null,max:null,maxLength:ze,media:null,method:null,min:null,minLength:ze,multiple:Pt,muted:Pt,name:null,nonce:null,noModule:Pt,noValidate:Pt,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:Pt,optimum:ze,pattern:null,ping:Bn,placeholder:null,playsInline:Pt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pt,referrerPolicy:null,rel:Bn,required:Pt,reversed:Pt,rows:ze,rowSpan:ze,sandbox:Bn,scope:null,scoped:Pt,seamless:Pt,selected:Pt,shadowRootClonable:Pt,shadowRootCustomElementRegistry:Pt,shadowRootDelegatesFocus:Pt,shadowRootMode:null,shadowRootSerializable:Pt,shape:null,size:ze,sizes:null,slot:null,span:ze,spellCheck:xr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ze,step:null,style:null,tabIndex:ze,target:null,title:null,translate:null,type:null,typeMustMatch:Pt,useMap:null,value:xr,width:ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Bn,axis:null,background:null,bgColor:null,border:ze,borderColor:null,bottomMargin:ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pt,declare:Pt,event:null,face:null,frame:null,frameBorder:null,hSpace:ze,leftMargin:ze,link:null,longDesc:null,lowSrc:null,marginHeight:ze,marginWidth:ze,noResize:Pt,noHref:Pt,noShade:Pt,noWrap:Pt,object:null,profile:null,prompt:null,rev:null,rightMargin:ze,rules:null,scheme:null,scrolling:xr,standby:null,summary:null,text:null,topMargin:ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ze,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Pt,disablePictureInPicture:Pt,disableRemotePlayback:Pt,exportParts:du,part:Bn,prefix:null,property:null,results:ze,security:null,unselectable:null},space:"html",transform:ZN}),rV=Sh({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:fi,accentHeight:ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ze,amplitude:ze,arabicForm:null,ascent:ze,attributeName:null,attributeType:null,azimuth:ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ze,by:null,calcMode:null,capHeight:ze,className:Bn,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:ze,diffuseConstant:ze,direction:null,display:null,dur:null,divisor:ze,dominantBaseline:null,download:Pt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ze,enableBackground:null,end:null,event:null,exponent:ze,externalResourcesRequired:null,fill:null,fillOpacity:ze,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:du,g2:du,glyphName:du,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ze,horizOriginX:ze,horizOriginY:ze,id:null,ideographic:ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ze,k:ze,k1:ze,k2:ze,k3:ze,k4:ze,kernelMatrix:fi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ze,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:ze,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:ze,overlineThickness:ze,paintOrder:null,panose1:null,path:null,pathLength:ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Bn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ze,pointsAtY:ze,pointsAtZ:ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fi,rev:fi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fi,requiredFeatures:fi,requiredFonts:fi,requiredFormats:fi,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:ze,specularExponent:ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ze,strikethroughThickness:ze,string:null,stroke:null,strokeDashArray:fi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ze,strokeOpacity:ze,strokeWidth:null,style:null,surfaceScale:ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fi,tabIndex:ze,tableValues:null,target:null,targetX:ze,targetY:ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ze,underlineThickness:ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ze,values:null,vAlphabetic:ze,vMathematical:ze,vectorEffect:null,vHanging:ze,vIdeographic:ze,version:null,vertAdvY:ze,vertOriginX:ze,vertOriginY:ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:JN}),eI=Sh({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()}}),tI=Sh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ZN}),nI=Sh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),sV={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"},iV=/[A-Z]/g,sS=/-[a-z]/g,oV=/^data[-\w.:]+$/i;function E_(e,t){const n=k0(t);let r=t,s=li;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&oV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(sS,lV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!sS.test(i)){let o=i.replace(iV,aV);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=A_}return new s(r,t)}function aV(e){return"-"+e.toLowerCase()}function lV(e){return e.charAt(1).toUpperCase()}const M_=XN([QN,nV,eI,tI,nI],"html"),Th=XN([QN,rV,eI,tI,nI],"svg");function iS(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function rI(e){return e.join(" ").trim()}var N_={},oS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cV=/\n/g,uV=/^\s*/,dV=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,hV=/^:\s*/,fV=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,mV=/^[;\s]*/,pV=/^\s+|\s+$/g,gV=`
`,aS="/",lS="*",Gc="",yV="comment",bV="declaration";function wV(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(cV);y&&(n+=y.length);var x=p.lastIndexOf(gV);r=~x?p.length-x:r+p.length}function i(){var p={line:n,column:r};return function(y){return y.position=new o(p),c(),y}}function o(p){this.start=p,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(p){var y=new Error(t.source+":"+n+":"+r+": "+p);if(y.reason=p,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(p){var y=p.exec(e);if(y){var x=y[0];return s(x),e=e.slice(x.length),y}}function c(){l(uV)}function u(p){var y;for(p=p||[];y=d();)y!==!1&&p.push(y);return p}function d(){var p=i();if(!(aS!=e.charAt(0)||lS!=e.charAt(1))){for(var y=2;Gc!=e.charAt(y)&&(lS!=e.charAt(y)||aS!=e.charAt(y+1));)++y;if(y+=2,Gc===e.charAt(y-1))return a("End of comment missing");var x=e.slice(2,y-2);return r+=2,s(x),e=e.slice(y),r+=2,p({type:yV,comment:x})}}function f(){var p=i(),y=l(dV);if(y){if(d(),!l(hV))return a("property missing ':'");var x=l(fV),b=p({type:bV,property:cS(y[0].replace(oS,Gc)),value:x?cS(x[0].replace(oS,Gc)):Gc});return l(mV),b}}function m(){var p=[];u(p);for(var y;y=f();)y!==!1&&(p.push(y),u(p));return p}return c(),m()}function cS(e){return e?e.replace(pV,Gc):Gc}var vV=wV,xV=kg&&kg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(N_,"__esModule",{value:!0});N_.default=kV;const _V=xV(vV);function kV(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,_V.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;s?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var _y={};Object.defineProperty(_y,"__esModule",{value:!0});_y.camelCase=void 0;var SV=/^--[a-zA-Z0-9_-]+$/,TV=/-([a-z])/g,CV=/^[^-]+$/,AV=/^-(webkit|moz|ms|o|khtml)-/,EV=/^-(ms)-/,MV=function(e){return!e||CV.test(e)||SV.test(e)},NV=function(e,t){return t.toUpperCase()},uS=function(e,t){return"".concat(t,"-")},IV=function(e,t){return t===void 0&&(t={}),MV(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(EV,uS):e=e.replace(AV,uS),e.replace(TV,NV))};_y.camelCase=IV;var RV=kg&&kg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},jV=RV(N_),LV=_y;function hv(e,t){var n={};return!e||typeof e!="string"||(0,jV.default)(e,function(r,s){r&&s&&(n[(0,LV.camelCase)(r,t)]=s)}),n}hv.default=hv;var DV=hv;const OV=G1(DV),sI=iI("end"),I_=iI("start");function iI(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 BV(e){const t=I_(e),n=sI(e);if(t&&n)return{start:t,end:n}}function Yf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dS(e.position):"start"in e||"end"in e?dS(e):"line"in e||"column"in e?fv(e):""}function fv(e){return hS(e&&e.line)+":"+hS(e&&e.column)}function dS(e){return fv(e&&e.start)+"-"+fv(e&&e.end)}function hS(e){return e&&typeof e=="number"?e:1}class ks extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=Yf(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ks.prototype.file="";ks.prototype.name="";ks.prototype.reason="";ks.prototype.message="";ks.prototype.stack="";ks.prototype.column=void 0;ks.prototype.line=void 0;ks.prototype.ancestors=void 0;ks.prototype.cause=void 0;ks.prototype.fatal=void 0;ks.prototype.place=void 0;ks.prototype.ruleId=void 0;ks.prototype.source=void 0;const R_={}.hasOwnProperty,PV=new Map,zV=/[A-Z]/g,$V=new Set(["table","tbody","thead","tfoot","tr"]),qV=new Set(["td","th"]),oI="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function FV(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=XV(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=YV(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"?Th:M_,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=aI(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function aI(e,t,n){if(t.type==="element")return UV(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return HV(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return WV(e,t,n);if(t.type==="mdxjsEsm")return VV(e,t);if(t.type==="root")return GV(e,t,n);if(t.type==="text")return KV(e,t)}function UV(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Th,e.schema=s),e.ancestors.push(t);const i=cI(e,t.tagName,!1),o=QV(e,t);let a=L_(e,t);return $V.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!xy(l):!0})),lI(e,o,i,t),j_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function HV(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)}S0(e,t.position)}function VV(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);S0(e,t.position)}function WV(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Th,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:cI(e,t.name,!0),o=JV(e,t),a=L_(e,t);return lI(e,o,i,t),j_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function GV(e,t,n){const r={};return j_(r,L_(e,t)),e.create(t,e.Fragment,r,n)}function KV(e,t){return t.value}function lI(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function j_(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function YV(e,t,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function XV(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=I_(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function QV(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&R_.call(t.properties,s)){const i=ZV(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&qV.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function JV(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else S0(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else S0(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function L_(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:PV;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=s.get(l)||0;o=l+"-"+c,s.set(l,c+1)}}const a=aI(e,i,o);a!==void 0&&n.push(a)}return n}function ZV(e,t,n){const r=E_(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?YN(n):rI(n)),r.property==="style"){let s=typeof n=="object"?n:eW(e,String(n));return e.stylePropertyNameCase==="css"&&(s=tW(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?sV[r.property]||r.property:r.attribute,n]}}function eW(e,t){try{return OV(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new ks("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=oI+"#cannot-parse-style-attribute",s}}function cI(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=tS(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=tS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return R_.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);S0(e)}function S0(e,t){const n=new ks("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=oI+"#cannot-handle-mdx-estrees-without-createevaluater",n}function tW(e){const t={};let n;for(n in e)R_.call(e,n)&&(t[nW(n)]=e[n]);return t}function nW(e){let t=e.replace(zV,rW);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rW(e){return"-"+e.toLowerCase()}const k2={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"]},sW={};function D_(e,t){const n=sW,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return uI(e,r,s)}function uI(e,t,n){if(iW(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 fS(e.children,t,n)}return Array.isArray(e)?fS(e,t,n):""}function fS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=uI(e[s],t,n);return r.join("")}function iW(e){return!!(e&&typeof e=="object")}const mS=document.createElement("i");function O_(e){const t="&"+e+";";mS.innerHTML=t;const n=mS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ci(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function qi(e,t){return e.length>0?(Ci(e,e.length,0,t),e):t}const pS={}.hasOwnProperty;function dI(e){const t={};let n=-1;for(;++n<e.length;)oW(t,e[n]);return t}function oW(e,t){let n;for(n in t){const s=(pS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){pS.call(s,o)||(s[o]=[]);const a=i[o];aW(s[o],Array.isArray(a)?a:a?[a]:[])}}}function aW(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ci(e,0,0,r)}function hI(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 go(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ds=wc(/[A-Za-z]/),ws=wc(/[\dA-Za-z]/),lW=wc(/[#-'*+\--9=?A-Z^-~]/);function s1(e){return e!==null&&(e<32||e===127)}const mv=wc(/\d/),cW=wc(/[\dA-Fa-f]/),uW=wc(/[!-/:-@[-`{-~]/);function kt(e){return e!==null&&e<-2}function $n(e){return e!==null&&(e<0||e===32)}function en(e){return e===-2||e===-1||e===32}const ky=wc(new RegExp("\\p{P}|\\p{S}","u")),xu=wc(/\s/);function wc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ch(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&ws(e.charCodeAt(n+1))&&ws(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Yt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return en(l)?(e.enter(n),a(l)):t(l)}function a(l){return en(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const dW={tokenize:hW};function hW(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function s(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return kt(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const fW={tokenize:mW},gS={tokenize:pW};function mW(e){const t=this,n=[];let r=0,s,i,o;return a;function a(v){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&w();const _=t.events.length;let S=_,C;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){C=t.events[S][1].end;break}b(r);let E=_;for(;E<t.events.length;)t.events[E][1].end={...C},E++;return Ci(t.events,S+1,0,t.events.slice(_)),t.events.length=E,c(v)}return a(v)}function c(v){if(r===n.length){if(!s)return f(v);if(s.currentConstruct&&s.currentConstruct.concrete)return p(v);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(gS,u,d)(v)}function u(v){return s&&w(),b(r),f(v)}function d(v){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,p(v)}function f(v){return t.containerState={},e.attempt(gS,m,p)(v)}function m(v){return r++,n.push([t.currentConstruct,t.containerState]),f(v)}function p(v){if(v===null){s&&w(),b(0),e.consume(v);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(v)}function y(v){if(v===null){x(e.exit("chunkFlow"),!0),b(0),e.consume(v);return}return kt(v)?(e.consume(v),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),y)}function x(v,_){const S=t.sliceStream(v);if(_&&S.push(null),v.previous=i,i&&(i.next=v),i=v,s.defineSkip(v.start),s.write(S),t.parser.lazy[v.start.line]){let C=s.events.length;for(;C--;)if(s.events[C][1].start.offset<o&&(!s.events[C][1].end||s.events[C][1].end.offset>o))return;const E=t.events.length;let R=E,j,N;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(j){N=t.events[R][1].end;break}j=!0}for(b(r),C=E;C<t.events.length;)t.events[C][1].end={...N},C++;Ci(t.events,R+1,0,t.events.slice(E)),t.events.length=C}}function b(v){let _=n.length;for(;_-- >v;){const S=n[_];t.containerState=S[1],S[0].exit.call(t,e)}n.length=v}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function pW(e,t,n){return Yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function th(e){if(e===null||$n(e)||xu(e))return 1;if(ky(e))return 2}function Sy(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 pv={name:"attention",resolveAll:gW,tokenize:yW};function gW(e,t){let n=-1,r,s,i,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};yS(d,-l),yS(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=qi(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=qi(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=qi(c,Sy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=qi(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=qi(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Ci(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 yW(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=th(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),u=th(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 yS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const bW={name:"autolink",tokenize:wW};function wW(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 Ds(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||ws(m)?(r=1,a(m)):c(m)}function a(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||ws(m))&&r++<32?(e.consume(m),a):(r=0,c(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||s1(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),u):lW(m)?(e.consume(m),c):n(m)}function u(m){return ws(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||ws(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const lm={partial:!0,tokenize:vW};function vW(e,t,n){return r;function r(i){return en(i)?Yt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||kt(i)?t(i):n(i)}}const fI={continuation:{tokenize:_W},exit:kW,name:"blockQuote",tokenize:xW};function xW(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return en(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function _W(e,t,n){const r=this;return s;function s(o){return en(o)?Yt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(fI,t,n)(o)}}function kW(e){e.exit("blockQuote")}const mI={name:"characterEscape",tokenize:SW};function SW(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 uW(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const pI={name:"characterReference",tokenize:TW};function TW(e,t,n){const r=this;let s=0,i,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=ws,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=cW,u):(e.enter("characterReferenceValue"),i=7,o=mv,u(d))}function u(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return o===ws&&!O_(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),u):n(d)}}const bS={partial:!0,tokenize:AW},wS={concrete:!0,name:"codeFenced",tokenize:CW};function CW(e,t,n){const r=this,s={partial:!0,tokenize:S};let i=0,o=0,a;return l;function l(C){return c(C)}function c(C){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===a?(o++,e.consume(C),u):o<3?n(C):(e.exit("codeFencedFenceSequence"),en(C)?Yt(e,d,"whitespace")(C):d(C))}function d(C){return C===null||kt(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(bS,y,_)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||kt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(C)):en(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,m,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),f)}function m(C){return C===null||kt(C)?d(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||kt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(C)):C===96&&C===a?n(C):(e.consume(C),p)}function y(C){return e.attempt(s,_,x)(C)}function x(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),b}function b(C){return i>0&&en(C)?Yt(e,w,"linePrefix",i+1)(C):w(C)}function w(C){return C===null||kt(C)?e.check(bS,y,_)(C):(e.enter("codeFlowValue"),v(C))}function v(C){return C===null||kt(C)?(e.exit("codeFlowValue"),w(C)):(e.consume(C),v)}function _(C){return e.exit("codeFenced"),t(C)}function S(C,E,R){let j=0;return N;function N(J){return C.enter("lineEnding"),C.consume(J),C.exit("lineEnding"),B}function B(J){return C.enter("codeFencedFence"),en(J)?Yt(C,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):M(J)}function M(J){return J===a?(C.enter("codeFencedFenceSequence"),$(J)):R(J)}function $(J){return J===a?(j++,C.consume(J),$):j>=o?(C.exit("codeFencedFenceSequence"),en(J)?Yt(C,H,"whitespace")(J):H(J)):R(J)}function H(J){return J===null||kt(J)?(C.exit("codeFencedFence"),E(J)):R(J)}}}function AW(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const S2={name:"codeIndented",tokenize:MW},EW={partial:!0,tokenize:NW};function MW(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),Yt(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):kt(c)?e.attempt(EW,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||kt(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function NW(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):kt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Yt(e,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):kt(o)?s(o):n(o)}}const IW={name:"codeText",previous:jW,resolve:RW,tokenize:LW};function RW(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 jW(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function LW(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),s=0,u(d)):kt(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||kt(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 DW{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&&tf(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),tf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),tf(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);tf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);tf(this.left,n.reverse())}}}function tf(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 gI(e){const t={};let n=-1,r,s,i,o,a,l,c;const u=new DW(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,OW(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return Ci(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function OW(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,m=n,p=0,y=0;const x=[y];for(;m;){for(;e.get(++s)[1]!==m;);i.push(s),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),d&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(y=f+1,x.push(y),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):x.pop(),f=x.length;f--;){const b=a.slice(x[f],x[f+1]),w=i.pop();l.push([w,w+b.length-1]),e.splice(w,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const BW={resolve:zW,tokenize:$W},PW={partial:!0,tokenize:qW};function zW(e){return gI(e),e}function $W(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):kt(a)?e.check(PW,o,i)(a):(e.consume(a),s)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function qW(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Yt(e,i,"linePrefix")}function i(o){if(o===null||kt(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function yI(e,t,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||s1(b)?n(b):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(b))}function f(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(e.exit("chunkString"),e.exit(a),f(b)):b===null||b===60||kt(b)?n(b):(e.consume(b),b===92?p:m)}function p(b){return b===60||b===62||b===92?(e.consume(b),m):m(b)}function y(b){return!u&&(b===null||b===41||$n(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,y):b===41?(e.consume(b),u--,y):b===null||b===32||b===40||s1(b)?n(b):(e.consume(b),b===92?x:y)}function x(b){return b===40||b===41||b===92?(e.consume(b),y):y(b)}}function bI(e,t,n,r,s,i){const o=this;let a=0,l;return c;function c(m){return e.enter(r),e.enter(s),e.consume(m),e.exit(s),e.enter(i),u}function u(m){return a>999||m===null||m===91||m===93&&!l||m===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(i),e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):kt(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||kt(m)||a++>999?(e.exit("chunkString"),u(m)):(e.consume(m),l||(l=!en(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}}function wI(e,t,n,r,s,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):kt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Yt(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||kt(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Xf(e,t){let n;return r;function r(s){return kt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):en(s)?Yt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const FW={name:"definition",tokenize:HW},UW={partial:!0,tokenize:VW};function HW(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return bI.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return s=go(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 $n(m)?Xf(e,c)(m):c(m)}function c(m){return yI(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return e.attempt(UW,d,d)(m)}function d(m){return en(m)?Yt(e,f,"whitespace")(m):f(m)}function f(m){return m===null||kt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function VW(e,t,n){return r;function r(a){return $n(a)?Xf(e,s)(a):n(a)}function s(a){return wI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return en(a)?Yt(e,o,"whitespace")(a):o(a)}function o(a){return a===null||kt(a)?t(a):n(a)}}const WW={name:"hardBreakEscape",tokenize:GW};function GW(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return kt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const KW={name:"headingAtx",resolve:YW,tokenize:XW};function YW(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"},Ci(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function XW(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||$n(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||kt(u)?(e.exit("atxHeading"),t(u)):en(u)?Yt(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||$n(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const QW=["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"],vS=["pre","script","style","textarea"],JW={concrete:!0,name:"htmlFlow",resolveTo:tG,tokenize:nG},ZW={partial:!0,tokenize:sG},eG={partial:!0,tokenize:rG};function tG(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 nG(e,t,n){const r=this;let s,i,o,a,l;return c;function c(A){return u(A)}function u(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),d}function d(A){return A===33?(e.consume(A),f):A===47?(e.consume(A),i=!0,y):A===63?(e.consume(A),s=3,r.interrupt?t:L):Ds(A)?(e.consume(A),o=String.fromCharCode(A),x):n(A)}function f(A){return A===45?(e.consume(A),s=2,m):A===91?(e.consume(A),s=5,a=0,p):Ds(A)?(e.consume(A),s=4,r.interrupt?t:L):n(A)}function m(A){return A===45?(e.consume(A),r.interrupt?t:L):n(A)}function p(A){const ne="CDATA[";return A===ne.charCodeAt(a++)?(e.consume(A),a===ne.length?r.interrupt?t:M:p):n(A)}function y(A){return Ds(A)?(e.consume(A),o=String.fromCharCode(A),x):n(A)}function x(A){if(A===null||A===47||A===62||$n(A)){const ne=A===47,be=o.toLowerCase();return!ne&&!i&&vS.includes(be)?(s=1,r.interrupt?t(A):M(A)):QW.includes(o.toLowerCase())?(s=6,ne?(e.consume(A),b):r.interrupt?t(A):M(A)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):i?w(A):v(A))}return A===45||ws(A)?(e.consume(A),o+=String.fromCharCode(A),x):n(A)}function b(A){return A===62?(e.consume(A),r.interrupt?t:M):n(A)}function w(A){return en(A)?(e.consume(A),w):N(A)}function v(A){return A===47?(e.consume(A),N):A===58||A===95||Ds(A)?(e.consume(A),_):en(A)?(e.consume(A),v):N(A)}function _(A){return A===45||A===46||A===58||A===95||ws(A)?(e.consume(A),_):S(A)}function S(A){return A===61?(e.consume(A),C):en(A)?(e.consume(A),S):v(A)}function C(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),l=A,E):en(A)?(e.consume(A),C):R(A)}function E(A){return A===l?(e.consume(A),l=null,j):A===null||kt(A)?n(A):(e.consume(A),E)}function R(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||$n(A)?S(A):(e.consume(A),R)}function j(A){return A===47||A===62||en(A)?v(A):n(A)}function N(A){return A===62?(e.consume(A),B):n(A)}function B(A){return A===null||kt(A)?M(A):en(A)?(e.consume(A),B):n(A)}function M(A){return A===45&&s===2?(e.consume(A),O):A===60&&s===1?(e.consume(A),Y):A===62&&s===4?(e.consume(A),F):A===63&&s===3?(e.consume(A),L):A===93&&s===5?(e.consume(A),ee):kt(A)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(ZW,P,$)(A)):A===null||kt(A)?(e.exit("htmlFlowData"),$(A)):(e.consume(A),M)}function $(A){return e.check(eG,H,P)(A)}function H(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),J}function J(A){return A===null||kt(A)?$(A):(e.enter("htmlFlowData"),M(A))}function O(A){return A===45?(e.consume(A),L):M(A)}function Y(A){return A===47?(e.consume(A),o="",G):M(A)}function G(A){if(A===62){const ne=o.toLowerCase();return vS.includes(ne)?(e.consume(A),F):M(A)}return Ds(A)&&o.length<8?(e.consume(A),o+=String.fromCharCode(A),G):M(A)}function ee(A){return A===93?(e.consume(A),L):M(A)}function L(A){return A===62?(e.consume(A),F):A===45&&s===2?(e.consume(A),L):M(A)}function F(A){return A===null||kt(A)?(e.exit("htmlFlowData"),P(A)):(e.consume(A),F)}function P(A){return e.exit("htmlFlow"),t(A)}}function rG(e,t,n){const r=this;return s;function s(o){return kt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function sG(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(lm,t,n)}}const iG={name:"htmlText",tokenize:oG};function oG(e,t,n){const r=this;let s,i,o;return a;function a(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),l}function l(L){return L===33?(e.consume(L),c):L===47?(e.consume(L),S):L===63?(e.consume(L),v):Ds(L)?(e.consume(L),R):n(L)}function c(L){return L===45?(e.consume(L),u):L===91?(e.consume(L),i=0,p):Ds(L)?(e.consume(L),w):n(L)}function u(L){return L===45?(e.consume(L),m):n(L)}function d(L){return L===null?n(L):L===45?(e.consume(L),f):kt(L)?(o=d,Y(L)):(e.consume(L),d)}function f(L){return L===45?(e.consume(L),m):d(L)}function m(L){return L===62?O(L):L===45?f(L):d(L)}function p(L){const F="CDATA[";return L===F.charCodeAt(i++)?(e.consume(L),i===F.length?y:p):n(L)}function y(L){return L===null?n(L):L===93?(e.consume(L),x):kt(L)?(o=y,Y(L)):(e.consume(L),y)}function x(L){return L===93?(e.consume(L),b):y(L)}function b(L){return L===62?O(L):L===93?(e.consume(L),b):y(L)}function w(L){return L===null||L===62?O(L):kt(L)?(o=w,Y(L)):(e.consume(L),w)}function v(L){return L===null?n(L):L===63?(e.consume(L),_):kt(L)?(o=v,Y(L)):(e.consume(L),v)}function _(L){return L===62?O(L):v(L)}function S(L){return Ds(L)?(e.consume(L),C):n(L)}function C(L){return L===45||ws(L)?(e.consume(L),C):E(L)}function E(L){return kt(L)?(o=E,Y(L)):en(L)?(e.consume(L),E):O(L)}function R(L){return L===45||ws(L)?(e.consume(L),R):L===47||L===62||$n(L)?j(L):n(L)}function j(L){return L===47?(e.consume(L),O):L===58||L===95||Ds(L)?(e.consume(L),N):kt(L)?(o=j,Y(L)):en(L)?(e.consume(L),j):O(L)}function N(L){return L===45||L===46||L===58||L===95||ws(L)?(e.consume(L),N):B(L)}function B(L){return L===61?(e.consume(L),M):kt(L)?(o=B,Y(L)):en(L)?(e.consume(L),B):j(L)}function M(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),s=L,$):kt(L)?(o=M,Y(L)):en(L)?(e.consume(L),M):(e.consume(L),H)}function $(L){return L===s?(e.consume(L),s=void 0,J):L===null?n(L):kt(L)?(o=$,Y(L)):(e.consume(L),$)}function H(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||$n(L)?j(L):(e.consume(L),H)}function J(L){return L===47||L===62||$n(L)?j(L):n(L)}function O(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function Y(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),G}function G(L){return en(L)?Yt(e,ee,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):ee(L)}function ee(L){return e.enter("htmlTextData"),o(L)}}const B_={name:"labelEnd",resolveAll:uG,resolveTo:dG,tokenize:hG},aG={tokenize:fG},lG={tokenize:mG},cG={tokenize:pG};function uG(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&&Ci(e,0,e.length,n),e}function dG(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=qi(a,e.slice(i+1,i+r+3)),a=qi(a,[["enter",u,t]]),a=qi(a,Sy(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=qi(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=qi(a,e.slice(o+1)),a=qi(a,[["exit",l,t]]),Ci(e,i,e.length,a),e}function hG(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(go(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(aG,u,o?u:d)(f):f===91?e.attempt(lG,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(cG,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function fG(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 $n(d)?Xf(e,i)(d):i(d)}function i(d){return d===41?u(d):yI(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return $n(d)?Xf(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?wI(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return $n(d)?Xf(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 mG(e,t,n){const r=this;return s;function s(a){return bI.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(go(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function pG(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 gG={name:"labelStartImage",resolveAll:B_.resolveAll,tokenize:yG};function yG(e,t,n){const r=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const bG={name:"labelStartLink",resolveAll:B_.resolveAll,tokenize:wG};function wG(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const T2={name:"lineEnding",tokenize:vG};function vG(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const ig={name:"thematicBreak",tokenize:xG};function xG(e,t,n){let r=0,s;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||kt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===s?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),en(c)?Yt(e,a,"whitespace")(c):a(c))}}const Ws={continuation:{tokenize:TG},exit:AG,name:"list",tokenize:SG},_G={partial:!0,tokenize:EG},kG={partial:!0,tokenize:CG};function SG(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:mv(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(ig,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 mv(m)&&++o<10?(e.consume(m),l):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(lm,r.interrupt?n:u,e.attempt(_G,f,d))}function u(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return en(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 TG(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(lm,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Yt(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!en(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(kG,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Yt(e,e.attempt(Ws,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function CG(e,t,n){const r=this;return Yt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function AG(e){e.exit(this.containerState.type)}function EG(e,t,n){const r=this;return Yt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!en(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const xS={name:"setextUnderline",resolveTo:MG,tokenize:NG};function MG(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function NG(e,t,n){const r=this;let s;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),en(c)?Yt(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||kt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const IG={tokenize:RG};function RG(e){const t=this,n=e.attempt(lm,r,e.attempt(this.parser.constructs.flowInitial,s,Yt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(BW,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 jG={resolveAll:xI()},LG=vI("string"),DG=vI("text");function vI(e){return{resolveAll:xI(e==="text"?OG:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=s[u];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function xI(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 OG(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const c=s[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const BG={42:Ws,43:Ws,45:Ws,48:Ws,49:Ws,50:Ws,51:Ws,52:Ws,53:Ws,54:Ws,55:Ws,56:Ws,57:Ws,62:fI},PG={91:FW},zG={[-2]:S2,[-1]:S2,32:S2},$G={35:KW,42:ig,45:[xS,ig],60:JW,61:xS,95:ig,96:wS,126:wS},qG={38:pI,92:mI},FG={[-5]:T2,[-4]:T2,[-3]:T2,33:gG,38:pI,42:pv,60:[bW,iG],91:bG,92:[WW,mI],93:B_,95:pv,96:IW},UG={null:[pv,jG]},HG={null:[42,95]},VG={null:[]},WG=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HG,contentInitial:PG,disable:VG,document:BG,flow:$G,flowInitial:zG,insideSpan:UG,string:qG,text:FG},Symbol.toStringTag,{value:"Module"}));function GG(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],a=[];const l={attempt:E(S),check:E(C),consume:w,enter:v,exit:_,interrupt:E(C,{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(B){return o=qi(o,B),x(),o[o.length-1]!==null?[]:(R(t,0),c.events=Sy(i,c.events,c),c.events)}function f(B,M){return YG(m(B),M)}function m(B){return KG(o,B)}function p(){const{_bufferIndex:B,_index:M,line:$,column:H,offset:J}=r;return{_bufferIndex:B,_index:M,line:$,column:H,offset:J}}function y(B){s[B.line]=B.column,N()}function x(){let B;for(;r._index<o.length;){const M=o[r._index];if(typeof M=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<M.length;)b(M.charCodeAt(r._bufferIndex));else b(M)}}function b(B){u=u(B)}function w(B){kt(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,N()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=B}function v(B,M){const $=M||{};return $.type=B,$.start=p(),c.events.push(["enter",$,c]),a.push($),$}function _(B){const M=a.pop();return M.end=p(),c.events.push(["exit",M,c]),M}function S(B,M){R(B,M.from)}function C(B,M){M.restore()}function E(B,M){return $;function $(H,J,O){let Y,G,ee,L;return Array.isArray(H)?P(H):"tokenize"in H?P([H]):F(H);function F(he){return ye;function ye(me){const se=me!==null&&he[me],re=me!==null&&he.null,oe=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(re)?re:re?[re]:[]];return P(oe)(me)}}function P(he){return Y=he,G=0,he.length===0?O:A(he[G])}function A(he){return ye;function ye(me){return L=j(),ee=he,he.partial||(c.currentConstruct=he),he.name&&c.parser.constructs.disable.null.includes(he.name)?be():he.tokenize.call(M?Object.assign(Object.create(c),M):c,l,ne,be)(me)}}function ne(he){return B(ee,L),J}function be(he){return L.restore(),++G<Y.length?A(Y[G]):O}}}function R(B,M){B.resolveAll&&!i.includes(B)&&i.push(B),B.resolve&&Ci(c.events,M,c.events.length-M,B.resolve(c.events.slice(M),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function j(){const B=p(),M=c.previous,$=c.currentConstruct,H=c.events.length,J=Array.from(a);return{from:H,restore:O};function O(){r=B,c.previous=M,c.currentConstruct=$,c.events.length=H,a=J,N()}}function N(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function KG(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function YG(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function XG(e){const r={constructs:dI([WG,...(e||{}).extensions||[]]),content:s(dW),defined:[],document:s(fW),flow:s(IG),lazy:{},string:s(LG),text:s(DG)};return r;function s(i){return o;function o(a){return GG(r,i,a)}}}function QG(e){for(;!gI(e););return e}const _S=/[\0\t\n\r]/g;function JG(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let c,u,d,f,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(_S.lastIndex=d,c=_S.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){t=i.slice(d);break}if(m===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),e+=f-d),m){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const ZG=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eK(e){return e.replace(ZG,tK)}function tK(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return hI(n.slice(i?2:1),i?16:10)}return O_(n)||e}const _I={}.hasOwnProperty;function nK(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),rK(n)(QG(XG(n).document().write(JG()(e,t,!0))))}function rK(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ct),autolinkProtocol:j,autolinkEmail:j,atxHeading:i(ce),blockQuote:i(re),characterEscape:j,characterReference:j,codeFenced:i(oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(oe,o),codeText:i(ke,o),codeTextData:j,data:j,codeFlowValue:j,definition:i(He),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ve),hardBreakEscape:i(xe),hardBreakTrailing:i(xe),htmlFlow:i(Me,o),htmlFlowData:j,htmlText:i(Me,o),htmlTextData:j,image:i(Re),label:o,link:i(ct),listItem:i(vt),listItemValue:f,listOrdered:i(Ct,d),listUnordered:i(Ct),paragraph:i(Rt),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ce),strong:i(Ke),thematicBreak:i(yt)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:se,autolinkProtocol:me,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:he,characterReference:ye,codeFenced:l(x),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:N,codeIndented:l(b),codeText:l(J),codeTextData:N,data:N,definition:l(),definitionDestinationString:_,definitionLabelString:w,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l($),htmlFlowData:N,htmlText:l(H),htmlTextData:N,image:l(Y),label:ee,labelText:G,lineEnding:B,link:l(O),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:L,resourceTitleString:F,resource:P,setextHeading:l(R),setextHeadingLineSequence:E,setextHeadingText:C,strong:l(),thematicBreak:l()}};kI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ae){let V={type:"root",children:[]};const ue={stack:[V],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Ne=[];let ut=-1;for(;++ut<ae.length;)if(ae[ut][1].type==="listOrdered"||ae[ut][1].type==="listUnordered")if(ae[ut][0]==="enter")Ne.push(ut);else{const ht=Ne.pop();ut=s(ae,ht,ut)}for(ut=-1;++ut<ae.length;){const ht=t[ae[ut][0]];_I.call(ht,ae[ut][1].type)&&ht[ae[ut][1].type].call(Object.assign({sliceSerialize:ae[ut][2].sliceSerialize},ue),ae[ut][1])}if(ue.tokenStack.length>0){const ht=ue.tokenStack[ue.tokenStack.length-1];(ht[1]||kS).call(ue,void 0,ht[0])}for(V.position={start:fl(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:fl(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},ut=-1;++ut<t.transforms.length;)V=t.transforms[ut](V)||V;return V}function s(ae,V,ue){let Ne=V-1,ut=-1,ht=!1,ft,pe,Ae,te;for(;++Ne<=ue;){const K=ae[Ne];switch(K[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{K[0]==="enter"?ut++:ut--,te=void 0;break}case"lineEndingBlank":{K[0]==="enter"&&(ft&&!te&&!ut&&!Ae&&(Ae=Ne),te=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:te=void 0}if(!ut&&K[0]==="enter"&&K[1].type==="listItemPrefix"||ut===-1&&K[0]==="exit"&&(K[1].type==="listUnordered"||K[1].type==="listOrdered")){if(ft){let ie=Ne;for(pe=void 0;ie--;){const fe=ae[ie];if(fe[1].type==="lineEnding"||fe[1].type==="lineEndingBlank"){if(fe[0]==="exit")continue;pe&&(ae[pe][1].type="lineEndingBlank",ht=!0),fe[1].type="lineEnding",pe=ie}else if(!(fe[1].type==="linePrefix"||fe[1].type==="blockQuotePrefix"||fe[1].type==="blockQuotePrefixWhitespace"||fe[1].type==="blockQuoteMarker"||fe[1].type==="listItemIndent"))break}Ae&&(!pe||Ae<pe)&&(ft._spread=!0),ft.end=Object.assign({},pe?ae[pe][1].start:K[1].end),ae.splice(pe||Ne,0,["exit",ft,K[2]]),Ne++,ue++}if(K[1].type==="listItemPrefix"){const ie={type:"listItem",_spread:!1,start:Object.assign({},K[1].start),end:void 0};ft=ie,ae.splice(Ne,0,["enter",ie,K[2]]),Ne++,ue++,Ae=void 0,te=!0}}}return ae[V][1]._spread=ht,ue}function i(ae,V){return ue;function ue(Ne){a.call(this,ae(Ne),Ne),V&&V.call(this,Ne)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ae,V,ue){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([V,ue||void 0]),ae.position={start:fl(V.start),end:void 0}}function l(ae){return V;function V(ue){ae&&ae.call(this,ue),c.call(this,ue)}}function c(ae,V){const ue=this.stack.pop(),Ne=this.tokenStack.pop();if(Ne)Ne[0].type!==ae.type&&(V?V.call(this,ae,Ne[0]):(Ne[1]||kS).call(this,ae,Ne[0]));else throw new Error("Cannot close `"+ae.type+"` ("+Yf({start:ae.start,end:ae.end})+"): it’s not open");ue.position.end=fl(ae.end)}function u(){return D_(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(ae){if(this.data.expectingFirstListItemValue){const V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.lang=ae}function p(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.meta=ae}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.value=ae.replace(/(\r?\n|\r)$/g,"")}function w(ae){const V=this.resume(),ue=this.stack[this.stack.length-1];ue.label=V,ue.identifier=go(this.sliceSerialize(ae)).toLowerCase()}function v(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.title=ae}function _(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.url=ae}function S(ae){const V=this.stack[this.stack.length-1];if(!V.depth){const ue=this.sliceSerialize(ae).length;V.depth=ue}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function E(ae){const V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function j(ae){const ue=this.stack[this.stack.length-1].children;let Ne=ue[ue.length-1];(!Ne||Ne.type!=="text")&&(Ne=pt(),Ne.position={start:fl(ae.start),end:void 0},ue.push(Ne)),this.stack.push(Ne)}function N(ae){const V=this.stack.pop();V.value+=this.sliceSerialize(ae),V.position.end=fl(ae.end)}function B(ae){const V=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=V.children[V.children.length-1];ue.position.end=fl(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(V.type)&&(j.call(this,ae),N.call(this,ae))}function M(){this.data.atHardBreak=!0}function $(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.value=ae}function H(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.value=ae}function J(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.value=ae}function O(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=V,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Y(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=V,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function G(ae){const V=this.sliceSerialize(ae),ue=this.stack[this.stack.length-2];ue.label=eK(V),ue.identifier=go(V).toLowerCase()}function ee(){const ae=this.stack[this.stack.length-1],V=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const Ne=ae.children;ue.children=Ne}else ue.alt=V}function L(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.url=ae}function F(){const ae=this.resume(),V=this.stack[this.stack.length-1];V.title=ae}function P(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ne(ae){const V=this.resume(),ue=this.stack[this.stack.length-1];ue.label=V,ue.identifier=go(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function be(ae){this.data.characterReferenceType=ae.type}function he(ae){const V=this.sliceSerialize(ae),ue=this.data.characterReferenceType;let Ne;ue?(Ne=hI(V,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=O_(V);const ut=this.stack[this.stack.length-1];ut.value+=Ne}function ye(ae){const V=this.stack.pop();V.position.end=fl(ae.end)}function me(ae){N.call(this,ae);const V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(ae)}function se(ae){N.call(this,ae);const V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(ae)}function re(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function ke(){return{type:"inlineCode",value:""}}function He(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function ce(){return{type:"heading",depth:0,children:[]}}function xe(){return{type:"break"}}function Me(){return{type:"html",value:""}}function Re(){return{type:"image",title:null,url:"",alt:null}}function ct(){return{type:"link",title:null,url:"",children:[]}}function Ct(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function vt(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Rt(){return{type:"paragraph",children:[]}}function Ke(){return{type:"strong",children:[]}}function pt(){return{type:"text",value:""}}function yt(){return{type:"thematicBreak"}}}function fl(e){return{line:e.line,column:e.column,offset:e.offset}}function kI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?kI(e,r):sK(e,r)}}function sK(e,t){let n;for(n in t)if(_I.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 kS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Yf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Yf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Yf({start:t.start,end:t.end})+") is still open")}function iK(e){const t=this;t.parser=n;function n(r){return nK(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function oK(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 aK(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function lK(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 cK(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uK(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dK(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Ch(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function hK(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 fK(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function SI(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function mK(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return SI(e,t);const s={src:Ch(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 pK(e,t){const n={src:Ch(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 gK(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 yK(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return SI(e,t);const s={href:Ch(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 bK(e,t){const n={href:Ch(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 wK(e,t,n){const r=e.all(t),s=n?vK(n):TI(t),i={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,c),e.applyData(t,c)}function vK(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=TI(n[r])}return t}function TI(e){const t=e.spread;return t??e.children.length>1}function xK(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function _K(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kK(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function SK(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TK(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=I_(t.children[1]),l=sI(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function CK(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],f={},m=o?o[l]:void 0;m&&(f.align=m);let p={type:"element",tagName:i,properties:f,children:[]};d&&(p.children=e.all(d),e.patch(d,p),p=e.applyData(d,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function AK(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const SS=9,TS=32;function EK(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(CS(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(CS(t.slice(s),s>0,!1)),i.join("")}function CS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===SS||i===TS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===SS||i===TS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function MK(e,t){const n={type:"text",value:EK(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function NK(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const IK={blockquote:oK,break:aK,code:lK,delete:cK,emphasis:uK,footnoteReference:dK,heading:hK,html:fK,imageReference:mK,image:pK,inlineCode:gK,linkReference:yK,link:bK,listItem:wK,list:xK,paragraph:_K,root:kK,strong:SK,table:TK,tableCell:AK,tableRow:CK,text:MK,thematicBreak:NK,toml:Zm,yaml:Zm,definition:Zm,footnoteDefinition:Zm};function Zm(){}const CI=-1,Ty=0,Qf=1,i1=2,P_=3,z_=4,$_=5,q_=6,AI=7,EI=8,AS=typeof self=="object"?self:globalThis,RK=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Ty:case CI:return n(o,s);case Qf:{const a=n([],s);for(const l of o)a.push(r(l));return a}case i1:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case P_:return n(new Date(o),s);case z_:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case $_:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case q_:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case AI:{const{name:a,message:l}=o;return n(new AS[a](l),s)}case EI:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new AS[i](o),s)};return r},ES=e=>RK(new Map,e)(0),Ju="",{toString:jK}={},{keys:LK}=Object,nf=e=>{const t=typeof e;if(t!=="object"||!e)return[Ty,t];const n=jK.call(e).slice(8,-1);switch(n){case"Array":return[Qf,Ju];case"Object":return[i1,Ju];case"Date":return[P_,Ju];case"RegExp":return[z_,Ju];case"Map":return[$_,Ju];case"Set":return[q_,Ju];case"DataView":return[Qf,n]}return n.includes("Array")?[Qf,n]:n.includes("Error")?[AI,n]:[i1,n]},ep=([e,t])=>e===Ty&&(t==="function"||t==="symbol"),DK=(e,t,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=nf(o);switch(a){case Ty:{let u=o;switch(l){case"bigint":a=EI,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([CI],o)}return s([a,u],o)}case Qf:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),s([l,[...f]],o)}const u=[],d=s([a,u],o);for(const f of o)u.push(i(f));return d}case i1:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],d=s([a,u],o);for(const f of LK(o))(e||!ep(nf(o[f])))&&u.push([i(f),i(o[f])]);return d}case P_:return s([a,o.toISOString()],o);case z_:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case $_:{const u=[],d=s([a,u],o);for(const[f,m]of o)(e||!(ep(nf(f))||ep(nf(m))))&&u.push([i(f),i(m)]);return d}case q_:{const u=[],d=s([a,u],o);for(const f of o)(e||!ep(nf(f)))&&u.push(i(f));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},MS=(e,{json:t,lossy:n}={})=>{const r=[];return DK(!(t||n),!!t,new Map,r)(e),r},o1=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ES(MS(e,t)):structuredClone(e):(e,t)=>ES(MS(e,t));function OK(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 BK(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function PK(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||OK,r=e.options.footnoteBackLabel||BK,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),d=String(c.identifier).toUpperCase(),f=Ch(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 w=typeof n=="string"?n:n(l,m);typeof w=="string"&&(w={type:"text",value:w}),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(w)?w:[w]})}const x=u[u.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const w=x.children[x.children.length-1];w&&w.type==="text"?w.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...p)}else u.push(...p);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...o1(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const cm=function(e){if(e==null)return FK;if(typeof e=="function")return Cy(e);if(typeof e=="object")return Array.isArray(e)?zK(e):$K(e);if(typeof e=="string")return qK(e);throw new Error("Expected function, string, or object as test")};function zK(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=cm(e[n]);return Cy(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function $K(e){const t=e;return Cy(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function qK(e){return Cy(t);function t(n){return n&&n.type===e}}function Cy(e){return t;function t(n,r,s){return!!(UK(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function FK(){return!0}function UK(e){return e!==null&&typeof e=="object"&&"type"in e}const MI=[],HK=!0,gv=!1,NI="skip";function F_(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=cm(s),o=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=MI,p,y,x;if((!t||i(l,c,u[u.length-1]||void 0))&&(m=VK(n(l,u)),m[0]===gv))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==NI)for(y=(r?b.children.length:-1)+o,x=u.concat(b);y>-1&&y<b.children.length;){const w=b.children[y];if(p=a(w,y,x)(),p[0]===gv)return p;y=typeof p[1]=="number"?p[1]:y+o}}return m}}}function VK(e){return Array.isArray(e)?e:typeof e=="number"?[HK,e]:e==null?MI:[e]}function U_(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),F_(e,i,a,s);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const yv={}.hasOwnProperty,WK={};function GK(e,t){const n=t||WK,r=new Map,s=new Map,i=new Map,o={...IK,...n.handlers},a={all:c,applyData:YK,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:KK,wrap:QK};return U_(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:s,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,m=a.handlers[f];if(yv.call(a.handlers,f)&&m)return m(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:y,...x}=u,b=o1(x);return b.children=a.all(u),b}return o1(u)}return(a.options.unknownHandler||XK)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let m=-1;for(;++m<f.length;){const p=a.one(f[m],u);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=NS(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=NS(y.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function KK(e,t){e.position&&(t.position=BV(e))}function YK(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,o1(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function XK(e,t){const n=t.data||{},r="value"in t&&!(yv.call(n,"hProperties")||yv.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 QK(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 NS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function IS(e,t){const n=GK(e,t),r=n.one(e,void 0),s=PK(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function JK(e,t){return e&&"run"in e?async function(n,r){const s=IS(n,{file:r,...t});await e.run(s,r)}:function(n,r){return IS(n,{file:r,...e||t})}}function RS(e){if(e)throw e}var og=Object.prototype.hasOwnProperty,II=Object.prototype.toString,jS=Object.defineProperty,LS=Object.getOwnPropertyDescriptor,DS=function(t){return typeof Array.isArray=="function"?Array.isArray(t):II.call(t)==="[object Array]"},OS=function(t){if(!t||II.call(t)!=="[object Object]")return!1;var n=og.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&og.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||og.call(t,s)},BS=function(t,n){jS&&n.name==="__proto__"?jS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},PS=function(t,n){if(n==="__proto__")if(og.call(t,n)){if(LS)return LS(t,n).value}else return;return t[n]},ZK=function e(){var t,n,r,s,i,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=PS(a,n),s=PS(t,n),a!==s&&(u&&s&&(OS(s)||(i=DS(s)))?(i?(i=!1,o=r&&DS(r)?r:[]):o=r&&OS(r)?r:{},BS(a,{name:n,newValue:e(u,o,s)})):typeof s<"u"&&BS(a,{name:n,newValue:s}));return a};const C2=G1(ZK);function bv(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 eY(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=e[++i];let d=-1;if(l){o(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?tY(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function tY(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(s);try{l=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,t(o,...a))}function i(o){s(null,o)}}const Do={basename:nY,dirname:rY,extname:sY,join:iY,sep:"/"};function nY(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');um(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function rY(e){if(um(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 sY(e){um(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function iY(...e){let t=-1,n;for(;++t<e.length;)um(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":oY(n)}function oY(e){um(e);const t=e.codePointAt(0)===47;let n=aY(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function aY(e,t){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function um(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lY={cwd:cY};function cY(){return"/"}function wv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uY(e){if(typeof e=="string")e=new URL(e);else if(!wv(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 dY(e)}function dY(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 A2=["history","path","basename","stem","extname","dirname"];class RI{constructor(t){let n;t?wv(t)?n={path:t}:typeof t=="string"||hY(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":lY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<A2.length;){const i=A2[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)A2.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Do.basename(this.path):void 0}set basename(t){M2(t,"basename"),E2(t,"basename"),this.path=Do.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Do.dirname(this.path):void 0}set dirname(t){zS(this.basename,"dirname"),this.path=Do.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Do.extname(this.path):void 0}set extname(t){if(E2(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=Do.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){wv(t)&&(t=uY(t)),M2(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Do.basename(this.path,this.extname):void 0}set stem(t){M2(t,"stem"),E2(t,"stem"),this.path=Do.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 ks(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 E2(e,t){if(e&&e.includes(Do.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Do.sep+"`")}function M2(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 hY(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fY=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},mY={}.hasOwnProperty;class H_ extends fY{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=eY()}copy(){const t=new H_;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(C2(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(R2("data",this.frozen),this.namespace[t]=n,this):mY.call(this.namespace,t)&&this.namespace[t]||void 0:t?(R2("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=tp(t),r=this.parser||this.Parser;return N2("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),N2("process",this.parser||this.Parser),I2("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=tp(t),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const m=d,p=r.stringify(m,f);yY(p)?f.value=p:f.result=p,c(u,f)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),N2("processSync",this.parser||this.Parser),I2("processSync",this.compiler||this.Compiler),this.process(t,s),qS("processSync","process",n),r;function s(i,o){n=!0,RS(i),r=o}}run(t,n,r){$S(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=tp(n);s.run(t,l,c);function c(u,d,f){const m=d||t;u?a(u):o?o(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),qS("runSync","run",r),s;function i(o,a){RS(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=tp(n),s=this.compiler||this.Compiler;return I2("stringify",s),$S(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(R2("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=C2(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[m,...p]=u;const y=r[f][1];bv(y)&&bv(m)&&(m=C2(!0,y,m)),r[f]=[c,m,...p]}}}}const pY=new H_().freeze();function N2(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function I2(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function R2(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 $S(e){if(!bv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function qS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function tp(e){return gY(e)?e:new RI(e)}function gY(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yY(e){return typeof e=="string"||bY(e)}function bY(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wY="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",FS=[],US={allowDangerousHtml:!0},vY=/^(https?|ircs?|mailto|xmpp)$/i,xY=[{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 _Y(e){const t=kY(e),n=SY(e);return TY(t.runSync(t.parse(n),n),e)}function kY(e){const t=e.rehypePlugins||FS,n=e.remarkPlugins||FS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...US}:US;return pY().use(iK).use(n).use(JK,r).use(t)}function SY(e){const t=e.children||"",n=new RI;return typeof t=="string"&&(n.value=t),n}function TY(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||CY;for(const u of xY)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+wY+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),U_(e,c),FV(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let m;for(m in k2)if(Object.hasOwn(k2,m)&&Object.hasOwn(u.properties,m)){const p=u.properties[m],y=k2[m];(y===null||y.includes(u.tagName))&&(u.properties[m]=l(String(p||""),m,u))}}if(u.type==="element"){let m=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!m&&r&&typeof d=="number"&&(m=!r(u,d,f)),m&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function CY(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||vY.test(e.slice(0,t))?e:""}function a1(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 AY(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function EY(e,t,n){const s=cm((n||{}).ignore||[]),i=MY(t);let o=-1;for(;++o<i.length;)F_(e,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const m=u[d],p=f?f.children:void 0;if(s(m,p?p.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[o][0],m=i[o][1];let p=0;const x=d.children.indexOf(c);let b=!1,w=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){const _=v.index,S={index:v.index,input:v.input,stack:[...u,c]};let C=m(...v,S);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=_+1:(p!==_&&w.push({type:"text",value:c.value.slice(p,_)}),Array.isArray(C)?w.push(...C):C&&w.push(C),p=_+v[0].length,b=!0),!f.global)break;v=f.exec(c.value)}return b?(p<c.value.length&&w.push({type:"text",value:c.value.slice(p)}),d.children.splice(x,1,...w)):w=[c],x+w.length}}function MY(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([NY(s[0]),IY(s[1])])}return t}function NY(e){return typeof e=="string"?new RegExp(AY(e),"g"):e}function IY(e){return typeof e=="function"?e:function(){return e}}const j2="phrasing",L2=["autolink","link","image","label"];function RY(){return{transforms:[zY],enter:{literalAutolink:LY,literalAutolinkEmail:D2,literalAutolinkHttp:D2,literalAutolinkWww:D2},exit:{literalAutolink:PY,literalAutolinkEmail:BY,literalAutolinkHttp:DY,literalAutolinkWww:OY}}}function jY(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:j2,notInConstruct:L2},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:j2,notInConstruct:L2},{character:":",before:"[ps]",after:"\\/",inConstruct:j2,notInConstruct:L2}]}}function LY(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function D2(e){this.config.enter.autolinkProtocol.call(this,e)}function DY(e){this.config.exit.autolinkProtocol.call(this,e)}function OY(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 BY(e){this.config.exit.autolinkEmail.call(this,e)}function PY(e){this.exit(e)}function zY(e){EY(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,$Y],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),qY]],{ignore:["link","linkReference"]})}function $Y(e,t,n,r,s){let i="";if(!jI(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!FY(n)))return!1;const o=UY(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function qY(e,t,n,r){return!jI(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function FY(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 UY(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=a1(e,"(");let i=a1(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 jI(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||xu(n)||ky(n))&&(!t||n!==47)}LI.peek=JY;function HY(){this.buffer()}function VY(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function WY(){this.buffer()}function GY(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function KY(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=go(this.sliceSerialize(e)).toLowerCase(),n.label=t}function YY(e){this.exit(e)}function XY(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=go(this.sliceSerialize(e)).toLowerCase(),n.label=t}function QY(e){this.exit(e)}function JY(){return"["}function LI(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function ZY(){return{enter:{gfmFootnoteCallString:HY,gfmFootnoteCall:VY,gfmFootnoteDefinitionLabelString:WY,gfmFootnoteDefinition:GY},exit:{gfmFootnoteCallString:KY,gfmFootnoteCall:YY,gfmFootnoteDefinitionLabelString:XY,gfmFootnoteDefinition:QY}}}function eX(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:LI},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(r,a.current()),t?DI:tX))),c(),l}}function tX(e,t,n){return t===0?e:DI(e,t,n)}function DI(e,t,n){return(n?"":"    ")+e}const nX=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];OI.peek=aX;function rX(){return{canContainEols:["delete"],enter:{strikethrough:iX},exit:{strikethrough:oX}}}function sX(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:nX}],handlers:{delete:OI}}}function iX(e){this.enter({type:"delete",children:[]},e)}function oX(e){this.exit(e)}function OI(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function aX(){return"~"}function lX(e){return e.length}function cX(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||lX,i=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const y=[],x=[];let b=-1;for(e[u].length>c&&(c=e[u].length);++b<e[u].length;){const w=uX(e[u][b]);if(n.alignDelimiters!==!1){const v=s(w);x[b]=v,(l[b]===void 0||v>l[b])&&(l[b]=v)}y.push(w)}o[u]=y,a[u]=x}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=HS(r[d]);else{const y=HS(r);for(;++d<c;)i[d]=y}d=-1;const f=[],m=[];for(;++d<c;){const y=i[d];let x="",b="";y===99?(x=":",b=":"):y===108?x=":":y===114&&(b=":");let w=n.alignDelimiters===!1?1:Math.max(1,l[d]-x.length-b.length);const v=x+"-".repeat(w)+b;n.alignDelimiters!==!1&&(w=x.length+w+b.length,w>l[d]&&(l[d]=w),m[d]=w),f[d]=v}o.splice(1,0,f),a.splice(1,0,m),u=-1;const p=[];for(;++u<o.length;){const y=o[u],x=a[u];d=-1;const b=[];for(;++d<c;){const w=y[d]||"";let v="",_="";if(n.alignDelimiters!==!1){const S=l[d]-(x[d]||0),C=i[d];C===114?v=" ".repeat(S):C===99?S%2?(v=" ".repeat(S/2+.5),_=" ".repeat(S/2-.5)):(v=" ".repeat(S/2),_=v):_=" ".repeat(S)}n.delimiterStart!==!1&&!d&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||d)&&b.push(" "),n.alignDelimiters!==!1&&b.push(v),b.push(w),n.alignDelimiters!==!1&&b.push(_),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
`)}function uX(e){return e==null?"":String(e)}function HS(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 VS={}.hasOwnProperty;function dX(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&VS.call(s,e)){const l=String(s[e]);o=VS.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function hX(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),fX);return s(),o}function fX(e,t,n){return">"+(n?"":" ")+e}function mX(e,t){return WS(e,t.inConstruct,!0)&&!WS(e,t.notInConstruct,!1)}function WS(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 GS(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&mX(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function BI(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function pX(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 gX(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 yX(e,t,n,r){const s=gX(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(pX(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,bX);return d(),f}const a=n.createTracker(r),l=s.repeat(Math.max(BI(i,s)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:`
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
`),i&&(u+=a.move(i+`
`)),u+=a.move(l),c(),u}function bX(e,t,n){return(n?"":"    ")+e}function V_(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 wX(e,t,n,r){const s=V_(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),o(),c}function vX(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 T0(e){return"&#x"+e.toString(16).toUpperCase()+";"}function l1(e,t,n){const r=th(e),s=th(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}}PI.peek=xX;function PI(e,t,n,r){const s=vX(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=l1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=T0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=l1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+T0(d));const m=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function xX(e,t,n){return n.options.emphasis||"*"}function _X(e,t){let n=!1;return U_(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,gv}),!!((!e.depth||e.depth<3)&&D_(e)&&(t.options.setext||n))}function kX(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(_X(e,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return d(),u(),f+`
`+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
`))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(c)&&(c=T0(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}zI.peek=SX;function zI(e){return e.value||""}function SX(){return"<"}$I.peek=TX;function $I(e,t,n,r){const s=V_(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),o(),c}function TX(){return"!"}qI.peek=CX;function qI(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function CX(){return"!"}FI.peek=AX;function FI(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return s+r+s}function AX(){return"`"}function UI(e,t){const n=D_(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))}HI.peek=EX;function HI(e,t,n,r){const s=V_(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(UI(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=o.move(" "+s),c+=o.move(n.safe(e.title,{before:c,after:s,...o.current()})),c+=o.move(s),l()),c+=o.move(")"),a(),c}function EX(e,t,n){return UI(e,n)?"<":"["}VI.peek=MX;function VI(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function MX(){return"["}function W_(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 NX(e){const t=W_(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 IX(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 WI(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 RX(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?IX(n):W_(n);const a=e.ordered?o==="."?")":".":NX(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),WI(n)===o&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),c}function jX(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 LX(e,t,n,r){const s=jX(n);let i=n.bulletCurrent||W_(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,m){return f?(m?"":" ".repeat(o))+d:(m?i:i+" ".repeat(o-i.length))+d}}function DX(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const OX=cm(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function BX(e,t,n,r){return(e.children.some(function(o){return OX(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function PX(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}GI.peek=zX;function GI(e,t,n,r){const s=PX(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=l1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=T0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=l1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+T0(d));const m=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function zX(e,t,n){return n.options.strong||"*"}function $X(e,t,n,r){return n.safe(e.value,r)}function qX(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 FX(e,t,n){const r=(WI(n)+(n.options.ruleSpaces?" ":"")).repeat(qX(n));return n.options.ruleSpaces?r.slice(0,-1):r}const KI={blockquote:hX,break:GS,code:yX,definition:wX,emphasis:PI,hardBreak:GS,heading:kX,html:zI,image:$I,imageReference:qI,inlineCode:FI,link:HI,linkReference:VI,list:RX,listItem:LX,paragraph:DX,root:BX,strong:GI,text:$X,thematicBreak:FX};function UX(){return{enter:{table:HX,tableData:KS,tableHeader:KS,tableRow:WX},exit:{codeText:GX,table:VX,tableData:O2,tableHeader:O2,tableRow:O2}}}function HX(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 VX(e){this.exit(e),this.data.inTable=void 0}function WX(e){this.enter({type:"tableRow",children:[]},e)}function O2(e){this.exit(e)}function KS(e){this.enter({type:"tableCell",children:[]},e)}function GX(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KX));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KX(e,t){return t==="|"?t:e}function YX(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(m,p,y,x){return c(u(m,y,x),m.align)}function a(m,p,y,x){const b=d(m,y,x),w=c([b]);return w.slice(0,w.indexOf(`
`))}function l(m,p,y,x){const b=y.enter("tableCell"),w=y.enter("phrasing"),v=y.containerPhrasing(m,{...x,before:i,after:i});return w(),b(),v}function c(m,p){return cX(m,{align:p,alignDelimiters:r,padding:n,stringLength:s})}function u(m,p,y){const x=m.children;let b=-1;const w=[],v=p.enter("table");for(;++b<x.length;)w[b]=d(x[b],p,y);return v(),w}function d(m,p,y){const x=m.children;let b=-1;const w=[],v=p.enter("tableRow");for(;++b<x.length;)w[b]=l(x[b],m,p,y);return v(),w}function f(m,p,y){let x=KI.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function XX(){return{exit:{taskListCheckValueChecked:YS,taskListCheckValueUnchecked:YS,paragraph:JX}}}function QX(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ZX}}}function YS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function JX(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function ZX(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=KI.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function eQ(){return[RY(),ZY(),rX(),UX(),XX()]}function tQ(e){return{extensions:[jY(),eX(e),sX(),YX(e),QX()]}}const nQ={tokenize:lQ,partial:!0},YI={tokenize:cQ,partial:!0},XI={tokenize:uQ,partial:!0},QI={tokenize:dQ,partial:!0},rQ={tokenize:hQ,partial:!0},JI={name:"wwwAutolink",tokenize:oQ,previous:eR},ZI={name:"protocolAutolink",tokenize:aQ,previous:tR},Qa={name:"emailAutolink",tokenize:iQ,previous:nR},Zo={};function sQ(){return{text:Zo}}let Ic=48;for(;Ic<123;)Zo[Ic]=Qa,Ic++,Ic===58?Ic=65:Ic===91&&(Ic=97);Zo[43]=Qa;Zo[45]=Qa;Zo[46]=Qa;Zo[95]=Qa;Zo[72]=[Qa,ZI];Zo[104]=[Qa,ZI];Zo[87]=[Qa,JI];Zo[119]=[Qa,JI];function iQ(e,t,n){const r=this;let s,i;return o;function o(d){return!vv(d)||!nR.call(r,r.previous)||G_(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return vv(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(rQ,u,c)(d):d===45||d===95||ws(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&&Ds(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function oQ(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!eR.call(r,r.previous)||G_(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(nQ,e.attempt(YI,e.attempt(XI,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function aQ(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&tR.call(r,r.previous)&&!G_(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Ds(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||s1(d)||$n(d)||xu(d)||ky(d)?n(d):e.attempt(YI,e.attempt(XI,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function lQ(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function cQ(e,t,n){let r,s,i;return o;function o(c){return c===46||c===95?e.check(QI,l,a)(c):c===null||$n(c)||xu(c)||c!==45&&ky(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),e.consume(c),o}function l(c){return s||r||!i?n(c):t(c)}}function uQ(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(QI,t,i)(o):o===null||$n(o)||xu(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function dQ(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),i):a===93?(e.consume(a),s):a===60||a===null||$n(a)||xu(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||$n(a)||xu(a)?t(a):r(a)}function i(a){return Ds(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ds(a)?(e.consume(a),o):n(a)}}function hQ(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return ws(i)?n(i):t(i)}}function eR(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||$n(e)}function tR(e){return!Ds(e)}function nR(e){return!(e===47||vv(e))}function vv(e){return e===43||e===45||e===46||e===95||ws(e)}function G_(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 fQ={tokenize:xQ,partial:!0};function mQ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:bQ,continuation:{tokenize:wQ},exit:vQ}},text:{91:{name:"gfmFootnoteCall",tokenize:yQ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pQ,resolveTo:gQ}}}}function pQ(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=go(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function gQ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function yQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!o||d===null||d===91||$n(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(go(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return $n(d)||(o=!0),i++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),i++,c):c(d)}}function bQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(p)}function u(p){if(o>999||p===93&&!a||p===null||p===91||$n(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=go(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return $n(p)||(a=!0),o++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),o++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s.includes(i)||s.push(i),Yt(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function wQ(e,t,n){return e.check(lm,t,e.attempt(fQ,t,n))}function vQ(e){e.exit("gfmFootnoteDefinition")}function xQ(e,t,n){const r=this;return Yt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function _Q(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],m=a.parser.constructs.insideSpan.null;m&&Ci(f,f.length,0,Sy(m,o.slice(c+1,l),a)),Ci(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Ci(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const y=th(c);if(p===126)return d>1?l(p):(o.consume(p),d++,m);if(d<2&&!n)return l(p);const x=o.exit("strikethroughSequenceTemporary"),b=th(p);return x._open=!b||b===2&&!!y,x._close=!y||y===2&&!!b,a(p)}}}class kQ{constructor(){this.map=[]}add(t,n,r){SQ(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function SQ(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 TQ(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 CQ(){return{flow:{null:{name:"table",tokenize:AQ,resolveAll:EQ}}}}function AQ(e,t,n){const r=this;let s=0,i=0,o;return a;function a(N){let B=r.events.length-1;for(;B>-1;){const H=r.events[B][1].type;if(H==="lineEnding"||H==="linePrefix")B--;else break}const M=B>-1?r.events[B][1].type:null,$=M==="tableHead"||M==="tableRow"?C:l;return $===C&&r.parser.lazy[r.now().line]?n(N):$(N)}function l(N){return e.enter("tableHead"),e.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,i+=1),u(N)}function u(N){return N===null?n(N):kt(N)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),m):n(N):en(N)?Yt(e,u,"whitespace")(N):(i+=1,o&&(o=!1,s+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(N)))}function d(N){return N===null||N===124||$n(N)?(e.exit("data"),u(N)):(e.consume(N),N===92?f:d)}function f(N){return N===92||N===124?(e.consume(N),d):d(N)}function m(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,en(N)?Yt(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):p(N))}function p(N){return N===45||N===58?x(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),y):S(N)}function y(N){return en(N)?Yt(e,x,"whitespace")(N):x(N)}function x(N){return N===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),b):N===45?(i+=1,b(N)):N===null||kt(N)?_(N):S(N)}function b(N){return N===45?(e.enter("tableDelimiterFiller"),w(N)):S(N)}function w(N){return N===45?(e.consume(N),w):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(N))}function v(N){return en(N)?Yt(e,_,"whitespace")(N):_(N)}function _(N){return N===124?p(N):N===null||kt(N)?!o||s!==i?S(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):S(N)}function S(N){return n(N)}function C(N){return e.enter("tableRow"),E(N)}function E(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),E):N===null||kt(N)?(e.exit("tableRow"),t(N)):en(N)?Yt(e,E,"whitespace")(N):(e.enter("data"),R(N))}function R(N){return N===null||N===124||$n(N)?(e.exit("data"),E(N)):(e.consume(N),N===92?j:R)}function j(N){return N===92||N===124?(e.consume(N),R):R(N)}}function EQ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new kQ;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(XS(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",u,t]])),s=p.type==="tableDelimiterRow"?2:u?3:1):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=np(f,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=np(f,t,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],d=np(f,t,i,s,n,d)):o[1]!==0&&(d=np(f,t,o,s,n,d)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&XS(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=TQ(t.events,n))}return e}function np(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},od(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=od(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=od(t.events,n[2]),u=od(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,y=n[3]-n[2]-1;e.add(p,y,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return s!==void 0&&(i.end=Object.assign({},od(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function XS(e,t,n,r,s){const i=[],o=od(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function od(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const MQ={name:"tasklistCheck",tokenize:IQ};function NQ(){return{text:{91:MQ}}}function IQ(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 $n(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return kt(l)?t(l):en(l)?e.check({tokenize:RQ},t,n)(l):n(l)}}function RQ(e,t,n){return Yt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function jQ(e){return dI([sQ(),mQ(),_Q(e),CQ(),NQ()])}const LQ={};function QS(e){const t=this,n=e||LQ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(jQ(n)),i.push(eQ()),o.push(tQ(n))}function DQ(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function e(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function t(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c;const d=u.data.hChildren[0];d.type,d.tagName,d.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function OQ(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,o,a,l){const c=i.value||"",u=a.createTracker(l),d="$".repeat(Math.max(BI(c,"$")+1,2)),f=a.enter("mathFlow");let m=u.move(d);if(i.meta){const p=a.enter("mathFlowMeta");m+=u.move(a.safe(i.meta,{after:`
`,before:m,encode:["$"],...u.current()})),p()}return m+=u.move(`
`),c&&(m+=u.move(c+`
`)),m+=u.move(d),f(),m}function r(i,o,a){let l=i.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++d<a.unsafe.length;){const f=a.unsafe[d];if(!f.atBreak)continue;const m=a.compilePattern(f);let p;for(;p=m.exec(l);){let y=p.index;l.codePointAt(y)===10&&l.codePointAt(y-1)===13&&y--,l=l.slice(0,y)+" "+l.slice(p.index+1)}}return u+l+u}function s(){return"$"}}const BQ={tokenize:PQ,concrete:!0,name:"mathFlow"},JS={tokenize:zQ,partial:!0};function PQ(e,t,n){const r=this,s=r.events[r.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let o=0;return a;function a(w){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(w)}function l(w){return w===36?(e.consume(w),o++,l):o<2?n(w):(e.exit("mathFlowFenceSequence"),Yt(e,c,"whitespace")(w))}function c(w){return w===null||kt(w)?d(w):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(w))}function u(w){return w===null||kt(w)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(w)):w===36?n(w):(e.consume(w),u)}function d(w){return e.exit("mathFlowFence"),r.interrupt?t(w):e.attempt(JS,f,x)(w)}function f(w){return e.attempt({tokenize:b,partial:!0},x,m)(w)}function m(w){return(i?Yt(e,p,"linePrefix",i+1):p)(w)}function p(w){return w===null?x(w):kt(w)?e.attempt(JS,f,x)(w):(e.enter("mathFlowValue"),y(w))}function y(w){return w===null||kt(w)?(e.exit("mathFlowValue"),p(w)):(e.consume(w),y)}function x(w){return e.exit("mathFlow"),t(w)}function b(w,v,_){let S=0;return Yt(w,C,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function C(j){return w.enter("mathFlowFence"),w.enter("mathFlowFenceSequence"),E(j)}function E(j){return j===36?(S++,w.consume(j),E):S<o?_(j):(w.exit("mathFlowFenceSequence"),Yt(w,R,"whitespace")(j))}function R(j){return j===null||kt(j)?(w.exit("mathFlowFence"),v(j)):_(j)}}}function zQ(e,t,n){const r=this;return s;function s(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function $Q(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:qQ,previous:FQ,name:"mathText"};function r(s,i,o){let a=0,l,c;return u;function u(y){return s.enter("mathText"),s.enter("mathTextSequence"),d(y)}function d(y){return y===36?(s.consume(y),a++,d):a<2&&!n?o(y):(s.exit("mathTextSequence"),f(y))}function f(y){return y===null?o(y):y===36?(c=s.enter("mathTextSequence"),l=0,p(y)):y===32?(s.enter("space"),s.consume(y),s.exit("space"),f):kt(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||kt(y)?(s.exit("mathTextData"),f(y)):(s.consume(y),m)}function p(y){return y===36?(s.consume(y),l++,p):l===a?(s.exit("mathTextSequence"),s.exit("mathText"),i(y)):(c.type="mathTextData",m(y))}}}function qQ(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 FQ(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function UQ(e){return{flow:{36:BQ},text:{36:$Q(e)}}}class Pe extends Error{constructor(t,n){var r="KaTeX parse error: "+t,s,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;s=o.start,i=o.end,s===a.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var l=a.slice(s,i).replace(/[^]/g,"$&̲"),c;s>15?c="…"+a.slice(s-15,s):c=a.slice(0,s);var u;i+15<a.length?u=a.slice(i,i+15)+"…":u=a.slice(i),r+=c+l+u}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,Pe.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var HQ=/([A-Z])/g,VQ=e=>e.replace(HQ,"-$1").toLowerCase(),WQ={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},GQ=/[&><"']/g,_s=e=>String(e).replace(GQ,t=>WQ[t]),ag=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?ag(e.body[0]):e:e.type==="font"?ag(e.body):e,KQ=new Set(["mathord","textord","atom"]),Ja=e=>KQ.has(ag(e).type),YQ=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"},c1={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 XQ(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 QQ(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return XQ(t)}function JQ(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:QQ(r)}class K_{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(c1)){var r=c1[n];r&&JQ(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 Pe("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=YQ(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class ml{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 Oo[ZQ[this.id]]}sub(){return Oo[eJ[this.id]]}fracNum(){return Oo[tJ[this.id]]}fracDen(){return Oo[nJ[this.id]]}cramp(){return Oo[rJ[this.id]]}text(){return Oo[sJ[this.id]]}isTight(){return this.size>=2}}var Y_=0,u1=1,Dd=2,Ba=3,C0=4,Gi=5,nh=6,Bs=7,Oo=[new ml(Y_,0,!1),new ml(u1,0,!0),new ml(Dd,1,!1),new ml(Ba,1,!0),new ml(C0,2,!1),new ml(Gi,2,!0),new ml(nh,3,!1),new ml(Bs,3,!0)],ZQ=[C0,Gi,C0,Gi,nh,Bs,nh,Bs],eJ=[Gi,Gi,Gi,Gi,Bs,Bs,Bs,Bs],tJ=[Dd,Ba,C0,Gi,nh,Bs,nh,Bs],nJ=[Ba,Ba,Gi,Gi,Bs,Bs,Bs,Bs],rJ=[u1,u1,Ba,Ba,Gi,Gi,Bs,Bs],sJ=[Y_,u1,Dd,Ba,Dd,Ba,Dd,Ba],zt={DISPLAY:Oo[Y_],TEXT:Oo[Dd],SCRIPT:Oo[C0],SCRIPTSCRIPT:Oo[nh]},xv=[{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 iJ(e){for(var t=0;t<xv.length;t++)for(var n=xv[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 lg=[];xv.forEach(e=>e.blocks.forEach(t=>lg.push(...t)));function rR(e){for(var t=0;t<lg.length;t+=2)if(e>=lg[t]&&e<=lg[t+1])return!0;return!1}var Lr=e=>e+" "+e,Zu=80,oJ=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"},aJ=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"},lJ=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"},cJ=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"},uJ=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"},dJ=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},hJ=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"},fJ=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=oJ(n,Zu);break;case"sqrtSize1":s=aJ(n,Zu);break;case"sqrtSize2":s=lJ(n,Zu);break;case"sqrtSize3":s=cJ(n,Zu);break;case"sqrtSize4":s=uJ(n,Zu);break;case"sqrtTall":s=hJ(n,Zu,r)}return s},mJ=function(t,n){switch(t){case"⎜":return Lr("M291 0 H417 V"+n+" H291z");case"∣":return Lr("M145 0 H188 V"+n+" H145z");case"∥":return Lr("M145 0 H188 V"+n+" H145z")+Lr("M367 0 H410 V"+n+" H367z");case"⎟":return Lr("M457 0 H583 V"+n+" H457z");case"⎢":return Lr("M319 0 H403 V"+n+" H319z");case"⎥":return Lr("M263 0 H347 V"+n+" H263z");case"⎪":return Lr("M384 0 H504 V"+n+" H384z");case"⏐":return Lr("M312 0 H355 V"+n+" H312z");case"‖":return Lr("M257 0 H300 V"+n+" H257z")+Lr("M478 0 H521 V"+n+" H478z");default:return""}},ZS={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:Lr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Lr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Lr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Lr("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:Lr("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:Lr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Lr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Lr("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`},pJ=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 gJ(e){return"toText"in e}class Ah{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(gJ(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var _v={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},yJ={ex:!0,em:!0,mu:!0},sR=function(t){return typeof t!="string"&&(t=t.unit),t in _v||t in yJ||t==="ex"},sr=function(t,n){var r;if(t.unit in _v)r=_v[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 Pe("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},Ue=function(t){return+t.toFixed(4)+"em"},sc=function(t){return t.filter(n=>n).join(" ")},X_=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=VQ(r)+":"+s+";")}return n},iR=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)}},oR=function(t){var n=document.createElement(t);n.className=sc(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},bJ=/[\s"'>/=\x00-\x1f]/,aR=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+_s(sc(this.classes))+'"');var r=X_(this.style);r&&(n+=' style="'+_s(r)+'"');for(var s of Object.keys(this.attributes)){if(bJ.test(s))throw new Pe("Invalid attribute name '"+s+"'");n+=" "+s+'="'+_s(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class Eh{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,iR.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return oR.call(this,"span")}toMarkup(){return aR.call(this,"span")}}class Ay{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,iR.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 oR.call(this,"a")}toMarkup(){return aR.call(this,"a")}}class wJ{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="'+_s(this.src)+'"'+(' alt="'+_s(this.alt)+'"'),n=X_(this.style);return n&&(t+=' style="'+_s(n)+'"'),t+="'/>",t}}var vJ={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Ni{constructor(t,n,r,s,i,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=n||0,this.depth=r||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=iJ(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=vJ[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=Ue(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=sc(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+=_s(sc(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+Ue(this.italic)+";"),r+=X_(this.style),r&&(t=!0,n+=' style="'+_s(r)+'"');var s=_s(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class Wa{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+'="'+_s(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class ic{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",ZS[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+_s(this.alternate)+'"/>':'<path d="'+_s(ZS[this.pathName])+'"/>'}}class kv{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+'="'+_s(this.attributes[n])+'"';return t+="/>",t}}function xJ(e){if(e instanceof Ni)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function _J(e){if(e instanceof Eh)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var kJ=e=>e instanceof Eh||e instanceof Ay||e instanceof Ah,Uo={"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]}},rp={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]},e7={Å:"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 lR(e,t){Uo[e]=t}function Q_(e,t,n){if(!Uo[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=Uo[t][r];if(!s&&e[0]in e7&&(r=e7[e[0]].charCodeAt(0),s=Uo[t][r]),!s&&n==="text"&&rR(r)&&(s=Uo[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var B2={};function SJ(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!B2[t]){var n=B2[t]={cssEmPerMu:rp.quad[t]/18};for(var r in rp)rp.hasOwnProperty(r)&&(n[r]=rp[r][t])}return B2[t]}var er={math:{},text:{}};function k(e,t,n,r,s,i){er[e][s]={font:t,group:n,replace:r},i&&r&&(er[e][r]=er[e][s])}var T="math",Ce="text",I="main",U="ams",tr="accent-token",lt="bin",qs="close",Mh="inner",It="mathord",Mr="op-token",Ii="open",dm="punct",W="rel",Za="spacing",Z="textord";k(T,I,W,"≡","\\equiv",!0);k(T,I,W,"≺","\\prec",!0);k(T,I,W,"≻","\\succ",!0);k(T,I,W,"∼","\\sim",!0);k(T,I,W,"⊥","\\perp");k(T,I,W,"⪯","\\preceq",!0);k(T,I,W,"⪰","\\succeq",!0);k(T,I,W,"≃","\\simeq",!0);k(T,I,W,"∣","\\mid",!0);k(T,I,W,"≪","\\ll",!0);k(T,I,W,"≫","\\gg",!0);k(T,I,W,"≍","\\asymp",!0);k(T,I,W,"∥","\\parallel");k(T,I,W,"⋈","\\bowtie",!0);k(T,I,W,"⌣","\\smile",!0);k(T,I,W,"⊑","\\sqsubseteq",!0);k(T,I,W,"⊒","\\sqsupseteq",!0);k(T,I,W,"≐","\\doteq",!0);k(T,I,W,"⌢","\\frown",!0);k(T,I,W,"∋","\\ni",!0);k(T,I,W,"∝","\\propto",!0);k(T,I,W,"⊢","\\vdash",!0);k(T,I,W,"⊣","\\dashv",!0);k(T,I,W,"∋","\\owns");k(T,I,dm,".","\\ldotp");k(T,I,dm,"⋅","\\cdotp");k(T,I,dm,"⋅","·");k(Ce,I,Z,"⋅","·");k(T,I,Z,"#","\\#");k(Ce,I,Z,"#","\\#");k(T,I,Z,"&","\\&");k(Ce,I,Z,"&","\\&");k(T,I,Z,"ℵ","\\aleph",!0);k(T,I,Z,"∀","\\forall",!0);k(T,I,Z,"ℏ","\\hbar",!0);k(T,I,Z,"∃","\\exists",!0);k(T,I,Z,"∇","\\nabla",!0);k(T,I,Z,"♭","\\flat",!0);k(T,I,Z,"ℓ","\\ell",!0);k(T,I,Z,"♮","\\natural",!0);k(T,I,Z,"♣","\\clubsuit",!0);k(T,I,Z,"℘","\\wp",!0);k(T,I,Z,"♯","\\sharp",!0);k(T,I,Z,"♢","\\diamondsuit",!0);k(T,I,Z,"ℜ","\\Re",!0);k(T,I,Z,"♡","\\heartsuit",!0);k(T,I,Z,"ℑ","\\Im",!0);k(T,I,Z,"♠","\\spadesuit",!0);k(T,I,Z,"§","\\S",!0);k(Ce,I,Z,"§","\\S");k(T,I,Z,"¶","\\P",!0);k(Ce,I,Z,"¶","\\P");k(T,I,Z,"†","\\dag");k(Ce,I,Z,"†","\\dag");k(Ce,I,Z,"†","\\textdagger");k(T,I,Z,"‡","\\ddag");k(Ce,I,Z,"‡","\\ddag");k(Ce,I,Z,"‡","\\textdaggerdbl");k(T,I,qs,"⎱","\\rmoustache",!0);k(T,I,Ii,"⎰","\\lmoustache",!0);k(T,I,qs,"⟯","\\rgroup",!0);k(T,I,Ii,"⟮","\\lgroup",!0);k(T,I,lt,"∓","\\mp",!0);k(T,I,lt,"⊖","\\ominus",!0);k(T,I,lt,"⊎","\\uplus",!0);k(T,I,lt,"⊓","\\sqcap",!0);k(T,I,lt,"∗","\\ast");k(T,I,lt,"⊔","\\sqcup",!0);k(T,I,lt,"◯","\\bigcirc",!0);k(T,I,lt,"∙","\\bullet",!0);k(T,I,lt,"‡","\\ddagger");k(T,I,lt,"≀","\\wr",!0);k(T,I,lt,"⨿","\\amalg");k(T,I,lt,"&","\\And");k(T,I,W,"⟵","\\longleftarrow",!0);k(T,I,W,"⇐","\\Leftarrow",!0);k(T,I,W,"⟸","\\Longleftarrow",!0);k(T,I,W,"⟶","\\longrightarrow",!0);k(T,I,W,"⇒","\\Rightarrow",!0);k(T,I,W,"⟹","\\Longrightarrow",!0);k(T,I,W,"↔","\\leftrightarrow",!0);k(T,I,W,"⟷","\\longleftrightarrow",!0);k(T,I,W,"⇔","\\Leftrightarrow",!0);k(T,I,W,"⟺","\\Longleftrightarrow",!0);k(T,I,W,"↦","\\mapsto",!0);k(T,I,W,"⟼","\\longmapsto",!0);k(T,I,W,"↗","\\nearrow",!0);k(T,I,W,"↩","\\hookleftarrow",!0);k(T,I,W,"↪","\\hookrightarrow",!0);k(T,I,W,"↘","\\searrow",!0);k(T,I,W,"↼","\\leftharpoonup",!0);k(T,I,W,"⇀","\\rightharpoonup",!0);k(T,I,W,"↙","\\swarrow",!0);k(T,I,W,"↽","\\leftharpoondown",!0);k(T,I,W,"⇁","\\rightharpoondown",!0);k(T,I,W,"↖","\\nwarrow",!0);k(T,I,W,"⇌","\\rightleftharpoons",!0);k(T,U,W,"≮","\\nless",!0);k(T,U,W,"","\\@nleqslant");k(T,U,W,"","\\@nleqq");k(T,U,W,"⪇","\\lneq",!0);k(T,U,W,"≨","\\lneqq",!0);k(T,U,W,"","\\@lvertneqq");k(T,U,W,"⋦","\\lnsim",!0);k(T,U,W,"⪉","\\lnapprox",!0);k(T,U,W,"⊀","\\nprec",!0);k(T,U,W,"⋠","\\npreceq",!0);k(T,U,W,"⋨","\\precnsim",!0);k(T,U,W,"⪹","\\precnapprox",!0);k(T,U,W,"≁","\\nsim",!0);k(T,U,W,"","\\@nshortmid");k(T,U,W,"∤","\\nmid",!0);k(T,U,W,"⊬","\\nvdash",!0);k(T,U,W,"⊭","\\nvDash",!0);k(T,U,W,"⋪","\\ntriangleleft");k(T,U,W,"⋬","\\ntrianglelefteq",!0);k(T,U,W,"⊊","\\subsetneq",!0);k(T,U,W,"","\\@varsubsetneq");k(T,U,W,"⫋","\\subsetneqq",!0);k(T,U,W,"","\\@varsubsetneqq");k(T,U,W,"≯","\\ngtr",!0);k(T,U,W,"","\\@ngeqslant");k(T,U,W,"","\\@ngeqq");k(T,U,W,"⪈","\\gneq",!0);k(T,U,W,"≩","\\gneqq",!0);k(T,U,W,"","\\@gvertneqq");k(T,U,W,"⋧","\\gnsim",!0);k(T,U,W,"⪊","\\gnapprox",!0);k(T,U,W,"⊁","\\nsucc",!0);k(T,U,W,"⋡","\\nsucceq",!0);k(T,U,W,"⋩","\\succnsim",!0);k(T,U,W,"⪺","\\succnapprox",!0);k(T,U,W,"≆","\\ncong",!0);k(T,U,W,"","\\@nshortparallel");k(T,U,W,"∦","\\nparallel",!0);k(T,U,W,"⊯","\\nVDash",!0);k(T,U,W,"⋫","\\ntriangleright");k(T,U,W,"⋭","\\ntrianglerighteq",!0);k(T,U,W,"","\\@nsupseteqq");k(T,U,W,"⊋","\\supsetneq",!0);k(T,U,W,"","\\@varsupsetneq");k(T,U,W,"⫌","\\supsetneqq",!0);k(T,U,W,"","\\@varsupsetneqq");k(T,U,W,"⊮","\\nVdash",!0);k(T,U,W,"⪵","\\precneqq",!0);k(T,U,W,"⪶","\\succneqq",!0);k(T,U,W,"","\\@nsubseteqq");k(T,U,lt,"⊴","\\unlhd");k(T,U,lt,"⊵","\\unrhd");k(T,U,W,"↚","\\nleftarrow",!0);k(T,U,W,"↛","\\nrightarrow",!0);k(T,U,W,"⇍","\\nLeftarrow",!0);k(T,U,W,"⇏","\\nRightarrow",!0);k(T,U,W,"↮","\\nleftrightarrow",!0);k(T,U,W,"⇎","\\nLeftrightarrow",!0);k(T,U,W,"△","\\vartriangle");k(T,U,Z,"ℏ","\\hslash");k(T,U,Z,"▽","\\triangledown");k(T,U,Z,"◊","\\lozenge");k(T,U,Z,"Ⓢ","\\circledS");k(T,U,Z,"®","\\circledR");k(Ce,U,Z,"®","\\circledR");k(T,U,Z,"∡","\\measuredangle",!0);k(T,U,Z,"∄","\\nexists");k(T,U,Z,"℧","\\mho");k(T,U,Z,"Ⅎ","\\Finv",!0);k(T,U,Z,"⅁","\\Game",!0);k(T,U,Z,"‵","\\backprime");k(T,U,Z,"▲","\\blacktriangle");k(T,U,Z,"▼","\\blacktriangledown");k(T,U,Z,"■","\\blacksquare");k(T,U,Z,"⧫","\\blacklozenge");k(T,U,Z,"★","\\bigstar");k(T,U,Z,"∢","\\sphericalangle",!0);k(T,U,Z,"∁","\\complement",!0);k(T,U,Z,"ð","\\eth",!0);k(Ce,I,Z,"ð","ð");k(T,U,Z,"╱","\\diagup");k(T,U,Z,"╲","\\diagdown");k(T,U,Z,"□","\\square");k(T,U,Z,"□","\\Box");k(T,U,Z,"◊","\\Diamond");k(T,U,Z,"¥","\\yen",!0);k(Ce,U,Z,"¥","\\yen",!0);k(T,U,Z,"✓","\\checkmark",!0);k(Ce,U,Z,"✓","\\checkmark");k(T,U,Z,"ℶ","\\beth",!0);k(T,U,Z,"ℸ","\\daleth",!0);k(T,U,Z,"ℷ","\\gimel",!0);k(T,U,Z,"ϝ","\\digamma",!0);k(T,U,Z,"ϰ","\\varkappa");k(T,U,Ii,"┌","\\@ulcorner",!0);k(T,U,qs,"┐","\\@urcorner",!0);k(T,U,Ii,"└","\\@llcorner",!0);k(T,U,qs,"┘","\\@lrcorner",!0);k(T,U,W,"≦","\\leqq",!0);k(T,U,W,"⩽","\\leqslant",!0);k(T,U,W,"⪕","\\eqslantless",!0);k(T,U,W,"≲","\\lesssim",!0);k(T,U,W,"⪅","\\lessapprox",!0);k(T,U,W,"≊","\\approxeq",!0);k(T,U,lt,"⋖","\\lessdot");k(T,U,W,"⋘","\\lll",!0);k(T,U,W,"≶","\\lessgtr",!0);k(T,U,W,"⋚","\\lesseqgtr",!0);k(T,U,W,"⪋","\\lesseqqgtr",!0);k(T,U,W,"≑","\\doteqdot");k(T,U,W,"≓","\\risingdotseq",!0);k(T,U,W,"≒","\\fallingdotseq",!0);k(T,U,W,"∽","\\backsim",!0);k(T,U,W,"⋍","\\backsimeq",!0);k(T,U,W,"⫅","\\subseteqq",!0);k(T,U,W,"⋐","\\Subset",!0);k(T,U,W,"⊏","\\sqsubset",!0);k(T,U,W,"≼","\\preccurlyeq",!0);k(T,U,W,"⋞","\\curlyeqprec",!0);k(T,U,W,"≾","\\precsim",!0);k(T,U,W,"⪷","\\precapprox",!0);k(T,U,W,"⊲","\\vartriangleleft");k(T,U,W,"⊴","\\trianglelefteq");k(T,U,W,"⊨","\\vDash",!0);k(T,U,W,"⊪","\\Vvdash",!0);k(T,U,W,"⌣","\\smallsmile");k(T,U,W,"⌢","\\smallfrown");k(T,U,W,"≏","\\bumpeq",!0);k(T,U,W,"≎","\\Bumpeq",!0);k(T,U,W,"≧","\\geqq",!0);k(T,U,W,"⩾","\\geqslant",!0);k(T,U,W,"⪖","\\eqslantgtr",!0);k(T,U,W,"≳","\\gtrsim",!0);k(T,U,W,"⪆","\\gtrapprox",!0);k(T,U,lt,"⋗","\\gtrdot");k(T,U,W,"⋙","\\ggg",!0);k(T,U,W,"≷","\\gtrless",!0);k(T,U,W,"⋛","\\gtreqless",!0);k(T,U,W,"⪌","\\gtreqqless",!0);k(T,U,W,"≖","\\eqcirc",!0);k(T,U,W,"≗","\\circeq",!0);k(T,U,W,"≜","\\triangleq",!0);k(T,U,W,"∼","\\thicksim");k(T,U,W,"≈","\\thickapprox");k(T,U,W,"⫆","\\supseteqq",!0);k(T,U,W,"⋑","\\Supset",!0);k(T,U,W,"⊐","\\sqsupset",!0);k(T,U,W,"≽","\\succcurlyeq",!0);k(T,U,W,"⋟","\\curlyeqsucc",!0);k(T,U,W,"≿","\\succsim",!0);k(T,U,W,"⪸","\\succapprox",!0);k(T,U,W,"⊳","\\vartriangleright");k(T,U,W,"⊵","\\trianglerighteq");k(T,U,W,"⊩","\\Vdash",!0);k(T,U,W,"∣","\\shortmid");k(T,U,W,"∥","\\shortparallel");k(T,U,W,"≬","\\between",!0);k(T,U,W,"⋔","\\pitchfork",!0);k(T,U,W,"∝","\\varpropto");k(T,U,W,"◀","\\blacktriangleleft");k(T,U,W,"∴","\\therefore",!0);k(T,U,W,"∍","\\backepsilon");k(T,U,W,"▶","\\blacktriangleright");k(T,U,W,"∵","\\because",!0);k(T,U,W,"⋘","\\llless");k(T,U,W,"⋙","\\gggtr");k(T,U,lt,"⊲","\\lhd");k(T,U,lt,"⊳","\\rhd");k(T,U,W,"≂","\\eqsim",!0);k(T,I,W,"⋈","\\Join");k(T,U,W,"≑","\\Doteq",!0);k(T,U,lt,"∔","\\dotplus",!0);k(T,U,lt,"∖","\\smallsetminus");k(T,U,lt,"⋒","\\Cap",!0);k(T,U,lt,"⋓","\\Cup",!0);k(T,U,lt,"⩞","\\doublebarwedge",!0);k(T,U,lt,"⊟","\\boxminus",!0);k(T,U,lt,"⊞","\\boxplus",!0);k(T,U,lt,"⋇","\\divideontimes",!0);k(T,U,lt,"⋉","\\ltimes",!0);k(T,U,lt,"⋊","\\rtimes",!0);k(T,U,lt,"⋋","\\leftthreetimes",!0);k(T,U,lt,"⋌","\\rightthreetimes",!0);k(T,U,lt,"⋏","\\curlywedge",!0);k(T,U,lt,"⋎","\\curlyvee",!0);k(T,U,lt,"⊝","\\circleddash",!0);k(T,U,lt,"⊛","\\circledast",!0);k(T,U,lt,"⋅","\\centerdot");k(T,U,lt,"⊺","\\intercal",!0);k(T,U,lt,"⋒","\\doublecap");k(T,U,lt,"⋓","\\doublecup");k(T,U,lt,"⊠","\\boxtimes",!0);k(T,U,W,"⇢","\\dashrightarrow",!0);k(T,U,W,"⇠","\\dashleftarrow",!0);k(T,U,W,"⇇","\\leftleftarrows",!0);k(T,U,W,"⇆","\\leftrightarrows",!0);k(T,U,W,"⇚","\\Lleftarrow",!0);k(T,U,W,"↞","\\twoheadleftarrow",!0);k(T,U,W,"↢","\\leftarrowtail",!0);k(T,U,W,"↫","\\looparrowleft",!0);k(T,U,W,"⇋","\\leftrightharpoons",!0);k(T,U,W,"↶","\\curvearrowleft",!0);k(T,U,W,"↺","\\circlearrowleft",!0);k(T,U,W,"↰","\\Lsh",!0);k(T,U,W,"⇈","\\upuparrows",!0);k(T,U,W,"↿","\\upharpoonleft",!0);k(T,U,W,"⇃","\\downharpoonleft",!0);k(T,I,W,"⊶","\\origof",!0);k(T,I,W,"⊷","\\imageof",!0);k(T,U,W,"⊸","\\multimap",!0);k(T,U,W,"↭","\\leftrightsquigarrow",!0);k(T,U,W,"⇉","\\rightrightarrows",!0);k(T,U,W,"⇄","\\rightleftarrows",!0);k(T,U,W,"↠","\\twoheadrightarrow",!0);k(T,U,W,"↣","\\rightarrowtail",!0);k(T,U,W,"↬","\\looparrowright",!0);k(T,U,W,"↷","\\curvearrowright",!0);k(T,U,W,"↻","\\circlearrowright",!0);k(T,U,W,"↱","\\Rsh",!0);k(T,U,W,"⇊","\\downdownarrows",!0);k(T,U,W,"↾","\\upharpoonright",!0);k(T,U,W,"⇂","\\downharpoonright",!0);k(T,U,W,"⇝","\\rightsquigarrow",!0);k(T,U,W,"⇝","\\leadsto");k(T,U,W,"⇛","\\Rrightarrow",!0);k(T,U,W,"↾","\\restriction");k(T,I,Z,"‘","`");k(T,I,Z,"$","\\$");k(Ce,I,Z,"$","\\$");k(Ce,I,Z,"$","\\textdollar");k(T,I,Z,"%","\\%");k(Ce,I,Z,"%","\\%");k(T,I,Z,"_","\\_");k(Ce,I,Z,"_","\\_");k(Ce,I,Z,"_","\\textunderscore");k(T,I,Z,"∠","\\angle",!0);k(T,I,Z,"∞","\\infty",!0);k(T,I,Z,"′","\\prime");k(T,I,Z,"△","\\triangle");k(T,I,Z,"Γ","\\Gamma",!0);k(T,I,Z,"Δ","\\Delta",!0);k(T,I,Z,"Θ","\\Theta",!0);k(T,I,Z,"Λ","\\Lambda",!0);k(T,I,Z,"Ξ","\\Xi",!0);k(T,I,Z,"Π","\\Pi",!0);k(T,I,Z,"Σ","\\Sigma",!0);k(T,I,Z,"Υ","\\Upsilon",!0);k(T,I,Z,"Φ","\\Phi",!0);k(T,I,Z,"Ψ","\\Psi",!0);k(T,I,Z,"Ω","\\Omega",!0);k(T,I,Z,"A","Α");k(T,I,Z,"B","Β");k(T,I,Z,"E","Ε");k(T,I,Z,"Z","Ζ");k(T,I,Z,"H","Η");k(T,I,Z,"I","Ι");k(T,I,Z,"K","Κ");k(T,I,Z,"M","Μ");k(T,I,Z,"N","Ν");k(T,I,Z,"O","Ο");k(T,I,Z,"P","Ρ");k(T,I,Z,"T","Τ");k(T,I,Z,"X","Χ");k(T,I,Z,"¬","\\neg",!0);k(T,I,Z,"¬","\\lnot");k(T,I,Z,"⊤","\\top");k(T,I,Z,"⊥","\\bot");k(T,I,Z,"∅","\\emptyset");k(T,U,Z,"∅","\\varnothing");k(T,I,It,"α","\\alpha",!0);k(T,I,It,"β","\\beta",!0);k(T,I,It,"γ","\\gamma",!0);k(T,I,It,"δ","\\delta",!0);k(T,I,It,"ϵ","\\epsilon",!0);k(T,I,It,"ζ","\\zeta",!0);k(T,I,It,"η","\\eta",!0);k(T,I,It,"θ","\\theta",!0);k(T,I,It,"ι","\\iota",!0);k(T,I,It,"κ","\\kappa",!0);k(T,I,It,"λ","\\lambda",!0);k(T,I,It,"μ","\\mu",!0);k(T,I,It,"ν","\\nu",!0);k(T,I,It,"ξ","\\xi",!0);k(T,I,It,"ο","\\omicron",!0);k(T,I,It,"π","\\pi",!0);k(T,I,It,"ρ","\\rho",!0);k(T,I,It,"σ","\\sigma",!0);k(T,I,It,"τ","\\tau",!0);k(T,I,It,"υ","\\upsilon",!0);k(T,I,It,"ϕ","\\phi",!0);k(T,I,It,"χ","\\chi",!0);k(T,I,It,"ψ","\\psi",!0);k(T,I,It,"ω","\\omega",!0);k(T,I,It,"ε","\\varepsilon",!0);k(T,I,It,"ϑ","\\vartheta",!0);k(T,I,It,"ϖ","\\varpi",!0);k(T,I,It,"ϱ","\\varrho",!0);k(T,I,It,"ς","\\varsigma",!0);k(T,I,It,"φ","\\varphi",!0);k(T,I,lt,"∗","*",!0);k(T,I,lt,"+","+");k(T,I,lt,"−","-",!0);k(T,I,lt,"⋅","\\cdot",!0);k(T,I,lt,"∘","\\circ",!0);k(T,I,lt,"÷","\\div",!0);k(T,I,lt,"±","\\pm",!0);k(T,I,lt,"×","\\times",!0);k(T,I,lt,"∩","\\cap",!0);k(T,I,lt,"∪","\\cup",!0);k(T,I,lt,"∖","\\setminus",!0);k(T,I,lt,"∧","\\land");k(T,I,lt,"∨","\\lor");k(T,I,lt,"∧","\\wedge",!0);k(T,I,lt,"∨","\\vee",!0);k(T,I,Z,"√","\\surd");k(T,I,Ii,"⟨","\\langle",!0);k(T,I,Ii,"∣","\\lvert");k(T,I,Ii,"∥","\\lVert");k(T,I,qs,"?","?");k(T,I,qs,"!","!");k(T,I,qs,"⟩","\\rangle",!0);k(T,I,qs,"∣","\\rvert");k(T,I,qs,"∥","\\rVert");k(T,I,W,"=","=");k(T,I,W,":",":");k(T,I,W,"≈","\\approx",!0);k(T,I,W,"≅","\\cong",!0);k(T,I,W,"≥","\\ge");k(T,I,W,"≥","\\geq",!0);k(T,I,W,"←","\\gets");k(T,I,W,">","\\gt",!0);k(T,I,W,"∈","\\in",!0);k(T,I,W,"","\\@not");k(T,I,W,"⊂","\\subset",!0);k(T,I,W,"⊃","\\supset",!0);k(T,I,W,"⊆","\\subseteq",!0);k(T,I,W,"⊇","\\supseteq",!0);k(T,U,W,"⊈","\\nsubseteq",!0);k(T,U,W,"⊉","\\nsupseteq",!0);k(T,I,W,"⊨","\\models");k(T,I,W,"←","\\leftarrow",!0);k(T,I,W,"≤","\\le");k(T,I,W,"≤","\\leq",!0);k(T,I,W,"<","\\lt",!0);k(T,I,W,"→","\\rightarrow",!0);k(T,I,W,"→","\\to");k(T,U,W,"≱","\\ngeq",!0);k(T,U,W,"≰","\\nleq",!0);k(T,I,Za," ","\\ ");k(T,I,Za," ","\\space");k(T,I,Za," ","\\nobreakspace");k(Ce,I,Za," ","\\ ");k(Ce,I,Za," "," ");k(Ce,I,Za," ","\\space");k(Ce,I,Za," ","\\nobreakspace");k(T,I,Za,"","\\nobreak");k(T,I,Za,"","\\allowbreak");k(T,I,dm,",",",");k(T,I,dm,";",";");k(T,U,lt,"⊼","\\barwedge",!0);k(T,U,lt,"⊻","\\veebar",!0);k(T,I,lt,"⊙","\\odot",!0);k(T,I,lt,"⊕","\\oplus",!0);k(T,I,lt,"⊗","\\otimes",!0);k(T,I,Z,"∂","\\partial",!0);k(T,I,lt,"⊘","\\oslash",!0);k(T,U,lt,"⊚","\\circledcirc",!0);k(T,U,lt,"⊡","\\boxdot",!0);k(T,I,lt,"△","\\bigtriangleup");k(T,I,lt,"▽","\\bigtriangledown");k(T,I,lt,"†","\\dagger");k(T,I,lt,"⋄","\\diamond");k(T,I,lt,"⋆","\\star");k(T,I,lt,"◃","\\triangleleft");k(T,I,lt,"▹","\\triangleright");k(T,I,Ii,"{","\\{");k(Ce,I,Z,"{","\\{");k(Ce,I,Z,"{","\\textbraceleft");k(T,I,qs,"}","\\}");k(Ce,I,Z,"}","\\}");k(Ce,I,Z,"}","\\textbraceright");k(T,I,Ii,"{","\\lbrace");k(T,I,qs,"}","\\rbrace");k(T,I,Ii,"[","\\lbrack",!0);k(Ce,I,Z,"[","\\lbrack",!0);k(T,I,qs,"]","\\rbrack",!0);k(Ce,I,Z,"]","\\rbrack",!0);k(T,I,Ii,"(","\\lparen",!0);k(T,I,qs,")","\\rparen",!0);k(Ce,I,Z,"<","\\textless",!0);k(Ce,I,Z,">","\\textgreater",!0);k(T,I,Ii,"⌊","\\lfloor",!0);k(T,I,qs,"⌋","\\rfloor",!0);k(T,I,Ii,"⌈","\\lceil",!0);k(T,I,qs,"⌉","\\rceil",!0);k(T,I,Z,"\\","\\backslash");k(T,I,Z,"∣","|");k(T,I,Z,"∣","\\vert");k(Ce,I,Z,"|","\\textbar",!0);k(T,I,Z,"∥","\\|");k(T,I,Z,"∥","\\Vert");k(Ce,I,Z,"∥","\\textbardbl");k(Ce,I,Z,"~","\\textasciitilde");k(Ce,I,Z,"\\","\\textbackslash");k(Ce,I,Z,"^","\\textasciicircum");k(T,I,W,"↑","\\uparrow",!0);k(T,I,W,"⇑","\\Uparrow",!0);k(T,I,W,"↓","\\downarrow",!0);k(T,I,W,"⇓","\\Downarrow",!0);k(T,I,W,"↕","\\updownarrow",!0);k(T,I,W,"⇕","\\Updownarrow",!0);k(T,I,Mr,"∐","\\coprod");k(T,I,Mr,"⋁","\\bigvee");k(T,I,Mr,"⋀","\\bigwedge");k(T,I,Mr,"⨄","\\biguplus");k(T,I,Mr,"⋂","\\bigcap");k(T,I,Mr,"⋃","\\bigcup");k(T,I,Mr,"∫","\\int");k(T,I,Mr,"∫","\\intop");k(T,I,Mr,"∬","\\iint");k(T,I,Mr,"∭","\\iiint");k(T,I,Mr,"∏","\\prod");k(T,I,Mr,"∑","\\sum");k(T,I,Mr,"⨂","\\bigotimes");k(T,I,Mr,"⨁","\\bigoplus");k(T,I,Mr,"⨀","\\bigodot");k(T,I,Mr,"∮","\\oint");k(T,I,Mr,"∯","\\oiint");k(T,I,Mr,"∰","\\oiiint");k(T,I,Mr,"⨆","\\bigsqcup");k(T,I,Mr,"∫","\\smallint");k(Ce,I,Mh,"…","\\textellipsis");k(T,I,Mh,"…","\\mathellipsis");k(Ce,I,Mh,"…","\\ldots",!0);k(T,I,Mh,"…","\\ldots",!0);k(T,I,Mh,"⋯","\\@cdots",!0);k(T,I,Mh,"⋱","\\ddots",!0);k(T,I,Z,"⋮","\\varvdots");k(Ce,I,Z,"⋮","\\varvdots");k(T,I,tr,"ˊ","\\acute");k(T,I,tr,"ˋ","\\grave");k(T,I,tr,"¨","\\ddot");k(T,I,tr,"~","\\tilde");k(T,I,tr,"ˉ","\\bar");k(T,I,tr,"˘","\\breve");k(T,I,tr,"ˇ","\\check");k(T,I,tr,"^","\\hat");k(T,I,tr,"⃗","\\vec");k(T,I,tr,"˙","\\dot");k(T,I,tr,"˚","\\mathring");k(T,I,It,"","\\@imath");k(T,I,It,"","\\@jmath");k(T,I,Z,"ı","ı");k(T,I,Z,"ȷ","ȷ");k(Ce,I,Z,"ı","\\i",!0);k(Ce,I,Z,"ȷ","\\j",!0);k(Ce,I,Z,"ß","\\ss",!0);k(Ce,I,Z,"æ","\\ae",!0);k(Ce,I,Z,"œ","\\oe",!0);k(Ce,I,Z,"ø","\\o",!0);k(Ce,I,Z,"Æ","\\AE",!0);k(Ce,I,Z,"Œ","\\OE",!0);k(Ce,I,Z,"Ø","\\O",!0);k(Ce,I,tr,"ˊ","\\'");k(Ce,I,tr,"ˋ","\\`");k(Ce,I,tr,"ˆ","\\^");k(Ce,I,tr,"˜","\\~");k(Ce,I,tr,"ˉ","\\=");k(Ce,I,tr,"˘","\\u");k(Ce,I,tr,"˙","\\.");k(Ce,I,tr,"¸","\\c");k(Ce,I,tr,"˚","\\r");k(Ce,I,tr,"ˇ","\\v");k(Ce,I,tr,"¨",'\\"');k(Ce,I,tr,"˝","\\H");k(Ce,I,tr,"◯","\\textcircled");var cR={"--":!0,"---":!0,"``":!0,"''":!0};k(Ce,I,Z,"–","--",!0);k(Ce,I,Z,"–","\\textendash");k(Ce,I,Z,"—","---",!0);k(Ce,I,Z,"—","\\textemdash");k(Ce,I,Z,"‘","`",!0);k(Ce,I,Z,"‘","\\textquoteleft");k(Ce,I,Z,"’","'",!0);k(Ce,I,Z,"’","\\textquoteright");k(Ce,I,Z,"“","``",!0);k(Ce,I,Z,"“","\\textquotedblleft");k(Ce,I,Z,"”","''",!0);k(Ce,I,Z,"”","\\textquotedblright");k(T,I,Z,"°","\\degree",!0);k(Ce,I,Z,"°","\\degree");k(Ce,I,Z,"°","\\textdegree",!0);k(T,I,Z,"£","\\pounds");k(T,I,Z,"£","\\mathsterling",!0);k(Ce,I,Z,"£","\\pounds");k(Ce,I,Z,"£","\\textsterling",!0);k(T,U,Z,"✠","\\maltese");k(Ce,U,Z,"✠","\\maltese");var t7='0123456789/@."';for(var P2=0;P2<t7.length;P2++){var n7=t7.charAt(P2);k(T,I,Z,n7,n7)}var r7='0123456789!@*()-=+";:?/.,';for(var z2=0;z2<r7.length;z2++){var s7=r7.charAt(z2);k(Ce,I,Z,s7,s7)}var d1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var $2=0;$2<d1.length;$2++){var sp=d1.charAt($2);k(T,I,It,sp,sp),k(Ce,I,Z,sp,sp)}k(T,U,Z,"C","ℂ");k(Ce,U,Z,"C","ℂ");k(T,U,Z,"H","ℍ");k(Ce,U,Z,"H","ℍ");k(T,U,Z,"N","ℕ");k(Ce,U,Z,"N","ℕ");k(T,U,Z,"P","ℙ");k(Ce,U,Z,"P","ℙ");k(T,U,Z,"Q","ℚ");k(Ce,U,Z,"Q","ℚ");k(T,U,Z,"R","ℝ");k(Ce,U,Z,"R","ℝ");k(T,U,Z,"Z","ℤ");k(Ce,U,Z,"Z","ℤ");k(T,I,It,"h","ℎ");k(Ce,I,It,"h","ℎ");var Lt;for(var Ms=0;Ms<d1.length;Ms++){var ir=d1.charAt(Ms);Lt=String.fromCharCode(55349,56320+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56372+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56424+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56580+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56684+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56736+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56788+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56840+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56944+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Ms<26&&(Lt=String.fromCharCode(55349,56632+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt),Lt=String.fromCharCode(55349,56476+Ms),k(T,I,It,ir,Lt),k(Ce,I,Z,ir,Lt))}Lt="𝕜";k(T,I,It,"k",Lt);k(Ce,I,Z,"k",Lt);for(var Rc=0;Rc<10;Rc++){var pl=Rc.toString();Lt=String.fromCharCode(55349,57294+Rc),k(T,I,It,pl,Lt),k(Ce,I,Z,pl,Lt),Lt=String.fromCharCode(55349,57314+Rc),k(T,I,It,pl,Lt),k(Ce,I,Z,pl,Lt),Lt=String.fromCharCode(55349,57324+Rc),k(T,I,It,pl,Lt),k(Ce,I,Z,pl,Lt),Lt=String.fromCharCode(55349,57334+Rc),k(T,I,It,pl,Lt),k(Ce,I,Z,pl,Lt)}var Sv="ÐÞþ";for(var q2=0;q2<Sv.length;q2++){var ip=Sv.charAt(q2);k(T,I,It,ip,ip),k(Ce,I,Z,ip,ip)}var Tv={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},i7={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},o7={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},TJ={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},Kc={mathClass:"",textClass:"",font:""},a7={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},l7={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},c7={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Cv={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Av={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},u7={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Ev={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},d7=[Tv,Tv,i7,i7,o7,o7,TJ,Kc,Kc,Kc,a7,a7,l7,l7,c7,c7,Cv,Cv,Av,Av,u7,u7,Kc,Kc,Ev,Ev],CJ=[Tv,Kc,Cv,Av,Ev],AJ=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 d7[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return CJ[i]}else{if(r===120485||r===120486)return d7[0];if(120486<r&&r<120782)return Kc;throw new Pe("Unsupported character: "+e)}},Ey=function(t,n,r){if(er[r][t]){var s=er[r][t].replace;s&&(t=s)}return{value:t,metrics:Q_(t,n,r)}},Is=function(t,n,r,s,i){var o=Ey(t,n,r),a=o.metrics;t=o.value;var l;if(a){var c=a.italic;(r==="text"||s&&s.font==="mathit")&&(c=0),l=new Ni(t,a.height,a.depth,c,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+r+"'")),l=new Ni(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},J_=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&Ey(t,"Main-Bold",n).metrics?Is(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||er[n][t].font==="main"?Is(t,"Main-Regular",n,r,s):Is(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},EJ=function(t,n,r){return r!=="textord"&&Ey(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},My=function(t,n,r){var s=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:u}=n,d=s==="math"||s==="text"&&!!a,f=d?a:l,m="",p="";if(i.charCodeAt(0)===55349){var y=AJ(i);m=y.font,p=y[s+"Class"]}if(m)return Is(i,m,s,n,o.concat(p));if(f){var x,b;if(f==="boldsymbol"){var w=EJ(i,s,r);x=w.fontName,b=[w.fontClass]}else d?(x=Mv[a].fontName,b=[a]):(x=op(l,c,u),b=[l,c,u]);if(Ey(i,x,s).metrics)return Is(i,x,s,n,o.concat(b));if(cR.hasOwnProperty(i)&&x.slice(0,10)==="Typewriter"){for(var v=[],_=0;_<i.length;_++)v.push(Is(i[_],x,s,n,o.concat(b)));return el(v)}}if(r==="mathord")return Is(i,"Math-Italic",s,n,o.concat(["mathnormal"]));if(r==="textord"){var S=er[s][i]&&er[s][i].font;if(S==="ams"){var C=op("amsrm",c,u);return Is(i,C,s,n,o.concat("amsrm",c,u))}else if(S==="main"||!S){var E=op("textrm",c,u);return Is(i,E,s,n,o.concat(c,u))}else{var R=op(S,c,u);return Is(i,R,s,n,o.concat(R,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},MJ=(e,t)=>{if(sc(e.classes)!==sc(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},uR=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof Ni&&r instanceof Ni&&MJ(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},Z_=function(t){for(var n=0,r=0,s=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}t.height=n,t.depth=r,t.maxFontSize=s},Ie=function(t,n,r,s){var i=new Eh(t,n,r,s);return Z_(i),i},oc=(e,t,n,r)=>new Eh(e,t,n,r),rh=function(t,n,r){var s=Ie([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ue(s.height),s.maxFontSize=1,s},NJ=function(t,n,r,s){var i=new Ay(t,n,r,s);return Z_(i),i},el=function(t){var n=new Ah(t);return Z_(n),n},sh=function(t,n){return t instanceof Ah?Ie([],[t],n):t},IJ=function(t){if(t.positionType==="individualShift"){for(var n=t.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,o=1;o<n.length;o++){var a=-n[o].shift-i-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,r.push({type:"kern",size:l}),r.push(n[o])}return{children:r,depth:s}}var c;if(t.positionType==="top"){for(var u=t.positionData,d=0;d<t.children.length;d++){var f=t.children[d];u-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=u}else if(t.positionType==="bottom")c=-t.positionData;else{var m=t.children[0];if(m.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")c=-m.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")c=-m.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:c}},bn=function(t,n){for(var{children:r,depth:s}=IJ(t),i=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=Ie(["pstrut"],[]);c.style.height=Ue(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 x=y.elem,b=y.wrapperClasses||[],w=y.wrapperStyle||{},v=Ie(b,[c,x],void 0,w);v.style.top=Ue(-i-m-x.depth),y.marginLeft&&(v.style.marginLeft=y.marginLeft),y.marginRight&&(v.style.marginRight=y.marginRight),u.push(v),m+=x.height+x.depth}d=Math.min(d,m),f=Math.max(f,m)}var _=Ie(["vlist"],u);_.style.height=Ue(f);var S;if(d<0){var C=Ie([],[]),E=Ie(["vlist"],[C]);E.style.height=Ue(-d);var R=Ie(["vlist-s"],[new Ni("​")]);S=[Ie(["vlist-r"],[_,R]),Ie(["vlist-r"],[E])]}else S=[Ie(["vlist-r"],[_])];var j=Ie(["vlist-t"],S);return S.length===2&&j.classes.push("vlist-t2"),j.height=f,j.depth=-d,j},dR=(e,t)=>{var n=Ie(["mspace"],[],t),r=sr(e,t);return n.style.marginRight=Ue(r),n},op=(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},Mv={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"}},hR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},fR=function(t,n){var[r,s,i]=hR[t],o=new ic(r),a=new Wa([o],{width:Ue(s),height:Ue(i),style:"width:"+Ue(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=oc(["overlay"],[a],n);return l.height=i,l.style.height=Ue(i),l.style.width=Ue(s),l},nr={number:3,unit:"mu"},jc={number:4,unit:"mu"},ga={number:5,unit:"mu"},RJ={mord:{mop:nr,mbin:jc,mrel:ga,minner:nr},mop:{mord:nr,mop:nr,mrel:ga,minner:nr},mbin:{mord:jc,mop:jc,mopen:jc,minner:jc},mrel:{mord:ga,mop:ga,mopen:ga,minner:ga},mopen:{},mclose:{mop:nr,mbin:jc,mrel:ga,minner:nr},mpunct:{mord:nr,mop:nr,mrel:ga,mopen:nr,mclose:nr,mpunct:nr,minner:nr},minner:{mord:nr,mop:nr,mbin:jc,mrel:ga,mopen:nr,mpunct:nr,minner:nr}},jJ={mord:{mop:nr},mop:{mord:nr,mop:nr},mbin:{},mrel:{},mopen:{},mclose:{mop:nr},mpunct:{},minner:{mop:nr}},mR={},h1={},f1={};function tt(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},l=0;l<n.length;++l)mR[n[l]]=a;t&&(i&&(h1[t]=i),o&&(f1[t]=o))}function Du(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;tt({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var m1=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Ar=function(t){return t.type==="ordgroup"?t.body:[t]},LJ=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),DJ=new Set(["rightmost","mrel","mclose","mpunct"]),OJ={display:zt.DISPLAY,text:zt.TEXT,script:zt.SCRIPT,scriptscript:zt.SCRIPTSCRIPT},BJ={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},qr=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=vn(t[o],n);if(a instanceof Ah){var l=a.children;i.push(...l)}else i.push(a)}if(uR(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(OJ[u.style]))}var d=Ie([s[0]||"leftmost"],[],n),f=Ie([s[1]||"rightmost"],[],n),m=r==="root";return Nv(i,(p,y)=>{var x=y.classes[0],b=p.classes[0];x==="mbin"&&DJ.has(b)?y.classes[0]="mord":b==="mbin"&&LJ.has(x)&&(p.classes[0]="mord")},{node:d},f,m),Nv(i,(p,y)=>{var x,b,w=Rv(y),v=Rv(p),_=w&&v?p.hasClass("mtight")?(x=jJ[w])==null?void 0:x[v]:(b=RJ[w])==null?void 0:b[v]:null;if(_)return dR(_,c)},{node:d},f,m),i},Nv=function(t,n,r,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var a=t[o],l=pR(a);if(l){Nv(l.children,n,r,null,i);continue}var c=!a.hasClass("mspace");if(c){var u=n(a,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),o++))}c?r.node=a:i&&a.hasClass("newline")&&(r.node=Ie(["leftmost"])),r.insertAfter=(d=>f=>{t.splice(d+1,0,f),o++})(o)}s&&t.pop()},pR=function(t){return t instanceof Ah||t instanceof Ay||t instanceof Eh&&t.hasClass("enclosing")?t:null},Iv=function(t,n){var r=pR(t);if(r){var s=r.children;if(s.length){if(n==="right")return Iv(s[s.length-1],"right");if(n==="left")return Iv(s[0],"left")}}return t},Rv=function(t,n){if(!t)return null;n&&(t=Iv(t,n));var r=t.classes[0];return BJ[r]||null},A0=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return Ie(n.concat(r))},vn=function(t,n,r){if(!t)return Ie();if(h1[t.type]){var s=h1[t.type](t,n);if(r&&n.size!==r.size){s=Ie(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Pe("Got group of unknown type: '"+t.type+"'")};function ap(e,t){var n=Ie(["base"],e,t),r=Ie(["strut"]);return r.style.height=Ue(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ue(-n.depth)),n.children.unshift(r),n}function jv(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=qr(e,t,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(i.push(ap(o,t)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(ap(o,t)),o=[]),i.push(r[a]));o.length>0&&i.push(ap(o,t));var c;n?(c=ap(qr(n,t,!0),t),c.classes=["tag"],i.push(c)):s&&i.push(s);var u=Ie(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=Ue(u.height+u.depth),u.depth&&(d.style.verticalAlign=Ue(-u.depth))}return u}function gR(e){return new Ah(e)}class $e{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=sc(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Er&&this.children[r+1]instanceof Er){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Er;)s+=this.children[++r].toText();t.appendChild(new Er(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+=_s(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+_s(sc(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 Er=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return _s(this.toText())}toText(){return this.text}};class yR{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",Ue(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ue(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var PJ=new Set(["\\imath","\\jmath"]),zJ=new Set(["mrow","mtable"]),no=function(t,n,r){return er[n][t]&&er[n][t].replace&&t.charCodeAt(0)!==55349&&!(cR.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=er[n][t].replace),new Er(t)},e5=function(t){return t.length===1?t[0]:new $e("mrow",t)},$J={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"},t5=(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=$J[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(PJ.has(i))return null;if(er[r][i]){var o=er[r][i].replace;o&&(i=o)}var a=Mv[n].fontName;return Q_(i,a,r)?Mv[n].variant:null};function F2(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Er&&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 Er&&n.text===","}else return!1}var Ri=function(t,n,r){if(t.length===1){var s=qn(t[0],n);return r&&s instanceof $e&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<t.length;a++){var l=qn(t[a],n);if(l instanceof $e&&o instanceof $e){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(F2(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&F2(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||F2(o))){var c=l.children[0];c instanceof $e&&c.type==="mn"&&(c.children=[...o.children,...c.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Er&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Er&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),o=l}return i},ac=function(t,n,r){return e5(Ri(t,n,r))},qn=function(t,n){if(!t)return new $e("mrow");if(f1[t.type])return f1[t.type](t,n);throw new Pe("Got group of unknown type: '"+t.type+"'")};function h7(e,t,n,r,s){var i=Ri(e,n),o;i.length===1&&i[0]instanceof $e&&zJ.has(i[0].type)?o=i[0]:o=new $e("mrow",i);var a=new $e("annotation",[new Er(t)]);a.setAttribute("encoding","application/x-tex");var l=new $e("semantics",[o,a]),c=new $e("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=s?"katex":"katex-mathml";return Ie([u],[c])}var qJ=[[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]],f7=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],m7=function(t,n){return n.size<2?t:qJ[t-1][n.size-1]};class Sa{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||Sa.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=f7[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 Sa(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:m7(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:f7[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=m7(Sa.BASESIZE,t);return this.size===n&&this.textSize===Sa.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!==Sa.BASESIZE?["sizing","reset-size"+this.size,"size"+Sa.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=SJ(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Sa.BASESIZE=6;var bR=function(t){return new Sa({style:t.displayMode?zt.DISPLAY:zt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},wR=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=Ie(r,[t])}return t},FJ=function(t,n,r){var s=bR(r),i;if(r.output==="mathml")return h7(t,n,s,r.displayMode,!0);if(r.output==="html"){var o=jv(t,s);i=Ie(["katex"],[o])}else{var a=h7(t,n,s,r.displayMode,!1),l=jv(t,s);i=Ie(["katex"],[a,l])}return wR(i,r)},UJ=function(t,n,r){var s=bR(r),i=jv(t,s),o=Ie(["katex"],[i]);return wR(o,r)},HJ={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":"="},Ny=function(t){var n=new $e("mo",[new Er(HJ[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},VJ={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]},WJ=new Set(["widehat","widecheck","widetilde","utilde"]),Iy=function(t,n){function r(){var a=4e5,l=t.label.slice(1);if(WJ.has(l)&&"base"in t){var c=t.base.type==="ordgroup"?t.base.body.length:1,u,d,f;if(c>5)l==="widehat"||l==="widecheck"?(u=420,a=2364,f=.42,d=l+"4"):(u=312,a=2340,f=.34,d="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],u=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],d=l+m):(a=[0,600,1033,2339,2340][m],u=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],d="tilde"+m)}var p=new ic(d),y=new Wa([p],{width:"100%",height:Ue(f),viewBox:"0 0 "+a+" "+u,preserveAspectRatio:"none"});return{span:oc([],[y],n),minWidth:0,height:f}}else{var x=[],b=VJ[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[w,v,_]=b,S=_/1e3,C=w.length,E,R;if(C===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');E=["hide-tail"],R=[b[3]]}else if(C===2)E=["halfarrow-left","halfarrow-right"],R=["xMinYMin","xMaxYMin"];else if(C===3)E=["brace-left","brace-center","brace-right"],R=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+C+" children.");for(var j=0;j<C;j++){var N=new ic(w[j]),B=new Wa([N],{width:"400em",height:Ue(S),viewBox:"0 0 "+a+" "+_,preserveAspectRatio:R[j]+" slice"}),M=oc([E[j]],[B],n);if(C===1)return{span:M,minWidth:v,height:S};M.style.height=Ue(S),x.push(M)}return{span:Ie(["stretchy"],x,n),minWidth:v,height:S}}}var{span:s,minWidth:i,height:o}=r();return s.height=o,s.style.height=Ue(o),i>0&&(s.style.minWidth=Ue(i)),s},GJ=function(t,n,r,s,i){var o,a=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(o=Ie(["stretchy",n],[],i),n==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new kv({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new kv({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Wa(c,{width:"100%",height:Ue(a)});o=oc([],[u],i)}return o.height=a,o.style.height=Ue(a),o},KJ={bin:1,close:1,inner:1,open:1,punct:1,rel:1},YJ={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function XJ(e){return e in KJ}function Wt(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 Ry(e){var t=jy(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 jy(e){return e&&(e.type==="atom"||YJ.hasOwnProperty(e.type))?e:null}var vR=e=>{if(e instanceof Ni)return e;if(kJ(e)&&e.children.length===1)return vR(e.children[0])},n5=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=Wt(e.base,"accent"),n=r.base,e.base=n,s=_J(vn(e,t)),e.base=r):(r=Wt(e,"accent"),n=r.base);var i=vn(n,t.havingCrampedStyle()),o=r.isShifty&&Ja(n),a=0;if(o){var l,c;a=(l=(c=vR(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=Iy(r,t),f=bn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Ue(2*a)+")",marginLeft:Ue(2*a)}:void 0}]});else{var m,p;r.label==="\\vec"?(m=fR("vec",t),p=hR.vec[1]):(m=My({mode:r.mode,text:r.label},t,"textord"),m=xJ(m),m.italic=0,p=m.width,u&&(d+=m.depth)),f=Ie(["accent-body"],[m]);var y=r.label==="\\textcircled";y&&(f.classes.push("accent-full"),d=i.height);var x=a;y||(x-=p/2),f.style.left=Ue(x),r.label==="\\textcircled"&&(f.style.top=".2em"),f=bn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:f}]})}var b=Ie(["mord","accent"],[f],t);return s?(s.children[0]=b,s.height=Math.max(b.height,s.height),s.classes[0]="mord",s):b},xR=(e,t)=>{var n=e.isStretchy?Ny(e.label):new $e("mo",[no(e.label,e.mode)]),r=new $e("mover",[qn(e.base,t),n]);return r.setAttribute("accent","true"),r},QJ=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));tt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=m1(t[0]),r=!QJ.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:n5,mathmlBuilder:xR});tt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],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:n5,mathmlBuilder:xR});tt({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=vn(e.base,t),r=Iy(e,t),s=e.label==="\\utilde"?.12:0,i=bn({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return Ie(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=Ny(e.label),r=new $e("munder",[qn(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var lp=e=>{var t=new $e("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};tt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser: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=sh(vn(e.body,r,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;e.below&&(r=t.havingStyle(n.sub()),o=sh(vn(e.below,r,t),t),o.classes.push(i+"-arrow-pad"));var a=Iy(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,c=-t.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(c-=s.depth);var u;if(o){var d=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;u=bn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:d}]})}else u=bn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return Ie(["mrel","x-arrow"],[u],t)},mathmlBuilder(e,t){var n=Ny(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=lp(qn(e.body,t));if(e.below){var i=lp(qn(e.below,t));r=new $e("munderover",[n,i,s])}else r=new $e("mover",[n,s])}else if(e.below){var o=lp(qn(e.below,t));r=new $e("munder",[n,o])}else r=lp(),r=new $e("mover",[n,r]);return r}});function _R(e,t){var n=qr(e.body,t,!0);return Ie([e.mclass],n,t)}function kR(e,t){var n,r=Ri(e.body,t);return e.mclass==="minner"?n=new $e("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new $e("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new $e("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}tt({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:Ar(s),isCharacterBox:Ja(s)}},htmlBuilder:_R,mathmlBuilder:kR});var Ly=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};tt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Ly(t[0]),body:Ar(t[1]),isCharacterBox:Ja(t[1])}}});tt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:r}=e,s=t[1],i=t[0],o;r!=="\\stackrel"?o=Ly(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Ar(s)},l={type:"supsub",mode:i.mode,base:a,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:Ja(l)}},htmlBuilder:_R,mathmlBuilder:kR});tt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Ly(t[0]),body:Ar(t[0])}},htmlBuilder(e,t){var n=qr(e.body,t,!0),r=Ie([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=Ri(e.body,t),r=new $e("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var JJ={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},p7=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),g7=e=>e.type==="textord"&&e.text==="@",ZJ=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function eZ(e,t,n){var r=JJ[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[s,o,a]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function tZ(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 Pe("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var o=t[i],a=p7(),l=0;l<o.length;l++)if(!g7(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=Ry(o[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var f=!0,m=l+1;m<o.length;m++){if(ZJ(o[m],c)){f=!1,l=m;break}if(g7(o[m]))throw new Pe("Missing a "+c+" character to complete a CD arrow.",o[m]);u[d].body.push(o[m])}if(f)throw new Pe("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new Pe('Expected one of "<>AV=|." after @',o[l]);var p=eZ(c,u,e),y={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(y),a=p7()}i%2===0?r.push(a):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var x=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:x,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}tt({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=sh(vn(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=Ue(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new $e("mrow",[qn(e.label,t)]);return n=new $e("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new $e("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});tt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=sh(vn(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new $e("mrow",[qn(e.fragment,t)])}});tt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=Wt(t[0],"ordgroup"),s=r.body,i="",o=0;o<s.length;o++){var a=Wt(s[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new Pe("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new Pe("\\@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 SR=(e,t)=>{var n=qr(e.body,t.withColor(e.color),!1);return el(n)},TR=(e,t)=>{var n=Ri(e.body,t.withColor(e.color)),r=new $e("mstyle",n);return r.setAttribute("mathcolor",e.color),r};tt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=Wt(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:Ar(s)}},htmlBuilder:SR,mathmlBuilder:TR});tt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=Wt(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:SR,mathmlBuilder:TR});tt({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&&Wt(s,"size").value}},htmlBuilder(e,t){var n=Ie(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Ue(sr(e.size,t)))),n},mathmlBuilder(e,t){var n=new $e("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Ue(sr(e.size,t)))),n}});var Lv={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},CR=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Pe("Expected a control sequence",e);return t},nZ=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},AR=(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)};tt({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(Lv[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=Lv[r.text]),Wt(t.parseFunction(),"internal");throw new Pe("Invalid token after macro prefix",r)}});tt({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 Pe("Expected a control sequence",r);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(r=t.gullet.popToken(),r.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Pe('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Pe('Argument number "'+r.text+'" out of order');i++,a.push([])}else{if(r.text==="EOF")throw new Pe("Expected a macro definition");a[i].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(s,{tokens:l,numArgs:i,delimiters:a},n===Lv[n]),{type:"internal",mode:t.mode}}});tt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=CR(t.gullet.popToken());t.gullet.consumeSpaces();var s=nZ(t);return AR(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});tt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=CR(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return AR(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var _f=function(t,n,r){var s=er.math[t]&&er.math[t].replace,i=Q_(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},r5=function(t,n,r,s){var i=r.havingBaseStyle(n),o=Ie(s.concat(i.sizingClasses(r)),[t],r),a=i.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},ER=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=Ue(i),t.height-=i,t.depth+=i},rZ=function(t,n,r,s,i,o){var a=Is(t,"Main-Regular",i,s),l=r5(a,n,s,o);return ER(l,s,n),l},sZ=function(t,n,r,s){return Is(t,"Size"+n+"-Regular",r,s)},MR=function(t,n,r,s,i,o){var a=sZ(t,n,i,s),l=r5(Ie(["delimsizing","size"+n],[a],s),zt.TEXT,s,o);return r&&ER(l,s,zt.TEXT),l},U2=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=Ie(["delimsizinginner",s],[Ie([],[Is(t,n,r)])]);return{type:"elem",elem:i}},H2=function(t,n,r){var s=Uo["Size4-Regular"][t.charCodeAt(0)]?Uo["Size4-Regular"][t.charCodeAt(0)][4]:Uo["Size1-Regular"][t.charCodeAt(0)][4],i=new ic("inner",mJ(t,Math.round(1e3*n))),o=new Wa([i],{width:Ue(s),height:Ue(n),style:"width:"+Ue(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=oc([],[o],r);return a.height=n,a.style.height=Ue(n),a.style.width=Ue(s),{type:"elem",elem:a}},Dv=.008,cp={type:"kern",size:-1*Dv},iZ=new Set(["|","\\lvert","\\rvert","\\vert"]),oZ=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),NR=function(t,n,r,s,i,o){var a,l,c,u,d="",f=0;a=c=u=t,l=null;var m="Size1-Regular";t==="\\uparrow"?c=u="⏐":t==="\\Uparrow"?c=u="‖":t==="\\downarrow"?a=c="⏐":t==="\\Downarrow"?a=c="‖":t==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):iZ.has(t)?(c="∣",d="vert",f=333):oZ.has(t)?(c="∥",d="doublevert",f=556):t==="["||t==="\\lbrack"?(a="⎡",c="⎢",u="⎣",m="Size4-Regular",d="lbrack",f=667):t==="]"||t==="\\rbrack"?(a="⎤",c="⎥",u="⎦",m="Size4-Regular",d="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=a="⎢",u="⎣",m="Size4-Regular",d="lfloor",f=667):t==="\\lceil"||t==="⌈"?(a="⎡",c=u="⎢",m="Size4-Regular",d="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=a="⎥",u="⎦",m="Size4-Regular",d="rfloor",f=667):t==="\\rceil"||t==="⌉"?(a="⎤",c=u="⎥",m="Size4-Regular",d="rceil",f=667):t==="("||t==="\\lparen"?(a="⎛",c="⎜",u="⎝",m="Size4-Regular",d="lparen",f=875):t===")"||t==="\\rparen"?(a="⎞",c="⎟",u="⎠",m="Size4-Regular",d="rparen",f=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",u="⎩",c="⎪",m="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",u="⎭",c="⎪",m="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",u="⎩",c="⎪",m="Size4-Regular");var p=_f(a,m,i),y=p.height+p.depth,x=_f(c,m,i),b=x.height+x.depth,w=_f(u,m,i),v=w.height+w.depth,_=0,S=1;if(l!==null){var C=_f(l,m,i);_=C.height+C.depth,S=2}var E=y+v+_,R=Math.max(0,Math.ceil((n-E)/(S*b))),j=E+R*S*b,N=s.fontMetrics().axisHeight;r&&(N*=s.sizeMultiplier);var B=j/2-N,M=[];if(d.length>0){var $=j-y-v,H=Math.round(j*1e3),J=pJ(d,Math.round($*1e3)),O=new ic(d,J),Y=Ue(f/1e3),G=Ue(H/1e3),ee=new Wa([O],{width:Y,height:G,viewBox:"0 0 "+f+" "+H}),L=oc([],[ee],s);L.height=H/1e3,L.style.width=Y,L.style.height=G,M.push({type:"elem",elem:L})}else{if(M.push(U2(u,m,i)),M.push(cp),l===null){var F=j-y-v+2*Dv;M.push(H2(c,F,s))}else{var P=(j-y-v-_)/2+2*Dv;M.push(H2(c,P,s)),M.push(cp),M.push(U2(l,m,i)),M.push(cp),M.push(H2(c,P,s))}M.push(cp),M.push(U2(a,m,i))}var A=s.havingBaseStyle(zt.TEXT),ne=bn({positionType:"bottom",positionData:B,children:M});return r5(Ie(["delimsizing","mult"],[ne],A),zt.TEXT,s,o)},V2=80,W2=.08,G2=function(t,n,r,s,i){var o=fJ(t,s,r),a=new ic(t,o),l=new Wa([a],{width:"400em",height:Ue(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return oc(["hide-tail"],[l],i)},aZ=function(t,n){var r=n.havingBaseSizing(),s=DR("\\surd",t*r.sizeMultiplier,LR,r),i=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,u,d;return s.type==="small"?(u=1e3+1e3*o+V2,t<1?i=1:t<1.4&&(i=.7),l=(1+o+W2)/i,c=(1+o)/i,a=G2("sqrtMain",l,u,o,n),a.style.minWidth="0.853em",d=.833/i):s.type==="large"?(u=(1e3+V2)*Jf[s.size],c=(Jf[s.size]+o)/i,l=(Jf[s.size]+o+W2)/i,a=G2("sqrtSize"+s.size,l,u,o,n),a.style.minWidth="1.02em",d=1/i):(l=t+o+W2,c=t+o,u=Math.floor(1e3*t+o)+V2,a=G2("sqrtTall",l,u,o,n),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=Ue(l),{span:a,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},IR=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),lZ=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),RR=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Jf=[0,1.2,1.8,2.4,3],jR=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),IR.has(t)||RR.has(t))return MR(t,n,!1,r,s,i);if(lZ.has(t))return NR(t,Jf[n],!1,r,s,i);throw new Pe("Illegal delimiter: '"+t+"'")},cZ=[{type:"small",style:zt.SCRIPTSCRIPT},{type:"small",style:zt.SCRIPT},{type:"small",style:zt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],uZ=[{type:"small",style:zt.SCRIPTSCRIPT},{type:"small",style:zt.SCRIPT},{type:"small",style:zt.TEXT},{type:"stack"}],LR=[{type:"small",style:zt.SCRIPTSCRIPT},{type:"small",style:zt.SCRIPT},{type:"small",style:zt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],dZ=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.")},DR=function(t,n,r,s){for(var i=Math.min(2,3-s.style.size),o=i;o<r.length;o++){var a=r[o];if(a.type==="stack")break;var l=_f(t,dZ(a),"math"),c=l.height+l.depth;if(a.type==="small"){var u=s.havingBaseStyle(a.style);c*=u.sizeMultiplier}if(c>n)return a}return r[r.length-1]},Ov=function(t,n,r,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;RR.has(t)?a=cZ:IR.has(t)?a=LR:a=uZ;var l=DR(t,n,a,s);return l.type==="small"?rZ(t,l.style,r,s,i,o):l.type==="large"?MR(t,l.size,r,s,i,o):NR(t,n,r,s,i,o)},K2=function(t,n,r,s,i,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,c=5/s.fontMetrics().ptPerEm,u=Math.max(n-a,r+a),d=Math.max(u/500*l,2*u-c);return Ov(t,d,!0,s,i,o)},y7={"\\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}},hZ=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 b7(e){return"isMiddle"in e}function Dy(e,t){var n=jy(e);if(n&&hZ.has(n.text))return n;throw n?new Pe("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Pe("Invalid delimiter type '"+e.type+"'",e)}tt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Dy(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:y7[e.funcName].size,mclass:y7[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Ie([e.mclass]):jR(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(no(e.delim,e.mode));var n=new $e("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ue(Jf[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function w7(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}tt({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Pe("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Dy(t[0],e).text,color:n}}});tt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Dy(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Wt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{w7(e);for(var n=qr(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,o=0;o<n.length;o++){var a=n[o];b7(a)?i=!0:(r=Math.max(n[o].height,r),s=Math.max(n[o].depth,s))}r*=t.sizeMultiplier,s*=t.sizeMultiplier;var l;if(e.left==="."?l=A0(t,["mopen"]):l=K2(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(b7(u)){var d=u.isMiddle;n[c]=K2(d.delim,r,s,d.options,e.mode,[])}}var f;if(e.right===".")f=A0(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=K2(e.right,r,s,m,e.mode,["mclose"])}return n.push(f),Ie(["minner"],n,t)},mathmlBuilder:(e,t)=>{w7(e);var n=Ri(e.body,t);if(e.left!=="."){var r=new $e("mo",[no(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new $e("mo",[no(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return e5(n)}});tt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Dy(t[0],e);if(!e.parser.leftrightDepth)throw new Pe("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=A0(t,[]):(n=jR(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?no("|","text"):no(e.delim,e.mode),r=new $e("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Oy=(e,t)=>{var n=sh(vn(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,o,a=Ja(e.body);if(r==="sout")i=Ie(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=sr({number:.6,unit:"pt"},t),c=sr({number:.35,unit:"ex"},t),u=t.havingBaseSizing();s=s/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=Ue(d/2+l);var f=Math.floor(1e3*d*s),m=dJ(f),p=new Wa([new ic("phase",m)],{width:"400em",height:Ue(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=oc(["hide-tail"],[p],t),i.style.height=Ue(d),o=n.depth+l+c}else{/cancel/.test(r)?a||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,x,b=0;/box/.test(r)?(b=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(r==="colorbox"?0:b),x=y):r==="angl"?(b=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*b,x=Math.max(0,.25-n.depth)):(y=a?.2:0,x=y),i=GJ(n,r,y,x,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ue(b)):r==="angl"&&b!==.049&&(i.style.borderTopWidth=Ue(b),i.style.borderRightWidth=Ue(b)),o=n.depth+x,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var w;if(e.backgroundColor)w=bn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var v=/cancel|phase/.test(r)?["svg-align"]:[];w=bn({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:v}]})}return/cancel/.test(r)&&(w.height=n.height,w.depth=n.depth),/cancel/.test(r)&&!a?Ie(["mord","cancel-lap"],[w],t):Ie(["mord"],[w],t)},By=(e,t)=>{var n,r=new $e(e.label.includes("colorbox")?"mpadded":"menclose",[qn(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: "+Ue(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};tt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Wt(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:Oy,mathmlBuilder:By});tt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Wt(t[0],"color-token").color,o=Wt(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:Oy,mathmlBuilder:By});tt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});tt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:Oy,mathmlBuilder:By});tt({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:Oy,mathmlBuilder:By});tt({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var OR={};function ea(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<n.length;++l)OR[n[l]]=a;i&&(h1[t]=i),o&&(f1[t]=o)}var BR={};function D(e,t){BR[e]=t}class Js{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 Js(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class Ai{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 Ai(n,Js.range(this,t))}}function v7(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 Py=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Pe("{"+e.envName+"} can be used only in display mode.")},fZ=new Set(["gather","gather*"]);function s5(e){if(!e.includes("ed"))return!e.includes("*")}function vc(e,t,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:f}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var m=e.gullet.expandMacroAsText("\\arraystretch");if(m==null)o=1;else if(o=parseFloat(m),!o||o<0)throw new Pe("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],y=[p],x=[],b=[],w=l!=null?[]:void 0;function v(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function _(){w&&(e.gullet.macros.get("\\df@tag")?(w.push(e.subparse([new Ai("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(v(),b.push(v7(e));;){var S=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var C={type:"ordgroup",mode:e.mode,body:S};n&&(C={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[C]}),p.push(C);var E=e.fetch().text;if(E==="&"){if(d&&p.length===d){if(c||a)throw new Pe("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(E==="\\end"){_(),p.length===1&&C.type==="styling"&&C.body.length===1&&C.body[0].type==="ordgroup"&&C.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),b.length<y.length+1&&b.push([]);break}else if(E==="\\\\"){e.consume();var R=void 0;e.gullet.future().text!==" "&&(R=e.parseSizeGroup(!0)),x.push(R?R.value:null),_(),b.push(v7(e)),p=[],y.push(p),v()}else throw new Pe("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:s,arraystretch:o,body:y,cols:i,rowGaps:x,hskipBeforeAndAfter:r,hLinesBeforeRow:b,colSeparationType:a,tags:w,leqno:f}}function i5(e){return e.slice(0,1)==="d"?"display":"text"}var ta=function(t,n){var r,s,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),c=[],u=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),d=1/n.fontMetrics().ptPerEm,f=5*d;if(t.colSeparationType&&t.colSeparationType==="small"){var m=n.havingStyle(zt.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var p=t.colSeparationType==="CD"?sr({number:3,unit:"ex"},n):12*d,y=3*d,x=t.arraystretch*p,b=.7*x,w=.3*x,v=0;function _(ue){for(var Ne=0;Ne<ue.length;++Ne)Ne>0&&(v+=.25),c.push({pos:v,isDashed:ue[Ne]})}for(_(o[0]),r=0;r<t.body.length;++r){var S=t.body[r],C=b,E=w;a<S.length&&(a=S.length);var R={cells:new Array(S.length),height:0,depth:0,pos:0};for(s=0;s<S.length;++s){var j=vn(S[s],n);E<j.depth&&(E=j.depth),C<j.height&&(C=j.height),R.cells[s]=j}var N=t.rowGaps[r],B=0;N&&(B=sr(N,n),B>0&&(B+=w,E<B&&(E=B),B=0)),t.addJot&&r<t.body.length-1&&(E+=y),R.height=C,R.depth=E,v+=C,R.pos=v,v+=E+B,l[r]=R,_(o[r+1])}var M=v/2+n.fontMetrics().axisHeight,$=t.cols||[],H=[],J,O,Y=[];if(t.tags&&t.tags.some(ue=>ue))for(r=0;r<i;++r){var G=l[r],ee=G.pos-M,L=t.tags[r],F=void 0;L===!0?F=Ie(["eqn-num"],[],n):L===!1?F=Ie([],[],n):F=Ie([],qr(L,n,!0),n),F.depth=G.depth,F.height=G.height,Y.push({type:"elem",elem:F,shift:ee})}for(s=0,O=0;s<a||O<$.length;++s,++O){for(var P,A=$[O],ne=!0;((be=A)==null?void 0:be.type)==="separator";){var be;if(ne||(J=Ie(["arraycolsep"],[]),J.style.width=Ue(n.fontMetrics().doubleRuleSep),H.push(J)),A.separator==="|"||A.separator===":"){var he=A.separator==="|"?"solid":"dashed",ye=Ie(["vertical-separator"],[],n);ye.style.height=Ue(v),ye.style.borderRightWidth=Ue(u),ye.style.borderRightStyle=he,ye.style.margin="0 "+Ue(-u/2);var me=v-M;me&&(ye.style.verticalAlign=Ue(-me)),H.push(ye)}else throw new Pe("Invalid separator type: "+A.separator);O++,A=$[O],ne=!1}if(!(s>=a)){var se=void 0;if(s>0||t.hskipBeforeAndAfter){var re,oe;se=(re=(oe=A)==null?void 0:oe.pregap)!=null?re:f,se!==0&&(J=Ie(["arraycolsep"],[]),J.style.width=Ue(se),H.push(J))}var ke=[];for(r=0;r<i;++r){var He=l[r],Ve=He.cells[s];if(Ve){var ce=He.pos-M;Ve.depth=He.depth,Ve.height=He.height,ke.push({type:"elem",elem:Ve,shift:ce})}}var xe=bn({positionType:"individualShift",children:ke}),Me=Ie(["col-align-"+(((P=A)==null?void 0:P.align)||"c")],[xe]);if(H.push(Me),s<a-1||t.hskipBeforeAndAfter){var Re,ct;se=(Re=(ct=A)==null?void 0:ct.postgap)!=null?Re:f,se!==0&&(J=Ie(["arraycolsep"],[]),J.style.width=Ue(se),H.push(J))}}}var Ct=Ie(["mtable"],H);if(c.length>0){for(var vt=rh("hline",n,u),Rt=rh("hdashline",n,u),Ke=[{type:"elem",elem:Ct,shift:0}];c.length>0;){var pt=c.pop(),yt=pt.pos-M;pt.isDashed?Ke.push({type:"elem",elem:Rt,shift:yt}):Ke.push({type:"elem",elem:vt,shift:yt})}Ct=bn({positionType:"individualShift",children:Ke})}if(Y.length===0)return Ie(["mord"],[Ct],n);var ae=bn({positionType:"individualShift",children:Y}),V=Ie(["tag"],[ae],n);return el([Ct,V])},mZ={c:"center ",l:"left ",r:"right "},na=function(t,n){for(var r=[],s=new $e("mtd",[],["mtr-glue"]),i=new $e("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],l=[],c=0;c<a.length;c++)l.push(new $e("mtd",[qn(a[c],n)]));t.tags&&t.tags[o]&&(l.unshift(s),l.push(s),t.leqno?l.unshift(i):l.push(i)),r.push(new $e("mtr",l))}var u=new $e("mtable",r),d=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);u.setAttribute("rowspacing",Ue(d));var f="",m="";if(t.cols&&t.cols.length>0){var p=t.cols,y="",x=!1,b=0,w=p.length;p[0].type==="separator"&&(f+="top ",b=1),p[p.length-1].type==="separator"&&(f+="bottom ",w-=1);for(var v=b;v<w;v++){var _=p[v];_.type==="align"?(m+=mZ[_.align],x&&(y+="none "),x=!0):_.type==="separator"&&x&&(y+=_.separator==="|"?"solid ":"dashed ",x=!1)}u.setAttribute("columnalign",m.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var S=t.cols||[],C="",E=1;E<S.length;E++)C+=E%2?"0em ":"1em ";u.setAttribute("columnspacing",C.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 R="",j=t.hLinesBeforeRow;f+=j[0].length>0?"left ":"",f+=j[j.length-1].length>0?"right ":"";for(var N=1;N<j.length-1;N++)R+=j[N].length===0?"none ":j[N][0]?"dashed ":"solid ";return/[sd]/.test(R)&&u.setAttribute("rowlines",R.trim()),f!==""&&(u=new $e("menclose",[u]),u.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(u=new $e("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},PR=function(t,n){t.envName.includes("ed")||Py(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=vc(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:s5(t.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,l=0,c={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var u="",d=0;d<n[0].body.length;d++){var f=Wt(n[0].body[d],"textord");u+=f.text}a=Number(u),l=a*2}var m=!l;o.body.forEach(function(b){for(var w=1;w<b.length;w+=2){var v=Wt(b[w],"styling"),_=Wt(v.body[0],"ordgroup");_.body.unshift(c)}if(m)l<b.length&&(l=b.length);else{var S=b.length/2;if(a<S)throw new Pe("Too many math in a row: "+("expected "+a+", but got "+S),b[0])}});for(var p=0;p<l;++p){var y="r",x=0;p%2===1?y="l":p>0&&m&&(x=1),r[p]={type:"align",align:y,pregap:x,postgap:0}}return o.colSeparationType=m?"align":"alignat",o};ea({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=jy(t[0]),r=n?[t[0]]:Wt(t[0],"ordgroup").body,s=r.map(function(o){var a=Ry(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Pe("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return vc(e.parser,i,i5(e.envName))},htmlBuilder:ta,mathmlBuilder:na});ea({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 Pe("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=vc(e.parser,r,i5(e.envName)),o=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(o).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=vc(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=jy(t[0]),r=n?[t[0]]:Wt(t[0],"ordgroup").body,s=r.map(function(a){var l=Ry(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Pe("Unknown column alignment: "+c,a)});if(s.length>1)throw new Pe("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=vc(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new Pe("{subarray} can contain only one column");return o},htmlBuilder:ta,mathmlBuilder:na});ea({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=vc(e.parser,t,i5(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:PR,htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){fZ.has(e.envName)&&Py(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:s5(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return vc(e.parser,t,"display")},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:PR,htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Py(e);var t={autoTag:s5(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return vc(e.parser,t,"display")},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Py(e),tZ(e.parser)},htmlBuilder:ta,mathmlBuilder:na});D("\\nonumber","\\gdef\\@eqnsw{0}");D("\\notag","\\nonumber");tt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Pe(e.funcName+" valid only within array environment")}});var x7=OR;tt({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 Pe("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=Wt(s.body[o],"textord").text;if(r==="\\begin"){if(!x7.hasOwnProperty(i))throw new Pe("No such environment: "+i,s);var a=x7[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",a),u={mode:n.mode,envName:i,parser:n},d=a.handler(u,l,c);n.expect("\\end",!1);var f=n.nextToken,m=Wt(n.parseFunction(),"environment");if(m.name!==i)throw new Pe("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return d}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var zR=(e,t)=>{var n=e.font,r=t.withFont(n);return vn(e.body,r)},$R=(e,t)=>{var n=e.font,r=t.withFont(n);return qn(e.body,r)},_7={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};tt({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=m1(t[0]),i=r;return i in _7&&(i=_7[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:zR,mathmlBuilder:$R});tt({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:Ly(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Ja(r)}}});tt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:s}=e,{mode:i}=n,o=n.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:zR,mathmlBuilder:$R});var pZ=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var o=vn(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}i=t.havingStyle(s);var c=vn(e.denom,i,t),u,d,f;e.hasBarLine?(e.barSize?(d=sr(e.barSize,t),u=rh("frac-line",t,d)):u=rh("frac-line",t),d=u.height,f=u.height):(u=null,d=0,f=t.fontMetrics().defaultRuleThickness);var m,p,y;n.size===zt.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 x;if(u){var w=t.fontMetrics().axisHeight;m-o.depth-(w+.5*d)<p&&(m+=p-(m-o.depth-(w+.5*d))),w-.5*d-(c.height-y)<p&&(y+=p-(w-.5*d-(c.height-y)));var v=-(w-.5*d);x=bn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:v},{type:"elem",elem:o,shift:-m}]})}else{var b=m-o.depth-(c.height-y);b<p&&(m+=.5*(p-b),y+=.5*(p-b)),x=bn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-m}]})}i=t.havingStyle(n),x.height*=i.sizeMultiplier/t.sizeMultiplier,x.depth*=i.sizeMultiplier/t.sizeMultiplier;var _;n.size===zt.DISPLAY.size?_=t.fontMetrics().delim1:n.size===zt.SCRIPTSCRIPT.size?_=t.havingStyle(zt.SCRIPT).fontMetrics().delim2:_=t.fontMetrics().delim2;var S,C;return e.leftDelim==null?S=A0(t,["mopen"]):S=Ov(e.leftDelim,_,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?C=Ie([]):e.rightDelim==null?C=A0(t,["mclose"]):C=Ov(e.rightDelim,_,!0,t.havingStyle(n),e.mode,["mclose"]),Ie(["mord"].concat(i.sizingClasses(t)),[S,Ie(["mfrac"],[x]),C],t)},gZ=(e,t)=>{var n=new $e("mfrac",[qn(e.numer,t),qn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=sr(e.barSize,t);n.setAttribute("linethickness",Ue(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new $e("mo",[new Er(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var o=new $e("mo",[new Er(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return e5(s)}return n},qR=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};tt({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=t[1],o,a=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=r==="\\cfrac",u=null;return c||r.startsWith("\\d")?u="display":r.startsWith("\\t")&&(u="text"),qR({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:pZ,mathmlBuilder:gZ});tt({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 k7=["display","text","script","scriptscript"],S7=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};tt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,r=t[4],s=t[5],i=m1(t[0]),o=i.type==="atom"&&i.family==="open"?S7(i.text):null,a=m1(t[1]),l=a.type==="atom"&&a.family==="close"?S7(a.text):null,c=Wt(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=Wt(m.body[0],"textord");f=k7[Number(p.text)]}}else m=Wt(m,"textord"),f=k7[Number(m.text)];return qR({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l},f)}});tt({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:Wt(t[0],"size").value,token:s}}});tt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=Wt(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var FR=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?vn(e.sup,t.havingStyle(n.sup()),t):vn(e.sub,t.havingStyle(n.sub()),t),s=Wt(e.base,"horizBrace")):s=Wt(e,"horizBrace");var i=vn(s.base,t.havingBaseStyle(zt.DISPLAY)),o=Iy(s,t),a;if(s.isOver?a=bn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=bn({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=Ie(["minner",s.isOver?"mover":"munder"],[a],t);s.isOver?a=bn({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=bn({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Ie(["minner",s.isOver?"mover":"munder"],[a],t)},yZ=(e,t)=>{var n=Ny(e.label);return new $e(e.isOver?"mover":"munder",[qn(e.base,t),n])};tt({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:FR,mathmlBuilder:yZ});tt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=Wt(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=qr(e.body,t,!1);return NJ(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=ac(e.body,t);return n instanceof $e||(n=new $e("mrow",[n])),n.setAttribute("href",e.href),n}});tt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=Wt(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<r.length;i++){var o=r[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:Ar(a)}}});tt({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:Ar(t[0])}},htmlBuilder(e,t){var n=qr(e.body,t.withFont(""),!1);return el(n)},mathmlBuilder(e,t){return new $e("mrow",Ri(e.body,t.withFont("")))}});tt({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,token:s}=e,i=Wt(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(r){case"\\htmlClass":l.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var c=i.split(","),u=0;u<c.length;u++){var d=c[u],f=d.indexOf("=");if(f<0)throw new Pe("\\htmlData key/value '"+d+"' missing equals sign");var m=d.slice(0,f),p=d.slice(f+1);l["data-"+m.trim()]=p}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:Ar(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=qr(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=Ie(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)=>ac(e.body,t)});tt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Ar(t[0]),mathml:Ar(t[1])}},htmlBuilder:(e,t)=>{var n=qr(e.html,t,!1);return el(n)},mathmlBuilder:(e,t)=>ac(e.mathml,t)});var Y2=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 Pe("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!sR(r))throw new Pe("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};tt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=Wt(n[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var f=d[1].trim();switch(d[0].trim()){case"alt":a=f;break;case"width":s=Y2(f);break;case"height":i=Y2(f);break;case"totalheight":o=Y2(f);break;default:throw new Pe("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var m=Wt(t[0],"url").url;return a===""&&(a=m,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:r.mode,alt:a,width:s,height:i,totalheight:o,src:m}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=sr(e.height,t),r=0;e.totalheight.number>0&&(r=sr(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=sr(e.width,t));var i={height:Ue(n+r)};s>0&&(i.width=Ue(s)),r>0&&(i.verticalAlign=Ue(-r));var o=new wJ(e.src,e.alt,i);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new $e("mglyph",[]);n.setAttribute("alt",e.alt);var r=sr(e.height,t),s=0;if(e.totalheight.number>0&&(s=sr(e.totalheight,t)-r,n.setAttribute("valign",Ue(-s))),n.setAttribute("height",Ue(r+s)),e.width.number>0){var i=sr(e.width,t);n.setAttribute("width",Ue(i))}return n.setAttribute("src",e.src),n}});tt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=Wt(t[0],"size");if(n.settings.strict){var i=r[1]==="m",o=s.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(e,t){return dR(e.dimension,t)},mathmlBuilder(e,t){var n=sr(e.dimension,t);return new yR(n)}});tt({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=Ie([],[vn(e.body,t)]),n=Ie(["inner"],[n],t)):n=Ie(["inner"],[vn(e.body,t)]);var r=Ie(["fix"],[]),s=Ie([e.alignment],[n,r],t),i=Ie(["strut"]);return i.style.height=Ue(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ue(-s.depth)),s.children.unshift(i),s=Ie(["thinbox"],[s],t),Ie(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new $e("mpadded",[qn(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}});tt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",o=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}});tt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Pe("Mismatched "+e.funcName)}});var T7=(e,t)=>{switch(t.style.size){case zt.DISPLAY.size:return e.display;case zt.TEXT.size:return e.text;case zt.SCRIPT.size:return e.script;case zt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};tt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Ar(t[0]),text:Ar(t[1]),script:Ar(t[2]),scriptscript:Ar(t[3])}},htmlBuilder:(e,t)=>{var n=T7(e,t),r=qr(n,t,!1);return el(r)},mathmlBuilder:(e,t)=>{var n=T7(e,t);return ac(n,t)}});var UR=(e,t,n,r,s,i,o)=>{e=Ie([],[e]);var a=n&&Ja(n),l,c;if(t){var u=vn(t,r.havingStyle(s.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=vn(n,r.havingStyle(s.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var f;if(c&&l){var m=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;f=bn({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ue(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ue(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=e.height-o;f=bn({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ue(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=bn({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ue(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var x=[f];if(l&&i!==0&&!a){var b=Ie(["mspace"],[],r);b.style.marginRight=Ue(i),x.unshift(b)}return Ie(["mop","op-limits"],x,r)},HR=new Set(["\\smallint"]),Nh=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Wt(e.base,"op"),s=!0):i=Wt(e,"op");var o=t.style,a=!1;o.size===zt.DISPLAY.size&&i.symbol&&!HR.has(i.name)&&(a=!0);var l,c;if(i.symbol){var u=a?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=Is(i.name,u,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var f=fR(d+"Size"+(a?"2":"1"),t);l=bn({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var m=qr(i.body,t,!0);m.length===1&&m[0]instanceof Ni?(l=m[0],l.classes[0]="mop"):l=Ie(["mop"],m,t)}else{for(var p=[],y=1;y<i.name.length;y++)p.push(J_(i.name[y],i.mode,t));l=Ie(["mop"],p,t)}var x=0,b=0;if((l instanceof Ni||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var w;x=(l.height-l.depth)/2-t.fontMetrics().axisHeight,b=(w=l.italic)!=null?w:0}return s?UR(l,n,r,t,o,b,x):(x&&(l.style.position="relative",l.style.top=Ue(x)),l)},hm=(e,t)=>{var n;if(e.symbol)n=new $e("mo",[no(e.name,e.mode)]),HR.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new $e("mo",Ri(e.body,t));else{n=new $e("mi",[new Er(e.name.slice(1))]);var r=new $e("mo",[no("⁡","text")]);e.parentIsSupSub?n=new $e("mrow",[n,r]):n=gR([n,r])}return n},bZ={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};tt({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=r;return s.length===1&&(s=bZ[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Nh,mathmlBuilder:hm});tt({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:Ar(r)}},htmlBuilder:Nh,mathmlBuilder:hm});var wZ={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};tt({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Nh,mathmlBuilder:hm});tt({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Nh,mathmlBuilder:hm});tt({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=wZ[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Nh,mathmlBuilder:hm});var VR=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Wt(e.base,"operatorname"),s=!0):i=Wt(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(d=>{var f="text"in d?d.text:void 0;return typeof f=="string"?{type:"textord",mode:d.mode,text:f}:d}),l=qr(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof Ni&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Ie(["mop"],l,t)}else o=Ie(["mop"],[],t);return s?UR(o,n,r,t,t.style,0,0):o},vZ=(e,t)=>{for(var n=Ri(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof yR))if(i instanceof $e)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof Er?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(u=>u.toText()).join("");n=[new Er(a)]}var l=new $e("mi",n);l.setAttribute("mathvariant","normal");var c=new $e("mo",[no("⁡","text")]);return e.parentIsSupSub?new $e("mrow",[l,c]):gR([l,c])};tt({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:Ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:VR,mathmlBuilder:vZ});D("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Du({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?el(qr(e.body,t,!1)):Ie(["mord"],qr(e.body,t,!0),t)},mathmlBuilder(e,t){return ac(e.body,t,!0)}});tt({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=vn(e.body,t.havingCrampedStyle()),r=rh("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=bn({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return Ie(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new $e("mo",[new Er("‾")]);n.setAttribute("stretchy","true");var r=new $e("mover",[qn(e.body,t),n]);return r.setAttribute("accent","true"),r}});tt({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:Ar(r)}},htmlBuilder:(e,t)=>{var n=qr(e.body,t.withPhantom(),!1);return el(n)},mathmlBuilder:(e,t)=>{var n=Ri(e.body,t);return new $e("mphantom",n)}});D("\\hphantom","\\smash{\\phantom{#1}}");tt({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=Ie(["inner"],[vn(e.body,t.withPhantom())]),r=Ie(["fix"],[]);return Ie(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=Ri(Ar(e.body),t),r=new $e("mphantom",n),s=new $e("mpadded",[r]);return s.setAttribute("width","0px"),s}});tt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=Wt(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=vn(e.body,t),r=sr(e.dy,t);return bn({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new $e("mpadded",[qn(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});tt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});tt({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,s=n[0],i=Wt(t[0],"size"),o=Wt(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&Wt(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Ie(["mord","rule"],[],t),r=sr(e.width,t),s=sr(e.height,t),i=e.shift?sr(e.shift,t):0;return n.style.borderRightWidth=Ue(r),n.style.borderTopWidth=Ue(s),n.style.bottom=Ue(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=sr(e.width,t),r=sr(e.height,t),s=e.shift?sr(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new $e("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Ue(n)),o.setAttribute("height",Ue(r));var a=new $e("mpadded",[o]);return s>=0?a.setAttribute("height",Ue(s)):(a.setAttribute("height",Ue(s)),a.setAttribute("depth",Ue(-s))),a.setAttribute("voffset",Ue(s)),a}});function WR(e,t,n){for(var r=qr(e,t,!1),s=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var o=r[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[o+1]==="reset-size"+t.size&&(r[i].classes[o+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return el(r)}var C7=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],xZ=(e,t)=>{var n=t.havingSize(e.size);return WR(e.body,n,t)};tt({type:"sizing",names:C7,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:C7.indexOf(r)+1,body:i}},htmlBuilder:xZ,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Ri(e.body,n),s=new $e("mstyle",r);return s.setAttribute("mathsize",Ue(n.sizeMultiplier)),s}});tt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,s=!1,i=!1,o=n[0]&&Wt(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=Ry(c).text,a==="t")s=!0;else if(a==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var u=t[0];return{type:"smash",mode:r.mode,body:u,smashHeight:s,smashDepth:i}},htmlBuilder:(e,t)=>{var n=Ie([],[vn(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 Ie(["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=bn({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Ie(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new $e("mpadded",[qn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});tt({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,s=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(e,t){var n=vn(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=sh(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<zt.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,a=n.height+n.depth+o+s,{span:l,ruleWidth:c,advanceWidth:u}=aZ(a,t),d=l.height-c;d>n.height+n.depth+o&&(o=(o+d-n.height-n.depth)/2);var f=l.height-n.height-o-c;n.style.paddingLeft=Ue(u);var m=bn({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(zt.SCRIPTSCRIPT),y=vn(e.index,p,t),x=.6*(m.height-m.depth),b=bn({positionType:"shift",positionData:-x,children:[{type:"elem",elem:y}]}),w=Ie(["root"],[b]);return Ie(["mord","sqrt"],[w,m],t)}else return Ie(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new $e("mroot",[qn(n,t),qn(r,t)]):new $e("msqrt",[qn(n,t)])}});var Bv={display:zt.DISPLAY,text:zt.TEXT,script:zt.SCRIPT,scriptscript:zt.SCRIPTSCRIPT};function _Z(e){return e in Bv}tt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!_Z(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var n=Bv[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),WR(e.body,r,t)},mathmlBuilder(e,t){var n=Bv[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=Ri(e.body,r),i=new $e("mstyle",s),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var kZ=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===zt.DISPLAY.size||r.alwaysHandleSupSub);return s?Nh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===zt.DISPLAY.size||r.limits);return i?VR:null}else{if(r.type==="accent")return Ja(r.base)?n5:null;if(r.type==="horizBrace"){var o=!t.sub;return o===r.isOver?FR:null}else return null}else return null};Du({type:"supsub",htmlBuilder(e,t){var n=kZ(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,o=vn(r,t),a,l,c=t.fontMetrics(),u=0,d=0,f=r&&Ja(r);if(s){var m=t.havingStyle(t.style.sup());a=vn(s,m,t),f||(u=o.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var p=t.havingStyle(t.style.sub());l=vn(i,p,t),f||(d=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/t.sizeMultiplier)}var y;t.style===zt.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var x=t.sizeMultiplier,b=Ue(.5/c.ptPerEm/x),w=null;if(l){var v=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Ni||v){var _;w=Ue(-((_=o.italic)!=null?_:0))}}var S;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var C=c.defaultRuleThickness,E=4*C;if(u-a.depth-(l.height-d)<E){d=E-(u-a.depth)+l.height;var R=.8*c.xHeight-(u-a.depth);R>0&&(u+=R,d-=R)}var j=[{type:"elem",elem:l,shift:d,marginRight:b,marginLeft:w},{type:"elem",elem:a,shift:-u,marginRight:b}];S=bn({positionType:"individualShift",children:j})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var N=[{type:"elem",elem:l,marginLeft:w,marginRight:b}];S=bn({positionType:"shift",positionData:d,children:N})}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),S=bn({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var B=Rv(o,"right")||"mord";return Ie([B],[o,Ie(["msupsub"],[S])],t)},mathmlBuilder(e,t){var n=!1,r,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[qn(e.base,t)];e.sub&&i.push(qn(e.sub,t)),e.sup&&i.push(qn(e.sup,t));var o;if(n)o=r?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===zt.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===zt.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===zt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===zt.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===zt.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===zt.DISPLAY)?o="mover":o="msup"}return new $e(o,i)}});Du({type:"atom",htmlBuilder(e,t){return J_(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new $e("mo",[no(e.text,e.mode)]);if(e.family==="bin"){var r=t5(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 GR={mi:"italic",mn:"normal",mtext:"normal"};Du({type:"mathord",htmlBuilder(e,t){return My(e,t,"mathord")},mathmlBuilder(e,t){var n=new $e("mi",[no(e.text,e.mode,t)]),r=t5(e,t)||"italic";return r!==GR[n.type]&&n.setAttribute("mathvariant",r),n}});Du({type:"textord",htmlBuilder(e,t){return My(e,t,"textord")},mathmlBuilder(e,t){var n=no(e.text,e.mode,t),r=t5(e,t)||"normal",s;return e.mode==="text"?s=new $e("mtext",[n]):/[0-9]/.test(e.text)?s=new $e("mn",[n]):e.text==="\\prime"?s=new $e("mo",[n]):s=new $e("mi",[n]),r!==GR[s.type]&&s.setAttribute("mathvariant",r),s}});var X2={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Q2={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Du({type:"spacing",htmlBuilder(e,t){if(Q2.hasOwnProperty(e.text)){var n=Q2[e.text].className||"";if(e.mode==="text"){var r=My(e,t,"textord");return r.classes.push(n),r}else return Ie(["mspace",n],[J_(e.text,e.mode,t)],t)}else{if(X2.hasOwnProperty(e.text))return Ie(["mspace",X2[e.text]],[],t);throw new Pe('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(Q2.hasOwnProperty(e.text))n=new $e("mtext",[new Er(" ")]);else{if(X2.hasOwnProperty(e.text))return new $e("mspace");throw new Pe('Unknown type of space "'+e.text+'"')}return n}});var A7=()=>{var e=new $e("mtd",[]);return e.setAttribute("width","50%"),e};Du({type:"tag",mathmlBuilder(e,t){var n=new $e("mtable",[new $e("mtr",[A7(),new $e("mtd",[ac(e.body,t)]),A7(),new $e("mtd",[ac(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var E7={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},M7={"\\textbf":"textbf","\\textmd":"textmd"},SZ={"\\textit":"textit","\\textup":"textup"},N7=(e,t)=>{var n=e.font;if(n){if(E7[n])return t.withTextFontFamily(E7[n]);if(M7[n])return t.withTextFontWeight(M7[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(SZ[n])};tt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"text",mode:n.mode,body:Ar(s),font:r}},htmlBuilder(e,t){var n=N7(e,t),r=qr(e.body,n,!0);return Ie(["mord","text"],r,n)},mathmlBuilder(e,t){var n=N7(e,t);return ac(e.body,n)}});tt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=vn(e.body,t),r=rh("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=bn({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return Ie(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new $e("mo",[new Er("‾")]);n.setAttribute("stretchy","true");var r=new $e("munder",[qn(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});tt({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=vn(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return bn({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new $e("mpadded",[qn(e.body,t)],["vcenter"]);return new $e("mrow",[n])}});tt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Pe("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=I7(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),r.push(Is(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return Ie(["mord","text"].concat(s.sizingClasses(t)),uR(r),s)},mathmlBuilder(e,t){var n=new Er(I7(e)),r=new $e("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var I7=e=>e.body.replace(/ /g,e.star?"␣":" "),Ol=mR,KR=`[ \r
	]`,TZ="\\\\[a-zA-Z@]+",CZ="\\\\[^\uD800-\uDFFF]",AZ="("+TZ+")"+KR+"*",EZ=`\\\\(
|[ \r	]+
?)[ \r	]*`,Pv="[̀-ͯ]",MZ=new RegExp(Pv+"+$"),NZ="("+KR+"+)|"+(EZ+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(Pv+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Pv+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+AZ)+("|"+CZ+")");class R7{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(NZ,"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 Ai("EOF",new Js(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new Pe("Unexpected character: '"+t[n]+"'",new Ai(t[n],new Js(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 Ai(s,new Js(this,n,this.tokenRegex.lastIndex))}}class IZ{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 Pe("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 RZ=BR;D("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});D("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});D("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});D("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});D("\\@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}});D("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");D("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var j7={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};D("\\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 Pe("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=j7[t.text],r==null||r>=n)throw new Pe("Invalid base-"+n+" digit "+t.text);for(var s;(s=j7[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var o5=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new Pe("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new Pe("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new Pe("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(s=e.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var l="",c=e.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Pe("Invalid number of arguments: "+l);a=parseInt(l),s=e.consumeArg().tokens}return o&&r||e.macros.set(i,{tokens:s,numArgs:a}),""};D("\\newcommand",e=>o5(e,!1,!0,!1));D("\\renewcommand",e=>o5(e,!0,!1,!1));D("\\providecommand",e=>o5(e,!0,!0,!0));D("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});D("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});D("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Ol[n],er.math[n],er.text[n]),""});D("\\bgroup","{");D("\\egroup","}");D("~","\\nobreakspace");D("\\lq","`");D("\\rq","'");D("\\aa","\\r a");D("\\AA","\\r A");D("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");D("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");D("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");D("ℬ","\\mathscr{B}");D("ℰ","\\mathscr{E}");D("ℱ","\\mathscr{F}");D("ℋ","\\mathscr{H}");D("ℐ","\\mathscr{I}");D("ℒ","\\mathscr{L}");D("ℳ","\\mathscr{M}");D("ℛ","\\mathscr{R}");D("ℭ","\\mathfrak{C}");D("ℌ","\\mathfrak{H}");D("ℨ","\\mathfrak{Z}");D("\\Bbbk","\\Bbb{k}");D("\\llap","\\mathllap{\\textrm{#1}}");D("\\rlap","\\mathrlap{\\textrm{#1}}");D("\\clap","\\mathclap{\\textrm{#1}}");D("\\mathstrut","\\vphantom{(}");D("\\underbar","\\underline{\\text{#1}}");D("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');D("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");D("\\ne","\\neq");D("≠","\\neq");D("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");D("∉","\\notin");D("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");D("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");D("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");D("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");D("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");D("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");D("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");D("⟂","\\perp");D("‼","\\mathclose{!\\mkern-0.8mu!}");D("∌","\\notni");D("⌜","\\ulcorner");D("⌝","\\urcorner");D("⌞","\\llcorner");D("⌟","\\lrcorner");D("©","\\copyright");D("®","\\textregistered");D("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');D("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');D("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');D("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');D("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");D("⋮","\\vdots");D("\\varGamma","\\mathit{\\Gamma}");D("\\varDelta","\\mathit{\\Delta}");D("\\varTheta","\\mathit{\\Theta}");D("\\varLambda","\\mathit{\\Lambda}");D("\\varXi","\\mathit{\\Xi}");D("\\varPi","\\mathit{\\Pi}");D("\\varSigma","\\mathit{\\Sigma}");D("\\varUpsilon","\\mathit{\\Upsilon}");D("\\varPhi","\\mathit{\\Phi}");D("\\varPsi","\\mathit{\\Psi}");D("\\varOmega","\\mathit{\\Omega}");D("\\substack","\\begin{subarray}{c}#1\\end{subarray}");D("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");D("\\boxed","\\fbox{$\\displaystyle{#1}$}");D("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");D("\\implies","\\DOTSB\\;\\Longrightarrow\\;");D("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");D("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");D("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var L7={",":"\\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"},jZ=new Set(["bin","rel"]);D("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in L7?t=L7[n]:(n.slice(0,4)==="\\not"||n in er.math&&jZ.has(er.math[n].group))&&(t="\\dotsb"),t});var a5={")":!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};D("\\dotso",function(e){var t=e.future().text;return t in a5?"\\ldots\\,":"\\ldots"});D("\\dotsc",function(e){var t=e.future().text;return t in a5&&t!==","?"\\ldots\\,":"\\ldots"});D("\\cdots",function(e){var t=e.future().text;return t in a5?"\\@cdots\\,":"\\@cdots"});D("\\dotsb","\\cdots");D("\\dotsm","\\cdots");D("\\dotsi","\\!\\cdots");D("\\dotsx","\\ldots\\,");D("\\DOTSI","\\relax");D("\\DOTSB","\\relax");D("\\DOTSX","\\relax");D("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");D("\\,","\\tmspace+{3mu}{.1667em}");D("\\thinspace","\\,");D("\\>","\\mskip{4mu}");D("\\:","\\tmspace+{4mu}{.2222em}");D("\\medspace","\\:");D("\\;","\\tmspace+{5mu}{.2777em}");D("\\thickspace","\\;");D("\\!","\\tmspace-{3mu}{.1667em}");D("\\negthinspace","\\!");D("\\negmedspace","\\tmspace-{4mu}{.2222em}");D("\\negthickspace","\\tmspace-{5mu}{.277em}");D("\\enspace","\\kern.5em ");D("\\enskip","\\hskip.5em\\relax");D("\\quad","\\hskip1em\\relax");D("\\qquad","\\hskip2em\\relax");D("\\tag","\\@ifstar\\tag@literal\\tag@paren");D("\\tag@paren","\\tag@literal{({#1})}");D("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Pe("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});D("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");D("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");D("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");D("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");D("\\newline","\\\\\\relax");D("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var YR=Ue(Uo["Main-Regular"][84][1]-.7*Uo["Main-Regular"][65][1]);D("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+YR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");D("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+YR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");D("\\hspace","\\@ifstar\\@hspacer\\@hspace");D("\\@hspace","\\hskip #1\\relax");D("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");D("\\ordinarycolon",":");D("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");D("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');D("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');D("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');D("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');D("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');D("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');D("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');D("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');D("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');D("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');D("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');D("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');D("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');D("∷","\\dblcolon");D("∹","\\eqcolon");D("≔","\\coloneqq");D("≕","\\eqqcolon");D("⩴","\\Coloneqq");D("\\ratio","\\vcentcolon");D("\\coloncolon","\\dblcolon");D("\\colonequals","\\coloneqq");D("\\coloncolonequals","\\Coloneqq");D("\\equalscolon","\\eqqcolon");D("\\equalscoloncolon","\\Eqqcolon");D("\\colonminus","\\coloneq");D("\\coloncolonminus","\\Coloneq");D("\\minuscolon","\\eqcolon");D("\\minuscoloncolon","\\Eqcolon");D("\\coloncolonapprox","\\Colonapprox");D("\\coloncolonsim","\\Colonsim");D("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");D("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");D("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");D("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");D("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");D("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");D("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");D("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");D("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");D("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");D("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");D("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");D("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");D("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");D("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");D("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");D("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");D("\\nleqq","\\html@mathml{\\@nleqq}{≰}");D("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");D("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");D("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");D("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");D("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");D("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");D("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");D("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");D("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");D("\\imath","\\html@mathml{\\@imath}{ı}");D("\\jmath","\\html@mathml{\\@jmath}{ȷ}");D("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");D("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");D("⟦","\\llbracket");D("⟧","\\rrbracket");D("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");D("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");D("⦃","\\lBrace");D("⦄","\\rBrace");D("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");D("⦵","\\minuso");D("\\darr","\\downarrow");D("\\dArr","\\Downarrow");D("\\Darr","\\Downarrow");D("\\lang","\\langle");D("\\rang","\\rangle");D("\\uarr","\\uparrow");D("\\uArr","\\Uparrow");D("\\Uarr","\\Uparrow");D("\\N","\\mathbb{N}");D("\\R","\\mathbb{R}");D("\\Z","\\mathbb{Z}");D("\\alef","\\aleph");D("\\alefsym","\\aleph");D("\\Alpha","\\mathrm{A}");D("\\Beta","\\mathrm{B}");D("\\bull","\\bullet");D("\\Chi","\\mathrm{X}");D("\\clubs","\\clubsuit");D("\\cnums","\\mathbb{C}");D("\\Complex","\\mathbb{C}");D("\\Dagger","\\ddagger");D("\\diamonds","\\diamondsuit");D("\\empty","\\emptyset");D("\\Epsilon","\\mathrm{E}");D("\\Eta","\\mathrm{H}");D("\\exist","\\exists");D("\\harr","\\leftrightarrow");D("\\hArr","\\Leftrightarrow");D("\\Harr","\\Leftrightarrow");D("\\hearts","\\heartsuit");D("\\image","\\Im");D("\\infin","\\infty");D("\\Iota","\\mathrm{I}");D("\\isin","\\in");D("\\Kappa","\\mathrm{K}");D("\\larr","\\leftarrow");D("\\lArr","\\Leftarrow");D("\\Larr","\\Leftarrow");D("\\lrarr","\\leftrightarrow");D("\\lrArr","\\Leftrightarrow");D("\\Lrarr","\\Leftrightarrow");D("\\Mu","\\mathrm{M}");D("\\natnums","\\mathbb{N}");D("\\Nu","\\mathrm{N}");D("\\Omicron","\\mathrm{O}");D("\\plusmn","\\pm");D("\\rarr","\\rightarrow");D("\\rArr","\\Rightarrow");D("\\Rarr","\\Rightarrow");D("\\real","\\Re");D("\\reals","\\mathbb{R}");D("\\Reals","\\mathbb{R}");D("\\Rho","\\mathrm{P}");D("\\sdot","\\cdot");D("\\sect","\\S");D("\\spades","\\spadesuit");D("\\sub","\\subset");D("\\sube","\\subseteq");D("\\supe","\\supseteq");D("\\Tau","\\mathrm{T}");D("\\thetasym","\\vartheta");D("\\weierp","\\wp");D("\\Zeta","\\mathrm{Z}");D("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");D("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");D("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");D("\\bra","\\mathinner{\\langle{#1}|}");D("\\ket","\\mathinner{|{#1}\\rangle}");D("\\braket","\\mathinner{\\langle{#1}\\rangle}");D("\\Bra","\\left\\langle#1\\right|");D("\\Ket","\\left|#1\\right\\rangle");var XR=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,s=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=d=>f=>{e&&(f.macros.set("|",o),s.length&&f.macros.set("\\|",a));var m=d;if(!d&&s.length){var p=f.future();p.text==="|"&&(f.popToken(),m=!0)}return{tokens:m?s:r,numArgs:0}};t.macros.set("|",l(!1)),s.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,u=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};D("\\bra@ket",XR(!1));D("\\bra@set",XR(!0));D("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");D("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");D("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");D("\\angln","{\\angl n}");D("\\blue","\\textcolor{##6495ed}{#1}");D("\\orange","\\textcolor{##ffa500}{#1}");D("\\pink","\\textcolor{##ff00af}{#1}");D("\\red","\\textcolor{##df0030}{#1}");D("\\green","\\textcolor{##28ae7b}{#1}");D("\\gray","\\textcolor{gray}{#1}");D("\\purple","\\textcolor{##9d38bd}{#1}");D("\\blueA","\\textcolor{##ccfaff}{#1}");D("\\blueB","\\textcolor{##80f6ff}{#1}");D("\\blueC","\\textcolor{##63d9ea}{#1}");D("\\blueD","\\textcolor{##11accd}{#1}");D("\\blueE","\\textcolor{##0c7f99}{#1}");D("\\tealA","\\textcolor{##94fff5}{#1}");D("\\tealB","\\textcolor{##26edd5}{#1}");D("\\tealC","\\textcolor{##01d1c1}{#1}");D("\\tealD","\\textcolor{##01a995}{#1}");D("\\tealE","\\textcolor{##208170}{#1}");D("\\greenA","\\textcolor{##b6ffb0}{#1}");D("\\greenB","\\textcolor{##8af281}{#1}");D("\\greenC","\\textcolor{##74cf70}{#1}");D("\\greenD","\\textcolor{##1fab54}{#1}");D("\\greenE","\\textcolor{##0d923f}{#1}");D("\\goldA","\\textcolor{##ffd0a9}{#1}");D("\\goldB","\\textcolor{##ffbb71}{#1}");D("\\goldC","\\textcolor{##ff9c39}{#1}");D("\\goldD","\\textcolor{##e07d10}{#1}");D("\\goldE","\\textcolor{##a75a05}{#1}");D("\\redA","\\textcolor{##fca9a9}{#1}");D("\\redB","\\textcolor{##ff8482}{#1}");D("\\redC","\\textcolor{##f9685d}{#1}");D("\\redD","\\textcolor{##e84d39}{#1}");D("\\redE","\\textcolor{##bc2612}{#1}");D("\\maroonA","\\textcolor{##ffbde0}{#1}");D("\\maroonB","\\textcolor{##ff92c6}{#1}");D("\\maroonC","\\textcolor{##ed5fa6}{#1}");D("\\maroonD","\\textcolor{##ca337c}{#1}");D("\\maroonE","\\textcolor{##9e034e}{#1}");D("\\purpleA","\\textcolor{##ddd7ff}{#1}");D("\\purpleB","\\textcolor{##c6b9fc}{#1}");D("\\purpleC","\\textcolor{##aa87ff}{#1}");D("\\purpleD","\\textcolor{##7854ab}{#1}");D("\\purpleE","\\textcolor{##543b78}{#1}");D("\\mintA","\\textcolor{##f5f9e8}{#1}");D("\\mintB","\\textcolor{##edf2df}{#1}");D("\\mintC","\\textcolor{##e0e5cc}{#1}");D("\\grayA","\\textcolor{##f6f7f7}{#1}");D("\\grayB","\\textcolor{##f0f1f2}{#1}");D("\\grayC","\\textcolor{##e3e5e6}{#1}");D("\\grayD","\\textcolor{##d6d8da}{#1}");D("\\grayE","\\textcolor{##babec2}{#1}");D("\\grayF","\\textcolor{##888d93}{#1}");D("\\grayG","\\textcolor{##626569}{#1}");D("\\grayH","\\textcolor{##3b3e40}{#1}");D("\\grayI","\\textcolor{##21242c}{#1}");D("\\kaBlue","\\textcolor{##314453}{#1}");D("\\kaGreen","\\textcolor{##71B307}{#1}");var QR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class LZ{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 IZ(RZ,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new R7(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 Ai("EOF",r.loc)),this.pushTokens(s),new Ai("",Js.range(n,r))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],r=t&&t.length>0;r||this.consumeSpaces();var s=this.future(),i,o=0,a=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new Pe("Extra }",i)}else if(i.text==="EOF")throw new Pe("Unexpected end of input in a macro argument, expected '"+(t&&r?t[a]:"}")+"'",i);if(t&&r)if((o===0||o===1&&t[a]==="{")&&i.text===t[a]){if(++a,a===t.length){n.splice(-a,a);break}}else a=0}while(o!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new Pe("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 Pe("Use of the macro doesn't match its definition",i)}}for(var o=[],a=0;a<t;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new Pe("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 Pe("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new Pe("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...o[+l.text-1]);else throw new Pe("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 Ai(t)]):void 0}expandTokens(t){var n=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(r=>r.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var r=this.lexer.catcodes[t];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new R7(s,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:i};return u}return s}isDefined(t){return this.macros.has(t)||Ol.hasOwnProperty(t)||er.math.hasOwnProperty(t)||er.text.hasOwnProperty(t)||QR.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Ol.hasOwnProperty(t)&&!Ol[t].primitive}}var D7=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,up=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),J2={"́":{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"}},O7={á:"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 JR=class ZR{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 LZ(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 Pe("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 Ai("}")),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(ZR.endOfExpression.has(s.text)||n&&s.text===n||t&&Ol[s.text]&&Ol[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 Pe("only one infix operator per group",i.token);n=s,r=i.replaceWith}}if(n!==-1&&r){var o,a,l=t.slice(0,n),c=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var u;return r==="\\\\abovefrac"?u=this.callFunction(r,[o,t[n],a],[]):u=this.callFunction(r,[o,a],[]),[u]}else return t}handleSupSubscript(t){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(t)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new Pe("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(t){for(var n=[],r=0;r<t.length;r++)n.push({type:"textord",mode:"text",text:t[r]});var s={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(t){var n=this.parseGroup("atom",t);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var o=i.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new Pe("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new Pe("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new Pe("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new Pe("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(up[i.text]){var c=D7.test(i.text),u=[];for(u.push(new Ai(up[i.text])),this.consume();;){var d=this.fetch().text;if(!up[d]||D7.test(d)!==c)break;u.unshift(new Ai(up[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=Ol[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Pe("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new Pe("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new Pe("Can't use function '"+s+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(s,i);return this.callFunction(s,o,a,r,t)}callFunction(t,n,r,s,i){var o={funcName:t,parser:this,token:s,breakOnTokenText:i},a=Ol[t];if(a&&a.handler)return a.handler(o,n,r);throw new Pe("No function handler for "+t)}parseArguments(t,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<r;o++){var a=n.argTypes&&n.argTypes[o],l=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+t+"'",a,l);if(l)i.push(c);else if(c!=null)s.push(c);else throw new Pe("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 Pe("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new Pe("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Pe("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(t,n){for(var r=this.fetch(),s=r,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new Pe("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 Pe("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 Pe("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!sR(i))throw new Pe("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(t,n){var r=this.gullet.scanArgument(t);if(r==null)return null;var s=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),o}parseGroup(t,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:Js.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!QR.hasOwnProperty(s)){if(this.settings.throwOnError)throw new Pe("Undefined control sequence: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){for(var n=t.length-1,r=0;r<n;++r){var s=t[r];if(s.type==="textord"){var i=s.text,o=t[r+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[r+2];r+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:Js.range(s,a),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:Js.range(s,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:Js.range(s,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new Pe(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}O7.hasOwnProperty(n[0])&&!er[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=O7[n[0]]+n.slice(1));var i=MZ.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(er[this.mode][n]){this.settings.strict&&this.mode==="math"&&Sv.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=er[this.mode][n].group,l=Js.range(t),c;XJ(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:n}:c={type:a,mode:this.mode,loc:l,text:n},o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(rR(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:Js.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(!J2[d])throw new Pe("Unknown accent ' "+d+"'",t);var f=J2[d][this.mode]||J2[d].text;if(!f)throw new Pe("Accent "+d+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Js.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};JR.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var l5=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new JR(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 Pe("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new Ai("\\df@tag")])}]}return s},c5=function(t,n,r){n.textContent="";var s=zy(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."),c5=function(){throw new Pe("KaTeX doesn't work in quirks mode.")});var ej=function(t,n){var r=zy(t,n).toMarkup();return r},tj=function(t,n){var r=new K_(n);return l5(t,r)},nj=function(t,n,r){if(r.throwOnError||!(t instanceof Pe))throw t;var s=Ie(["katex-error"],[new Ni(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},zy=function(t,n){var r=new K_(n);try{var s=l5(t,r);return FJ(s,t,r)}catch(i){return nj(i,t,r)}},rj=function(t,n){var r=new K_(n);try{var s=l5(t,r);return UJ(s,t,r)}catch(i){return nj(i,t,r)}},sj="0.16.47",ij={Span:Eh,Anchor:Ay,SymbolNode:Ni,SvgNode:Wa,PathNode:ic,LineNode:kv},zv={version:sj,render:c5,renderToString:ej,ParseError:Pe,SETTINGS_SCHEMA:c1,__parse:tj,__renderToDomTree:zy,__renderToHTMLTree:rj,__setFontMetrics:lR,__defineSymbol:k,__defineFunction:tt,__defineMacro:D,__domTree:ij};const X9e=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Pe,SETTINGS_SCHEMA:c1,__defineFunction:tt,__defineMacro:D,__defineSymbol:k,__domTree:ij,__parse:tj,__renderToDomTree:zy,__renderToHTMLTree:rj,__setFontMetrics:lR,default:zv,get render(){return c5},renderToString:ej,version:sj},Symbol.toStringTag,{value:"Module"})),DZ={};function B7(e){const t=this,n=e||DZ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(UQ(n)),i.push(DQ()),o.push(OQ(n))}const P7=/[#.]/g;function OZ(e,t){const n=e||"",r={};let s=0,i,o;for(;s<n.length;){P7.lastIndex=s;const a=P7.exec(n),l=n.slice(s,a?a.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,s+=l.length),a&&(i=a[0],s++)}return{type:"element",tagName:o||t||"div",properties:r,children:[]}}function oj(e,t,n){const r=n?$Z(n):void 0;function s(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=OZ(i,t);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,BZ(o))a.unshift(o);else for(const[d,f]of Object.entries(o))PZ(e,l.properties,d,f)}for(const c of a)$v(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function BZ(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const s=t[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function PZ(e,t,n,r){const s=E_(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=iS(r):s.commaSeparated?i=eS(r):s.commaOrSpaceSeparated?i=iS(eS(r).join(" ")):i=z7(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?zZ(r):String(r);if(Array.isArray(i)){const o=[];for(const a of i)o.push(z7(s,s.property,a));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function $v(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)$v(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?$v(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function z7(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||k0(n)===k0(t)))return!0}return n}function zZ(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function $Z(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const qZ=["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"],FZ=oj(M_,"div"),UZ=oj(Th,"g",qZ),Z2={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function HZ(e,t){return aj(e,{})||{type:"root",children:[]}}function aj(e,t){const n=VZ(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function VZ(e,t){switch(e.nodeType){case 1:return YZ(e,t);case 3:return GZ(e);case 8:return KZ(e);case 9:return $7(e,t);case 10:return WZ();case 11:return $7(e,t);default:return}}function $7(e,t){return{type:"root",children:lj(e,t)}}function WZ(){return{type:"doctype"}}function GZ(e){return{type:"text",value:e.nodeValue||""}}function KZ(e){return{type:"comment",value:e.nodeValue||""}}function YZ(e,t){const n=e.namespaceURI,r=n===Z2.svg?UZ:FZ,s=n===Z2.html?e.tagName.toLowerCase():e.tagName,i=n===Z2.html&&s==="template"?e.content:e,o=e.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=e.getAttribute(o[l])||"";return r(s,a,lj(i,t))}function lj(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=aj(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function XZ(e,t){const n=QZ(e);return HZ(n)}function QZ(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const q7=function(e,t,n){const r=cm(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 eee;if(typeof e=="string")return ZZ(e);if(typeof e=="object")return JZ(e);if(typeof e=="function")return u5(e);throw new Error("Expected function, string, or array as `test`")};function JZ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ou(e[n]);return u5(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function ZZ(e){return u5(t);function t(n){return n.tagName===e}}function u5(e){return t;function t(n,r,s){return!!(tee(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function eee(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function tee(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const F7=/\n/g,U7=/[\t ]+/g,qv=Ou("br"),H7=Ou(cee),nee=Ou("p"),V7=Ou("tr"),ree=Ou(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",lee,uee]),cj=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 see(e,t){const n=t||{},r="children"in e?e.children:[],s=cj(e),i=hj(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...dj(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...uj(r[a],e,{whitespace:i,breakBefore:a?void 0:s,breakAfter:a<r.length-1?qv(r[a+1]):s}));const l=[];let c;for(a=-1;++a<o.length;){const u=o[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function uj(e,t,n){return e.type==="element"?iee(e,t,n):e.type==="text"?n.whitespace==="normal"?dj(e,n):oee(e):[]}function iee(e,t,n){const r=hj(e,n),s=e.children||[];let i=-1,o=[];if(ree(e))return o;let a,l;for(qv(e)||V7(e)&&q7(t,e,V7)?l=`
`:nee(e)?(a=2,l=2):cj(e)&&(a=1,l=1);++i<s.length;)o=o.concat(uj(s[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<s.length-1?qv(s[i+1]):l}));return H7(e)&&q7(t,e,H7)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function dj(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){F7.lastIndex=i;const l=F7.exec(n),c=l&&"index"in l?l.index:n.length;r.push(aee(n.slice(i,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,c===n.length?t.breakAfter:!0)),i=c+1}let o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(s.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&s.push(a),s.push(r[o]),a=0):(o===0||o===r.length-1)&&s.push(0);return s}function oee(e){return[String(e.value)]}function aee(e,t,n){const r=[];let s=0,i;for(;s<e.length;){U7.lastIndex=s;const o=U7.exec(e);i=o?o.index:e.length,!s&&!i&&o&&!t&&r.push(""),s!==i&&r.push(e.slice(s,i)),s=o?i+o[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function hj(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 lee(e){return!!(e.properties||{}).hidden}function cee(e){return e.tagName==="td"||e.tagName==="th"}function uee(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const dee={},hee=[];function W7(e){const t=e||dee;return function(n,r){F_(n,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:hee,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let u=l;if(!a&&!l&&!c)return;let d=i[i.length-1],f=s;if(s.tagName==="code"&&a&&d&&d.type==="element"&&d.tagName==="pre"&&(f=d,d=i[i.length-2],u=!0),!d)return;const m=see(f,{whitespace:"pre"});let p;try{p=zv.renderToString(m,{...t,displayMode:u,throwOnError:!0})}catch(x){const b=x,w=b.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:b,place:s.position,ruleId:w,source:"rehype-katex"});try{p=zv.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(x)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=XZ(p).children);const y=d.children.indexOf(f);return d.children.splice(y,1,...p),NI})}}const fj=[{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"),[])}],fee=Object.fromEntries(fj.map(e=>[e.id,e.import])),mee=Object.fromEntries(fj.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),pee={...fee,...mee},gee=[{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"),[])}],yee=Object.fromEntries(gee.map(e=>[e.id,e.import]));let Pa=class extends Error{constructor(t){super(t),this.name="ShikiError"}},d5=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function bee(){return 2147483648}function wee(){return typeof performance<"u"?performance.now():Date.now()}const vee=(e,t)=>e+(t-e%t)%t;async function xee(e){let t,n;const r={};function s(m){n=m,r.HEAPU8=new Uint8Array(m),r.HEAPU32=new Uint32Array(m)}function i(m,p,y){r.HEAPU8.copyWithin(m,p,p+y)}function o(m){try{return t.grow(m-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function a(m){const p=r.HEAPU8.length;m=m>>>0;const y=bee();if(m>y)return!1;for(let x=1;x<=4;x*=2){let b=p*(1+.2/x);b=Math.min(b,m+100663296);const w=Math.min(y,vee(Math.max(m,b),65536));if(o(w))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,p,y=1024){const x=p+y;let b=p;for(;m[b]&&!(b>=x);)++b;if(b-p>16&&m.buffer&&l)return l.decode(m.subarray(p,b));let w="";for(;p<b;){let v=m[p++];if(!(v&128)){w+=String.fromCharCode(v);continue}const _=m[p++]&63;if((v&224)===192){w+=String.fromCharCode((v&31)<<6|_);continue}const S=m[p++]&63;if((v&240)===224?v=(v&15)<<12|_<<6|S:v=(v&7)<<18|_<<12|S<<6|m[p++]&63,v<65536)w+=String.fromCharCode(v);else{const C=v-65536;w+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return w}function u(m,p){return m?c(r.HEAPU8,m,p):""}const d={emscripten_get_now:wee,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const p=await e({env:d,wasi_snapshot_preview1:d});t=p.memory,s(t.buffer),Object.assign(r,p),r.UTF8ToString=u}return await f(),r}var _ee=Object.defineProperty,kee=(e,t,n)=>t in e?_ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Or=(e,t,n)=>(kee(e,typeof t!="symbol"?t+"":t,n),n);let Vr=null;function See(e){throw new d5(e.UTF8ToString(e.getLastOnigError()))}class $y{constructor(t){Or(this,"utf16Length"),Or(this,"utf8Length"),Or(this,"utf16Value"),Or(this,"utf8Value"),Or(this,"utf16OffsetToUtf8"),Or(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 o=s?new Uint32Array(r+1):null;s&&(o[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=t.charCodeAt(c);let d=u,f=!1;if(u>=55296&&u<=56319&&c+1<n){const m=t.charCodeAt(c+1);m>=56320&&m<=57343&&(d=(u-55296<<10)+65536|m-56320,f=!0)}s&&(i[c]=l,f&&(i[c+1]=l),d<=127?o[l+0]=c:d<=2047?(o[l+0]=c,o[l+1]=c):d<=65535?(o[l+0]=c,o[l+1]=c,o[l+2]=c):(o[l+0]=c,o[l+1]=c,o[l+2]=c,o[l+3]=c)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const i=t.charCodeAt(r);let o=i,a=!1;if(i>=55296&&i<=56319&&r+1<s){const l=t.charCodeAt(r+1);l>=56320&&l<=57343&&(o=(i-55296<<10)+65536|l-56320,a=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,a&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Io=class{constructor(e){if(Or(this,"id",++Io.LAST_ID),Or(this,"_onigBinding"),Or(this,"content"),Or(this,"utf16Length"),Or(this,"utf8Length"),Or(this,"utf16OffsetToUtf8"),Or(this,"utf8OffsetToUtf16"),Or(this,"ptr"),!Vr)throw new d5("Must invoke loadWasm first.");this._onigBinding=Vr,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&&!Io._sharedPtrInUse?(Io._sharedPtr||(Io._sharedPtr=Vr.omalloc(1e4)),Io._sharedPtrInUse=!0,Vr.HEAPU8.set(t.utf8Value,Io._sharedPtr),this.ptr=Io._sharedPtr):this.ptr=t.createString(Vr)}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===Io._sharedPtr?Io._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let fm=Io;Or(fm,"LAST_ID",0);Or(fm,"_sharedPtr",0);Or(fm,"_sharedPtrInUse",!1);class Tee{constructor(t){if(Or(this,"_onigBinding"),Or(this,"_ptr"),!Vr)throw new d5("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a<l;a++){const c=new $y(t[a]);n[a]=c.createString(Vr),r[a]=c.utf8Length}const s=Vr.omalloc(4*t.length);Vr.HEAPU32.set(n,s/4);const i=Vr.omalloc(4*t.length);Vr.HEAPU32.set(r,i/4);const o=Vr.createOnigScanner(s,i,t.length);for(let a=0,l=t.length;a<l;a++)Vr.ofree(n[a]);Vr.ofree(i),Vr.ofree(s),o===0&&See(Vr),this._onigBinding=Vr,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new fm(t);const i=this._findNextMatchSync(t,n,!1,s);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,s)}_findNextMatchSync(t,n,r,s){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(o===0)return null;const a=i.HEAPU32;let l=o/4;const c=a[l++],u=a[l++],d=[];for(let f=0;f<u;f++){const m=t.convertUtf8OffsetToUtf16(a[l++]),p=t.convertUtf8OffsetToUtf16(a[l++]);d[f]={start:m,end:p,length:p-m}}return{index:c,captureIndices:d}}}function Cee(e){return typeof e.instantiator=="function"}function Aee(e){return typeof e.default=="function"}function Eee(e){return typeof e.data<"u"}function Mee(e){return typeof Response<"u"&&e instanceof Response}function Nee(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 dp;function Iee(e){if(dp)return dp;async function t(){Vr=await xee(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Cee(r)?r=await r.instantiator(n):Aee(r)?r=await r.default(n):(Eee(r)&&(r=r.data),Mee(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Ree(r)(n):r=await jee(r)(n):Nee(r)?r=await e4(r)(n):r instanceof WebAssembly.Module?r=await e4(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await e4(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return dp=t(),dp}function e4(e){return t=>WebAssembly.instantiate(e,t)}function Ree(e){return t=>WebAssembly.instantiateStreaming(e,t)}function jee(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Lee;function Dee(){return Lee}async function mj(e){return e&&await Iee(e),{createScanner(t){return new Tee(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new fm(t)}}}function Oee(e){return h5(e)}function h5(e){return Array.isArray(e)?Bee(e):e instanceof RegExp?e:typeof e=="object"?Pee(e):e}function Bee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=h5(e[n]);return t}function Pee(e){let t={};for(let n in e)t[n]=h5(e[n]);return t}function pj(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function gj(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?gj(e.substring(0,e.length-1)):e.substr(~t+1)}var t4=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,hp=class{static hasCaptures(e){return e===null?!1:(t4.lastIndex=0,t4.test(e))}static replaceCaptures(e,t,n){return e.replace(t4,(r,s,i,o)=>{let a=n[parseInt(s||i,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function yj(e,t){return e<t?-1:e>t?1:0}function bj(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=yj(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function G7(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 wj(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var vj=class{constructor(e){le(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}},p1=class{constructor(e,t,n){le(this,"_cachedMatchRoot",new vj(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(qee(e),t)}static createFromParsedTheme(e,t){return Uee(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=>zee(e.parent,s.parentScopes));return r?new xj(r.fontStyle,r.foreground,r.background):null}},n4=class cg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new cg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new cg(n,t[r]);return n}push(t){return new cg(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 zee(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&&!$ee(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function $ee(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var xj=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function qee(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,i=t.length;s<i;s++){let o=t[s];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let d=o.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),a=d.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let d=o.settings.fontStyle.split(" ");for(let f=0,m=d.length;f<m;f++)switch(d[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof o.settings.foreground=="string"&&G7(o.settings.foreground)&&(c=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&G7(o.settings.background)&&(u=o.settings.background);for(let d=0,f=a.length;d<f;d++){let p=a[d].trim().split(" "),y=p[p.length-1],x=null;p.length>1&&(x=p.slice(0,p.length-1),x.reverse()),n[r++]=new Fee(y,x,s,l,c,u)}}return n}var Fee=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}},Ra=(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))(Ra||{});function Uee(e,t){e.sort((l,c)=>{let u=yj(l.scope,c.scope);return u!==0||(u=bj(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 Hee(t),o=new xj(n,i.getId(r),i.getId(s)),a=new Wee(new Fv(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let u=e[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new p1(i,o,a)}var Hee=class{constructor(e){le(this,"_isFrozen");le(this,"_lastColorId");le(this,"_id2color");le(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)}},Vee=Object.freeze([]),Fv=class _j{constructor(t,n,r,s,i){le(this,"scopeDepth");le(this,"parentScopes");le(this,"fontStyle");le(this,"foreground");le(this,"background");this.scopeDepth=t,this.parentScopes=n||Vee,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new _j(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)}},Wee=class Uv{constructor(t,n=[],r={}){le(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(Uv._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(n===""){this._doInsertHere(t,r,s,i,o);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Uv(this._mainRule.clone(),Fv.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(t+1,c,r,s,i,o)}_doInsertHere(t,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(t,r,s,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let l=this._rulesWithParentScopes[o];if(bj(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 Fv(t,n,r,s,i))}},ih=class Oi{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Oi.getLanguageId(t),r=Oi.getTokenType(t),s=Oi.getFontStyle(t),i=Oi.getForeground(t),o=Oi.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,i,o,a){let l=Oi.getLanguageId(t),c=Oi.getTokenType(t),u=Oi.containsBalancedBrackets(t)?1:0,d=Oi.getFontStyle(t),f=Oi.getForeground(t),m=Oi.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),i!==-1&&(d=i),o!==0&&(f=o),a!==0&&(m=a),(l<<0|c<<8|u<<10|d<<11|f<<15|m<<24)>>>0}};function g1(e,t){const n=[],r=Gee(e);let s=r.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=o();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();const l=i();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(K7(s)){const l=[];do l.push(s),s=r.next();while(K7(s));return c=>t(l,c)}return null}function o(){const l=[];let c=i();for(;c;)l.push(c),c=i();return u=>l.every(d=>d(u))}function a(){const l=[];let c=o();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=o()}return u=>l.some(d=>d(u))}}function K7(e){return!!e&&!!e.match(/[\w\.:]+/)}function Gee(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 kj(e){typeof e.dispose=="function"&&e.dispose()}var E0=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Kee=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Yee=class{constructor(){le(this,"_references",[]);le(this,"_seenReferenceKeys",new Set);le(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))}},Xee=class{constructor(e,t){le(this,"seenFullScopeRequests",new Set);le(this,"seenPartialScopeRequests",new Set);le(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new E0(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Yee;for(const n of e)Qee(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof E0){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 Qee(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 E0?ug({baseGrammar:i,selfGrammar:s},r):Hv(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const o=n.injections(e.scopeName);if(o)for(const a of o)r.add(new E0(a))}function Hv(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];y1([r],t,n)}}function ug(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&y1(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&y1(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function y1(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?pj({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&y1(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const o=Sj(i);switch(o.kind){case 0:ug({...t,selfGrammar:t.baseGrammar},n);break;case 1:ug(t,n);break;case 2:Hv(o.ruleName,{...t,repository:s},n);break;case 3:case 4:const a=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:s};o.kind===4?Hv(o.ruleName,l,n):ug(l,n)}else o.kind===4?n.add(new Kee(o.scopeName,o.ruleName)):n.add(new E0(o.scopeName));break}}}var Jee=class{constructor(){le(this,"kind",0)}},Zee=class{constructor(){le(this,"kind",1)}},ete=class{constructor(e){le(this,"kind",2);this.ruleName=e}},tte=class{constructor(e){le(this,"kind",3);this.scopeName=e}},nte=class{constructor(e,t){le(this,"kind",4);this.scopeName=e,this.ruleName=t}};function Sj(e){if(e==="$base")return new Jee;if(e==="$self")return new Zee;const t=e.indexOf("#");if(t===-1)return new tte(e);if(t===0)return new ete(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new nte(n,r)}}var rte=/\\(\d+)/,Y7=/\\(\d+)/g,ste=-1,Tj=-2;var mm=class{constructor(t,n,r,s){le(this,"$location");le(this,"id");le(this,"_nameIsCapturing");le(this,"_name");le(this,"_contentNameIsCapturing");le(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=hp.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=hp.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${gj(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:hp.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:hp.replaceCaptures(this._contentName,t,n)}},ite=class extends mm{constructor(t,n,r,s,i){super(t,n,r,s);le(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!")}},ote=class extends mm{constructor(t,n,r,s,i){super(t,n,r,null);le(this,"_match");le(this,"captures");le(this,"_cachedCompiledPatterns");this._match=new M0(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 N0,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},X7=class extends mm{constructor(t,n,r,s,i){super(t,n,r,s);le(this,"hasMissingPatterns");le(this,"patterns");le(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 N0,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Vv=class extends mm{constructor(t,n,r,s,i,o,a,l,c,u){super(t,n,r,s);le(this,"_begin");le(this,"beginCaptures");le(this,"_end");le(this,"endHasBackReferences");le(this,"endCaptures");le(this,"applyEndPatternLast");le(this,"hasMissingPatterns");le(this,"patterns");le(this,"_cachedCompiledPatterns");this._begin=new M0(i,this.id),this.beginCaptures=o,this._end=new M0(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,s)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new N0;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}},b1=class extends mm{constructor(t,n,r,s,i,o,a,l,c){super(t,n,r,s);le(this,"_begin");le(this,"beginCaptures");le(this,"whileCaptures");le(this,"_while");le(this,"whileHasBackReferences");le(this,"hasMissingPatterns");le(this,"patterns");le(this,"_cachedCompiledPatterns");le(this,"_cachedCompiledWhilePatterns");this._begin=new M0(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new M0(a,Tj),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 N0;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 N0,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Cj=class ps{static createCaptureRule(t,n,r,s,i){return t.registerRule(o=>new ite(n,o,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ote(t.$vscodeTextmateLocation,t.id,t.name,t.match,ps._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=pj({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new X7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,ps._compilePatterns(i,n,r))}return t.while?new b1(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ps._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,ps._compileCaptures(t.whileCaptures||t.captures,n,r),ps._compilePatterns(t.patterns,n,r)):new Vv(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ps._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,ps._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,ps._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)s[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let l=0;t[o].patterns&&(l=ps.getCompiledRuleId(t[o],n,r)),s[a]=ps.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let l=-1;if(a.include){const c=Sj(a.include);switch(c.kind){case 0:case 1:l=ps.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=ps.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=ps.getCompiledRuleId(p,n,m.repository))}else l=ps.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=ps.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof X7||c instanceof Vv||c instanceof b1)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},M0=class Aj{constructor(t,n){le(this,"source");le(this,"ruleId");le(this,"hasAnchor");le(this,"hasBackReferences");le(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let s=0,i=[],o=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const c=t.charAt(a+1);c==="z"?(i.push(t.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(o=!0),a++}this.hasAnchor=o,s===0?this.source=t:(i.push(t.substring(s,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=rte.test(this.source):this.hasBackReferences=!1}clone(){return new Aj(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 Y7.lastIndex=0,this.source.replace(Y7,(s,i)=>wj(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],i,o,a,l;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),t[i]=a,n[i]=a,r[i]=a,s[i]=a,a==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",r[i+1]="A",s[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",r[i+1]="",s[i+1]="G"):(t[i+1]=l,n[i+1]=l,r[i+1]=l,s[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},N0=class{constructor(){le(this,"_items");le(this,"_hasAnchors");le(this,"_cached");le(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 Q7(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 Q7(e,r,this._items.map(s=>s.ruleId))}},Q7=class{constructor(e,t,n){le(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}},r4=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Aa,ate=(Aa=class{constructor(t,n){le(this,"_defaultAttributes");le(this,"_embeddedLanguagesMatcher");le(this,"_getBasicScopeAttributes",new vj(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new r4(n,r)}));this._defaultAttributes=new r4(t,8),this._embeddedLanguagesMatcher=new lte(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Aa._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Aa.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!")}},le(Aa,"_NULL_SCOPE_METADATA",new r4(0,0)),le(Aa,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Aa),lte=class{constructor(e){le(this,"values");le(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>wj(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])}},J7=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Ej(e,t,n,r,s,i,o,a){const l=t.content.length;let c=!1,u=-1;if(o){const m=cte(e,t,n,r,s,i);s=m.stack,r=m.linePos,n=m.isFirstLine,u=m.anchorPosition}const d=Date.now();for(;!c;){if(a!==0&&Date.now()-d>a)return new J7(s,!0);f()}return new J7(s,!1);function f(){const m=ute(e,t,n,r,s,u);if(!m){i.produce(s,l),c=!0;return}const p=m.captureIndices,y=m.matchedRuleId,x=p&&p.length>0?p[0].end>r:!1;if(y===ste){const b=s.getRule(e);i.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),kf(e,t,n,s,i,b.endCaptures,p),i.produce(s,p[0].end);const w=s;if(s=s.parent,u=w.getAnchorPos(),!x&&w.getEnterPos()===r){s=w,i.produce(s,l),c=!0;return}}else{const b=e.getRule(y);i.produce(s,p[0].start);const w=s,v=b.getName(t.content,p),_=s.contentNameScopesList.pushAttributed(v,e);if(s=s.push(y,r,u,p[0].end===l,null,_,_),b instanceof Vv){const S=b;kf(e,t,n,s,i,S.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const C=S.getContentName(t.content,p),E=_.pushAttributed(C,e);if(s=s.withContentNameScopesList(E),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,p))),!x&&w.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(b instanceof b1){const S=b;kf(e,t,n,s,i,S.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const C=S.getContentName(t.content,p),E=_.pushAttributed(C,e);if(s=s.withContentNameScopesList(E),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,p))),!x&&w.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(kf(e,t,n,s,i,b.captures,p),i.produce(s,p[0].end),s=s.pop(),!x){s=s.safePop(),i.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function cte(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(e);c instanceof b1&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=fte(l.rule,e,l.stack.endRule,n,r===o),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==Tj){s=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(i.produce(l.stack,d.captureIndices[0].start),kf(e,t,n,l.stack,i,l.rule.whileCaptures,d.captureIndices),i.produce(l.stack,d.captureIndices[0].end),o=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function ute(e,t,n,r,s,i){const o=dte(e,t,n,r,s,i),a=e.getInjections();if(a.length===0)return o;const l=hte(a,e,t,n,r,s,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:o}function dte(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=Mj(o,e,s.endRule,n,r===i),c=a.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function hte(e,t,n,r,s,i,o){let a=Number.MAX_VALUE,l=null,c,u=0;const d=i.contentNameScopesList.getScopeNames();for(let f=0,m=e.length;f<m;f++){const p=e[f];if(!p.matcher(d))continue;const y=t.getRule(p.ruleId),{ruleScanner:x,findOptions:b}=Mj(y,t,null,r,s===o),w=x.findNextMatchSync(n,s,b);if(!w)continue;const v=w.captureIndices[0].start;if(!(v>=a)&&(a=v,l=w.captureIndices,c=w.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Mj(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function fte(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function kf(e,t,n,r,s,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),c=[],u=o[0].end;for(let d=0;d<l;d++){const f=i[d];if(f===null)continue;const m=o[d];if(m.length===0)continue;if(m.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,m.start):s.produce(r,m.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,o),x=r.contentNameScopesList.pushAttributed(y,e),b=f.getContentName(a,o),w=x.pushAttributed(b,e),v=r.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,x,w),_=e.createOnigString(a.substring(0,m.end));Ej(e,_,n&&m.start===0,m.start,v,s,!1,0),kj(_);continue}const p=f.getName(a,o);if(p!==null){const x=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new mte(x,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var mte=class{constructor(e,t){le(this,"scopes");le(this,"endPos");this.scopes=e,this.endPos=t}};function pte(e,t,n,r,s,i,o,a){return new yte(e,t,n,r,s,i,o,a)}function Z7(e,t,n,r,s){const i=g1(t,w1),o=Cj.getCompiledRuleId(n,r,s.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:s,priority:a.priority})}function w1(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(gte(t[s],r))return n=s+1,!0;return!1})}function gte(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 yte=class{constructor(e,t,n,r,s,i,o,a){le(this,"_rootId");le(this,"_lastRuleId");le(this,"_ruleId2desc");le(this,"_includedGrammars");le(this,"_grammarRepository");le(this,"_grammar");le(this,"_injections");le(this,"_basicScopeAttributesProvider");le(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new ate(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=e9(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=g1(l,w1);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let o in s)Z7(t,o,s[o],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&Z7(t,l,a,this,a)}})}return t.sort((s,i)=>s.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=e9(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=Cj.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===Wv.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=ih.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=Zf.createRootAndLookUpScopeName(f,d,this):m=Zf.createRoot("unknown",d),t=new Wv(null,this._rootId,-1,-1,!1,null,m,m)}else s=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new wte(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Ej(this,i,s,0,t,a,!0,r);return kj(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function e9(e,t){return e=Oee(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 Zf=class Ro{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=n4.push(s,i.scopeNames),r=new Ro(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new Ro(null,new n4(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new n4(null,t),o=r.themeProvider.themeMatch(i),a=Ro.mergeAttributes(n,s,o);return new Ro(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Ro.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,i=0,o=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,o=r.backgroundId),ih.set(t,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Ro._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=Ro._pushAttributed(s,i,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=Ro.mergeAttributes(t.tokenAttributes,s,o);return new Ro(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var s;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((s=r.parent)==null?void 0:s.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},Ui,Wv=(Ui=class{constructor(t,n,r,s,i,o,a,l){le(this,"_stackElementBrand");le(this,"_enterPos");le(this,"_anchorPos");le(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}equals(t){return t===null?!1:Ui._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Zf.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(){Ui._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new Ui(this,t,n,r,s,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var r,s;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Ui(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=Zf.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Ui(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Zf.fromExtension(r,n.contentNameScopesList))}},le(Ui,"NULL",new Ui(null,0,0,0,!1,null,null,null)),Ui),bte=class{constructor(e,t){le(this,"balancedBracketScopes");le(this,"unbalancedBracketScopes");le(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):g1(n,w1).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>g1(n,w1).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},wte=class{constructor(e,t,n,r){le(this,"_emitBinaryTokens");le(this,"_lineText");le(this,"_tokens");le(this,"_binaryTokens");le(this,"_lastTokenEndIndex");le(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let s=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(o)&&(s=ih.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(s=ih.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}},vte=class{constructor(e,t){le(this,"_grammars",new Map);le(this,"_rawGrammars",new Map);le(this,"_injectionGrammars",new Map);le(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,pte(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},xte=class{constructor(t){le(this,"_options");le(this,"_syncRegistry");le(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new vte(p1.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(p1.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 bte(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const o=new Xee(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,s,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,i)}},Gv=Wv.NULL;const _te=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],kte=/["&'<>`]/g,Ste=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Tte=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Cte=/[|\\{}()[\]^$+*?.]/g,t9=new WeakMap;function Ate(e,t){if(e=e.replace(t.subset?Ete(t.subset):kte,r),t.subset||t.escapeOnly)return e;return e.replace(Ste,n).replace(Tte,r);function n(s,i,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function r(s,i,o){return t.format(s.charCodeAt(0),o.charCodeAt(i+1),t)}}function Ete(e){let t=t9.get(e);return t||(t=Mte(e),t9.set(e,t)),t}function Mte(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Cte,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Nte=/[\dA-Fa-f]/;function Ite(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Nte.test(String.fromCharCode(t))?r:r+";"}const Rte=/\d/;function jte(e,t,n){const r="&#"+String(e);return n&&t&&!Rte.test(String.fromCharCode(t))?r:r+";"}const Lte=["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"],s4={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:"€"},Dte=["cent","copy","divide","gt","lt","not","para","times"],Nj={}.hasOwnProperty,Kv={};let fp;for(fp in s4)Nj.call(s4,fp)&&(Kv[s4[fp]]=fp);const Ote=/[^\dA-Za-z]/;function Bte(e,t,n,r){const s=String.fromCharCode(e);if(Nj.call(Kv,s)){const i=Kv[s],o="&"+i;return n&&Lte.includes(i)&&!Dte.includes(i)&&(!r||t&&t!==61&&Ote.test(String.fromCharCode(t)))?o:o+";"}return""}function Pte(e,t,n){let r=Ite(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Bte(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=jte(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Od(e,t){return Ate(e,Object.assign({format:Pte},t))}const zte=/^>|^->|<!--|-->|--!>|<!-$/g,$te=[">"],qte=["<",">"];function Fte(e,t,n,r){return r.settings.bogusComments?"<?"+Od(e.value,Object.assign({},r.settings.characterReferences,{subset:$te}))+">":"<!--"+e.value.replace(zte,s)+"-->";function s(i){return Od(i,Object.assign({},r.settings.characterReferences,{subset:qte}))}}function Ute(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const Fr=Rj(1),Ij=Rj(-1),Hte=[];function Rj(e){return t;function t(n,r,s){const i=n?n.children:Hte;let o=(r||0)+e,a=i[o];if(!s)for(;a&&xy(a);)o+=e,a=i[o];return a}}const Vte={}.hasOwnProperty;function jj(e){return t;function t(n,r,s){return Vte.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const f5=jj({body:Gte,caption:i4,colgroup:i4,dd:Qte,dt:Xte,head:i4,html:Wte,li:Yte,optgroup:Jte,option:Zte,p:Kte,rp:n9,rt:n9,tbody:tne,td:r9,tfoot:nne,th:r9,thead:ene,tr:rne});function i4(e,t,n){const r=Fr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&xy(r.value.charAt(0)))}function Wte(e,t,n){const r=Fr(n,t);return!r||r.type!=="comment"}function Gte(e,t,n){const r=Fr(n,t);return!r||r.type!=="comment"}function Kte(e,t,n){const r=Fr(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 Yte(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Xte(e,t,n){const r=Fr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Qte(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function n9(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Jte(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Zte(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ene(e,t,n){const r=Fr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function tne(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function nne(e,t,n){return!Fr(n,t)}function rne(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function r9(e,t,n){const r=Fr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const sne=jj({body:ane,colgroup:lne,head:one,html:ine,tbody:cne});function ine(e){const t=Fr(e,-1);return!t||t.type!=="comment"}function one(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 ane(e){const t=Fr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&xy(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function lne(e,t,n){const r=Ij(n,t),s=Fr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&f5(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function cne(e,t,n){const r=Ij(n,t),s=Fr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&f5(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const mp={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 une(e,t,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;s.space==="html"&&e.tagName==="svg"&&(r.schema=Th);const c=dne(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(o=!1),(c||!i||!sne(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!f5(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function dne(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=hne(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 hne(e,t,n){const r=E_(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Od(r.attribute,Object.assign({},e.settings.characterReferences,{subset:mp.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?YN:rI)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Od(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:mp.unquoted[s][i]}))),a!==n&&(e.settings.quoteSmart&&a1(n,o)>a1(n,e.alternative)&&(o=e.alternative),a=o+Od(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?mp.single:mp.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const fne=["<","&"];function Lj(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Od(e.value,Object.assign({},r.settings.characterReferences,{subset:fne}))}function mne(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Lj(e,t,n,r)}function pne(e,t,n,r){return r.all(e)}const gne=dX("type",{invalid:yne,unknown:bne,handlers:{comment:Fte,doctype:Ute,element:une,raw:mne,root:pne,text:Lj}});function yne(e){throw new Error("Expected node, not `"+e+"`")}function bne(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const wne={},vne={},xne=[];function _ne(e,t){const n=wne,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:kne,all:Sne,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||_te,characterReferences:n.characterReferences||vne,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Th:M_,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function kne(e,t,n){return gne(e,t,n,this)}function Sne(e){const t=[],n=e&&e.children||xne;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Tne(e){return Array.isArray(e)?e:[e]}function qy(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];s.push([a,r]),r+=n[o].length,r+=((i=n[o+1])==null?void 0:i.length)||0}return s}function m5(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Dj(e){return e==="ansi"||m5(e)}function p5(e){return e==="none"}function Oj(e){return p5(e)}function Bj(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 Cne(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 Ane(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,s)=>r-s);return n.length?e.map(r=>r.flatMap(s=>{const i=n.filter(o=>s.offset<o&&o<s.offset+s.content.length).map(o=>o-s.offset).sort((o,a)=>o-a);return i.length?Cne(s,i):s})):e}async function Pj(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function v1(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 Jc(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function zj(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Ra.Italic&&(t["font-style"]="italic"),e.fontStyle&Ra.Bold&&(t["font-weight"]="bold"),e.fontStyle&Ra.Underline&&(t["text-decoration"]="underline")),t}function Ene(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function Mne(e){const t=qy(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=s,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let a=0;a<s;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:r}}class js extends Error{constructor(t){super(t),this.name="ShikiError"}}const $j=new WeakMap;function Fy(e,t){$j.set(e,t)}function I0(e){return $j.get(e)}class Ih{constructor(...t){le(this,"_stacks",{});le(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 Ih(Object.fromEntries(Tne(n).map(r=>[r,Gv])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return s9(this._stacks[this.theme])}getScopes(t=this.theme){return s9(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function s9(e){const t=[],n=new Set;function r(s){var o;if(n.has(s))return;n.add(s);const i=(o=s==null?void 0:s.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),s.parent&&r(s.parent)}return r(e),t}function Nne(e,t){if(!(e instanceof Ih))throw new js("Invalid grammar state");return e.getInternalStack(t)}function Ine(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new js(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...s.indexToPos(o),offset:o}}else{const a=s.lines[o.line];if(a===void 0)throw new js(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);if(o.character<0||o.character>a.length)throw new js(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:s.posToIndex(o.line,o.character)}}};const s=Mne(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));Rne(i),e.set(n.meta,{decorations:i,converter:s,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const s=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return Ane(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 js(`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 x="",b=-1,w=-1;if(f===0&&(b=0),m===0&&(w=0),m===Number.POSITIVE_INFINITY&&(w=y.children.length),b===-1||w===-1)for(let _=0;_<y.children.length;_++)x+=qj(y.children[_]),b===-1&&x.length===f&&(b=_+1),w===-1&&x.length===m&&(w=_+1);if(b===-1)throw new js(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(w===-1)throw new js(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const v=y.children.slice(b,w);if(!p.alwaysWrap&&v.length===y.children.length)a(y,p,"line");else if(!p.alwaysWrap&&v.length===1&&v[0].type==="element")a(v[0],p,"token");else{const _={type:"element",tagName:"span",properties:{},children:v};a(_,p,"wrapper"),y.children.splice(b,v.length,_)}}function o(d,f){s[d]=a(s[d],f,"line")}function a(d,f,m){var x;const p=f.properties||{},y=f.transform||(b=>b);return d.tagName=f.tagName||"span",d.properties={...d.properties,...p,class:d.properties.class},(x=f.properties)!=null&&x.class&&Bj(d,f.properties.class),d=y(d,m)||d,d}const l=[],c=r.decorations.sort((d,f)=>f.start.offset-d.start.offset);for(const d of c){const{start:f,end:m}=d;if(f.line===m.line)i(f.line,f.character,m.character,d);else if(f.line<m.line){i(f.line,f.character,Number.POSITIVE_INFINITY,d);for(let p=f.line+1;p<m.line;p++)l.unshift(()=>o(p,d));i(m.line,0,m.character,d)}}l.forEach(d=>d())}}}function Rne(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new js(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[r],i=n.start.offset<s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<n.end.offset,a=s.start.offset<n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<s.end.offset;if(i||o||a||l){if(o&&o||a&&l)continue;throw new js(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function qj(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(qj).join(""):""}const jne=[Ine()];function x1(e){return[...e.transformers||[],...jne]}var Zc=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],o4={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Lne(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 i9(e,t){let n=1;const r=e[t+n++];let s;if(r==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(o=>Number.parseInt(o));i.length===3&&!i.some(o=>Number.isNaN(o))&&(s={type:"rgb",rgb:i})}else if(r==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(s={type:"table",index:Number(i)})}return[n,s]}function Dne(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)o4[s]&&t.push({type:"setDecoration",value:o4[s]});else if(s<=29){const i=o4[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Zc[s-30]}});else if(s===38){const[i,o]=i9(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Zc[s-40]}});else if(s===48){const[i,o]=i9(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else s===49?t.push({type:"resetBackgroundColor"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Zc[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Zc[s-100+8]}})}return t}function One(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=Lne(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0&&s.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const l=Dne(o.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=o.position}while(i<r.length);return s}}}var Bne={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 Pne(e=Bne){function t(a){return e[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<Zc.length;c++)r.push(t(Zc[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let d=0;d<6;d++)r.push(n([a[c],a[u],a[d]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(a){return s()[a]}function o(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}function zne(e,t,n){const r=v1(e,n),s=qy(t),i=Pne(Object.fromEntries(Zc.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=One();return s.map(a=>o.parse(a[0]).map(l=>{let c,u;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,u=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,u=l.background?i.value(l.background):void 0),c=Jc(c,r),u=Jc(u,r),l.decorations.has("dim")&&(c=$ne(c));let d=Ra.None;return l.decorations.has("bold")&&(d|=Ra.Bold),l.decorations.has("italic")&&(d|=Ra.Italic),l.decorations.has("underline")&&(d|=Ra.Underline),{content:l.value,offset:a[1],color:c,bgColor:u,fontStyle:d}}))}function $ne(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 g5(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(m5(r)||p5(s))return qy(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if(r==="ansi")return zne(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new Pa(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Pa(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Fne(t,a,i,o,n)}function qne(...e){if(e.length===2)return I0(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(m5(s)||p5(i))throw new Pa("Plain language does not have grammar state");if(s==="ansi")throw new Pa("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new Ih(_1(n,l,o,a,r).stateStack,l.name,o.name)}function Fne(e,t,n,r,s){const i=_1(e,t,n,r,s),o=new Ih(_1(e,t,n,r,s).stateStack,t.name,n.name);return Fy(i.tokens,o),i.tokens}function _1(e,t,n,r,s){const i=v1(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=qy(e);let c=s.grammarState?Nne(s.grammarState,n.name)??Gv:s.grammarContextCode!=null?_1(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Gv,u=[];const d=[];for(let f=0,m=l.length;f<m;f++){const[p,y]=l[f];if(p===""){u=[],d.push([]);continue}if(o>0&&p.length>=o){u=[],d.push([{content:p,offset:y,color:"",fontStyle:0}]);continue}let x,b,w;s.includeExplanation&&(x=t.tokenizeLine(p,c),b=x.tokens,w=0);const v=t.tokenizeLine2(p,c,a),_=v.tokens.length/2;for(let S=0;S<_;S++){const C=v.tokens[2*S],E=S+1<_?v.tokens[2*S+2]:p.length;if(C===E)continue;const R=v.tokens[2*S+1],j=Jc(r[ih.getForeground(R)],i),N=ih.getFontStyle(R),B={content:p.substring(C,E),offset:y+C,color:j,fontStyle:N};if(s.includeExplanation){const M=[];if(s.includeExplanation!=="scopeName")for(const H of n.settings){let J;switch(typeof H.scope){case"string":J=H.scope.split(/,/).map(O=>O.trim());break;case"object":J=H.scope;break;default:continue}M.push({settings:H,selectors:J.map(O=>O.split(/ /))})}B.explanation=[];let $=0;for(;C+$<E;){const H=b[w],J=p.substring(H.startIndex,H.endIndex);$+=J.length,B.explanation.push({content:J,scopes:s.includeExplanation==="scopeName"?Une(H.scopes):Hne(M,H.scopes)}),w+=1}}u.push(B)}d.push(u),u=[],c=v.ruleStack}return{tokens:d,stateStack:c}}function Une(e){return e.map(t=>({scopeName:t}))}function Hne(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:Wne(e,i,t.slice(0,r))}}return n}function o9(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Vne(e,t,n){if(!o9(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)o9(e[r],n[s])&&(r-=1),s-=1;return r===-1}function Wne(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const o of s)if(Vne(o,t,n)){r.push(i);break}return r}function Fj(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=g5(e,t,{...n,theme:l.theme}),u=I0(c),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:d}}),i=Gne(...s.map(l=>l.tokens)),o=i[0].map((l,c)=>l.map((u,d)=>{const f={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=u.explanation),i.forEach((m,p)=>{const{content:y,explanation:x,offset:b,...w}=m[c][d];f.variants[r[p].color]=w}),f})),a=s[0].state?new Ih(Object.fromEntries(s.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),s[0].state.lang):void 0;return a&&Fy(o,a),o}function Gne(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(l=>l[r]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const o=s.map(()=>0),a=s.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const u=a[c];u.content.length===l?(i[c].push(u),o[c]+=1,a[c]=s[c][o[c]]):(i[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return t}function k1(e,t,n){let r,s,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-"}=n,d=Object.entries(n.themes).filter(x=>x[1]).map(x=>({color:x[0],theme:x[1]})).sort((x,b)=>x.color===c?-1:b.color===c?1:0);if(d.length===0)throw new Pa("`themes` option must not be empty");const f=Fj(e,t,n);if(l=I0(f),c&&!d.find(x=>x.color===c))throw new Pa(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=d.map(x=>e.getTheme(x.theme)),p=d.map(x=>x.color);i=f.map(x=>x.map(b=>Kne(b,p,u,c))),l&&Fy(i,l);const y=d.map(x=>v1(x.theme,n));s=d.map((x,b)=>(b===0&&c?"":`${u+x.color}:`)+(Jc(m[b].fg,y[b])||"inherit")).join(";"),r=d.map((x,b)=>(b===0&&c?"":`${u+x.color}-bg:`)+(Jc(m[b].bg,y[b])||"inherit")).join(";"),o=`shiki-themes ${m.map(x=>x.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=v1(n.theme,n);i=g5(e,t,n);const u=e.getTheme(n.theme);r=Jc(u.bg,c),s=Jc(u.fg,c),o=u.name,l=I0(i)}else throw new Pa("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function Kne(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>zj(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,c)=>{for(const u of o){const d=l[u]||"inherit";if(c===0&&r)a[u]=d;else{const f=u==="color"?"":u==="background-color"?"-bg":`-${u}`,m=n+t[c]+(u==="color"?"":f);a[m]=d}}}),s.htmlStyle=a,s}function S1(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>S1(e,s,i),codeToTokens:(s,i)=>k1(e,s,i)}){var m,p;let s=t;for(const y of x1(n))s=((m=y.preprocess)==null?void 0:m.call(r,s,n))||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=k1(e,s,n);const{mergeWhitespaces:d=!0}=n;d===!0?i=Xne(i):d==="never"&&(i=Qne(i));const f={...r,get source(){return s}};for(const y of x1(n))i=((p=y.tokens)==null?void 0:p.call(f,i))||i;return Yne(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,u)}function Yne(e,t,n,r=I0(e)){var p,y,x;const s=x1(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([b])=>!b.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const d=[],f={...n,structure:a,addClassToHast:Bj,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return u},get lines(){return d}};if(e.forEach((b,w)=>{var S,C;w&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let v={type:"element",tagName:"span",properties:{class:"line"},children:[]},_=0;for(const E of b){let R={type:"element",tagName:"span",properties:{...E.htmlAttrs},children:[{type:"text",value:E.content}]};E.htmlStyle;const j=Ene(E.htmlStyle||zj(E));j&&(R.properties.style=j);for(const N of s)R=((S=N==null?void 0:N.span)==null?void 0:S.call(f,R,w+1,_,v,E))||R;a==="inline"?o.children.push(R):a==="classic"&&v.children.push(R),_+=E.content.length}if(a==="classic"){for(const E of s)v=((C=E==null?void 0:E.line)==null?void 0:C.call(f,v,w+1))||v;d.push(v),i.push(v)}}),a==="classic"){for(const b of s)u=((p=b==null?void 0:b.code)==null?void 0:p.call(f,u))||u;c.children.push(u);for(const b of s)c=((y=b==null?void 0:b.pre)==null?void 0:y.call(f,c))||c;o.children.push(c)}let m=o;for(const b of s)m=((x=b==null?void 0:b.root)==null?void 0:x.call(f,m))||m;return r&&Fy(m,r),m}function Xne(e){return e.map(t=>{const n=[];let r="",s=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&Ra.Underline);l&&i.content.match(/^\s+$/)&&t[o+1]?(s||(s=i.offset),r+=i.content):r?(l?n.push({...i,offset:s,content:r+i.content}):n.push({content:r,offset:s},i),s=0,r=""):n.push(i)}),n})}function Qne(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,i,o]=r;if(!s&&!o)return n;const a=[{...n,offset:n.offset+s.length,content:i}];return s&&a.unshift({content:s,offset:n.offset}),o&&a.push({content:o,offset:n.offset+s.length+i.length}),a}))}function Jne(e,t,n){var i;const r={meta:{},options:n,codeToHast:(o,a)=>S1(e,o,a),codeToTokens:(o,a)=>k1(e,o,a)};let s=_ne(S1(e,t,n,r));for(const o of x1(n))s=((i=o.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const a9={light:"#333333",dark:"#bbbbbb"},l9={light:"#fffffe",dark:"#1e1e1e"},c9="__shiki_resolved";function y5(e){var a,l,c,u,d;if(e!=null&&e[c9])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const f=t.settings?t.settings.find(m=>!m.name&&!m.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(r=f.settings.foreground),(l=f==null?void 0:f.settings)!=null&&l.background&&(n=f.settings.background),!r&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((u=t==null?void 0:t.colors)!=null&&u["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?a9.light:a9.dark),n||(n=t.type==="light"?l9.light:l9.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const i=new Map;function o(f){var p;if(i.has(f))return i.get(f);s+=1;const m=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(p=t.colorReplacements)!=null&&p[`#${m}`]?o(f):(i.set(f,m),m)}t.settings=t.settings.map(f=>{var x,b;const m=((x=f.settings)==null?void 0:x.foreground)&&!f.settings.foreground.startsWith("#"),p=((b=f.settings)==null?void 0:b.background)&&!f.settings.background.startsWith("#");if(!m&&!p)return f;const y={...f,settings:{...f.settings}};if(m){const w=o(f.settings.foreground);t.colorReplacements[w]=f.settings.foreground,y.settings.foreground=w}if(p){const w=o(f.settings.background);t.colorReplacements[w]=f.settings.background,y.settings.background=w}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((d=t.colors[f])!=null&&d.startsWith("#"))){const m=o(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,c9,{enumerable:!1,writable:!1,value:!0}),t}async function Uj(e){return Array.from(new Set((await Promise.all(e.filter(t=>!Dj(t)).map(async t=>await Pj(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Hj(e){return(await Promise.all(e.map(async n=>Oj(n)?null:y5(await Pj(n))))).filter(n=>!!n)}class Zne extends xte{constructor(n,r,s,i={}){super(n);le(this,"_resolvedThemes",new Map);le(this,"_resolvedGrammars",new Map);le(this,"_langMap",new Map);le(this,"_langGraph",new Map);le(this,"_textmateThemeCache",new WeakMap);le(this,"_loadedThemesCache",null);le(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=s,this._alias=i,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=y5(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=p1.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 js(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,c;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(u=>{var d;return(d=u.embeddedLangsLazy)==null?void 0:d.includes(n.name)}));this._resolver.addLanguage(n);const s={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,s);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(u=>{this._alias[u]=n.name}),this._loadedLanguagesCache=null,r.size)for(const u of r)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(u.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),s=r.filter(([i,o])=>!o);if(s.length){const i=r.filter(([o,a])=>{var l;return a&&((l=a.embeddedLangs)==null?void 0:l.some(c=>s.map(([u])=>u).includes(c)))}).filter(o=>!s.includes(o));throw new js(`Missing languages ${s.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of r)this._resolver.addLanguage(o);for(const[i,o]of r)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class ere{constructor(t,n){le(this,"_langs",new Map);le(this,"_scopeToLang",new Map);le(this,"_injections",new Map);le(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 rf=0;function tre(e){rf+=1,e.warnings!==!1&&rf>=10&&rf%10===0&&console.warn(`[Shiki] ${rf} 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 js("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(y5),s=new ere(e.engine,n),i=new Zne(s,r,n,e.langAlias);let o;function a(w){x();const v=i.getGrammar(typeof w=="string"?w:w.name);if(!v)throw new js(`Language \`${w}\` not found, you may need to load it first`);return v}function l(w){if(w==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};x();const v=i.getTheme(w);if(!v)throw new js(`Theme \`${w}\` not found, you may need to load it first`);return v}function c(w){x();const v=l(w);o!==w&&(i.setTheme(v),o=w);const _=i.getColorMap();return{theme:v,colorMap:_}}function u(){return x(),i.getLoadedThemes()}function d(){return x(),i.getLoadedLanguages()}function f(...w){x(),i.loadLanguages(w.flat(1))}async function m(...w){return f(await Uj(w))}function p(...w){x();for(const v of w.flat(1))i.loadTheme(v)}async function y(...w){return x(),p(await Hj(w))}function x(){if(t)throw new js("Shiki instance has been disposed")}function b(){t||(t=!0,i.dispose(),rf-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:d,loadLanguage:m,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:b,[Symbol.dispose]:b}}async function nre(e={}){e.loadWasm;const[t,n,r]=await Promise.all([Hj(e.themes||[]),Uj(e.langs||[]),e.engine||mj(e.loadWasm||Dee())]);return tre({...e,themes:t,langs:n,engine:r})}async function rre(e={}){const t=await nre(e);return{getLastGrammarState:(...n)=>qne(t,...n),codeToTokensBase:(n,r)=>g5(t,n,r),codeToTokensWithThemes:(n,r)=>Fj(t,n,r),codeToTokens:(n,r)=>k1(t,n,r),codeToHast:(n,r)=>S1(t,n,r),codeToHtml:(n,r)=>Jne(t,n,r),...t,getInternalContext:()=>t}}function sre(e,t,n){let r,s,i;{const a=e;r=a.langs,s=a.themes,i=a.engine}async function o(a){function l(m){if(typeof m=="string"){if(Dj(m))return[];const p=r[m];if(!p)throw new Pa(`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(Oj(m))return"none";if(typeof m=="string"){const p=s[m];if(!p)throw new Pa(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}const u=(a.themes??[]).map(m=>c(m)),d=(a.langs??[]).map(m=>l(m)),f=await rre({engine:a.engine??i(),...a,themes:u,langs:d});return{...f,loadLanguage(...m){return f.loadLanguage(...m.map(l))},loadTheme(...m){return f.loadTheme(...m.map(c))}}}return o}const ire=sre({langs:pee,themes:yee,engine:()=>mj(q(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ore=["github-light-default","github-dark-default"];let pp=null,Yv=null;const Xv=new Set,a4=new Map,u9=new Set,are=128,Sf=new Map;function Vj(e,t,n){return`${t}\0${n}\0${e}`}function lre(e,t){if(Sf.size>=are){const n=Sf.keys().next().value;n!==void 0&&Sf.delete(n)}Sf.set(e,t)}function cre(e,t,n){return Sf.get(Vj(e,t,n))??null}function ure(){return pp||(pp=ire({langs:[],themes:ore}).then(e=>(Yv=e,e)).catch(e=>{throw pp=null,e})),pp}async function dre(e){const t=await ure();if(Xv.has(e))return t;if(u9.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=a4.get(e);return n||(n=t.loadLanguage(e).then(()=>{Xv.add(e)}).catch(r=>{throw u9.add(e),r}).finally(()=>{a4.delete(e)}),a4.set(e,n)),await n,t}const hre=1e5,fre=2e4;function mre(e){if(e.length>hre)return!0;let t=0;const n=e.length;for(let r=0;r<=n;r++)if(r===n||e.charCodeAt(r)===10){if(r-t>fre)return!0;t=r+1}return!1}function d9(e,t,n,r=!0){if(Yv&&Xv.has(t))try{const s=Yv.codeToHtml(e,{lang:t,theme:n});return r&&lre(Vj(e,t,n),s),s}catch(s){return console.warn("[web-shell] sync highlight failed for lang=%s",t,s),null}return null}const pre="_tableShell_111ca_1",gre="_toolbar_111ca_11",yre="_summary_111ca_22",bre="_hint_111ca_27",wre="_selection_111ca_31",vre="_copyButton_111ca_36",xre="_secondaryButton_111ca_37",_re="_primaryButton_111ca_38",kre="_copyCheck_111ca_47",Sre="_scroller_111ca_71",Tre="_table_111ca_1",Cre="_headerCell_111ca_91",Are="_cell_111ca_92",Ere="_headerControls_111ca_115",Mre="_headerButton_111ca_121",Nre="_filterTrigger_111ca_138",Ire="_headerText_111ca_142",Rre="_sortIcon_111ca_149",jre="_filterTriggerActive_111ca_165",Lre="_filterMenu_111ca_170",Dre="_filterMenuTitle_111ca_186",Ore="_filterMenuSection_111ca_196",Bre="_filterMenuAction_111ca_204",Pre="_activeAction_111ca_217",zre="_filterSearch_111ca_226",$re="_conditionInput_111ca_227",qre="_conditionSelect_111ca_228",Fre="_filterOptionList_111ca_244",Ure="_filterOption_111ca_244",Hre="_optionLabel_111ca_270",Vre="_optionCount_111ca_278",Wre="_optionLimitHint_111ca_284",Gre="_conditionTitle_111ca_290",Kre="_conditionInputs_111ca_295",Yre="_filterFooter_111ca_300",Xre="_footerSpacer_111ca_307",Qre="_dragging_111ca_324",Jre="_evenRow_111ca_328",Zre="_selectedCell_111ca_336",ese="_actionHeaderCell_111ca_343",tse="_actionCell_111ca_344",nse="_rowDetailButton_111ca_357",rse="_detailRow_111ca_372",sse="_detailCell_111ca_376",ise="_detailPanel_111ca_383",ose="_detailTitle_111ca_389",ase="_detailItem_111ca_394",lse="_detailLabel_111ca_400",cse="_detailValue_111ca_405",use="_emptyState_111ca_412",ot={tableShell:pre,toolbar:gre,summary:yre,hint:bre,selection:wre,copyButton:vre,secondaryButton:xre,primaryButton:_re,copyCheck:kre,scroller:Sre,table:Tre,headerCell:Cre,cell:Are,headerControls:Ere,headerButton:Mre,filterTrigger:Nre,headerText:Ire,sortIcon:Rre,filterTriggerActive:jre,filterMenu:Lre,filterMenuTitle:Dre,filterMenuSection:Ore,filterMenuAction:Bre,activeAction:Pre,filterSearch:zre,conditionInput:$re,conditionSelect:qre,filterOptionList:Fre,filterOption:Ure,optionLabel:Hre,optionCount:Vre,optionLimitHint:Wre,conditionTitle:Gre,conditionInputs:Kre,filterFooter:Yre,footerSpacer:Xre,dragging:Qre,evenRow:Jre,selectedCell:Zre,actionHeaderCell:ese,actionCell:tse,rowDetailButton:nse,detailRow:rse,detailCell:sse,detailPanel:ise,detailTitle:ose,detailItem:ase,detailLabel:lse,detailValue:cse,emptyState:use},dse={contains:"markdownTable.filter.text.contains",equals:"markdownTable.filter.text.equals",notEquals:"markdownTable.filter.text.notEquals",startsWith:"markdownTable.filter.text.startsWith",endsWith:"markdownTable.filter.text.endsWith"},hse={gt:"markdownTable.filter.number.gt",gte:"markdownTable.filter.number.gte",lt:"markdownTable.filter.number.lt",lte:"markdownTable.filter.number.lte",between:"markdownTable.filter.number.between"},fse=500,mse=50,pse='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function gse(e){return Array.from(e.querySelectorAll(pse)).filter(t=>!t.hasAttribute("hidden"))}function h9(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function yse(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function eu(e,t){return g.isValidElement(e)&&e.type===t}function bse(e){return e.replace(/\s+/g," ").trim()}function Qv(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Qv).join(""):g.isValidElement(e)?e.type==="img"?e.props.alt??"":Qv(e.props.children):""}function wse(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",isHeader:!1}}function Wj(e,t){const n=g.Children.toArray(e.props.children).filter(r=>eu(r,"td")||eu(r,"th"));return{key:t,cells:n.map((r,s)=>{var i;return{key:`${t}-${s}`,content:r.props.children,text:bse(Qv(r.props.children)),isHeader:r.type==="th",textAlign:(i=r.props.style)==null?void 0:i.textAlign}})}}function l4(e,t){return g.Children.toArray(e.props.children).filter(n=>eu(n,"tr")).map((n,r)=>Wj(n,`${t}-${r}`))}function vse(e,t){return{...e,cells:Array.from({length:t},(n,r)=>e.cells[r]??wse(e.key,r))}}function xse(e,t){const n=g.Children.toArray(e),r=[],s=[],i=[];if(n.forEach((u,d)=>{eu(u,"thead")?r.push(...l4(u,`head-${d}`)):eu(u,"tbody")?s.push(...l4(u,`body-${d}`)):eu(u,"tfoot")?s.push(...l4(u,`foot-${d}`)):eu(u,"tr")&&i.push(Wj(u,`row-${d}`))}),i.length>0){const[u,...d]=i;u!=null&&u.cells.some(f=>f.isHeader)?(r.push(u),s.push(...d)):s.push(...i)}const o=[...r,...s],a=Math.max(0,...o.map(u=>u.cells.length)),l=r[0];return{headers:Array.from({length:a},(u,d)=>{const f=l==null?void 0:l.cells[d];if(f)return f;const m=t(d);return{key:`header-${d}`,content:m,text:m,isHeader:!0}}),rows:s.map(u=>vse(u,a)),columnCount:a}}function Xl(e){const t=e.trim(),n=t.endsWith("%"),s=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(s))return null;const i=Number(s);return n?i/100:i}function Gj(e,t){const n=Xl(e),r=Xl(t);return n!==null&&r!==null&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function b5(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow),minCol:Math.min(e.anchorCol,e.focusCol),maxCol:Math.max(e.anchorCol,e.focusCol)}}function Jv(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"");return/^[=+\-@]/.test(t)?`'${e}`:e}function f9(e,t,n){if(!e)return"";const{minRow:r,maxRow:s,minCol:i,maxCol:o}=b5(e),a=n.filter(c=>c>=i&&c<=o);if(a.length===0)return"";const l=[];for(let c=r;c<=s;c++){const u=t[c];u&&l.push(a.map(d=>{var f;return Jv(((f=u.cells[d])==null?void 0:f.text)??"")}).join("	"))}return l.join(`
`)}function _se(e,t,n){return n.length===0?"":[n.map(s=>{var i;return Jv(((i=e[s])==null?void 0:i.text)??"")}).join("	"),...t.map(s=>n.map(i=>{var o;return Jv(((o=s.cells[i])==null?void 0:o.text)??"")}).join("	"))].join(`
`)}function kse(e,t){if(!e)return 0;const{minRow:n,maxRow:r,minCol:s,maxCol:i}=b5(e),o=t.filter(a=>a>=s&&a<=i).length;return(r-n+1)*o}function e0(e){var t,n;return e?!!(e.selectedValues!==void 0||(t=e.textFilter)!=null&&t.value.trim()||(n=e.numberFilter)!=null&&n.value.trim()):!1}function Sse(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),r=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===r;case"notEquals":return n!==r;case"startsWith":return n.startsWith(r);case"endsWith":return n.endsWith(r);case"contains":default:return n.includes(r)}}function Tse(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Xl(e),r=Xl(t.value);if(n===null||r===null)return!1;switch(t.operator){case"gt":return n>r;case"gte":return n>=r;case"lt":return n<r;case"lte":return n<=r;case"between":{const s=Xl(t.valueTo??"");if(s===null)return!1;const i=Math.min(r,s),o=Math.max(r,s);return n>=i&&n<=o}default:return!0}}function Cse(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:Sse(e,t.textFilter)&&Tse(e,t.numberFilter)}function m9(e,t,n){const r=Object.entries(t).map(([s,i])=>[Number(s),i]).filter(([s,i])=>s!==n&&e0(i));return r.length===0?e:e.filter(s=>r.every(([i,o])=>{var a;return Cse(((a=s.cells[i])==null?void 0:a.text)??"",o)}))}function Ase(e,t){return t?e.map((n,r)=>({row:n,index:r})).sort((n,r)=>{var o,a;const s=Gj(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=r.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?s:-s;return i===0?n.index-r.index:i}).map(({row:n})=>n):e}function Ese(e,t,n){const r=new Map;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";r.set(i,(r.get(i)??0)+1)}),Array.from(r.entries()).map(([s,i])=>({value:s,label:s||n,count:i})).sort((s,i)=>Gj(s.value,i.value))}function Mse(e,t){let n=0,r=0;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";i&&(n+=1,Xl(i)!==null&&(r+=1))}),n>0&&r/n>=.7}function Nse(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function Ise(e,t){var r,s,i;const n={};if(e.selectedValues!==void 0&&!Nse(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(r=e.textFilter)!=null&&r.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(s=e.numberFilter)!=null&&s.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();Xl(o)!==null&&(e.numberFilter.operator!=="between"||Xl(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return e0(n)?n:void 0}function Rse({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:r}=at();return h.jsxs("div",{className:ot.filterMenuSection,children:[h.jsx("button",{className:`${ot.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?ot.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:r("markdownTable.sort.asc")}),h.jsx("button",{className:`${ot.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?ot.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:r("markdownTable.sort.desc")}),h.jsx("button",{className:ot.filterMenuAction,type:"button",onClick:()=>n(e,null),children:r("markdownTable.sort.clear")})]})}function jse({onHideColumn:e}){const{t}=at();return h.jsx("div",{className:ot.filterMenuSection,children:h.jsx("button",{className:ot.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function Lse({columnIndex:e,columnName:t,search:n,searchInputRef:r,filteredOptions:s,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:c,onToggleValue:u}){const{t:d}=at();return h.jsxs("div",{className:ot.filterMenuSection,children:[h.jsx("input",{ref:r,className:ot.filterSearch,value:n,onChange:f=>l(f.currentTarget.value),placeholder:d("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":d("markdownTable.filter.searchAria",{column:t})}),h.jsxs("label",{className:ot.filterOption,children:[h.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:f=>c(f.currentTarget.checked)}),h.jsx("span",{children:d("markdownTable.filter.selectVisible")}),h.jsx("span",{className:ot.optionCount,children:s.length})]}),h.jsxs("div",{className:ot.filterOptionList,children:[i.map((f,m)=>h.jsxs("label",{className:ot.filterOption,children:[h.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${m}`,checked:o.has(f.value),onChange:()=>u(f.value)}),h.jsx("span",{className:ot.optionLabel,children:f.label}),h.jsx("span",{className:ot.optionCount,children:f.count})]},f.value)),s.length>i.length&&h.jsx("div",{className:ot.optionLimitHint,children:d("markdownTable.filter.optionLimit",{count:i.length})}),s.length===0&&h.jsx("div",{className:ot.optionLimitHint,children:d("markdownTable.filter.noOptions")})]})]})}function Dse({columnIndex:e,columnName:t,isNumeric:n,textOperator:r,textValue:s,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:c,onNumberOperatorChange:u,onNumberValueChange:d,onNumberValueToChange:f}){const{t:m}=at();return h.jsxs("div",{className:ot.filterMenuSection,children:[h.jsx("div",{className:ot.conditionTitle,children:m("markdownTable.filter.custom")}),n?h.jsxs(h.Fragment,{children:[h.jsx("select",{className:ot.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:p=>u(p.currentTarget.value),"aria-label":m("markdownTable.filter.numberAria",{column:t}),children:Object.entries(hse).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsxs("div",{className:ot.conditionInputs,children:[h.jsx("input",{className:ot.conditionInput,value:o,onChange:p=>d(p.currentTarget.value),placeholder:m("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&h.jsx("input",{className:ot.conditionInput,value:a,onChange:p=>f(p.currentTarget.value),placeholder:m("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("select",{className:ot.conditionSelect,value:r,name:`markdown-table-text-operator-${e}`,onChange:p=>l(p.currentTarget.value),"aria-label":m("markdownTable.filter.textAria",{column:t}),children:Object.entries(dse).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsx("input",{className:ot.conditionInput,value:s,onChange:p=>c(p.currentTarget.value),placeholder:m("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function Ose({onClear:e,onClose:t,onApply:n}){const{t:r}=at();return h.jsxs("div",{className:ot.filterFooter,children:[h.jsx("button",{className:ot.secondaryButton,type:"button",onClick:e,children:r("markdownTable.filter.reset")}),h.jsx("span",{className:ot.footerSpacer}),h.jsx("button",{className:ot.secondaryButton,type:"button",onClick:t,children:r("markdownTable.filter.cancel")}),h.jsx("button",{className:ot.primaryButton,type:"button",onClick:n,children:r("markdownTable.filter.confirm")})]})}function Bse({id:e,columnName:t,columnIndex:n,filter:r,isNumeric:s,options:i,sort:o,style:a,menuRef:l,canHideColumn:c,onApply:u,onClose:d,onHideColumn:f,onSort:m}){var P,A,ne,be,he;const p=g.useMemo(()=>i.map(ye=>ye.value),[i]),[y,x]=g.useState(""),[b,w]=g.useState(()=>new Set((r==null?void 0:r.selectedValues)??p)),[v,_]=g.useState(((P=r==null?void 0:r.textFilter)==null?void 0:P.operator)??"contains"),[S,C]=g.useState(((A=r==null?void 0:r.textFilter)==null?void 0:A.value)??""),[E,R]=g.useState(((ne=r==null?void 0:r.numberFilter)==null?void 0:ne.operator)??"gt"),[j,N]=g.useState(((be=r==null?void 0:r.numberFilter)==null?void 0:be.value)??""),[B,M]=g.useState(((he=r==null?void 0:r.numberFilter)==null?void 0:he.valueTo)??""),$=g.useRef(null);g.useEffect(()=>{var ye;(ye=$.current)==null||ye.focus()},[]);const H=g.useMemo(()=>{const ye=y.trim().toLowerCase();return ye?i.filter(me=>me.label.toLowerCase().includes(ye)):i},[i,y]),J=H.slice(0,500),O=H.length>0&&H.every(ye=>b.has(ye.value)),Y=ye=>{w(me=>{const se=new Set(me);return H.forEach(re=>{ye?se.add(re.value):se.delete(re.value)}),se})},G=ye=>{w(me=>{const se=new Set(me);return se.has(ye)?se.delete(ye):se.add(ye),se})},ee=()=>{u(n,Ise({selectedValues:Array.from(b),textFilter:{operator:v,value:S},numberFilter:{operator:E,value:j,valueTo:B}},p))},L=()=>{u(n,void 0)},F=(o==null?void 0:o.columnIndex)===n?o:null;return h.jsxs("div",{ref:l,id:e,className:ot.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[h.jsx("div",{id:`${e}-title`,className:ot.filterMenuTitle,children:t}),h.jsx(Rse,{columnIndex:n,sortedThisColumn:F,onSort:m}),c&&h.jsx(jse,{onHideColumn:()=>f(n)}),h.jsx(Lse,{columnIndex:n,columnName:t,search:y,searchInputRef:$,filteredOptions:H,visibleOptions:J,selectedValues:b,allFilteredSelected:O,onSearchChange:x,onFilteredSelectionChange:Y,onToggleValue:G}),h.jsx(Dse,{columnIndex:n,columnName:t,isNumeric:s,textOperator:v,textValue:S,numberOperator:E,numberValue:j,numberValueTo:B,onTextOperatorChange:_,onTextValueChange:C,onNumberOperatorChange:R,onNumberValueChange:N,onNumberValueToChange:M}),h.jsx(Ose,{onClear:L,onClose:d,onApply:ee})]})}function Pse({children:e,fallback:t,toolbarExtra:n}){const{t:r}=at(),s=g.useMemo(()=>xse(e,i=>r("markdownTable.column",{index:i+1})),[e,r]);return s.columnCount===0?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):s.rows.length>fse||s.columnCount>mse?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):h.jsx(zse,{table:s,toolbarExtra:n})}function zse({table:e,toolbarExtra:t}){const{t:n}=at(),r=g.useId(),[s,i]=g.useState(null),[o,a]=g.useState({}),[l,c]=g.useState(null),[u,d]=g.useState(null),[f,m]=g.useState(()=>new Set),[p,y]=g.useState(null),[x,b]=g.useState(!1),[w,v]=g.useState(!1),[_,S]=g.useState(!1),C=g.useRef(!1),E=g.useRef(null),R=g.useRef(null),j=g.useRef(0),N=g.useRef(0),B=g.useRef(!0),M=g.useRef(null),$=g.useRef(null),H=g.useRef(null),J=g.useRef(null),O=g.useRef(0),Y=g.useRef(null),G=g.useRef(0),ee=g.useMemo(()=>`${e.columnCount}\0${e.headers.map(te=>te.text).join("\0")}`,[e.columnCount,e.headers]),L=g.useRef(ee),F=g.useCallback(()=>{O.current&&cancelAnimationFrame(O.current),O.current=requestAnimationFrame(()=>{O.current=0;const te=J.current;te!=null&&te.isConnected&&te.focus()})},[]),P=g.useCallback(()=>{d(null),F()},[F]),A=g.useCallback(()=>{j.current+=1,E.current&&(clearTimeout(E.current),E.current=null),v(!1)},[]),ne=g.useCallback(()=>{N.current+=1,R.current&&(clearTimeout(R.current),R.current=null),S(!1)},[]),be=g.useCallback(()=>{G.current&&(cancelAnimationFrame(G.current),G.current=0);const te=Y.current;Y.current=null,te&&c(K=>K&&{...K,focusRow:te.rowIndex,focusCol:te.columnIndex})},[]),he=g.useCallback(()=>{be(),C.current=!1,b(!1)},[be]);g.useEffect(()=>{const te=()=>{document.hidden&&he()};return window.addEventListener("mouseup",he),window.addEventListener("blur",he),document.addEventListener("visibilitychange",te),()=>{window.removeEventListener("mouseup",he),window.removeEventListener("blur",he),document.removeEventListener("visibilitychange",te),G.current&&cancelAnimationFrame(G.current),O.current&&cancelAnimationFrame(O.current)}},[he]),g.useEffect(()=>{L.current!==ee&&(L.current=ee,i(null),a({}),c(null),d(null),m(new Set),y(null),A(),ne(),C.current=!1,b(!1))},[ne,A,ee]),g.useEffect(()=>{ne()},[ne,l]),g.useEffect(()=>(B.current=!0,()=>{B.current=!1,E.current&&(clearTimeout(E.current),E.current=null),R.current&&(clearTimeout(R.current),R.current=null)}),[]),g.useEffect(()=>{if(!u)return;const te=We=>{var _t,jn;const Mt=We.target;!((_t=H.current)!=null&&_t.contains(Mt))&&!((jn=J.current)!=null&&jn.contains(Mt))&&d(null)},K=We=>{var on;if(We.key==="Escape"){P();return}if(We.key!=="Tab")return;const Mt=H.current,_t=document.activeElement;if(!Mt||!(_t instanceof Node)||!Mt.contains(_t))return;const jn=gse(Mt);if(jn.length===0)return;const ur=_t instanceof HTMLElement?jn.indexOf(_t):-1,Xr=We.shiftKey?ur<=0?jn.length-1:ur-1:ur===-1||ur===jn.length-1?0:ur+1;We.preventDefault(),(on=jn[Xr])==null||on.focus()},ie=We=>{var _t;const Mt=We.target;Mt instanceof Node&&((_t=H.current)!=null&&_t.contains(Mt))||d(null)},fe=()=>d(null);return document.addEventListener("mousedown",te),document.addEventListener("keydown",K),document.addEventListener("scroll",ie,!0),window.addEventListener("resize",fe),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("keydown",K),document.removeEventListener("scroll",ie,!0),window.removeEventListener("resize",fe)}},[P,u]);const ye=g.useMemo(()=>m9(e.rows,o),[o,e.rows]),me=g.useMemo(()=>Ase(ye,s),[ye,s]),se=g.useMemo(()=>{if(!u)return[];const te=u.columnIndex;return Ese(m9(e.rows,o,te),te,n("markdownTable.blank"))},[o,u,n,e.rows]),re=g.useMemo(()=>e.headers.map((te,K)=>Mse(e.rows,K)),[e.headers,e.rows]),oe=g.useMemo(()=>e.headers.map((te,K)=>K).filter(te=>!f.has(te)),[f,e.headers]);g.useEffect(()=>{A()},[A,oe,me]),g.useEffect(()=>{p&&!me.some(te=>te.key===p)&&y(null)},[p,me]);const ke=(te,K)=>{c(null),a(ie=>{const fe={...ie};return K&&e0(K)?fe[te]=K:delete fe[te],fe}),P()},He=(te,K)=>{c(null),i(K?{columnIndex:te,direction:K}:null)},Ve=te=>{c(null),i(K=>(K==null?void 0:K.columnIndex)!==te?{columnIndex:te,direction:"asc"}:K.direction==="asc"?{columnIndex:te,direction:"desc"}:null)},ce=(te,K)=>{c(null),J.current=te.currentTarget;const ie=te.currentTarget.getBoundingClientRect(),fe=300,We=430,Mt={columnIndex:K,left:Math.max(6,Math.min(ie.right-fe,window.innerWidth-fe-6)),top:window.innerHeight-ie.bottom<We?Math.max(8,ie.top-We-2):ie.bottom+2};d(_t=>(_t==null?void 0:_t.columnIndex)===K?null:Mt)},xe=te=>{oe.length<=1||(c(null),P(),a(K=>{const ie={...K};return delete ie[te],ie}),i(K=>(K==null?void 0:K.columnIndex)===te?null:K),m(K=>{const ie=new Set(K);return ie.add(te),ie}))},Me=()=>{c(null),m(new Set)},Re=te=>{c(null),y(K=>K===te?null:te)},ct=g.useMemo(()=>l?b5(l):null,[l]),Ct=(te,K)=>{if(!ct)return!1;const{minRow:ie,maxRow:fe,minCol:We,maxCol:Mt}=ct;return te>=ie&&te<=fe&&K>=We&&K<=Mt},vt=(te,K)=>{u!==null&&d(null),C.current=!0,c({anchorRow:te,anchorCol:K,focusRow:te,focusCol:K})},Rt=(te,K,ie)=>{var fe;te.button!==0||h9(te.target)||(te.preventDefault(),(fe=$.current)==null||fe.focus({preventScroll:!0}),vt(K,ie))},Ke=(te,K)=>{C.current&&(b(!0),Y.current={rowIndex:te,columnIndex:K},!G.current&&(G.current=requestAnimationFrame(()=>{G.current=0;const ie=Y.current;Y.current=null,ie&&c(fe=>fe&&{...fe,focusRow:ie.rowIndex,focusCol:ie.columnIndex})})))},pt=te=>{var Mt;const K=document.elementFromPoint(te.clientX,te.clientY),ie=K==null?void 0:K.closest("[data-row-index][data-column-index]");if(!ie||!((Mt=M.current)!=null&&Mt.contains(ie)))return null;const fe=Number(ie.dataset.rowIndex),We=Number(ie.dataset.columnIndex);return!Number.isInteger(fe)||!Number.isInteger(We)?null:{rowIndex:fe,columnIndex:We}},yt=(te,K,ie)=>{te.touches.length!==1||h9(te.target)||vt(K,ie)},ae=te=>{if(!C.current||te.touches.length!==1)return;const K=te.touches[0];if(!K)return;const ie=pt(K);ie&&(te.preventDefault(),Ke(ie.rowIndex,ie.columnIndex))},V=()=>{const te=f9(l,me,oe);if(!te||!navigator.clipboard)return;const K=N.current;navigator.clipboard.writeText(te).then(()=>{B.current&&N.current===K&&(R.current&&clearTimeout(R.current),S(!0),R.current=setTimeout(()=>S(!1),2e3))}).catch(ie=>console.warn("[web-shell] clipboard write failed:",ie))},ue=()=>{const te=_se(e.headers,me,oe);if(!te||!navigator.clipboard)return;const K=j.current;navigator.clipboard.writeText(te).then(()=>{B.current&&j.current===K&&(E.current&&clearTimeout(E.current),v(!0),E.current=setTimeout(()=>v(!1),2e3))}).catch(ie=>console.warn("[web-shell] clipboard write failed:",ie))},Ne=te=>{if(yse())return;const K=f9(l,me,oe);K&&(te.preventDefault(),te.clipboardData.setData("text/plain",K))},ut=kse(l,oe),ht=Object.values(o).filter(e0).length,ft=me.length===e.rows.length?n("markdownTable.rows",{count:e.rows.length}):n("markdownTable.rowsFiltered",{visible:me.length,total:e.rows.length}),pe=u===null?void 0:e.headers[u.columnIndex],Ae=pe&&u?pe.text||n("markdownTable.column",{index:u.columnIndex+1}):"";return h.jsxs("div",{ref:M,className:`${ot.tableShell} ${x?ot.dragging:""}`,children:[h.jsxs("div",{className:ot.toolbar,children:[h.jsx("span",{className:ot.summary,children:ft}),h.jsx("span",{className:ot.hint,children:n("markdownTable.hint")}),h.jsx("button",{className:ot.copyButton,type:"button",onClick:ue,children:w?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ot.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyVisible")}),f.size>0&&h.jsx("button",{className:ot.copyButton,type:"button",onClick:Me,children:n("markdownTable.showHiddenColumns",{count:f.size})}),ht>0&&h.jsx("span",{className:ot.selection,children:n("markdownTable.filtersActive",{count:ht})}),ut>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ot.selection,children:n("markdownTable.cellsSelected",{count:ut})}),h.jsx("button",{className:ot.copyButton,type:"button",onClick:V,children:_?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:ot.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyTsv")})]}),t]}),h.jsxs("div",{ref:$,className:ot.scroller,tabIndex:0,onCopy:Ne,children:[h.jsxs("table",{className:ot.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{className:`${ot.headerCell} ${ot.actionHeaderCell}`,children:n("markdownTable.actions")}),oe.map(te=>{const K=e.headers[te];if(!K)return null;const ie=(s==null?void 0:s.columnIndex)===te,fe=e0(o[te]),We=(u==null?void 0:u.columnIndex)===te,Mt=ie?s.direction==="asc"?"↑":"↓":"↕",_t=K.text||n("markdownTable.column",{index:te+1}),jn=ie?n(s.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:_t}):n("markdownTable.sortByColumn",{column:_t}),ur=ie?s.direction==="asc"?"ascending":"descending":"none",Xr=`${r}-filter-${te}`,on=K.textAlign?{textAlign:K.textAlign}:void 0;return h.jsx("th",{className:ot.headerCell,"aria-sort":ur,style:on,children:h.jsxs("div",{className:ot.headerControls,children:[h.jsxs("button",{className:ot.headerButton,type:"button",onClick:()=>Ve(te),"aria-label":jn,style:on,children:[h.jsx("span",{className:ot.headerText,style:on,children:K.content}),h.jsx("span",{className:ot.sortIcon,"aria-hidden":"true",children:Mt})]}),h.jsx("button",{className:`${ot.filterTrigger} ${fe?ot.filterTriggerActive:""}`,type:"button",onClick:Be=>ce(Be,te),"aria-label":n("markdownTable.filterColumn",{column:_t}),"aria-expanded":We,"aria-controls":We?Xr:void 0,children:"▾"})]})},K.key)})]})}),h.jsx("tbody",{children:me.map((te,K)=>{const ie=p===te.key,fe=`${r}-detail-${te.key}`;return h.jsxs(g.Fragment,{children:[h.jsxs("tr",{className:K%2===1?ot.evenRow:void 0,children:[h.jsx("td",{className:`${ot.cell} ${ot.actionCell}`,children:h.jsx("button",{className:ot.rowDetailButton,type:"button",onClick:()=>Re(te.key),"aria-expanded":ie,"aria-controls":fe,"aria-label":n(ie?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:K+1}),children:n("markdownTable.rowDetails")})}),oe.map(We=>{const Mt=te.cells[We];if(!Mt)return null;const _t=Mt.textAlign?{textAlign:Mt.textAlign}:void 0;return h.jsx("td",{className:`${ot.cell} ${Ct(K,We)?ot.selectedCell:""}`,style:_t,"data-row-index":K,"data-column-index":We,onMouseDown:jn=>Rt(jn,K,We),onMouseEnter:()=>Ke(K,We),onTouchStart:jn=>yt(jn,K,We),onTouchMove:ae,onTouchEnd:he,onTouchCancel:he,children:Mt.content},Mt.key)})]}),ie&&h.jsx("tr",{id:fe,className:ot.detailRow,children:h.jsx("td",{className:ot.detailCell,colSpan:oe.length+1,children:h.jsxs("div",{className:ot.detailPanel,children:[h.jsx("div",{className:ot.detailTitle,children:n("markdownTable.detailsHeader")}),oe.map(We=>{const Mt=e.headers[We],_t=te.cells[We];if(!Mt||!_t)return null;const jn=Mt.textAlign?{textAlign:Mt.textAlign}:void 0,ur=_t.textAlign?{textAlign:_t.textAlign}:void 0;return h.jsxs("div",{className:ot.detailItem,children:[h.jsx("div",{className:ot.detailLabel,style:jn,children:Mt.content}),h.jsx("div",{className:ot.detailValue,style:ur,children:_t.content})]},`${te.key}-detail-${We}`)})]})})})]},te.key)})})]}),me.length===0&&h.jsx("div",{className:ot.emptyState,children:e.rows.length===0?n("markdownTable.empty"):n("markdownTable.emptyFiltered")})]}),u&&pe&&h.jsx(Bse,{id:`${r}-filter-${u.columnIndex}`,columnName:Ae,columnIndex:u.columnIndex,filter:o[u.columnIndex],isNumeric:re[u.columnIndex]??!1,options:se,sort:s,style:{left:u.left,top:u.top},menuRef:H,canHideColumn:oe.length>1,onApply:ke,onClose:P,onHideColumn:xe,onSort:He},u.columnIndex)]})}const $se="_content_n5mo3_1",qse="_inlineCode_n5mo3_127",Fse="_link_n5mo3_139",Use="_tableWrapper_n5mo3_149",Hse="_table_n5mo3_149",Vse="_image_n5mo3_179",Wse="_codeBlock_n5mo3_187",Gse="_codeBlockHeader_n5mo3_196",Kse="_codeBlockLang_n5mo3_206",Yse="_codeBlockCopy_n5mo3_214",Xse="_codeBlockContent_n5mo3_232",Qse="_codeBlockPlain_n5mo3_251",Jse="_mermaidBlock_n5mo3_269",Zse="_mermaidInline_n5mo3_281",eie="_mermaidLoading_n5mo3_300",tie="_mermaidActions_n5mo3_307",gn={content:$se,inlineCode:qse,link:Fse,tableWrapper:Use,table:Hse,image:Vse,codeBlock:Wse,codeBlockHeader:Gse,codeBlockLang:Kse,codeBlockCopy:Yse,codeBlockContent:Xse,codeBlockPlain:Qse,mermaidBlock:Jse,mermaidInline:Zse,mermaidLoading:eie,mermaidActions:tie},nie=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),p9={ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function rie(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(p9,t)?p9[t]:t,r=nie.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:r}}const Kj=/^(https?:|mailto:)/i,sie=/^data:image\/(png|jpeg|gif|webp);base64,/i;function iie(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:Kj.test(t):!1}function Yj(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||sie.test(t)?!0:Kj.test(t):!1}let g9,oie=0;function aie({code:e}){const{t}=at(),n=T_(),[r,s]=g.useState(null),[i,o]=g.useState(null),[a,l]=g.useState("diagram"),[c,u]=g.useState(!1),d=n==="light"?"default":"dark";g.useEffect(()=>{let m=!1;s(null),o(null);const p=setTimeout(()=>{q(()=>import("./mermaid.core-DtB6NO1e.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const x=y.default;g9!==d&&(x.initialize({startOnLoad:!1,theme:d,securityLevel:"strict",suppressErrorRendering:!0}),g9=d);try{const b=`mermaid-${++oie}`,{svg:w}=await x.render(b,e.trim());m||s(w)}catch(b){m||o(b instanceof Error?b.message:"Mermaid render failed")}})},150);return()=>{m=!0,clearTimeout(p)}},[e,d]);const f=()=>{navigator.clipboard.writeText(e).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)},()=>{})};return i?h.jsxs("div",{className:gn.codeBlock,children:[h.jsx("div",{className:gn.codeBlockHeader,children:h.jsx("span",{className:gn.codeBlockLang,children:"mermaid (error)"})}),h.jsx("pre",{className:`${gn.codeBlockContent} ${gn.codeBlockPlain}`,children:h.jsx("code",{children:e})})]}):h.jsxs("div",{className:gn.codeBlock,children:[h.jsxs("div",{className:gn.codeBlockHeader,children:[h.jsx("span",{className:gn.codeBlockLang,children:"mermaid"}),h.jsxs("span",{className:gn.mermaidActions,children:[h.jsx("button",{className:gn.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),h.jsx("button",{className:gn.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?h.jsx("pre",{className:`${gn.codeBlockContent} ${gn.codeBlockPlain}`,children:h.jsx("code",{children:e})}):r?h.jsx("div",{className:`${gn.mermaidBlock} ${gn.mermaidInline}`,dangerouslySetInnerHTML:{__html:r}}):h.jsx("div",{className:`${gn.mermaidBlock} ${gn.mermaidLoading} ${gn.mermaidInline}`,children:h.jsx("span",{children:t("mermaid.rendering")})})]})}function lie({className:e,children:t,isStreaming:n}){const{t:r}=at(),s=T_(),[i,o]=g.useState(null),[a,l]=g.useState(!1),c=e==null?void 0:e.match(/language-(\w+)/),{label:u,lang:d,resolvedLang:f}=rie(c==null?void 0:c[1]),m=String(t).replace(/\n$/,""),p=s==="light"?"github-light-default":"github-dark-default";g.useEffect(()=>{if(d==="mermaid"||f==="text"||mre(m)){o(null);return}const x=cre(m,f,p);if(x!==null){o(x);return}const b=!n,w=d9(m,f,p,b);if(w!==null){o(w);return}o(null);let v=!1;return dre(f).then(()=>{if(v)return;const _=d9(m,f,p,b);_!==null&&o(_)}).catch(_=>{v||(console.warn("[web-shell] highlight failed for lang=%s",f,_),o(null))}),()=>{v=!0}},[m,d,f,p,n]);const y=()=>{navigator.clipboard.writeText(m).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?h.jsx(aie,{code:m}):h.jsxs("div",{className:gn.codeBlock,children:[h.jsxs("div",{className:gn.codeBlockHeader,children:[h.jsx("span",{className:gn.codeBlockLang,children:u}),h.jsx("button",{className:gn.codeBlockCopy,onClick:y,children:r(a?"code.copied":"code.copy")})]}),i!==null?h.jsx("div",{className:gn.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):h.jsx("pre",{className:`${gn.codeBlockContent} ${gn.codeBlockPlain}`,children:h.jsx("code",{children:m})})]})}function cie({children:e}){return h.jsx("code",{className:gn.inlineCode,children:e})}function y9({children:e}){return h.jsx("div",{className:gn.tableWrapper,children:h.jsx("table",{className:gn.table,children:e})})}class uie extends g.Component{constructor(){super(...arguments);le(this,"state",{hasError:!1,resetKey:this.props.resetKey})}static getDerivedStateFromError(){return{hasError:!0}}static getDerivedStateFromProps(n,r){return n.resetKey!==r.resetKey?{hasError:!1,resetKey:n.resetKey}:null}componentDidCatch(n,r){console.error("[web-shell] enhanced markdown table failed:",n,r.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const Xj=g.createContext(!1);function die({className:e,children:t}){const n=g.useContext(Xj);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?h.jsx(lie,{className:e,isStreaming:n,children:String(t)}):h.jsx(cie,{children:t})}function hie({children:e}){return h.jsx(h.Fragment,{children:e})}function fie({href:e,children:t}){const n=iie(e)?e:void 0;return h.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:gn.link,children:t})}function mie({src:e,alt:t}){const n=Yj(e)?e:void 0;return h.jsx("img",{src:n,alt:t||"",className:gn.image})}function Qj(e="basic",t=""){return{code:die,pre:hie,a:fie,img:mie,table({children:n}){if(e==="advanced"){const r=h.jsx(y9,{children:n});return h.jsx(uie,{fallback:r,resetKey:t,children:h.jsx(Pse,{fallback:r,children:n})})}return h.jsx(y9,{children:n})}}}const pie=Qj(),pm=g.memo(function({content:t,source:n,isStreaming:r,tableMode:s}){const{markdown:i,markdownTableMode:o}=bc(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,c=r?"basic":s??o??"basic",u=g.useMemo(()=>c==="advanced"?Qj("advanced",l):pie,[c,l]),d=a==null?void 0:a.components,f=g.useMemo(()=>d?{...u,...d,...c==="advanced"?{table:u.table}:{}}:u,[u,c,d]);if(!t)return null;const m=a!=null&&a.remarkPlugins?[QS,B7,...a.remarkPlugins]:[QS,B7],p=a!=null&&a.rehypePlugins?[W7,...a.rehypePlugins]:[W7];return h.jsx("div",{className:n!=="thinking"?gn.content:void 0,"data-markdown-source":n,children:h.jsx(Xj.Provider,{value:!!r,children:h.jsx(_Y,{remarkPlugins:m,rehypePlugins:p,components:f,children:l})})})}),gie="_chatMessageRow_1majp_41",yie="_chatBubble_1majp_48",bie="_chatContent_1majp_61",wie="_chatContentCollapsed_1majp_66",vie="_toggleButton_1majp_71",xie="_toggleIcon_1majp_92",_ie="_toggleIconExpanded_1majp_99",kie="_chatImages_1majp_103",Sie="_chatImageThumb_1majp_110",ya={chatMessageRow:gie,chatBubble:yie,chatContent:bie,chatContentCollapsed:wie,toggleButton:vie,toggleIcon:xie,toggleIconExpanded:_ie,chatImages:kie,chatImageThumb:Sie},Tie=g.memo(function({content:t,images:n}){const{t:r}=at(),s=g.useRef(null),[i,o]=g.useState(!1),[a,l]=g.useState(!1),c=g.useCallback(()=>{const u=s.current;u&&l(u.scrollHeight>400)},[]);return g.useLayoutEffect(()=>{o(!1),c()},[t,n==null?void 0:n.length,c]),g.useEffect(()=>{const u=s.current;if(!u||typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(u),()=>d.disconnect()},[c]),h.jsx("div",{className:ya.chatMessageRow,children:h.jsxs("div",{className:ya.chatBubble,children:[h.jsxs("div",{ref:s,className:`${ya.chatContent} ${a&&!i?ya.chatContentCollapsed:""}`,children:[n&&n.length>0&&h.jsx("div",{className:ya.chatImages,children:n.map((u,d)=>{const f=u.data.startsWith("data:")?u.data:`data:${u.mimeType};base64,${u.data}`;return Yj(f)?h.jsx("img",{src:f,alt:`User uploaded image ${d+1}`,className:ya.chatImageThumb,onLoad:c},d):null})}),t]}),a&&h.jsxs("button",{type:"button",className:ya.toggleButton,onClick:()=>o(u=>!u),children:[h.jsx("span",{children:r(i?"userMessage.showLess":"userMessage.showMore")}),h.jsx("svg",{className:`${ya.toggleIcon} ${i?ya.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"})})]})]})})}),Cie="_message_1hsrm_1",Aie="_messageFooter_1hsrm_7",Eie="_copyButton_1hsrm_23",Mie="_footerTime_1hsrm_49",Nie="_thinking_1hsrm_61",Iie="_thinkingBody_1hsrm_73",Rie="_thinkingSummary_1hsrm_104",jie="_thinkingSummaryTextActive_1hsrm_126",Lie="_thinkingSummaryIcon_1hsrm_132",Die="_thinkingSummaryText_1hsrm_126",Oie="_thinkingChevronRight_1hsrm_189",Bie="_thinkingChevronDown_1hsrm_190",Pie="_thinkingExpandedWrap_1hsrm_217",zie="_thinkingExpandedClip_1hsrm_221",$ie="_thinkingExpandedCollapsed_1hsrm_229",qie="_thinkingExpandedInner_1hsrm_233",Fie="_content_1hsrm_281",Uie="_contentBody_1hsrm_286",ar={message:Cie,messageFooter:Aie,copyButton:Eie,footerTime:Mie,thinking:Nie,thinkingBody:Iie,thinkingSummary:Rie,thinkingSummaryTextActive:jie,thinkingSummaryIcon:Lie,thinkingSummaryText:Die,thinkingChevronRight:Oie,thinkingChevronDown:Bie,thinkingExpandedWrap:Pie,thinkingExpandedClip:zie,thinkingExpandedCollapsed:$ie,thinkingExpandedInner:qie,content:Fie,contentBody:Uie},Hie=g.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:o=!1}){const{t:a}=at(),[l,c]=g.useState(!1),u=!!t&&!n&&i,d=g.useCallback(()=>{var m;const f=(m=navigator.clipboard)==null?void 0:m.writeText(t);f&&f.then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)}).catch(()=>{})},[t]);return h.jsxs("div",{className:ar.message,children:[t&&h.jsx("div",{className:ar.content,children:h.jsx("div",{className:ar.contentBody,children:h.jsx(pm,{content:t,source:"assistant",isStreaming:n})})}),u&&h.jsxs("div",{className:ar.messageFooter,children:[h.jsx("button",{type:"button",className:ar.copyButton,title:a("assistant.copy"),"aria-label":a("assistant.copy"),onClick:d,children:l?h.jsx(Wie,{}):h.jsx(Vie,{})}),o&&s&&h.jsx("button",{type:"button",className:ar.copyButton,title:a("assistant.branch"),"aria-label":a("assistant.branch"),onClick:s,children:h.jsx(Gie,{})}),r!==void 0&&h.jsx("span",{className:ar.footerTime,"aria-hidden":"true",children:eh(r)})]})]})});function Vie(){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 Wie(){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 Gie(){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 Kie=g.memo(function({content:t,isStreaming:n,timestamp:r}){const{t:s}=at(),i=g.useContext(Dh),[o,a]=g.useState(!1),l=Yie({isStreaming:n}),c=l==="thinking.running",u=g.useRef(r??Date.now()),d=g.useRef(c),[f,m]=g.useState(()=>Date.now()),[p,y]=g.useState(null);g.useEffect(()=>{if(!t||!c)return;m(Date.now());const w=setInterval(()=>m(Date.now()),1e3);return()=>clearInterval(w)},[t,c]),g.useEffect(()=>{if(t){if(c){d.current=!0,y(null);return}d.current&&p===null&&y(Date.now())}},[t,p,c]);const x=c||p?Xie((c?f:p)-u.current):"",b=g.useCallback(()=>{a(w=>!w)},[]);return h.jsx("div",{className:ar.message,children:t&&!i&&h.jsx("div",{className:ar.thinking,children:h.jsxs("div",{className:ar.thinkingBody,children:[h.jsxs("button",{type:"button",className:ar.thinkingSummary,onClick:b,"aria-expanded":o,title:s(o?"thinking.collapse":"thinking.expand"),children:[h.jsx("span",{className:ar.thinkingSummaryIcon,"aria-hidden":"true",children:h.jsx(Qie,{})}),h.jsx("span",{className:c?`${ar.thinkingSummaryText} ${ar.thinkingSummaryTextActive}`:ar.thinkingSummaryText,children:s(l,c?{duration:x}:{})}),h.jsx("span",{className:o?ar.thinkingChevronDown:ar.thinkingChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:o?ar.thinkingExpandedClip:`${ar.thinkingExpandedClip} ${ar.thinkingExpandedCollapsed}`,children:h.jsx("div",{className:ar.thinkingExpandedInner,children:h.jsx("div",{className:ar.thinkingExpandedWrap,children:h.jsx(pm,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function Yie({isStreaming:e}){return e?"thinking.running":"thinking.done"}function Xie(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 Qie(){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 Jie="_panel_8ng9u_1",Zie="_title_8ng9u_16",eoe="_metaLine_8ng9u_22",toe="_progress_8ng9u_32",noe="_spacer_8ng9u_38",roe="_row_8ng9u_42",soe="_detailRow_8ng9u_43",ioe="_subDetailRow_8ng9u_44",ooe="_symbol_8ng9u_65",aoe="_label_8ng9u_69",loe="_value_8ng9u_73",coe="_detailName_8ng9u_80",uoe="_sectionTitle_8ng9u_88",doe="_detailSection_8ng9u_94",hoe="_skillBlock_8ng9u_100",foe="_hint_8ng9u_105",moe="_detailCommand_8ng9u_111",poe="_bodyLoaded_8ng9u_132",goe="_accent_8ng9u_137",yoe="_secondary_8ng9u_141",boe="_warning_8ng9u_145",woe="_error_8ng9u_149",voe="_success_8ng9u_153",jt={panel:Jie,title:Zie,metaLine:eoe,progress:toe,spacer:noe,row:roe,detailRow:soe,subDetailRow:ioe,symbol:ooe,label:aoe,value:loe,detailName:coe,sectionTitle:uoe,detailSection:doe,skillBlock:hoe,hint:foe,detailCommand:moe,bodyLoaded:poe,accent:goe,secondary:yoe,warning:boe,error:woe,success:voe},Zv="web-shell:context-usage:v1:",yl="█",Jj="▒",Zj="░",eL=30;function xoe(e){return`${Zv}${JSON.stringify(e)}`}function _oe(e){if(!e.startsWith(Zv))return null;try{const t=JSON.parse(e.slice(Zv.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function tL(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function oh(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function koe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function Soe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function Toe({usedPercentage:e,bufferPercentage:t}){const r=Math.round(Math.min(e,100)/100*56),s=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-r-s),o=e>80?jt.error:e>60?jt.warning:jt.accent;return h.jsxs("div",{className:jt.progress,"aria-hidden":"true",children:[h.jsx("span",{className:o,children:yl.repeat(Math.max(0,r))}),h.jsx("span",{className:jt.secondary,children:Zj.repeat(Math.max(0,i))}),h.jsx("span",{className:jt.warning,children:Jj.repeat(Math.max(0,s))})]})}function ba({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=jt.secondary,isOverLimit:o}){return h.jsxs("div",{className:jt.row,children:[h.jsx("span",{className:`${jt.symbol} ${i}`,children:e}),h.jsx("span",{className:jt.label,children:t}),h.jsxs("span",{className:o?jt.error:jt.value,children:[oh(n)," ",r," (",koe(n,s),"%)"]})]})}const c4="/context detail";function Coe({hint:e,onShowDetail:t}){const n=t?e.indexOf(c4):-1;return n<0?h.jsx("div",{className:jt.hint,children:e}):h.jsxs("div",{className:jt.hint,children:[e.slice(0,n),h.jsx("button",{type:"button",className:jt.detailCommand,onClick:t,children:c4}),e.slice(n+c4.length)]})}function Aoe({name:e,tokens:t,tokenLabel:n}){return h.jsxs("div",{className:jt.detailRow,children:[h.jsxs("span",{className:jt.secondary,children:["└"," "]}),h.jsx("span",{className:jt.detailName,title:e,children:tL(e,eL)}),h.jsxs("span",{className:jt.value,children:[oh(t)," ",n]})]})}function u4({title:e,items:t,getName:n,tokenLabel:r}){const s=Soe(t);return s.length===0?null:h.jsxs("section",{className:jt.detailSection,children:[h.jsx("div",{className:jt.sectionTitle,children:e}),s.map(i=>h.jsx(Aoe,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function Eoe({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:jt.detailSection,children:[h.jsx("div",{className:jt.sectionTitle,children:t.skills}),n.map(r=>h.jsxs("div",{className:jt.skillBlock,children:[h.jsxs("div",{className:jt.detailRow,children:[h.jsxs("span",{className:jt.secondary,children:["└"," "]}),h.jsxs("span",{className:jt.detailName,title:r.name,children:[tL(r.name,eL),r.loaded&&h.jsxs("span",{className:jt.success,children:[" ",t.active]})]}),h.jsxs("span",{className:jt.value,children:[oh(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&h.jsxs("div",{className:jt.subDetailRow,children:[h.jsxs("span",{className:jt.secondary,children:["  └"," "]}),h.jsx("span",{className:jt.bodyLoaded,children:t.bodyLoaded}),h.jsxs("span",{className:jt.success,children:["+",oh(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function Moe({status:e,onShowDetail:t}){const{t:n}=at(),{usage:r}=e,{breakdown:s,contextWindowSize:i}=r,o=i>0?r.totalTokens/i*100:0,a=o>100,l=i>0?s.autocompactBuffer/i*100:0;return h.jsxs("div",{className:jt.panel,children:[h.jsx("div",{className:jt.title,children:n("contextUsage.title")}),r.isEstimated?h.jsx(h.Fragment,{children:h.jsxs("div",{className:jt.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",oh(i)," ",n("contextUsage.tokens")]})]})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:jt.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",oh(i)," ",n("contextUsage.tokens")]})]}),a&&h.jsx("div",{className:jt.error,children:n("contextUsage.overLimit")})]}),h.jsx(Toe,{usedPercentage:Math.min(o,100),bufferPercentage:l}),h.jsx("div",{className:jt.spacer}),h.jsx(ba,{symbol:yl,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?jt.error:jt.accent,isOverLimit:a}),h.jsx(ba,{symbol:Zj,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),h.jsx(ba,{symbol:Jj,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.warning}),h.jsx("div",{className:jt.spacer}),h.jsx("div",{className:jt.sectionTitle,children:n("contextUsage.usageByCategory")}),h.jsx(ba,{symbol:yl,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.accent}),h.jsx(ba,{symbol:yl,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.accent}),s.mcpTools>0&&h.jsx(ba,{symbol:yl,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.accent}),h.jsx(ba,{symbol:yl,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.accent}),h.jsx(ba,{symbol:yl,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.accent}),!r.isEstimated&&h.jsx(ba,{symbol:yl,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:jt.accent}),r.showDetails?h.jsxs(h.Fragment,{children:[h.jsx(u4,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(u4,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(u4,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),h.jsx(Eoe,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):h.jsx(Coe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const Noe={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 nL(e){if(!e.trim())return"Tool";const t=Noe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function tl(e,t){const n=nL(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 Rh(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function vs(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const ex=2e3;function rL(e,t){const n=Roe(e,t);if(n)return vs(n,ex);const r=joe(e,t);return r?vs(r,ex):""}function Ko(e){var t;if(!e.content)return nx(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return nx(e.rawOutput)}function Ioe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=b9((nx(e.rawOutput)??"").trim());if(o)return o}const n=Ko(e);if(!n)return"";const r=n.split(`
`),s=r.length;if(t==="read"||t==="read_file"||t==="readfile")return`${s} line(s)`;if(t==="glob")return`Found ${r.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${r.filter(a=>a.trim()).length} item(s)`;if(lc(t)){if(s>3)return`${s} lines of output`;const o=r[0]||"";return vs(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=b9(n.trim());return o||`${r.filter(l=>l.trim()).length} result(s)`}if(t==="edit"||t==="write"||t==="write_file"||t==="editfile")return"";if(t==="webfetch"||t==="web_fetch"||t==="fetch"){const o=r[0]||"";return vs(o,80)}if(t==="websearch"||t==="web_search"){const o=r.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:r[0]||""}if(Rh(t))return"";const i=r[0]||"";return vs(i,80)}function Roe(e,t){if(!e.title)return null;const n=nL(e.toolName),r=e.title.trim();if(r===e.toolName||r===n)return null;const s=[n,e.toolName];for(const i of s)if(r.startsWith(i)){const o=r.slice(i.length);if(/^(:\s*|\s+)/.test(o))return w9(o.replace(/^:\s*|\s+/,""),t)}return w9(r,t)}function b9(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function joe(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 ${_d(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," ")})`),vs(s,ex)}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):_d(String(n.file_path),t);if(n.url){const s=String(n.url),i=typeof n.prompt=="string"?n.prompt:void 0,o=i?`${s} — "${vs(i,40)}"`:s;return vs(o,80)}if(n.path)return _d(String(n.path),t);if(n.query)return vs(String(n.query),60);if(r==="list_directory"||r==="listfiles"){const s=n.path||n.directory||"";return _d(String(s),t)}return n.description?String(n.description):""}function lc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function Ga(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>Ga(r,t)))??!1}function w9(e,t){const n=e.trim();return sL(tx(n))?_d(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>_d(r,t))}function _d(e,t){const n=tx(e),r=t?tx(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":sL(n)?Loe(n):n}function tx(e){return e.replace(/\\/g,"/")}function sL(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Loe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function gm(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function w5(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 R0(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=w5(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function v5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const Doe="general-purpose";function x5(e){var r;const t=gm(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":Doe}function _5(e){var i,o;if(e.title){const a=e.title.indexOf(": ");if(a>0)return e.title.slice(a+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=gm(e.rawOutput),r=n==null?void 0:n.taskDescription;if(typeof r=="string"&&r.trim())return r.trim();const s=(o=e.args)==null?void 0:o.prompt;return typeof s=="string"&&s.trim()?s.trim().split(`
`)[0]??"":""}function Ooe(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const r=n[n.length-1];if(r.status!=="in_progress"&&r.status!=="pending")return"";let s=tl(r.toolName??"",t);if(r.title){const a=r.title.indexOf(": ");s+=" "+(a>0?r.title.slice(a+2):r.title)}else(i=r.args)!=null&&i.command?s+=" "+String(r.args.command):(o=r.args)!=null&&o.file_path&&(s+=" "+String(r.args.file_path));return vs(s,50)}function nx(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 Boe="_panel_1xezz_1",Poe="_title_1xezz_17",zoe="_sectionTitle_1xezz_23",$oe="_spacer_1xezz_29",qoe="_pivotRow_1xezz_35",Foe="_metricCell_1xezz_41",Uoe="_metricCellSection_1xezz_48",Hoe="_metricCellSub_1xezz_56",Voe="_modelCell_1xezz_64",Woe="_modelCellHeader_1xezz_71",Goe="_divider_1xezz_79",Koe="_kvRow_1xezz_87",Yoe="_kvSubRow_1xezz_94",Xoe="_kvLabel_1xezz_102",Qoe="_kvValue_1xezz_106",Joe="_tableRow_1xezz_115",Zoe="_tableNameCol_1xezz_121",eae="_tableToolCol_1xezz_129",tae="_tableNumCol_1xezz_137",nae="_success_1xezz_147",rae="_error_1xezz_151",sae="_secondary_1xezz_155",iae="_warning_1xezz_159",Fe={panel:Boe,title:Poe,sectionTitle:zoe,spacer:$oe,pivotRow:qoe,metricCell:Foe,metricCellSection:Uoe,metricCellSub:Hoe,modelCell:Voe,modelCellHeader:Woe,divider:Goe,kvRow:Koe,kvSubRow:Yoe,kvLabel:Xoe,kvValue:Qoe,tableRow:Joe,tableNameCol:Zoe,tableToolCol:eae,tableNumCol:tae,success:nae,error:rae,secondary:sae,warning:iae},rx="web-shell:session-stats:v1:";function oae(e,t="overview"){return`${rx}${JSON.stringify({_view:t,...e})}`}function aae(e){if(!e.startsWith(rx))return null;try{const t=JSON.parse(e.slice(rx.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 Ql(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 Yc({label:e,children:t}){return h.jsxs("div",{className:Fe.kvRow,children:[h.jsx("span",{className:Fe.kvLabel,children:e}),h.jsx("span",{className:Fe.kvValue,children:t})]})}function t0({label:e,children:t}){return h.jsxs("div",{className:Fe.kvSubRow,children:[h.jsxs("span",{className:Fe.secondary,children:["»"," ",e]}),h.jsx("span",{className:Fe.kvValue,children:t})]})}function iL(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const r=t.split("::"),s=r[0],i=r[1],o=i?`${s} (${i})`:s;return{key:t,label:o,metrics:n}})}function lae(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function cae(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function uae(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Co({metric:e,values:t,variant:n="normal"}){const r=n==="section"?Fe.metricCellSection:n==="sub"?Fe.metricCellSub:Fe.metricCell;return h.jsxs("div",{className:Fe.pivotRow,children:[h.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>h.jsx("span",{className:Fe.modelCell,children:s},i))]})}function dae({status:e}){const{t}=at(),{models:n,tools:r,files:s}=e,i=Object.values(n).reduce((y,x)=>y+x.api.totalLatencyMs,0),o=r.totalDurationMs,a=i+o,l=a>0?i/a*100:0,c=a>0?o/a*100:0,u=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,d=iL(n),f=d.reduce((y,x)=>y+x.metrics.tokens.cached,0),m=d.reduce((y,x)=>y+x.metrics.tokens.prompt,0),p=m>0?f/m*100:0;return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.title")}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.overview")}),h.jsx(Yc,{label:t("stats.duration"),children:Ql(e.durationMs)}),h.jsx(Yc,{label:t("stats.prompts"),children:e.promptCount}),h.jsx(Yc,{label:t("stats.toolCalls"),children:h.jsxs("span",{children:[r.totalCalls," ",h.jsx("span",{className:Fe.secondary,children:"("}),h.jsxs("span",{className:Fe.success,children:["✓",r.totalSuccess]})," ",h.jsxs("span",{className:Fe.error,children:["✗",r.totalFail]}),h.jsx("span",{className:Fe.secondary,children:")"})]})}),h.jsx(Yc,{label:t("stats.successRate"),children:h.jsxs("span",{className:u>=90?Fe.success:u>=70?Fe.warning:Fe.error,children:[u.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&h.jsx(Yc,{label:t("stats.codeChanges"),children:h.jsxs("span",{children:[h.jsxs("span",{className:Fe.success,children:["+",s.totalLinesAdded]})," ",h.jsxs("span",{className:Fe.error,children:["-",s.totalLinesRemoved]})]})}),h.jsx("div",{className:Fe.spacer}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.performance")}),h.jsxs(t0,{label:t("stats.apiTime"),children:[Ql(i)," ",h.jsxs("span",{className:Fe.secondary,children:["(",l.toFixed(1),"%)"]})]}),h.jsxs(t0,{label:t("stats.toolTime"),children:[Ql(o)," ",h.jsxs("span",{className:Fe.secondary,children:["(",c.toFixed(1),"%)"]})]}),d.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Fe.spacer}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.modelUsage")}),h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:Fe.tableNameCol,children:t("stats.modelUsage")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.reqs")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.inputTokens")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.outputTokens")})]}),h.jsx("div",{className:Fe.divider}),d.map(y=>h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:Fe.tableNameCol,children:y.label}),h.jsx("span",{className:Fe.tableNumCol,children:y.metrics.api.totalRequests}),h.jsx("span",{className:`${Fe.tableNumCol} ${Fe.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),h.jsx("span",{className:`${Fe.tableNumCol} ${Fe.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),p>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{children:[h.jsx("span",{className:Fe.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",p.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),h.jsxs("div",{className:Fe.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function hae({status:e}){const{t}=at(),n=iL(e.models);if(n.length===0)return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.modelStats")}),h.jsx("div",{children:t("stats.noApiCalls")})]});const r=n.some(o=>o.metrics.tokens.cached>0),s=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.modelStats")}),h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{className:Fe.pivotRow,children:[h.jsx("span",{className:Fe.metricCellSection,children:t("stats.metric")}),n.map(o=>h.jsx("span",{className:Fe.modelCellHeader,children:o.label},o.key))]}),h.jsx("div",{className:Fe.divider}),h.jsx(Co,{metric:t("stats.api"),values:[],variant:"section"}),h.jsx(Co,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),h.jsx(Co,{metric:t("stats.errors"),values:i(o=>{const a=lae(o);return h.jsxs("span",{className:o.api.totalErrors>0?Fe.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),h.jsx(Co,{metric:t("stats.avgLatency"),values:i(o=>Ql(cae(o)))}),h.jsx("div",{className:Fe.spacer}),h.jsx(Co,{metric:t("stats.tokens"),values:[],variant:"section"}),h.jsx(Co,{metric:t("stats.total"),values:i(o=>h.jsx("span",{className:Fe.warning,children:o.tokens.total.toLocaleString()}))}),h.jsx(Co,{metric:t("stats.prompt"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),r&&h.jsx(Co,{metric:t("stats.cached"),values:i(o=>h.jsxs("span",{className:Fe.success,children:[o.tokens.cached.toLocaleString()," (",uae(o).toFixed(1),"%)"]})),variant:"sub"}),s&&h.jsx(Co,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"}),h.jsx(Co,{metric:t("stats.output"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"})]})}function fae(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 mae({status:e}){const{t}=at(),n=fae(e.tools.byName);if(n.length===0)return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.toolStats")}),h.jsx("div",{children:t("stats.noToolCalls")})]});const r=Object.values(e.tools.byName).reduce((o,a)=>{var l,c,u;return o.accept+=((l=a.decisions)==null?void 0:l.accept)??0,o.reject+=((c=a.decisions)==null?void 0:c.reject)??0,o.modify+=((u=a.decisions)==null?void 0:u.modify)??0,o},{accept:0,reject:0,modify:0}),s=r.accept+r.reject+r.modify,i=s>0?r.accept/s*100:0;return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.toolStats")}),h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:Fe.tableToolCol,children:t("stats.toolName")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.calls")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.successRate")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.avgDuration")})]}),h.jsx("div",{className:Fe.divider}),n.map(o=>{const a=o.stats.count>0?o.stats.success/o.stats.count*100:0,l=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:`${Fe.tableToolCol} ${Fe.metricCell}`,children:tl(o.name,t)}),h.jsx("span",{className:Fe.tableNumCol,children:o.stats.count}),h.jsxs("span",{className:`${Fe.tableNumCol} ${a>=90?Fe.success:a>=70?Fe.warning:Fe.error}`,children:[a.toFixed(1),"%"]}),h.jsx("span",{className:Fe.tableNumCol,children:Ql(l)})]},o.name)}),h.jsx("div",{className:Fe.spacer}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.decisionSummary")}),h.jsx(Yc,{label:t("stats.totalReviewed"),children:s}),h.jsx(t0,{label:t("stats.accepted"),children:h.jsx("span",{className:Fe.success,children:r.accept})}),h.jsx(t0,{label:t("stats.rejected"),children:h.jsx("span",{className:Fe.error,children:r.reject})}),h.jsx(t0,{label:t("stats.modified"),children:h.jsx("span",{className:Fe.warning,children:r.modify})}),h.jsx("div",{className:Fe.divider}),h.jsx(Yc,{label:t("stats.agreementRate"),children:h.jsx("span",{className:s>0?i>=90?Fe.success:i>=70?Fe.warning:Fe.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function pae({view:e,status:t}){switch(e){case"model":return h.jsx(hae,{status:t});case"tools":return h.jsx(mae,{status:t});default:return h.jsx(dae,{status:t})}}function Uy(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 gae="_panel_13hcg_1",yae="_title_13hcg_17",bae="_row_13hcg_23",wae="_rowGap_13hcg_31",vae="_label_13hcg_35",xae="_value_13hcg_41",_ae="_accent_13hcg_46",tu={panel:gae,title:yae,row:bae,rowGap:wae,label:vae,value:xae,accent:_ae},{serialize:kae,parse:Sae}=Uy("web-shell:status:v1:");function co({label:e,children:t,gap:n}){return h.jsxs("div",{className:`${tu.row}${n?` ${tu.rowGap}`:""}`,children:[h.jsx("span",{className:tu.label,children:e}),h.jsx("span",{className:tu.value,children:t})]})}function Tae({info:e}){const{t}=at();return h.jsxs("div",{className:tu.panel,children:[h.jsx("div",{className:tu.title,children:t("about.title")}),e.cliVersion&&h.jsx(co,{label:t("about.qwenCode"),children:h.jsx("span",{className:tu.accent,children:e.cliVersion})}),e.runtime&&h.jsx(co,{label:t("about.runtime"),children:e.runtime}),e.platform&&h.jsx(co,{label:t("about.platform"),children:e.platform}),e.auth&&h.jsx(co,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&h.jsx(co,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&h.jsx(co,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&h.jsx(co,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&h.jsx(co,{label:t("about.sessionId"),children:e.sessionId}),h.jsx(co,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),h.jsx(co,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&h.jsx(co,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function j0(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function Cae(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function oL(e,t,n=50){const r=g.useRef(e);g.useEffect(()=>{r.current=e},[e]),g.useEffect(()=>{const s=o=>{o.defaultPrevented||j0(o.target)&&!Cae(o.target)||r.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}const Aae="_panel_1jx2a_1",Eae="_title_1jx2a_13",Mae="_header_1jx2a_18",Nae="_startup_1jx2a_24",Iae="_note_1jx2a_28",Rae="_secondary_1jx2a_29",jae="_row_1jx2a_39",Lae="_selected_1jx2a_48",Dae="_disabled_1jx2a_52",Oae="_pointer_1jx2a_56",Bae="_nameCell_1jx2a_62",Pae="_truncate_1jx2a_69",zae="_separator_1jx2a_75",$ae="_sectionTitle_1jx2a_79",qae="_groupTitle_1jx2a_80",Fae="_success_1jx2a_84",Uae="_warning_1jx2a_88",Hae="_error_1jx2a_92",Vae="_group_1jx2a_80",Wae="_list_1jx2a_102",Gae="_description_1jx2a_108",Kae="_schema_1jx2a_113",Yae="_shortcuts_1jx2a_131",Xae="_detail_1jx2a_137",Qae="_serverFields_1jx2a_143",Jae="_serverField_1jx2a_143",Zae="_serverFieldLabel_1jx2a_156",ele="_detailBlock_1jx2a_160",tle="_parameters_1jx2a_161",nle="_invalidBlock_1jx2a_162",rle="_parameterRow_1jx2a_172",sle="_actionMessage_1jx2a_177",ile="_oauthPage_1jx2a_183",ole="_scrollHint_1jx2a_189",st={panel:Aae,title:Eae,header:Mae,startup:Nae,note:Iae,secondary:Rae,row:jae,selected:Lae,disabled:Dae,pointer:Oae,nameCell:Bae,truncate:Pae,separator:zae,sectionTitle:$ae,groupTitle:qae,success:Fae,warning:Uae,error:Hae,group:Vae,list:Wae,description:Gae,schema:Kae,shortcuts:Yae,detail:Xae,serverFields:Qae,serverField:Jae,serverFieldLabel:Zae,detailBlock:ele,parameters:tle,invalidBlock:nle,parameterRow:rle,actionMessage:sle,oauthPage:ile,scrollHint:ole},sx="web-shell:mcp-panel-active",Lc=10,{parse:ale}=Uy("web-shell:mcp-status:v1:");function lle(e){const t=ale(e);return!t||!t.status?null:t}function gp(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:st.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:st.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:st.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:st.error}}}function aL(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 cle(e){const t=aL(e);return t?JSON.stringify(t,null,2):""}function ule(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function dle(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function hle(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 d4(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 v9(e,t){window.dispatchEvent(new CustomEvent(sx,{detail:{id:e,active:t}}))}function x9(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 yp(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function fle(e,t){return e?t("mcp.required"):""}function mle(e,t){const n=aL(e),r=n==null?void 0:n.properties,s=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object"){const o=cle(e);return o?h.jsx("pre",{className:st.schema,children:o}):null}const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:st.parameters,children:[h.jsx("div",{className:st.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:st.parameterRow,children:`• ${o}${fle(s.has(o),t)}: ${c}${u?` - ${u}`:""}`},o)})]})}function ple({message:e}){var F;const{t}=at(),n=PN({autoLoad:!1}),[r,s]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(null),[c,u]=g.useState(!1),d=g.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,m]=g.useState(!0),[p,y]=g.useState("servers"),[x,b]=g.useState(0),[w,v]=g.useState(0),[_,S]=g.useState(0),C=g.useMemo(()=>r.servers??[],[r.servers]),E=C[x]??null,R=g.useMemo(()=>{var P;return E?((P=i[E.name])==null?void 0:P.tools)??[]:[]},[E,i]),j=R[_]??null,N=g.useMemo(()=>R.length<=Lc||_<Lc-1?0:Math.min(_-Lc+1,R.length-Lc),[_,R.length]),B=g.useMemo(()=>R.slice(N,N+Lc),[R,N]),M=C.filter(P=>!P.disabled&&P.mcpStatus==="connecting").length,$=g.useMemo(()=>{const P=[];for(const A of C){const ne=ule(A,t),be=P.find(he=>he.label===ne);be?be.servers.push(A):P.push({label:ne,servers:[A]})}return P},[C,t]),H=g.useMemo(()=>C.length===0?20:Math.min(Math.max(...C.map(P=>P.name.length))+2,35),[C]),J=g.useMemo(()=>R.length===0?30:Math.min(Math.max(...R.map(P=>P.name.length))+2,50),[R]),O=g.useMemo(()=>{if(!E)return[];const P=[];return!E.disabled&&R.length>0&&P.push({id:"view-tools",label:t("mcp.action.tools")}),!E.disabled&&E.mcpStatus==="disconnected"&&P.push({id:"reconnect",label:t("mcp.action.reconnect")}),P.push({id:E.disabled?"enable":"disable",label:E.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),E.disabled||(P.push({id:"authenticate",label:E.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),E.hasOAuthTokens&&P.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),P},[E,R.length,t]),Y=g.useCallback(async()=>{var A;const P=await n.reload();if(P){s(P);const ne=((A=P.servers)==null?void 0:A.find(be=>be.name===(E==null?void 0:E.name)))??null;if(ne){const be=await n.loadTools(ne.name);o(he=>({...he,[ne.name]:be}))}}},[n,E==null?void 0:E.name]),G=g.useCallback(async P=>{if(!(!E||P.disabled||c)){if(P.id==="view-tools"){y("tools"),S(0),l(null);return}u(!0),P.id==="authenticate"&&y("oauth"),l(P.id==="authenticate"?yp(E.name,t):t("mcp.action.running",{action:P.label}));try{let A=null;if(P.id==="reconnect")await n.restartServer(E.name);else{const ne=await n.manageServer(E.name,P.id),be=[...ne.messages??[],...ne.authUrl?[ne.authUrl]:[]].join(`
`);be&&(A=P.id==="authenticate"?yp(E.name,t,be):be)}await Y(),l(A??t("mcp.action.done",{action:P.label}))}catch(A){l(P.id==="authenticate"?yp(E.name,t,x9(A)):t("mcp.action.failed",{error:x9(A)}))}finally{u(!1)}}},[c,n,Y,E,t]);if(g.useEffect(()=>{const P=d.current;return v9(P,f),()=>v9(P,!1)},[f]),g.useEffect(()=>{const P=A=>{const ne=A.detail;ne!=null&&ne.active&&ne.id&&ne.id!==d.current&&m(!1)};return window.addEventListener(sx,P),()=>window.removeEventListener(sx,P)},[]),oL(P=>{if(f){if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),p==="servers"?m(!1):p==="server"?(y("servers"),v(0),l(null)):p==="oauth"?(y("server"),l(null)):p==="tools"?(y("server"),S(0)):y("tools");return}if(P.key==="ArrowUp"||P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation();const A=P.key==="ArrowUp"?-1:1;p==="servers"?(b(ne=>Math.min(Math.max(ne+A,0),C.length-1)),v(0)):p==="server"?v(ne=>Math.min(Math.max(ne+A,0),O.length-1)):p==="tools"&&S(ne=>Math.min(Math.max(ne+A,0),R.length-1));return}if(P.key==="Enter")if(P.preventDefault(),P.stopPropagation(),p==="servers"&&C.length>0)y("server"),v(0);else if(p==="server"&&O.length>0){const A=O[w];A&&G(A)}else p==="tools"&&R.length>0&&y("tool")}},[f,w,R.length,O,G,C.length,p]),!f)return null;if(C.length===0)return h.jsxs("div",{className:st.panel,"data-keyboard-scope":!0,children:[h.jsxs("div",{className:st.header,children:[h.jsx("div",{className:st.title,children:t("mcp.manageServers")}),h.jsx("div",{className:st.secondary,children:t("mcp.servers",{count:0})})]}),h.jsx("div",{className:st.secondary,children:t("mcp.empty")}),h.jsx("div",{className:st.shortcuts,children:t("mcp.shortcut.close")})]});const ee=p==="servers"?t("mcp.manageServers"):p==="server"?(E==null?void 0:E.name)??t("mcp.manageServers"):p==="oauth"?t("mcp.oauth.title"):p==="tools"?t("mcp.toolsForServer",{name:(E==null?void 0:E.name)??"Server"}):(j==null?void 0:j.name)??t("mcp.toolDetail"),L=p==="servers"?t("mcp.servers",{count:C.length}):p==="server"||p==="oauth"?"":p==="tools"?t(R.length===1?"mcp.toolCount":"mcp.toolsCount",{count:R.length}):(j==null?void 0:j.serverToolName)??(E==null?void 0:E.name)??"";return h.jsxs("div",{className:st.panel,"data-keyboard-scope":!0,children:[M>0&&h.jsxs("div",{children:[h.jsx("div",{className:st.startup,children:t("mcp.starting",{count:M})}),h.jsx("div",{className:st.note,children:t("mcp.startingNote")})]}),h.jsxs("div",{className:st.header,children:[h.jsx("div",{className:st.title,children:ee}),L&&h.jsx("div",{className:st.secondary,children:L})]}),p==="servers"&&h.jsx("div",{className:st.list,children:$.map(P=>{let A=0;for(const ne of $){if(ne===P)break;A+=ne.servers.length}return h.jsxs("div",{className:st.group,children:[h.jsx("div",{className:st.groupTitle,children:P.label}),P.servers.map((ne,be)=>{const he=A+be,ye=he===x,me=gp(ne,t);return h.jsxs("div",{className:ye?`${st.row} ${st.selected}`:st.row,onClick:()=>{b(he),y("server"),v(0)},onMouseEnter:()=>b(he),children:[h.jsx("span",{className:st.pointer,children:ye?"❯":""}),h.jsx("span",{className:st.nameCell,style:{width:`${H}ch`},children:ne.name}),h.jsx("span",{className:st.separator,children:"·"}),h.jsxs("span",{className:me.className,children:[me.icon," ",me.text]})]},ne.name)})]},P.label)})}),p==="server"&&E&&h.jsxs("div",{className:st.detail,children:[h.jsxs("div",{className:st.serverFields,children:[h.jsxs("div",{className:st.serverField,children:[h.jsxs("span",{className:st.serverFieldLabel,children:[t("mcp.status"),":"]}),h.jsxs("span",{className:gp(E,t).className,children:[gp(E,t).icon," ",gp(E,t).text]})]}),h.jsxs("div",{className:st.serverField,children:[h.jsxs("span",{className:st.serverFieldLabel,children:[t("mcp.source"),":"]}),h.jsx("span",{children:dle(E,t)})]}),h.jsxs("div",{className:st.serverField,children:[h.jsxs("span",{className:st.serverFieldLabel,children:[t("mcp.command"),":"]}),h.jsx("span",{className:st.truncate,children:hle(E,t)})]}),((F=E.config)==null?void 0:F.cwd)&&h.jsxs("div",{className:st.serverField,children:[h.jsxs("span",{className:st.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),h.jsx("span",{className:st.truncate,children:E.config.cwd})]}),!E.disabled&&h.jsxs("div",{className:st.serverField,children:[h.jsxs("span",{className:st.serverFieldLabel,children:[t("mcp.tools"),":"]}),h.jsx("span",{children:t(R.length===1?"mcp.toolCount":"mcp.toolsCount",{count:R.length})})]})]}),h.jsx("div",{className:st.list,children:O.map((P,A)=>{const ne=A===w,be=[st.row,ne?st.selected:"",P.disabled?st.disabled:""].filter(Boolean).join(" ");return h.jsxs("div",{className:be,onClick:()=>{v(A),G(P)},children:[h.jsx("span",{className:st.pointer,children:ne?"❯":""}),h.jsx("span",{children:P.label})]},P.id)})}),a&&h.jsx("pre",{className:st.actionMessage,children:a})]}),p==="oauth"&&h.jsx("div",{className:st.oauthPage,children:h.jsx("pre",{className:st.actionMessage,children:a??(E?yp(E.name,t):t("mcp.status.unknown"))})}),p==="tools"&&h.jsx("div",{className:st.list,children:R.length===0?h.jsx("div",{className:st.secondary,children:t("mcp.emptyTools")}):B.map((P,A)=>{const ne=N+A,be=ne===_,he=d4(P,t);return h.jsxs("div",{className:be?`${st.row} ${st.selected}`:st.row,onClick:()=>{S(ne),y("tool")},onMouseEnter:()=>S(ne),children:[h.jsx("span",{className:st.pointer,children:be?"❯":""}),h.jsx("span",{className:st.nameCell,style:{width:`${J}ch`},children:P.name}),P.isValid?he?h.jsx("span",{className:st.secondary,children:he}):null:h.jsx("span",{className:st.warning,children:t("mcp.invalidReason",{reason:P.invalidReason||t("mcp.status.unknown")})})]},P.name)})}),p==="tools"&&R.length>Lc&&h.jsxs("div",{className:st.scrollHint,children:[N>0?"↑ ":"  ",t("mcp.scrollPosition",{current:_+1,total:R.length}),N+Lc<R.length?" ↓":""]}),p==="tool"&&j&&h.jsxs("div",{className:st.detail,children:[!j.isValid&&h.jsxs("div",{className:st.invalidBlock,children:[h.jsx("div",{className:st.sectionTitle,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",j.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:st.secondary,children:t("mcp.invalidToolHelp")})]}),j.description&&h.jsxs("div",{className:st.detailBlock,children:[h.jsx("div",{className:st.sectionTitle,children:t("mcp.description")}),h.jsx("div",{className:st.description,children:j.description.trim()})]}),d4(j,t)&&h.jsxs("div",{className:st.detailBlock,children:[h.jsx("span",{className:st.sectionTitle,children:t("mcp.annotations")})," ",h.jsx("span",{children:d4(j,t)})]}),mle(j,t)]}),h.jsx("div",{className:st.shortcuts,children:t(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function ix(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 gle="_panel_1n5sf_1",yle="_embeddedPanel_1n5sf_12",ble="_title_1n5sf_19",wle="_sectionTitle_1n5sf_24",vle="_overflowHint_1n5sf_28",xle="_header_1n5sf_33",_le="_secondary_1n5sf_39",kle="_row_1n5sf_43",Sle="_selected_1n5sf_51",Tle="_pointer_1n5sf_55",Cle="_nameCell_1n5sf_61",Ale="_status_1n5sf_70",Ele="_chevronCell_1n5sf_76",Mle="_chevron_1n5sf_76",Nle="_chevronExpanded_1n5sf_93",Ile="_separator_1n5sf_103",Rle="_list_1n5sf_107",jle="_task_1n5sf_113",Lle="_taskExpanded_1n5sf_119",Dle="_success_1n5sf_124",Ole="_warning_1n5sf_128",Ble="_error_1n5sf_132",Ple="_detail_1n5sf_136",zle="_detailTop_1n5sf_145",$le="_detailTopMain_1n5sf_152",qle="_inlineDetail_1n5sf_192",Fle="_taskIcon_1n5sf_208",Ule="_detailField_1n5sf_237",Hle="_detailFieldLabel_1n5sf_244",Vle="_detailContent_1n5sf_250",Wle="_compactSummary_1n5sf_257",Gle="_actionBar_1n5sf_266",Kle="_actionHint_1n5sf_275",Yle="_actionButton_1n5sf_280",Xle="_dangerButton_1n5sf_300",Qle="_shortcuts_1n5sf_304",Jle="_confirmHint_1n5sf_310",Zle="_statusBadge_1n5sf_314",ece="_activityCurrent_1n5sf_320",tce="_activityPast_1n5sf_327",nce="_promptContent_1n5sf_334",Ge={panel:gle,embeddedPanel:yle,title:ble,sectionTitle:wle,overflowHint:vle,header:xle,secondary:_le,row:kle,selected:Sle,pointer:Tle,nameCell:Cle,status:Ale,chevronCell:Ele,chevron:Mle,chevronExpanded:Nle,separator:Ile,list:Rle,task:jle,taskExpanded:Lle,success:Dle,warning:Ole,error:Ble,detail:Ple,detailTop:zle,detailTopMain:$le,inlineDetail:qle,taskIcon:Fle,detailField:Ule,detailFieldLabel:Hle,detailContent:Vle,compactSummary:Wle,actionBar:Gle,actionHint:Kle,actionButton:Yle,dangerButton:Xle,shortcuts:Qle,confirmHint:Jle,statusBadge:Zle,activityCurrent:ece,activityPast:tce,promptContent:nce},L0="web-shell:tasks-panel-active",rce=3e3,_9=8,{parse:sce}=Uy("web-shell:tasks-status:v1:");function ice(e){const t=sce(e);return!t||!t.snapshot?null:t}function k9(e,t){window.dispatchEvent(new CustomEvent(L0,{detail:{id:e,active:t}}))}function S9(e){return e.status==="running"||e.status==="paused"}function h4(e){return[...e].sort((t,n)=>{const r=S9(t),s=S9(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function T9(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lL(e){switch(e){case"running":return Ge.success;case"paused":return Ge.warning;case"completed":return Ge.success;case"failed":return Ge.error;case"cancelled":return Ge.warning;default:return""}}function oce(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 ace(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function lce({expanded:e}){return h.jsx("svg",{className:`${Ge.chevron} ${e?Ge.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function cce(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 uce(e,t){if(e.length<=_9)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,_9-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 dce(e,t,n){const r=tl(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"";return s?`${r}(${s})`:r}function cL({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r}){const{t:s}=at(),i=by(),[o,a]=g.useState(()=>h4(e.snapshot.tasks)),[l,c]=g.useState(!0),[u,d]=g.useState("list"),[f,m]=g.useState(0),[p,y]=g.useState(null),[x,b]=g.useState(!1),[w,v]=g.useState(!1),[_,S]=g.useState(null),C=g.useRef(`tasks-${Math.random().toString(36).slice(2)}`),E=g.useRef(!1),R=g.useRef(null),j=o.length===0?0:Math.min(f,o.length-1),N=o[j]??null;g.useEffect(()=>{if(!l)return;const P=setInterval(()=>{E.current||(E.current=!0,i.getTasks().then(A=>{a(h4(A.tasks)),v(!1)}).catch(A=>{console.warn("[web-shell] failed to refresh tasks:",A),v(!0)}).finally(()=>{E.current=!1}))},rce);return()=>clearInterval(P)},[l,i]),g.useEffect(()=>{o.length===0&&f!==0&&m(0),f>=o.length&&o.length>0&&m(o.length-1)},[o.length,f]),g.useEffect(()=>{if(!l||u!=="detail"){R.current=null;return}if(!N){R.current=null,d("list");return}const F=R.current;if(!F||F.taskId!==N.id){R.current={taskId:N.id,status:N.status};return}F.status==="running"&&N.status!=="running"&&(y(null),d("list"))},[l,u,N]),g.useEffect(()=>{if(!n)return;const F=C.current;return k9(F,l),()=>k9(F,!1)},[l,n]),g.useEffect(()=>{if(!n)return;const F=P=>{const A=P.detail;A!=null&&A.active&&A.id&&A.id!==C.current&&c(!1)};return window.addEventListener(L0,F),()=>window.removeEventListener(L0,F)},[n]),g.useEffect(()=>{l||r==null||r()},[l,r]);const B=g.useCallback(async F=>{if(x)return;const P=F.status==="running",A=F.kind==="agent"&&F.status==="paused";if(!P&&!A)return;if(F.kind==="agent"&&!F.isBackgrounded&&p!==F.id){y(F.id);return}y(null),b(!0);try{if(!(await i.cancelTask(F.id,F.kind)).cancelled){S(s("tasks.alreadyStopped"));return}const he=await i.getTasks();a(h4(he.tasks)),S(null)}catch(be){console.warn("[web-shell] failed to cancel task:",be),S(s("tasks.cancelFailed"))}finally{b(!1)}},[i,x,p,s]);if(oL(F=>{if(l){if(F.key==="Escape"){if(F.preventDefault(),F.stopPropagation(),p){y(null);return}u==="detail"?d("list"):c(!1);return}if(F.key==="ArrowLeft"){F.preventDefault(),F.stopPropagation(),u==="detail"?(y(null),d("list")):c(!1);return}if((F.key==="ArrowUp"||F.key==="ArrowDown")&&u==="list"){if(F.preventDefault(),F.stopPropagation(),o.length===0)return;const P=F.key==="ArrowUp"?-1:1;m(A=>Math.min(Math.max(A+P,0),o.length-1)),y(null);return}if(F.key==="Enter"){F.preventDefault(),F.stopPropagation(),u==="list"&&N?d("detail"):u==="detail"&&c(!1);return}if(F.key===" "&&u==="detail"){F.preventDefault(),F.stopPropagation(),c(!1);return}if(F.key==="x"&&!F.ctrlKey&&!F.metaKey){F.preventDefault(),F.stopPropagation(),N&&B(N);return}}},[l,u,o.length,N,B,p]),!l)return null;const M=p!==null&&N!==null&&p===N.id,$=[];M?($.push(s("tasks.confirmStop")),$.push(s("tasks.shortcut.cancelConfirm"))):($.push(s("tasks.shortcut.select")),$.push(s("tasks.shortcut.view")),(N==null?void 0:N.status)==="running"?$.push(s("tasks.shortcut.stop")):(N==null?void 0:N.kind)==="agent"&&(N==null?void 0:N.status)==="paused"&&$.push(s("tasks.shortcut.abandon")),$.push(s("tasks.shortcut.listClose")));const H=[];if(M?(H.push(s("tasks.confirmStop")),H.push(s("tasks.shortcut.cancelConfirm"))):(H.push(s("tasks.shortcut.detailBack")),H.push(s("tasks.shortcut.detailClose")),(N==null?void 0:N.status)==="running"?H.push(s("tasks.shortcut.stop")):(N==null?void 0:N.kind)==="agent"&&(N==null?void 0:N.status)==="paused"&&H.push(s("tasks.shortcut.abandon"))),o.length===0)return h.jsxs("div",{className:t?`${Ge.panel} ${Ge.embeddedPanel}`:Ge.panel,"data-keyboard-scope":!0,children:[(w||_||!t)&&h.jsxs("div",{className:Ge.header,children:[!t&&h.jsx("div",{className:Ge.title,children:s("tasks.title")}),w&&h.jsx("div",{className:Ge.warning,children:s("tasks.refreshStale")}),_&&h.jsx("div",{className:Ge.error,children:_})]}),h.jsx("div",{children:h.jsx("div",{className:Ge.secondary,children:s("tasks.empty")})}),!t&&h.jsx("div",{className:Ge.shortcuts,children:s("tasks.shortcut.close")})]});const{visible:J,windowStart:O,hiddenAbove:Y,hiddenBelow:G}=uce(o,j),ee=t?o:J,L=t?0:O;return h.jsxs("div",{className:t?`${Ge.panel} ${Ge.embeddedPanel}`:Ge.panel,"data-keyboard-scope":!0,children:[(t||u==="list")&&(w||_||!t)&&h.jsxs("div",{className:Ge.header,children:[!t&&h.jsx("div",{className:Ge.title,children:s("tasks.title")}),w&&h.jsx("div",{className:Ge.warning,children:s("tasks.refreshStale")}),_&&h.jsx("div",{className:Ge.error,children:_})]}),(t||u==="list")&&h.jsxs("div",{className:Ge.list,children:[!t&&h.jsxs("div",{className:Ge.sectionTitle,children:[s("tasks.title")," ",h.jsxs("span",{className:Ge.secondary,children:["(",o.length,")"]})]}),!t&&Y>0&&h.jsx("div",{className:Ge.overflowHint,children:s("tasks.moreAbove",{count:Y})}),ee.map((F,P)=>{const A=L+P,ne=A===j,be=lL(F.status),he=oce(F.status,s),ye=t&&ne&&u==="detail",me=t?ye:ne;return h.jsxs("div",{className:`${Ge.task} ${ye?Ge.taskExpanded:""}`,children:[h.jsxs("div",{className:me?`${Ge.row} ${Ge.selected}`:Ge.row,onClick:()=>{m(A),d(t&&ye?"list":"detail")},onMouseEnter:()=>{t||m(A)},children:[h.jsx("span",{className:Ge.pointer,children:me?"❯":""}),t&&h.jsx("span",{className:Ge.taskIcon,"aria-hidden":"true"}),h.jsx("span",{className:Ge.nameCell,children:cce(F)}),h.jsx("span",{className:`${Ge.status} ${be}`,children:he}),h.jsx("span",{className:Ge.chevronCell,children:h.jsx(lce,{expanded:ye})})]}),ye&&h.jsx("div",{className:Ge.inlineDetail,children:h.jsx(C9,{task:F,t:s,hideHeader:!0,busy:x,showCancelConfirm:p===F.id,onCancel:()=>void B(F),onCancelConfirmDismiss:()=>y(null)})})]},F.id)}),!t&&G>0&&h.jsx("div",{className:Ge.overflowHint,children:s("tasks.moreBelow",{count:G})})]}),!t&&u==="detail"&&N&&h.jsxs(h.Fragment,{children:[_&&h.jsx("div",{className:Ge.error,children:_}),h.jsx(C9,{task:N,t:s,busy:x,showCancelConfirm:p===N.id,onCancel:()=>void B(N),onCancelConfirmDismiss:()=>y(null)})]}),!t&&h.jsx("div",{className:M?`${Ge.shortcuts} ${Ge.confirmHint}`:Ge.shortcuts,children:(u==="list"?$:H).join(" · ")})]})}function hce(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 C9({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:o}){var v,_,S;const a=ace(e.status),l=lL(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=[ix(e.runtimeMs)],p=[{label:t("tasks.detail.runtime"),value:ix(e.runtimeMs)}],y=e.kind==="agent"?((v=e.stats)==null?void 0:v.outputTokens)??((_=e.stats)==null?void 0:_.totalTokens):void 0;y&&(m.push(t("tasks.detail.tokens",{count:T9(y)})),p.push({label:t("tasks.detail.tokenCount"),value:T9(y)})),e.kind==="agent"&&((S=e.stats)==null?void 0:S.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 x=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],b=u&&i?h.jsx("div",{className:Ge.actionBar,children:s?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Ge.actionHint,children:t("tasks.action.confirmHint")}),h.jsx("button",{type:"button",className:`${Ge.actionButton} ${Ge.dangerButton}`,disabled:r,onClick:i,children:f}),h.jsx("button",{type:"button",className:Ge.actionButton,onClick:o,children:t("common.cancel")})]}):h.jsx("button",{type:"button",className:`${Ge.actionButton} ${Ge.dangerButton}`,disabled:r,onClick:i,children:d})}):null,w=n?p.length>0?h.jsx("div",{className:Ge.compactSummary,children:p.map(C=>`${C.label} ${C.value}`).join(" · ")}):null:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ge.title,children:hce(e,t)}),h.jsxs("div",{className:Ge.statusBadge,children:[a&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),h.jsx("span",{className:Ge.separator,children:"·"})]}),h.jsx("span",{className:Ge.secondary,children:m.join(" · ")})]})]});return h.jsxs("div",{className:Ge.detail,children:[(w||b)&&h.jsxs("div",{className:Ge.detailTop,children:[w&&h.jsx("div",{className:Ge.detailTopMain,children:w}),b]}),e.kind==="shell"&&h.jsxs(h.Fragment,{children:[h.jsx(sf,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&h.jsx(sf,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&h.jsx(sf,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&h.jsx(sf,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:t("tasks.detail.progress")}),h.jsx("div",{className:Ge.detailContent,children:e.recentActivities.slice(-5).map((C,E,R)=>{const j=E===R.length-1,N=dce(C.name,C.description,t);return h.jsxs("div",{className:j?Ge.activityCurrent:Ge.activityPast,children:[j?"> ":"  ",N]},`${C.at}-${E}`)})})]}),e.kind==="agent"&&e.prompt&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:t("tasks.detail.prompt")}),h.jsx("div",{className:Ge.promptContent,children:x.slice(0,5).map((C,E,R)=>h.jsx("div",{children:E===R.length-1&&x.length>5?`${C}…`:C||" "},E))})]}),e.kind==="agent"&&e.outputFile&&h.jsx(sf,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:`${Ge.detailFieldLabel} ${Ge.error}`,children:t("tasks.detail.resumeBlocked")}),h.jsx("div",{className:Ge.error,children:e.resumeBlockedReason})]}),e.error&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:`${Ge.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?Ge.warning:Ge.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),h.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?Ge.warning:Ge.error,children:e.error})]})]})}function sf({label:e,value:t}){return h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:e}),h.jsx("div",{className:Ge.detailContent,children:t})]})}const fce="_message_fm8gc_1",mce="_body_fm8gc_15",pce="_title_fm8gc_20",gce="_muted_fm8gc_24",yce="_accent_fm8gc_28",bce="_success_fm8gc_32",wce="_error_fm8gc_36",vce="_warning_fm8gc_40",xce="_row_fm8gc_44",_ce="_label_fm8gc_50",kce="_value_fm8gc_55",Qs={message:fce,body:mce,title:pce,muted:gce,accent:yce,success:bce,error:wce,warning:vce,row:xce,label:_ce,value:kce},ox="web-shell-goal-status-active",{serialize:A9,parse:Sce}=Uy(nU),Tce=new Set(["set","achieved","cleared","failed","aborted","checking"]);function T1(e){const t=typeof e=="string"?Sce(e):e;return Cce(t)}function Cce(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!Tce.has(n)||typeof r!="string")return null;const s=f4(t.iterations),i=f4(t.durationMs),o=f4(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:r,...s!==void 0?{iterations:s}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function f4(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Ace(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function Ece(e,t){switch(e.kind){case"checking":return{title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:Qs.muted};case"set":return{title:t("goal.set"),colorClass:Qs.accent};case"achieved":return{title:t("goal.achieved"),colorClass:Qs.success};case"cleared":return{title:t("goal.cleared"),colorClass:Qs.muted};case"failed":return{title:t("goal.failed"),colorClass:Qs.error};case"aborted":return{title:t("goal.aborted"),colorClass:Qs.warning}}}function Mce({status:e,activateFooter:t=!1}){var l;const{t:n}=at();g.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(ox,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const r=Ece(e,n),s=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&s.push(Ace(e.iterations,n)),typeof e.durationMs=="number"&&s.push(ix(e.durationMs)));const i=s.length>0?` · ${s.join(" · ")}`:"",o=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((l=e.lastReason)==null?void 0:l.trim()),a=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return h.jsx("div",{className:Qs.message,children:h.jsxs("div",{className:Qs.body,children:[h.jsxs("div",{className:`${Qs.title} ${r.colorClass}`,children:[r.title,i&&h.jsx("span",{className:Qs.muted,children:i})]}),h.jsxs("div",{className:Qs.row,children:[h.jsxs("span",{className:Qs.label,children:[n("goal.label"),":"]}),h.jsx("span",{className:Qs.value,children:e.condition})]}),o&&h.jsxs("div",{className:Qs.muted,children:[a,": ",o]})]})})}const Nce="_message_u8kmd_1",Ice="_flushMessage_u8kmd_12",Rce="_noMarker_u8kmd_26",jce="_content_u8kmd_30",Lce="_info_u8kmd_49",Dce="_recap_u8kmd_54",Oce="_modelSwitch_u8kmd_67",Bce="_error_u8kmd_71",Pce="_warning_u8kmd_77",zce="_retryHint_u8kmd_83",$ce="_retryButton_u8kmd_90",qce="_cancelled_u8kmd_108",Vs={message:Nce,flushMessage:Ice,noMarker:Rce,content:jce,info:Lce,recap:Dce,modelSwitch:Oce,error:Bce,warning:Pce,retryHint:zce,retryButton:$ce,cancelled:qce},Fce=g.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=at();if(r==="prompt_cancelled")return h.jsx("div",{className:Vs.cancelled,role:"status",children:h.jsx("span",{children:c("turn.stopped")})});const u=n==="info"?_oe(t):null;if(u)return h.jsx("div",{className:Vs.flushMessage,children:h.jsx(Moe,{status:u,onShowDetail:i})});const d=n==="info"?aae(t):null;if(d)return h.jsx("div",{className:Vs.flushMessage,children:h.jsx(pae,{view:d.view,status:d.status})});const f=n==="info"?Sae(t):null;if(f)return h.jsx("div",{className:Vs.flushMessage,children:h.jsx(Tae,{info:f})});const m=n==="info"?lle(t):null;if(m)return h.jsx("div",{className:Vs.flushMessage,children:h.jsx(ple,{message:m})});const p=n==="info"?ice(t):null;if(p)return h.jsx("div",{className:Vs.flushMessage,children:h.jsx(cL,{message:p})});const y=n==="info"?T1(r==="goal"?s:t):null;if(y)return h.jsx("div",{className:Vs.flushMessage,children:h.jsx(Mce,{status:y,activateFooter:o})});const x=n==="info"&&r==="model_switch_summary",b=n==="info"&&r==="recap";return h.jsx("div",{className:`${Vs.message} ${Vs[n]} ${x?Vs.modelSwitch:""} ${b?Vs.recap:""}`,children:h.jsxs("div",{className:Vs.content,children:[x?h.jsx("pre",{children:t}):n==="info"?h.jsx(pm,{content:t}):h.jsx("pre",{children:t}),a&&l&&h.jsx("div",{className:Vs.retryHint,children:h.jsx("button",{type:"button",className:Vs.retryButton,onClick:l,children:c("retry.hint")})})]})})}),Uce="_group_9dxmn_1",Hce="_chatSummaryGroup_9dxmn_14",Vce="_line_9dxmn_22",Wce="_chatSummary_9dxmn_14",Gce="_chatSummaryTextActive_9dxmn_49",Kce="_chatSummaryIcon_9dxmn_55",Yce="_chatSummaryToolIcon_9dxmn_69",Xce="_chatSummaryText_9dxmn_49",Qce="_chatChevronRight_9dxmn_112",Jce="_chatChevronDown_9dxmn_113",Zce="_chatSummaryContentClip_9dxmn_140",eue="_chatSummaryContentCollapsed_9dxmn_148",tue="_chatSummaryContentInner_9dxmn_152",nue="_lineMain_9dxmn_157",rue="_icon_9dxmn_164",sue="_iconError_9dxmn_172",iue="_lineName_9dxmn_176",oue="_lineArg_9dxmn_183",aue="_lineElapsed_9dxmn_193",lue="_lineExpandable_9dxmn_200",cue="_lineOutput_9dxmn_215",uue="_lineFullArg_9dxmn_227",due="_lineDetail_9dxmn_239",hue="_expandedBash_9dxmn_242",fue="_expandedRead_9dxmn_243",mue="_expandedOutput_9dxmn_247",pue="_expandedEdit_9dxmn_260",gue="_expandBtn_9dxmn_274",yue="_todoProgress_9dxmn_293",bue="_todoBody_9dxmn_300",wue="_compactGroup_9dxmn_304",vue="_compactHeader_9dxmn_311",xue="_compactCount_9dxmn_318",_ue="_compactHint_9dxmn_324",Tt={group:Uce,chatSummaryGroup:Hce,line:Vce,chatSummary:Wce,chatSummaryTextActive:Gce,chatSummaryIcon:Kce,chatSummaryToolIcon:Yce,chatSummaryText:Xce,chatChevronRight:Qce,chatChevronDown:Jce,chatSummaryContentClip:Zce,chatSummaryContentCollapsed:eue,chatSummaryContentInner:tue,lineMain:nue,icon:rue,iconError:sue,lineName:iue,lineArg:oue,lineElapsed:aue,lineExpandable:lue,lineOutput:cue,lineFullArg:uue,lineDetail:due,expandedBash:hue,expandedRead:fue,expandedOutput:mue,expandedEdit:pue,expandBtn:gue,todoProgress:yue,todoBody:bue,compactGroup:wue,compactHeader:vue,compactCount:xue,compactHint:_ue};function _u({status:e}){const{t}=at();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return h.jsx("span",{className:`${Tt.icon} ${Tt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function ym(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 uL(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 dL(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 kue="_panel_1k01a_1",Sue="_header_1k01a_12",Tue="_desc_1k01a_24",Cue="_toggle_1k01a_33",Aue="_meta_1k01a_39",Eue="_body_1k01a_45",Mue="_content_1k01a_56",Nue="_stream_1k01a_71",Iue="_streamCollapsed_1k01a_81",Rue="_scrollWindow_1k01a_88",jue="_expandToggle_1k01a_93",Lue="_tabBar_1k01a_108",Due="_tab_1k01a_108",Oue="_tabActive_1k01a_130",Bue="_tools_1k01a_135",Pue="_toolTimeRow_1k01a_152",zue="_toolTimeTip_1k01a_156",Jn={panel:kue,header:Sue,desc:Tue,toggle:Cue,meta:Aue,body:Eue,content:Mue,stream:Nue,streamCollapsed:Iue,scrollWindow:Rue,expandToggle:jue,tabBar:Lue,tab:Due,tabActive:Oue,tools:Bue,toolTimeRow:Pue,toolTimeTip:zue};function hL(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function $ue({timestamp:e,children:t}){return e===void 0?h.jsx(h.Fragment,{children:t}):h.jsxs("div",{className:Jn.toolTimeRow,children:[t,h.jsx("span",{className:Jn.toolTimeTip,"aria-hidden":"true",children:eh(e)})]})}const que=g.memo(function({tool:t}){const n=t.subTools||t.subContent?h.jsx(k5,{tool:t}):h.jsx(cx,{tool:t});return h.jsx($ue,{timestamp:t.startTime,children:n})});function Fue({tc:e}){const{t}=at(),n=e.description||"";return h.jsx("div",{className:Tt.line,children:h.jsxs("div",{className:Tt.lineMain,children:[h.jsx(_u,{status:e.status}),h.jsx("span",{className:Tt.lineName,children:tl(e.name,t)}),n&&h.jsx("span",{className:Tt.lineArg,children:vs(n,70)})]})})}function Uue(e){var t;if(e.rawOutput&&hL(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 Hue({text:e}){const{compactThinking:t}=bc(),{t:n}=at(),[r,s]=g.useState(!1),[i,o]=g.useState(!1),a=g.useRef(null),l=t&&!r;return g.useEffect(()=>{const c=a.current;!c||!l||(o(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,e]),g.useEffect(()=>{const c=a.current;if(!c||!l)return;const u=()=>o(c.scrollHeight>c.clientHeight),d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[l]),h.jsxs("div",{children:[h.jsx("pre",{ref:a,className:l?`${Jn.stream} ${Jn.streamCollapsed}`:Jn.stream,children:e}),t&&(i||r)&&h.jsx("button",{className:Jn.expandToggle,onClick:()=>s(c=>!c),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function Vue({content:e}){const{compactThinking:t}=bc();return h.jsx("div",{className:t?Jn.scrollWindow:void 0,children:h.jsx(pm,{content:e,source:"assistant"})})}function E9({pinTail:e,itemCount:t,children:n}){const{compactThinking:r}=bc(),s=g.useRef(null);return g.useEffect(()=>{const i=s.current;!i||!r||(i.scrollTop=e?i.scrollHeight:0)},[r,e,t]),h.jsx("div",{ref:s,className:r?`${Jn.tools} ${Jn.scrollWindow}`:Jn.tools,children:n})}function k5({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var C,E,R,j;const s=e.status==="completed"||e.status==="failed",i=R0(e),[o,a]=g.useState(t??!1),[l,c]=g.useState("result"),u=hL(e.rawOutput)?e.rawOutput:null,d=((C=e.subTools)==null?void 0:C.length)||((E=u==null?void 0:u.toolCalls)==null?void 0:E.length)||0,f=_5(e),m=x5(e),p=ym(e.startTime,e.endTime)||uL((R=u==null?void 0:u.executionSummary)==null?void 0:R.totalDurationMs),y=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(j=u==null?void 0:u.executionSummary)==null?void 0:j.outputTokens,x=y?v5(y):"",b=s?Uue(e):"",w=g.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),v=!!(e.subContent||b),_=!!(e.subTools&&e.subTools.length>0||w&&w.length>0),S=v&&_;return h.jsxs("div",{className:r?void 0:Jn.panel,children:[!n&&h.jsxs("div",{className:Jn.header,onClick:()=>a(!o),children:[h.jsx(_u,{status:i}),h.jsxs("span",{className:Tt.lineName,children:[m,":"]}),f&&h.jsx("span",{className:Jn.desc,children:vs(f,50)}),s&&d>0&&h.jsxs("span",{className:Jn.meta,children:["· ",d," tools"]}),p&&h.jsxs("span",{className:Jn.meta,children:["· ",p]}),x&&h.jsxs("span",{className:Jn.meta,children:["· ",x]}),!s&&h.jsx("span",{className:Jn.toggle,children:o?"▼":"▶"})]}),(o||n)&&h.jsxs("div",{className:Jn.body,children:[S&&h.jsxs("div",{className:Jn.tabBar,children:[h.jsx("button",{className:`${Jn.tab} ${l==="result"?Jn.tabActive:""}`,onClick:()=>c("result"),children:"Result"}),h.jsxs("button",{className:`${Jn.tab} ${l==="tools"?Jn.tabActive:""}`,onClick:()=>c("tools"),children:["Tools (",d,")"]})]}),(!S||l==="result")&&v&&h.jsx("div",{className:Jn.content,children:s?h.jsx(Vue,{content:e.subContent||b}):e.subContent&&h.jsx(Hue,{text:e.subContent})}),(!S||l==="tools")&&h.jsxs(h.Fragment,{children:[e.subTools&&e.subTools.length>0&&h.jsx(E9,{pinTail:!s,itemCount:e.subTools.length,children:e.subTools.map(N=>h.jsx(que,{tool:N},N.callId))}),w&&w.length>0&&h.jsx(E9,{pinTail:!s,itemCount:w.length,children:w.map(N=>h.jsx(Fue,{tc:N},N.callId))})]})]})]})}const Wue="_view_13muf_1",Gue="_stats_13muf_9",Kue="_statAdd_13muf_18",Yue="_statDel_13muf_22",Xue="_lines_13muf_26",Que="_line_13muf_26",Jue="_lineAdd_13muf_38",Zue="_lineDel_13muf_42",ede="_lineHeader_13muf_46",tde="_lineContext_13muf_52",nde="_lineNo_13muf_56",rde="_marker_13muf_66",sde="_content_13muf_81",Ao={view:Wue,stats:Gue,statAdd:Kue,statDel:Yue,lines:Xue,line:Que,lineAdd:Jue,lineDel:Zue,lineHeader:ede,lineContext:tde,lineNo:nde,marker:rde,content:sde};function ide(e){let t=0,n=0;const r=[];let s=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(s=parseInt(a[1],10),i=parseInt(a[2],10)),r.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,r.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,r.push({type:"del",content:o.slice(1),oldLine:s}),s++):(r.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:s,newLine:i}),s++,i++);return{lines:r,additions:t,deletions:n}}const ode=g.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=ide(t);return h.jsxs("div",{className:Ao.view,children:[h.jsxs("div",{className:Ao.stats,children:[r>0&&h.jsxs("span",{className:Ao.statAdd,children:["+",r]}),s>0&&h.jsxs("span",{className:Ao.statDel,children:["-",s]})]}),h.jsx("div",{className:Ao.lines,children:n.map((i,o)=>h.jsxs("div",{className:`${Ao.line} ${Ao[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[h.jsx("span",{className:Ao.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),h.jsx("span",{className:Ao.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),h.jsx("span",{className:Ao.content,children:i.content})]},o))})]})}),M9={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 ade(e){const t=[];let n,r=!1,s=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let a;for(;(a=o.exec(e))!==null;){a.index>i&&t.push({text:e.slice(i,a.index),color:n,bold:r,dim:s}),i=a.index+a[0].length;const l=a[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,r=!1,s=!1):c===1?r=!0:c===2?s=!0:c===22?(r=!1,s=!1):c>=30&&c<=37||c>=90&&c<=97?n=M9[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function lde(e){return new RegExp(String.raw`\x1b\[`).test(e)}function jh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function m4(e){const t=e.flatMap((n,r)=>{const s=A1(n),i=bp(s,"content");return i?[{id:bp(s,"id")??`plan-${r}`,content:i,status:vde(bp(s,"status")),priority:xde(bp(s,"priority"))}]:[]});return t.length>0?t:void 0}function S5(e){if(!jh(e.toolName)&&e.kind!=="other")return;const t=I9(e.args);if(t)return m4(t);const n=A1(e.rawOutput),r=I9(n);if(r)return m4(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?m4(s):void 0}function cde(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function C1(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const N9={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function ude(e){let t=[],n=null,r=null,s=!1;for(const o of e){if(o.role==="user"){s=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,r=null,s=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const l=S5(a);l&&(t=l,n=o.id,r=a.callId,s=!1)}}if(t.length===0)return N9;const i=!cde(t);return i&&s?N9:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function T5(e){return JSON.stringify([e.id,e.content])}function Hy(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=S5(n);r&&t.push({key:n.callId,todos:r,stats:mde(n)})}return t}return[]}function dde(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of Hy(r)){const o=[];for(const a of i){const l=T5(a),c=n.get(l);a.status==="in_progress"&&c!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&c!=="completed"&&c!==void 0&&o.push({kind:"completed",id:a.id,content:a.content}),n.set(l,a.status)}t.set(s,{events:o})}return t}function hde(e){const t=[];for(const n of e)for(const{key:r,todos:s}of Hy(n))t.push(JSON.stringify([r,s.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function fde(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const r of n.tools)!jh(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 Hy(n))t.push(JSON.stringify([r,n.timestamp,s.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function mde(e){var o;const t=A1((o=A1(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const l=t[a];return typeof l=="number"&&Number.isFinite(l)?l:void 0},r=n("promptTokens"),s=n("cachedTokens"),i=n("candidateTokens");if(!(r===void 0||s===void 0||i===void 0))return{promptTokens:r,cachedTokens:s,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function pde(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools){if(jh(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 gde(e,t,n){let r=0,s=e.length;for(;r<s;){const o=r+s>>>1;e[o].start<t?r=o+1:s=o}let i=0;for(let o=r;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function yde(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 bde(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 wde(e){var a;const t=new Map,n=new Map,r=new Map,s=new Set,i=pde(e),o=l=>{let c=t.get(l);return c||(c={},t.set(l,c)),c};for(const l of e){const c=l.timestamp;for(const{todos:u,stats:d}of Hy(l))for(const f of u){const m=T5(f),p=n.get(m);if(f.status==="in_progress"&&p!=="in_progress")s.has(m)&&(s.delete(m),r.delete(m),t.delete(m)),r.get(m)===void 0&&(r.set(m,d),c!==void 0&&(o(m).startTs=c));else if(f.status==="completed"&&p!=="completed"&&p!==void 0){const y=r.get(m),x=y&&d?yde(y,d):void 0,b=(a=t.get(m))==null?void 0:a.startTs,w=b!==void 0&&c!==void 0?gde(i,b,c):void 0,v=bde(x,w);if(c!==void 0||v){const _=o(m);c!==void 0&&(_.endTs=c),v&&(_.resources=v)}}f.status==="completed"&&s.add(m),n.set(m,f.status)}}return t}function I9(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function vde(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function xde(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function A1(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function bp(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const dg=new Set;let of=null,fL=Date.now();function _de(){fL=Date.now();for(const e of dg)e()}function kde(e){return dg.add(e),of||(of=setInterval(_de,1e3)),()=>{dg.delete(e),dg.size===0&&of&&(clearInterval(of),of=null)}}function C5(e){const[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{if(e)return n(Date.now()),kde(()=>n(fL))},[e]),t}const Sde="_list_1bo8s_1",Tde="_summary_1bo8s_2",Cde="_row_1bo8s_8",Ade="_num_1bo8s_16",Ede="_icon_1bo8s_23",Mde="_text_1bo8s_29",Nde="_inProgress_1bo8s_43",Ide="_completed_1bo8s_48",Rde="_item_1bo8s_62",jde="_rowButton_1bo8s_69",Lde="_detailChevron_1bo8s_82",Dde="_detail_1bo8s_82",Ode="_detailSection_1bo8s_100",Bde="_detailSectionTitle_1bo8s_106",Pde="_detailRows_1bo8s_114",zde="_detailLabel_1bo8s_122",$de="_detailValue_1bo8s_126",qde="_detailDuration_1bo8s_132",Fde="_detailHint_1bo8s_136",cn={list:Sde,summary:Tde,row:Cde,num:Ade,icon:Ede,text:Mde,inProgress:Nde,completed:Ide,item:Rde,rowButton:jde,detailChevron:Lde,detail:Dde,detailSection:Ode,detailSectionTitle:Bde,detailRows:Pde,detailLabel:zde,detailValue:$de,detailDuration:qde,detailHint:Fde};function ax(e){switch(e){case"completed":return cn.completed;case"in_progress":return cn.inProgress;case"pending":return""}}function mL({todos:e,events:t}){const{t:n}=at();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return h.jsx("div",{className:cn.summary,children:h.jsxs("div",{className:`${cn.row} ${cn.completed}`,children:[h.jsx("span",{className:cn.icon,"aria-hidden":"true",children:"✓"}),h.jsx("span",{className:cn.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:cn.summary,children:h.jsxs("div",{className:`${cn.row} ${ax(s.status)}`,children:[h.jsx("span",{className:cn.icon,"aria-hidden":"true",children:C1(s.status)}),h.jsx("span",{className:cn.text,children:s.content})]})}):null}return h.jsx("div",{className:cn.summary,children:t.map(r=>h.jsxs("div",{className:`${cn.row} ${r.kind==="completed"?cn.completed:cn.inProgress}`,children:[h.jsx("span",{className:cn.icon,"aria-hidden":"true",children:C1(r.kind==="completed"?"completed":"in_progress")}),h.jsx("span",{className:cn.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:cn.detailLabel,children:e}),h.jsxs("span",{className:cn.detailValue,children:[t,n]})]})}function p4({title:e,children:t}){return h.jsxs("div",{className:cn.detailSection,children:[h.jsx("div",{className:cn.detailSectionTitle,children:e}),h.jsx("div",{className:cn.detailRows,children:t})]})}function Ude({detail:e}){const{t}=at(),{startTs:n,endTs:r,resources:s}=e,i=n!==void 0||r!==void 0,o=(s==null?void 0:s.inputTokens)!==void 0,a=(s==null?void 0:s.apiTimeMs)!==void 0||(s==null?void 0:s.toolTimeMs)!==void 0;return h.jsxs("div",{className:cn.detail,children:[i&&h.jsxs(p4,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&h.jsx(Dc,{label:t("todo.detail.start"),value:eh(n)}),r!==void 0&&h.jsx(Dc,{label:t("todo.detail.end"),value:eh(r),suffix:n!==void 0?h.jsxs("span",{className:cn.detailDuration,children:[" ","(",Ql(r-n),")"]}):void 0})]}),o&&h.jsxs(p4,{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()})]}),a&&h.jsxs(p4,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&h.jsx(Dc,{label:t("todo.detail.api"),value:Ql(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&h.jsx(Dc,{label:t("todo.detail.tool"),value:Ql(s.toolTimeMs)})]}),!s&&h.jsx("div",{className:cn.detailHint,children:t("todo.detail.noResources")})]})}function Hde(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function pL({todos:e,numbered:t=!1}){const{t:n}=at(),r=g.useContext(aB),[s,i]=g.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsx("div",{className:cn.list,children:e.map((l,c)=>{const u=l.id||String(c),d=r.get(T5(l)),f=Hde(d),m=f&&s.has(u),p=h.jsxs(h.Fragment,{children:[t&&h.jsxs("span",{className:cn.num,style:{minWidth:o},children:[c+1,"."]}),h.jsx("span",{className:cn.icon,"aria-hidden":"true",children:C1(l.status)}),h.jsx("span",{className:cn.text,children:l.content}),f&&h.jsx("span",{className:cn.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return h.jsxs("div",{className:cn.item,children:[f?h.jsx("button",{type:"button",className:`${cn.row} ${cn.rowButton} ${ax(l.status)}`,onClick:y=>{y.stopPropagation(),a(u)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:p}):h.jsx("div",{className:`${cn.row} ${ax(l.status)}`,children:p}),m&&d&&h.jsx(Ude,{detail:d})]},u)})})}const gL=5;function Vde(e){const t=e.toolName.toLowerCase();if(Rh(e.toolName))return!!Ko(e);if(t==="write_file"||t==="writefile")return!!nhe(e)||R9(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(lc(t)){const n=Ko(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(t==="edit"||t==="write"||t==="editfile")return R9(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Ko(e);return!!n&&n.split(`
`).length>3}return!1}function Wde(e){const t=e.toolName.toLowerCase();return lc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||Rh(e.toolName)}function Gde(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!yL(e)}function R9(e){return Gde(e)||!!Ko(e)}function Kde(e){const t=yL(e);if(t)return t;if(e.content){const n=e.content.find(r=>r.type==="diff");if(n&&n.type==="diff")return Qde(n.oldText||"",n.newText||"")}return""}function yL(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(Yde(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function Yde(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const Xde=25e4;function Qde(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>Xde){const u=n.map(f=>f?`-${f}`:"-"),d=r.map(f=>f?`+${f}`:"+");return[...u,...d].join(`
`)}const o=Array.from({length:s+1},()=>Array(i+1).fill(0));for(let u=1;u<=s;u++)for(let d=1;d<=i;d++)o[u][d]=n[u-1]===r[d-1]?o[u-1][d-1]+1:Math.max(o[u-1][d],o[u][d-1]);const a=[];let l=s,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(a.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||o[l][c-1]>=o[l-1][c])?(a.push(`+${r[c-1]}`),c--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const g4=150,j9=25,Jde=60;function Zde(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:gL)||0))}function L9(e,t){return e.length<=t?e:e.slice(0,t)+" …"}function ehe({tool:e,maxLines:t}){const{t:n}=at(),[r,s]=g.useState(!1),i=g.useMemo(()=>Ko(e)||"",[e]),o=g.useMemo(()=>i.split(`
`),[i]),a=t>0&&o.length>t,l=Math.max(0,o.length-t),c=g.useMemo(()=>o.some(m=>m.length>g4),[o]),u=a||c,d=g.useMemo(()=>r?i:a?[`... first ${l} lines hidden ...`,...o.slice(-t).map(m=>L9(m,g4))].join(`
`):o.map(m=>L9(m,g4)).join(`
`),[l,a,o,t,i,r]),f=g.useMemo(()=>lde(d)?ade(d):null,[d]);return h.jsxs("div",{className:Tt.expandedBash,children:[h.jsx("pre",{className:Tt.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:Tt.expandBtn,onClick:()=>s(!r),"aria-expanded":r,children:r?n("tool.showLess"):a?n("tool.showAll",{count:o.length}):n("tool.showFullLines")})]})}function the({tool:e}){const{t}=at(),[n,r]=g.useState(!1),s=g.useMemo(()=>Ko(e)||"",[e]),i=g.useMemo(()=>s.split(`
`),[s]),o=i.length>j9,a=g.useMemo(()=>o&&!n?i.slice(0,j9).join(`
`):s,[s,o,i,n]);return h.jsxs("div",{className:Tt.expandedRead,children:[h.jsx("pre",{className:Tt.expandedOutput,children:a}),o&&h.jsx("button",{className:Tt.expandBtn,onClick:()=>r(!n),"aria-expanded":n,children:n?t("tool.showLess"):t("tool.linesTotal",{count:i.length})})]})}function D9({tool:e}){const t=g.useMemo(()=>Kde(e),[e]),n=g.useMemo(()=>Ko(e)||"",[e]);return!t&&!n?null:h.jsx("div",{className:Tt.expandedEdit,children:t?h.jsx(ode,{diff:t}):h.jsx("pre",{className:Tt.expandedOutput,children:n})})}function nhe(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=Ko(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 rhe({tool:e,todos:t,expanded:n}){var i;const s=((i=g.useContext(c6).get(e.callId))==null?void 0:i.events)??[];return h.jsx("div",{className:Tt.todoBody,children:n?h.jsx(pL,{todos:t}):h.jsx(mL,{todos:t,events:s})})}function she(e,t){var m,p;const n=gm(e.rawOutput),r=w5(e),s=R0(e),i=x5(e),o=ihe(e),a=_5(e),l=((m=e.subTools)==null?void 0:m.length)||((p=n==null?void 0:n.toolCalls)==null?void 0:p.length)||0,c=n==null?void 0:n.executionSummary,u=c&&typeof c.totalDurationMs=="number"?uL(c.totalDurationMs):ym(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),d=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,f=d>0?v5(d):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:u,tokens:f,status:s,reason:r}}function ihe(e){var s;const t=gm(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const r=(s=e.args)==null?void 0:s.subagent_type;return typeof r=="string"&&r.trim()?r.trim():""}function O9(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Rh(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||lc(t))}function ohe({tool:e}){const t=Ko(e)||"";return h.jsx("pre",{className:Tt.expandedOutput,children:t})}function A5(e){const t=e.toolName.toLowerCase();return vy(e)?"agent":lc(t)?"shell":M5(t)?"fetch":jh(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 ahe({description:e,elapsed:t}){return h.jsxs(h.Fragment,{children:[e&&h.jsx("span",{className:Tt.lineArg,children:e}),t&&h.jsx("span",{className:Tt.lineElapsed,children:t})]})}function lx({info:e}){const{renderToolHeaderExtra:t}=bc(),n=t==null?void 0:t(e);return n?h.jsx(h.Fragment,{children:n}):h.jsx(ahe,{description:e.description,elapsed:e.elapsed})}function lhe(e){return e.length>Jde||e.includes(`
`)}function bL(e){return e==="in_progress"||e==="pending"||e==="running"}function E5(e){return e.find(t=>bL(t.status))??e[e.length-1]}function che(e,t,n){if(wL(e)){const r=E5(e);return t("toolGroup.running",{name:tl(r.toolName,t),count:e.length,duration:n??""})}return t("toolGroup.summary",{count:e.length})}function wL(e){return e.some(t=>bL(t.status))}function uhe(){return h.jsxs("svg",{className:Tt.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 vL(){return h.jsxs("svg",{className:Tt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[h.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),h.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),h.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function dhe(){return h.jsxs("svg",{className:Tt.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 hhe(){return h.jsxs("svg",{className:Tt.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 fhe(){return h.jsx("svg",{className:Tt.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 mhe(){return h.jsx("svg",{className:Tt.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 phe({tool:e}){const t=A5(e);return t==="agent"?h.jsx(mhe,{}):t==="edit"||t==="write"?h.jsx(uhe,{}):t==="fetch"?h.jsx(dhe,{}):t==="read"?h.jsx(hhe,{}):t==="todo"?h.jsx(fhe,{}):h.jsx(vL,{})}function M5(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const ghe=R0;function yhe({tools:e,workspaceCwd:t}){const{t:n}=at(),r=E5(e),s=tl(r.toolName,n),i=ghe(r),o=rL(r,t),a=lc(r.toolName)||M5(r.toolName)?"":ym(r.startTime,r.endTime);return h.jsxs("div",{className:Tt.compactGroup,children:[h.jsxs("div",{className:Tt.compactHeader,children:[h.jsx(_u,{status:i}),h.jsx("span",{className:Tt.lineName,children:s}),e.length>1&&h.jsxs("span",{className:Tt.compactCount,children:["× ",e.length]}),h.jsx(lx,{info:{kind:A5(r),tool:r,displayName:s,description:o,elapsed:a,workspaceCwd:t}})]}),h.jsx("div",{className:Tt.compactHint,children:n("compact.hint")})]})}function bhe(e,t){var s,i;if(((s=e.approval)==null?void 0:s.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.shellOutputMaxLines!==t.shellOutputMaxLines||e.summaryOnly!==t.summaryOnly)return!1;const n=e.tool,r=t.tool;return n.callId===r.callId&&n.toolName===r.toolName&&n.status===r.status&&n.startTime===r.startTime&&n.endTime===r.endTime&&n.subContent===r.subContent&&n.rawOutput===r.rawOutput&&n.args===r.args&&n.content===r.content&&n.title===r.title&&whe(n.subTools,r.subTools)}function whe(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 cx=g.memo(function({tool:t,approval:n,workspaceCwd:r,shellOutputMaxLines:s=gL,summaryOnly:i=!1}){const{t:o}=at(),a=g.useContext(Dh),[l,c]=g.useState(()=>!a&&O9(t)),u=g.useRef(!1);g.useEffect(()=>{c(a?!1:O9(t)),u.current=!1},[a,t.callId,t.toolName]);const d=vy(t),f=n&&n.toolCallId===t.callId,m=!f&&(n==null?void 0:n.toolCallId)&&d&&Ga(t,n.toolCallId),p=d&&t.status==="in_progress",y=C5(p);if(g.useEffect(()=>{!d&&t.status==="completed"&&!u.current&&c(!1)},[d,t.status]),d){const $=she(t,y),H=$.explicitAgentType?`${o("agent.label")} (${$.explicitAgentType})`:o("agent.label"),J=t.status==="completed"||t.status==="failed",Y=[t.status==="pending"?"pending":"running",$.elapsed].filter(Boolean).join(" · "),G=[$.subToolCount>0?`${$.subToolCount} tools`:"",$.elapsed,$.tokens,$.reason?vs($.reason,80):""].filter(Boolean).join(" · "),ee=l||!!f||!!m;return h.jsxs("div",{className:Tt.line,children:[h.jsxs("div",{className:`${Tt.lineMain} ${Tt.lineExpandable}`,onClick:()=>c(!l),children:[h.jsx(_u,{status:J?$.status:t.status}),h.jsx("span",{className:Tt.lineName,children:H}),h.jsx(lx,{info:{kind:"agent",tool:t,displayName:H,description:$.description?vs($.description,60):"",elapsed:J?G:Y,workspaceCwd:r}})]}),ee&&h.jsx("div",{className:Tt.lineDetail,children:h.jsx(k5,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0})})]})}const x=rL(t,r),b=Ioe(t),w=tl(t.toolName,o),v=lc(t.toolName)||M5(t.toolName)?"":ym(t.startTime,t.endTime),_=t.toolName.toLowerCase(),S=jh(_),C=S?S5(t):void 0,E=!!C&&C.length>0,R=C?C.filter($=>$.status==="completed").length:0,j=!S&&lhe(x),N=S?E:Vde(t)||j,B=l&&j,M=Wde(t);return h.jsxs("div",{className:Tt.line,children:[h.jsxs("div",{className:`${Tt.lineMain} ${N?Tt.lineExpandable:""}`,title:N?o(l?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":N?l:void 0,role:N?"button":void 0,tabIndex:N?0:void 0,onClick:N?()=>{u.current=!0,c($=>!$)}:void 0,onKeyDown:N?$=>{$.key!=="Enter"&&$.key!==" "||($.preventDefault(),u.current=!0,c(H=>!H))}:void 0,children:[h.jsx(_u,{status:t.status}),h.jsx("span",{className:Tt.lineName,children:w}),S&&E&&h.jsxs("span",{className:Tt.todoProgress,children:[R,"/",C.length]}),h.jsx(lx,{info:{kind:A5(t),tool:t,displayName:w,description:S||B?"":x,elapsed:S?"":v,workspaceCwd:r}})]}),(!i||l)&&S&&E&&h.jsx(rhe,{tool:t,todos:C,expanded:l}),(!i||l)&&S&&!E&&b&&h.jsx("div",{className:Tt.lineOutput,children:b}),B&&h.jsx("div",{className:Tt.lineFullArg,children:x}),!S&&b&&(!l||!M)&&(!i||l)&&h.jsx("div",{className:Tt.lineOutput,children:b}),!S&&l&&M&&h.jsxs("div",{className:Tt.lineDetail,children:[lc(_)&&h.jsx(ehe,{tool:t,maxLines:s}),(_==="write_file"||_==="writefile")&&h.jsx(D9,{tool:t}),(_==="edit"||_==="write"||_==="editfile")&&h.jsx(D9,{tool:t}),(_==="read"||_==="read_file"||_==="readfile")&&h.jsx(the,{tool:t}),Rh(t.toolName)&&h.jsx(ohe,{tool:t})]})]})},bhe),vhe=g.memo(function({tools:t,pendingApproval:n,workspaceCwd:r,shellOutputMaxLines:s}){const{t:i}=at(),o=g.useContext(Dh),[a,l]=g.useState(!1),c=wL(t),u=t.length>0?E5(t):void 0,d=t[0]??u,f=g.useRef(Date.now()),m=C5(c),p=(n==null?void 0:n.toolCallId)&&t.some(b=>Ga(b,n.toolCallId)),y=o&&!p,x=c?dL(m-f.current):void 0;return g.useEffect(()=>{c&&(f.current=Date.now())},[c,u==null?void 0:u.callId]),y?h.jsx(yhe,{tools:t,workspaceCwd:r}):p?h.jsx("div",{className:Tt.group,children:t.map(b=>h.jsx(cx,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s},b.callId))}):h.jsxs("div",{children:[h.jsxs("button",{type:"button",className:Tt.chatSummary,onClick:()=>l(b=>!b),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:Tt.chatSummaryIcon,"aria-hidden":"true",children:d?h.jsx(phe,{tool:d}):h.jsx(vL,{})}),h.jsx("span",{className:c?`${Tt.chatSummaryText} ${Tt.chatSummaryTextActive}`:Tt.chatSummaryText,children:che(t,i,x)}),h.jsx("span",{className:a?Tt.chatChevronDown:Tt.chatChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:a?Tt.chatSummaryContentClip:`${Tt.chatSummaryContentClip} ${Tt.chatSummaryContentCollapsed}`,children:h.jsx("div",{className:Tt.chatSummaryContentInner,children:h.jsx("div",{className:`${Tt.group} ${Tt.chatSummaryGroup}`,children:t.map(b=>h.jsx(cx,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s,summaryOnly:!0},b.callId))})})})]})}),xhe="_message_kwepu_1",_he="_header_kwepu_6",khe="_chevron_kwepu_20",She="_title_kwepu_26",The="_progress_kwepu_35",af={message:xhe,header:_he,chevron:khe,title:She,progress:The};function Che({id:e,todos:t}){var s;const r=((s=g.useContext(c6).get(e))==null?void 0:s.events)??[];return h.jsx(mL,{todos:t,events:r})}const Ahe=g.memo(function({id:t,todos:n}){const{t:r}=at(),[s,i]=g.useState(!1);if(n.length===0)return null;const o=n.length,a=n.filter(l=>l.status==="completed").length;return h.jsxs("div",{className:af.message,children:[h.jsxs("button",{type:"button",className:af.header,onClick:()=>i(l=>!l),"aria-expanded":s,title:r(s?"todo.collapse":"todo.expand"),children:[h.jsx("span",{className:af.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),h.jsx("span",{className:af.title,children:r("plan.title")}),h.jsxs("span",{className:af.progress,children:[a,"/",o]})]}),s?h.jsx(pL,{todos:n,numbered:!0}):h.jsx(Che,{id:t,todos:n})]})}),Ehe="_message_1abcu_1",Mhe="_content_1abcu_11",Nhe="_question_1abcu_17",Ihe="_prefix_1abcu_24",Rhe="_answer_1abcu_28",jhe="_pending_1abcu_32",Lhe="_shortcuts_1abcu_36",Oc={message:Ehe,content:Mhe,question:Nhe,prefix:Ihe,answer:Rhe,pending:jhe,shortcuts:Lhe},xL=g.memo(function({question:t,answer:n,isPending:r}){const{t:s}=at();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(pm,{content:n})})]}),h.jsx("div",{className:Oc.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),Dhe="_message_1q4dw_1",Ohe="_compact_1q4dw_16",Bhe="_header_1q4dw_21",Phe="_status_1q4dw_30",zhe="_name_1q4dw_35",$he="_command_1q4dw_42",qhe="_output_1q4dw_51",Fhe="_compactHint_1q4dw_62",wa={message:Dhe,compact:Ohe,header:Bhe,status:Phe,name:zhe,command:$he,output:qhe,compactHint:Fhe},Uhe=g.memo(function({command:t,output:n}){const r=g.useContext(Dh),{t:s}=at();return h.jsxs("div",{className:r?`${wa.message} ${wa.compact}`:wa.message,children:[h.jsxs("div",{className:wa.header,children:[h.jsx("span",{className:wa.status,children:"✓"}),h.jsx("span",{className:wa.name,children:s("shell.command")}),t&&h.jsx("span",{className:wa.command,children:t})]}),r?h.jsx("div",{className:wa.compactHint,children:s("compact.hint")}):n&&h.jsx("pre",{className:wa.output,children:n})]})}),Hhe="_progress_1j3ys_1",Vhe="_spinner_1j3ys_12",Whe="_bar_1j3ys_19",Ghe="_stage_1j3ys_25",Khe="_icon_1j3ys_29",Yhe="_done_1j3ys_35",Xhe="_error_1j3ys_43",Qhe="_detail_1j3ys_51",Jhe="_path_1j3ys_56",Hr={progress:Hhe,spinner:Vhe,bar:Whe,stage:Ghe,icon:Khe,done:Yhe,error:Xhe,detail:Qhe,path:Jhe},B9=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function Zhe({progress:e}){const{stage:t,progress:n,detail:r,isComplete:s,error:i}=e,[o,a]=g.useState(0),l=30,c=Math.round(n/100*l),u=l-c,d="█".repeat(Math.max(0,c))+"░".repeat(Math.max(0,u));return g.useEffect(()=>{if(s||i)return;const f=setInterval(()=>{a(m=>(m+1)%B9.length)},120);return()=>clearInterval(f)},[s,i]),i?h.jsxs("div",{className:`${Hr.progress} ${Hr.error}`,children:[h.jsx("span",{className:Hr.icon,children:"✕"}),h.jsx("span",{className:Hr.stage,children:t}),h.jsx("div",{className:Hr.detail,children:i})]}):s?h.jsxs("div",{className:`${Hr.progress} ${Hr.done}`,children:[h.jsx("span",{className:Hr.icon,children:"✓"}),h.jsx("span",{className:Hr.stage,children:t})]}):h.jsxs("div",{className:Hr.progress,children:[h.jsx("span",{className:Hr.spinner,children:B9[o]}),h.jsx("span",{className:Hr.bar,children:d}),h.jsxs("span",{className:Hr.stage,children:[t,r?` (${r})`:""]})]})}function efe({path:e}){const{t}=at();return h.jsxs("div",{className:`${Hr.progress} ${Hr.done}`,children:[h.jsx("span",{className:Hr.icon,children:"✓"}),h.jsx("span",{className:Hr.stage,children:t("insight.ready")}),h.jsx("span",{className:Hr.path,children:e})]})}const tfe=g.memo(function({message:t,pendingApproval:n,onShowContextDetail:r,workspaceCwd:s,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:c=!1,showAssistantBranch:u=!1,shellOutputMaxLines:d}){const f=(()=>{switch(t.role){case"user":return h.jsx(Tie,{content:t.content,images:t.images});case"assistant":return h.jsx(Hie,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:u});case"thinking":return h.jsx(Kie,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp});case"tool_group":return h.jsx(vhe,{tools:t.tools,pendingApproval:n,workspaceCwd:s,shellOutputMaxLines:d});case"plan":return h.jsx(Ahe,{id:t.id,todos:t.todos});case"system":return h.jsx(Fce,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:r,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return h.jsx(Uhe,{command:t.command,output:t.output});case"btw":return h.jsx(xL,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return h.jsx(Zhe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return h.jsx(efe,{path:t.path});case"insight_error":return h.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(f===null)return null;const m=h.jsx(WN,{label:`message:${t.role}`,resetKeys:[t],fallback:h.jsx(nfe,{align:t.role==="user"?"end":"start"}),children:f});return t.role==="assistant"?c?m:h.jsx(cv,{timestamp:t.timestamp,children:m}):t.role==="system"&&t.source==="prompt_cancelled"?m:h.jsx(cv,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:"Copy",children:m})},rfe);function nfe({align:e}){const{t}=at();return h.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:h.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function rfe(e,t){var n,r;return((n=e.pendingApproval)==null?void 0:n.id)!==((r=t.pendingApproval)==null?void 0:r.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.shellOutputMaxLines!==t.shellOutputMaxLines?!1:sfe(e.message,t.message)}function sfe(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&&afe(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"&&ife(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>_L(n,t.tools[r]));default:return!1}}function ife(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 _L(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&&gl(e.args)===gl(t.args)&&gl(e.rawOutput)===gl(t.rawOutput)&&gl(e.locations)===gl(t.locations)&&gl(e.content)===gl(t.content)&&ofe(e.subTools,t.subTools):!1}function ofe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>_L(n,t[r]))}const P9=new WeakMap;function afe(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 gl(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=P9.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return P9.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const lfe="_wrap_ftrze_1",cfe="_summary_ftrze_5",ufe="_summaryTextActive_ftrze_28",dfe="_summaryIcon_ftrze_34",hfe="_summaryStatus_ftrze_48",ffe="_summaryToolIcon_ftrze_55",mfe="_summaryText_ftrze_28",pfe="_summaryDot_ftrze_98",gfe="_chevronRight_ftrze_102",yfe="_chevronDown_ftrze_103",bfe="_group_ftrze_129",wfe="_list_ftrze_158",vfe="_row_ftrze_166",xfe="_rowStats_ftrze_180",_fe="_rowDesc_ftrze_188",kfe="_rowTool_ftrze_198",Sfe="_detail_ftrze_202",Ur={wrap:lfe,summary:cfe,summaryTextActive:ufe,summaryIcon:dfe,summaryStatus:hfe,summaryToolIcon:ffe,summaryText:mfe,summaryDot:pfe,chevronRight:gfe,chevronDown:yfe,group:bfe,list:wfe,row:vfe,rowStats:xfe,rowDesc:_fe,rowTool:kfe,detail:Sfe};function Tfe(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 Cfe(e,t){const n=[],r=gm(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?Tfe(s.totalDurationMs):ym(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=r&&typeof r.tokenCount=="number"&&r.tokenCount>0?r.tokenCount:s&&typeof s.outputTokens=="number"&&s.outputTokens>0?s.outputTokens:0;o>0&&n.push(v5(o));const a=w5(e);return a&&n.push(vs(a,80)),n.join(" · ")}function Afe(){return h.jsx("svg",{className:Ur.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 Efe({agents:e,pendingApproval:t}){const{t:n}=at(),[r,s]=g.useState(!1),[i,o]=g.useState(null),[a,l]=g.useState(()=>Date.now()),c=g.useRef(Date.now()),u=e.some(b=>b.status==="in_progress");g.useEffect(()=>{u&&(c.current=Date.now(),l(Date.now()))},[u]),g.useEffect(()=>{if(!u)return;const b=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(b)},[u]);const d=u?dL(a-c.current):"",f=e.filter(b=>b.status==="completed"||b.status==="failed").length,m=e.length,p=t!=null&&t.toolCallId?e.find(b=>Ga(b,t.toolCallId)):void 0,y=r||!!p,x=e.some(b=>R0(b)==="failed")?"failed":u?"in_progress":"completed";return h.jsxs("div",{className:Ur.wrap,children:[h.jsxs("button",{type:"button",className:Ur.summary,onClick:()=>s(b=>!b),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[x==="failed"?h.jsx("span",{className:Ur.summaryStatus,children:h.jsx(_u,{status:x})}):h.jsx("span",{className:Ur.summaryIcon,"aria-hidden":"true",children:h.jsx(Afe,{})}),h.jsxs("span",{className:u?`${Ur.summaryText} ${Ur.summaryTextActive}`:Ur.summaryText,children:[n("parallelAgents.title"),d&&h.jsxs(h.Fragment,{children:[" ",d]}),h.jsx("span",{className:Ur.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:m})]}),h.jsx("span",{className:y?Ur.chevronDown:Ur.chevronRight,"aria-hidden":"true"})]}),y&&h.jsx("div",{className:Ur.group,children:h.jsx("div",{className:Ur.list,children:e.map(b=>{const w=x5(b),v=_5(b),_=Ooe(b,n),S=Cfe(b,a),C=R0(b),E=i===b.callId;return h.jsxs("div",{children:[h.jsxs("div",{className:Ur.row,onClick:()=>o(E?null:b.callId),children:[h.jsx(_u,{status:C}),h.jsxs("span",{className:Ur.rowDesc,children:[vs(v||w,50),_&&h.jsx("span",{className:Ur.rowTool,children:` (${_})`})]}),S&&h.jsx("span",{className:Ur.rowStats,children:S})]}),E&&h.jsx("div",{className:Ur.detail,children:h.jsx(k5,{tool:b,hideHeader:!0})})]},b.callId)})})})]})}const Mfe="_collapseRow_d7f01_1",Nfe="_collapseRowClickable_d7f01_14",Ife="_collapseLabel_d7f01_19",Rfe="_processedLabel_d7f01_36",jfe="_processedMeta_d7f01_43",Lfe="_hiddenMetrics_d7f01_47",Dfe="_summaryMetrics_d7f01_51",Ofe="_collapseIcon_d7f01_59",Bfe="_chevronRight_d7f01_72",Pfe="_chevronDown_d7f01_73",uo={collapseRow:Mfe,collapseRowClickable:Nfe,collapseLabel:Ife,processedLabel:Rfe,processedMeta:jfe,hiddenMetrics:Lfe,summaryMetrics:Dfe,collapseIcon:Ofe,chevronRight:Bfe,chevronDown:Pfe},zfe="_list_1fc07_1",$fe="_rowFlash_1fc07_33",qfe="_turnStatusRow_1fc07_38",Ffe="_turnAnswerRow_1fc07_39",Ufe="_turnContentRow_1fc07_47",Hfe="_turnContentClip_1fc07_51",Vfe="_turnContentCollapsed_1fc07_59",Wfe="_turnContentInner_1fc07_63",Jl={list:zfe,rowFlash:$fe,turnStatusRow:qfe,turnAnswerRow:Ffe,turnContentRow:Ufe,turnContentClip:Hfe,turnContentCollapsed:Vfe,turnContentInner:Wfe};function z9(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="user")return n.id}return null}function $9(e){return e.role==="tool_group"&&e.tools.length===1&&vy(e.tools[0])}function y4(e){return e.role==="tool_group"&&e.tools.length===1&&FN(e.tools[0])}function q9(e){return e.role==="thinking"}function F9(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Ga(n,t.toolCallId)))}function U9(e){return e.role==="thinking"}function Gfe(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||F9(s,t)){U9(s)||n.push(s),r++;continue}const i=[s];let o=r,a=r+1;for(;a<e.length;){const c=e[a];if(U9(c)){a++;continue}if(c.role==="tool_group"&&!F9(c,t)){i.push(c),o=a,a++;continue}break}if(i.length===1){n.push(s),r++;continue}const l=i.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),r=o+1}return n}function Kfe(e){const t=[];let n=0;for(;n<e.length;){if(y4(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(y4(i)){r.push(i),s++;continue}if(q9(i)){let o=s+1;for(;o<e.length&&q9(e[o]);)o++;if(o<e.length&&y4(e[o])){s=o;continue}}break}if(r.length>=2){t.push({type:"parallel_agents",key:`par-${r[0].id}`,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp}),n=s;continue}}if($9(e[n])){const r=n;for(;n<e.length&&$9(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 H9(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 Yfe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function kL(e,t,n){let r=t;for(let s=n;s>t;s--)if(SL(e[s])){r=s;break}for(let s=n;s>r;s--)if(Yfe(e[s]))return s;return-1}function Xfe(e,t){const n=[];for(let s=0;s<e.length;s++){const i=e[s];i.type==="message"&&i.message.role==="user"&&n.push(s)}const r=new Set;for(let s=0;s<n.length;s++){if(s===n.length-1&&t)continue;const i=n[s],o=(s+1<n.length?n[s+1]:e.length)-1,a=kL(e,i,o);if(a<0)continue;const l=e[a];l.type==="message"&&l.message.role==="assistant"&&r.add(l.message.id)}return r}function ux(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=>ux(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return Qfe(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 Qfe(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 SL(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(SL):e.message.role==="tool_group"||e.message.role==="plan"}function V9(e){return e==="pending"||e==="running"||e==="in_progress"}function TL(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const r=TL(e.items[n]);if(r)return r}return null}if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){const n=e.agents.filter(r=>V9(r.status));return n.length===0?null:`agents:${e.key}:${n.map(r=>r.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>V9(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function Jfe(e){for(let t=e.length-1;t>=0;t--){const n=TL(e[t]);if(n)return n}return null}function Zfe(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 e0e(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 t0e(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function CL(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+CL(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function n0e(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 r0e(e,t,n,r){if(!r)return!1;for(let s=t;s<=n;s++){const i=e[s];if(i.type==="parallel_agents"){if(i.agents.some(o=>Ga(o,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Ga(o,r)))return!0}return!1}function s0e(e,{overrides:t,isResponding:n,activeTurnStartedAt:r,pendingApprovalCallId:s,enabled:i}){if(!i||e.length===0)return e;const o=[];for(let l=0;l<e.length;l++){const c=e[l];c.type==="message"&&c.message.role==="user"&&o.push(l)}if(o.length===0)return e;const a=[];for(let l=0;l<o[0];l++)a.push(e[l]);for(let l=0;l<o.length;l++){const c=o[l],u=(l+1<o.length?o[l+1]:e.length)-1,d=e[c],f=d.message.id,m=d.message.timestamp,p=l===o.length-1&&n,y=r0e(e,c,u,s),x=kL(e,c,u);let b=0,w,v,_=0,S=0,C=0,E=0,R=0,j=!1;for(let F=c+1;F<=u;F++){const P=e[F];ux(P,F===x)&&b++,E+=CL(P),P.type==="message"&&P.message.role==="thinking"&&R++;const ne=Zfe(P);ne!==void 0&&(w=w===void 0?ne:Math.max(w,ne));const be=e0e(P);be!==void 0&&(v=v===void 0?be:Math.max(v,be));const he=t0e(P);he&&(_+=he.inputTokens,S+=he.outputTokens,C+=he.cachedTokens??0,j=!0)}const N=p?r??m??Date.now():void 0,B=w??v,M=m!==void 0&&B!==void 0&&B>=m?B-m:void 0;if(y||b===0&&!(j||M!==void 0||N!==void 0)){for(let F=c;F<=u;F++)a.push(e[F]);continue}const J=!(b===0?!0:t.has(f)?t.get(f):p);let O=0;const Y=F=>{F.length!==0&&a.push({type:"turn_content",key:`${f}-content-${O++}`,turnId:f,collapsed:J,items:F})};a.push({type:"message",key:d.key,message:d.message});const G={turnId:f,collapsed:J,hiddenCount:b,...M!==void 0?{elapsedMs:M}:{},...j?{inputTokens:_,outputTokens:S}:{},...C>0?{cachedTokens:C}:{},...E>0?{toolCallCount:E}:{},...R>0?{thinkingCount:R}:{},...N!==void 0?{liveStartedAt:N}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:G}),!J){let F=[];for(let P=c+1;P<=u;P++){const A=e[P];P===x&&A.type==="message"&&A.message.role==="assistant"?(Y(F),F=[],a.push({...A,turnCollapse:G})):F.push(A)}Y(F);continue}const ee=[],L=[];for(let F=c+1;F<=u;F++){const P=e[F];if(!(F===x&&p)){if(F===x&&P.type==="message"&&P.message.role==="assistant"){L.push({...P,turnCollapse:G});continue}if(ux(P,F===x)){ee.push(P);continue}L.push(P)}}Y(ee),a.push(...L)}return a}function hg(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=>Ga(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>Ga(i,n)))return r;if(s.type==="turn_content"&&hg(s.items,t,n)>=0)return r}}return-1}const b4=0,i0e=120,w4=80,o0e=32,a0e=240,AL=200;function l0e(e,t=AL){return e>t}function c0e(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 v4(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function u0e(e){return e!==void 0?c0e(e):""}function d0e(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${v4(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${v4(e.inputTokens)}${r} ↓${v4(e.outputTokens)}`}function W9(e,t){const n=[],r=d0e(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 h0e(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const f0e=g.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=at(),s=t.hiddenCount>0,i=t.liveStartedAt,o=s||i!==void 0||h0e(t),a=C5(i!==void 0&&o),l=g.useRef(0);let c;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),c=l.current):o&&t.elapsedMs!==void 0?(l.current=0,c=t.elapsedMs):(l.current=0,c=void 0);const u=u0e(c),d=W9(t,r),f=W9(t,r),m=r(i!==void 0?"turn.processing":"turn.processed"),p=!!u&&o,y=!!d&&o,x=!!f&&o;if(!o)return null;const b=()=>{if(!s)return;const w=t.collapsed;n(t.turnId,w)};return h.jsxs("div",{className:s?`${uo.collapseRow} ${uo.collapseRowClickable}`:uo.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?b:void 0,onKeyDown:s?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),b())}:void 0,children:[h.jsxs("span",{className:uo.collapseLabel,children:[h.jsxs("span",{className:uo.processedLabel,children:[m,p&&h.jsxs("span",{className:uo.processedMeta,children:[" ",u]})]}),x&&h.jsx("span",{className:uo.summaryMetrics,children:f}),y&&h.jsx("span",{className:uo.hiddenMetrics,children:d})]}),s&&h.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:uo.collapseIcon,onClick:w=>{w.stopPropagation(),b()},children:h.jsx("span",{className:t.collapsed?uo.chevronRight:uo.chevronDown,"aria-hidden":"true"})})]})});function G9(e){if(e.type==="turn_collapse")return Jl.turnStatusRow;if(e.type==="turn_content")return Jl.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Jl.turnAnswerRow}const m0e=g.memo(function({collapsed:t,children:n}){const r=EL(Jl.turnContentClip,t?Jl.turnContentCollapsed:void 0);return h.jsx("div",{className:r,"data-collapsed":t?"true":"false",children:h.jsx("div",{className:Jl.turnContentInner,children:n})})});function EL(...e){return e.filter(Boolean).join(" ")||void 0}const p0e=g.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:r,catchingUp:s,isResponding:i=!1,activeTurnStartedAt:o,welcomeHeader:a,workspaceCwd:l,tailContent:c,tailKey:u="tail",virtualScrollThreshold:d=AL,shellOutputMaxLines:f,autoScrollTailIntoView:m=!1,showRetryHint:p=!1,onRetryClick:y,onBranchSession:x,onFollowStateChange:b},w){const v=g.useContext(Dh),_=g.useMemo(()=>v?Gfe(t,n):t,[v,t,n]),S=g.useMemo(()=>Kfe(_),[_]),C=g.useMemo(()=>{var pe;if(i)return null;for(let Ae=_.length-1;Ae>=0;Ae-=1){const te=_[Ae];if(te&&(te.role==="tool_group"||te.role==="plan"))return null;if((te==null?void 0:te.role)==="assistant"&&!te.isStreaming&&((pe=te.content)!=null&&pe.trim()))return te.id}return null},[i,_]),E=g.useMemo(()=>Xfe(S,i),[S,i]),{collapseCompletedTurns:R}=bc(),j=R??!0,[N,B]=g.useState(()=>new Map),M=g.useRef(!0),$=g.useRef(0),H=g.useRef(!1),J=g.useRef(0),O=g.useRef(!0),Y=g.useRef(null),G=g.useRef(null),ee=g.useRef(s),L=g.useRef(s),F=g.useRef(!1),P=g.useRef(!1),A=g.useRef(void 0),ne=g.useRef(void 0);L.current=s;const be=g.useRef(null),he=g.useCallback(pe=>{M.current=pe,O.current!==pe&&(O.current=pe,b==null||b(pe))},[b]),ye=g.useMemo(()=>s0e(S,{overrides:N,isResponding:i,activeTurnStartedAt:o,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:j}),[S,N,i,o,n==null?void 0:n.toolCallId,j]),me=c!=null,se=!!a,re=se?1:0,oe=re+ye.length,ke=oe+(me?1:0),He=l0e(ke,d),Ve=g.useCallback(()=>be.current,[]),ce=g.useCallback(()=>{const pe=be.current;if(!pe)return;const Ae=pe.scrollHeight-pe.scrollTop-pe.clientHeight;he(Ae<30)},[he]),xe=g.useCallback(()=>{P.current=!0,A.current!==void 0&&window.cancelAnimationFrame(A.current),ne.current!==void 0&&window.clearTimeout(ne.current),A.current=window.requestAnimationFrame(ce),ne.current=window.setTimeout(()=>{P.current=!1,A.current=void 0,ne.current=void 0,ce()},220)},[ce]);g.useEffect(()=>()=>{A.current!==void 0&&window.cancelAnimationFrame(A.current),ne.current!==void 0&&window.clearTimeout(ne.current)},[]);const Me=g.useCallback((pe,Ae)=>{const te=be.current;te&&te.scrollHeight<=te.clientHeight+1?xe():he(!1),B(K=>{const ie=new Map(K);return ie.set(pe,Ae),ie})},[xe,he]),Re=g.useCallback(pe=>{if(se&&pe===b4)return"slot:header";if(me&&pe===oe)return`slot:tail:${u}`;const Ae=ye[pe-re];return Ae?H9(Ae):`slot:row:${pe}`},[se,me,oe,u,ye,re]),ct=g.useCallback((pe="auto")=>{const Ae=Ve();if(!Ae||Ae.scrollHeight<=Ae.clientHeight)return;J.current+=1;const te=J.current;H.current=!0,pe==="smooth"?Ae.scrollTo({top:Ae.scrollHeight,behavior:pe}):Ae.scrollTop=Ae.scrollHeight,$.current=Math.max(0,Ae.scrollHeight-Ae.clientHeight);const K=()=>{J.current===te&&(H.current=!1)};pe==="smooth"?setTimeout(K,350):requestAnimationFrame(K)},[Ve]),Ct=g.useCallback((pe="smooth")=>{he(!0),ct(pe)},[ct,he]),vt=NH({count:ke,enabled:He,getScrollElement:Ve,getItemKey:Re,estimateSize:pe=>{if(se&&pe===b4)return i0e;if(me&&pe===oe)return a0e;const Ae=ye[pe-re];return(Ae==null?void 0:Ae.type)==="turn_collapse"?o0e:(Ae==null?void 0:Ae.type)==="turn_content"?Math.max(w4,Ae.items.length*w4):w4},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Rt=vt.getVirtualItems(),Ke=vt.getTotalSize(),[pt,yt]=g.useState(null);g.useEffect(()=>{if(!pt)return;const pe=setTimeout(()=>yt(null),1600);return()=>clearTimeout(pe)},[pt]);const ae=g.useCallback(pe=>{var K,ie;he(!1),J.current+=1;const Ae=J.current;H.current=!0,He?vt.scrollToIndex(pe,{align:"center"}):(ie=(K=be.current)==null?void 0:K.querySelector(`[data-index="${pe}"]`))==null||ie.scrollIntoView({block:"center"}),setTimeout(()=>{J.current===Ae&&(H.current=!1)},150);const te=Re(pe);yt(null),requestAnimationFrame(()=>yt(te))},[He,vt,Re,he]),V=g.useRef(null),ue=g.useCallback((pe,Ae)=>{const te=hg(ye,pe,Ae);if(te>=0){const fe=ye[te];return(fe==null?void 0:fe.type)==="turn_content"&&fe.collapsed?(V.current={messageId:pe,callId:Ae},B(We=>{if(We.get(fe.turnId)===!0)return We;const Mt=new Map(We);return Mt.set(fe.turnId,!0),Mt}),!0):(V.current=null,ae(te+re),!0)}const K=hg(S,pe,Ae);if(K<0)return!1;const ie=n0e(S,K);return ie?(V.current={messageId:pe,callId:Ae},B(fe=>{if(fe.get(ie)===!0)return fe;const We=new Map(fe);return We.set(ie,!0),We}),!0):!1},[ye,S,re,ae]);g.useImperativeHandle(w,()=>({scrollToMessage:ue,scrollToBottom:Ct}),[ue,Ct]),g.useEffect(()=>{const pe=V.current;if(!pe)return;const Ae=hg(ye,pe.messageId,pe.callId);Ae<0||(V.current=null,ae(Ae+re))},[ye,re,ae]);const Ne=g.useCallback(()=>{const pe=Ve();if(!pe)return;if(H.current){$.current=pe.scrollTop;return}const Ae=$.current,te=pe.scrollTop;$.current=te;const K=pe.scrollHeight-te-pe.clientHeight;if(te<Ae-1){he(K<30);return}K<30&&he(!0)},[Ve,he]);g.useEffect(()=>{const pe=Ve();if(pe)return pe.addEventListener("scroll",Ne,{passive:!0}),()=>pe.removeEventListener("scroll",Ne)},[Ve,Ne]),g.useEffect(()=>{t.length===0&&(he(!0),V.current=null,B(pe=>pe.size?new Map:pe))},[t.length,he]),g.useEffect(()=>{const pe=be.current;if(!pe)return;const Ae=new ResizeObserver(()=>{L.current||M.current&&requestAnimationFrame(()=>{!L.current&&M.current&&ct()})});return Ae.observe(pe),()=>Ae.disconnect()},[ct]),g.useEffect(()=>{const pe=z9(t);if(s){Y.current=pe;return}pe&&pe!==Y.current&&(he(!0),V.current=null),Y.current=pe},[t,s,he]),g.useEffect(()=>{ee.current&&!s&&(he(!0),requestAnimationFrame(()=>ct())),ee.current=s},[s,ct,he]);const ut=g.useMemo(()=>Jfe(ye),[ye]);g.useLayoutEffect(()=>{if(!s){if(!ut){G.current=null;return}ut!==G.current&&(G.current=ut,M.current&&requestAnimationFrame(()=>{M.current&&ct()}))}},[s,ut,ct]),g.useEffect(()=>{m&&me&&!F.current&&(he(!0),requestAnimationFrame(()=>{M.current&&ct()})),F.current=me},[m,me,ct,he]);const ht=g.useCallback(pe=>{const Ae=(ie,fe)=>ie.type==="parallel_agents"?h.jsx(cv,{timestamp:ie.timestamp,children:h.jsx(Efe,{agents:ie.agents,pendingApproval:n})}):ie.type==="turn_collapse"?h.jsx(f0e,{turnCollapse:ie.turnCollapse,onToggleCollapse:Me}):ie.type==="turn_content"?h.jsx(m0e,{collapsed:ie.collapsed,children:ie.items.map(We=>h.jsx("div",{className:G9(We),children:Ae(We,!1)},H9(We)))}):h.jsx(tfe,{message:ie.message,pendingApproval:n,onShowContextDetail:r,workspaceCwd:l,isLatest:fe,showRetryHint:p,onRetryClick:y,onBranchSession:x,showAssistantActions:ie.message.role==="assistant"&&E.has(ie.message.id),showAssistantBranch:ie.message.role==="assistant"&&ie.message.id===C,shellOutputMaxLines:f});if(se&&pe===b4)return a;if(me&&pe===oe)return c;const te=pe-re,K=ye[te];return K?Ae(K,te===ye.length-1):null},[se,a,me,c,oe,n,r,re,ye,E,C,l,p,y,x,f,Me]),ft=g.useCallback((pe,Ae)=>EL(pt===pe?Jl.rowFlash:void 0,Ae?G9(Ae):void 0),[pt]);return g.useLayoutEffect(()=>{if(!s&&!H.current&&!P.current&&M.current){const pe=z9(t),Ae=pe!==null&&pe!==Y.current;ct(Ae?"smooth":"auto")}},[Ke,t,ke,s,ct]),h.jsx("div",{ref:be,className:Jl.list,children:He?h.jsx("div",{style:{height:Ke,width:"100%",position:"relative"},children:Rt.map(pe=>h.jsx("div",{"data-index":pe.index,ref:vt.measureElement,className:ft(String(pe.key),ye[pe.index-re]),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${pe.start}px)`},children:ht(pe.index)},pe.key))}):Array.from({length:ke},(pe,Ae)=>{const te=Re(Ae),K=ye[Ae-re];return h.jsx("div",{"data-index":Ae,className:ft(te,K),children:ht(Ae)},te)})})});/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function g0e(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 y0e(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||!g0e(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 dx=[],ML=[];(()=>{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?ML:dx).push(n=n+e[t])})();function b0e(e){if(e<768)return!1;for(let t=0,n=dx.length;;){let r=t+n>>1;if(e<dx[r])n=r;else if(e>=ML[r])t=r+1;else return!0;if(t==n)return!1}}function K9(e){return e>=127462&&e<=127487}const Y9=8205;function w0e(e,t,n=!0,r=!0){return(n?NL:v0e)(e,t,r)}function NL(e,t,n){if(t==e.length)return t;t&&IL(e.charCodeAt(t))&&RL(e.charCodeAt(t-1))&&t--;let r=x4(e,t);for(t+=X9(r);t<e.length;){let s=x4(e,t);if(r==Y9||s==Y9||n&&b0e(s))t+=X9(s),r=s;else if(K9(s)){let i=0,o=t-2;for(;o>=0&&K9(x4(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function v0e(e,t,n){for(;t>0;){let r=NL(e,t-2,n);if(r<t)return r;t--}return 0}function x4(e,t){let n=e.charCodeAt(t);if(!RL(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return IL(r)?(n-55296<<10)+(r-56320)+65536:n}function IL(e){return e>=56320&&e<57344}function RL(e){return e>=55296&&e<56320}function X9(e){return e<65536?1:2}class hn{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]=ah(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),Bo.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]=ah(this,t,n);let r=[];return this.decompose(t,n,r,0),Bo.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 n0(this),i=new n0(t);for(let o=n,a=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(t=1){return new n0(this,t)}iterRange(t,n=this.length){return new jL(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 LL(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]?hn.empty:t.length<=32?new fr(t):Bo.from(fr.split(t,[]))}}class fr extends hn{constructor(t,n=x0e(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((n?r:a)>=t)return new _0e(s,a,r,o);s=a+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new fr(Q9(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),a=fg(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new fr(a,o.length+i.length));else{let l=a.length>>1;r.push(new fr(a.slice(0,l)),new fr(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof fr))return super.replace(t,n,r);[t,n]=ah(this,t,n);let s=fg(this.text,fg(r.text,Q9(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new fr(s,i):Bo.from(fr.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=ah(this,t,n);let s="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>t&&o&&(s+=r),t<l&&n>i&&(s+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return s}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],s=-1;for(let i of t)r.push(i),s+=i.length+1,r.length==32&&(n.push(new fr(r,s)),r=[],s=-1);return s>-1&&n.push(new fr(r,s)),n}}class Bo extends hn{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=r+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,r,s);s=a+1,r=l+1}}decompose(t,n,r,s){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(t<=l&&n>=o){let c=s&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?r.push(a):a.decompose(t-o,n-o,r,c)}o=l+1}}replace(t,n,r){if([t,n]=ah(this,t,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(t>=i&&n<=a){let l=o.replace(t-i,n-i,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new Bo(u,this.length-(n-t)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
`){[t,n]=ah(this,t,n);let s="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>t&&i&&(s+=r),t<l&&n>o&&(s+=a.sliceString(t-o,n-o,r)),o=l+1}return s}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Bo))return 0;let r=0,[s,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==a)return r;let l=this.children[s],c=t.children[i];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(t,n=t.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let m of t)r+=m.lines;if(r<32){let m=[];for(let p of t)p.flatten(m);return new fr(m,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,c=-1,u=[];function d(m){let p;if(m.lines>i&&m instanceof Bo)for(let y of m.children)d(y);else m.lines>o&&(l>o||!l)?(f(),a.push(m)):m instanceof fr&&l&&(p=u[u.length-1])instanceof fr&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new fr(p.text.concat(m.text),p.length+1+m.length)):(l+m.lines>s&&f(),l+=m.lines,c+=m.length+1,u.push(m))}function f(){l!=0&&(a.push(u.length==1?u[0]:Bo.from(u,c)),c=-1,l=u.length=0)}for(let m of t)d(m);return f(),a.length==1?a[0]:new Bo(a,n)}}hn.empty=new fr([""],0);function x0e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function fg(e,t,n=0,r=1e9){for(let s=0,i=0,o=!0;i<e.length&&s<=r;i++){let a=e[i],l=s+a.length;l>=n&&(l>r&&(a=a.slice(0,r-s)),s<n&&(a=a.slice(n-s)),o?(t[t.length-1]+=a,o=!1):t.push(a)),s=l+1}return t}function Q9(e,t,n){return fg(e,[""],t,n)}class n0{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 fr?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],o=i>>1,a=s instanceof fr?s.text.length:s.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(s instanceof fr){let l=s.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,t))return this.value=t==0?l:n>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=s.children[o+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof fr?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 jL{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new n0(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 LL{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"&&(hn.prototype[Symbol.iterator]=function(){return this.iter()},n0.prototype[Symbol.iterator]=jL.prototype[Symbol.iterator]=LL.prototype[Symbol.iterator]=function(){return this});class _0e{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 ah(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function xs(e,t,n=!0,r=!0){return w0e(e,t,n,r)}function k0e(e){return e>=56320&&e<57344}function S0e(e){return e>=55296&&e<56320}function xl(e,t){let n=e.charCodeAt(t);if(!S0e(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return k0e(r)?(n-55296<<10)+(r-56320)+65536:n}function T0e(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ad(e){return e<65536?1:2}const hx=/\r\n?|\n/;var wi=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(wi||(wi={}));class Yo{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];t+=r<0?this.sections[n]:r}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(t,n=!1){fx(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 Yo(t)}composeDesc(t){return this.empty?t:t.empty?this:DL(this,t)}mapDesc(t,n=!1){return t.empty?this:mx(this,t,n)}mapPos(t,n=-1,r=wi.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>t)return i+(t-s);i+=a}else{if(r!=wi.Simple&&c>=t&&(r==wi.TrackDel&&s<t&&c>t||r==wi.TrackBefore&&s<t||r==wi.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==s||n<0?i:i+l;i+=l}s=c}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return i}touchesRange(t,n=t){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],a=s+i;if(o>=0&&s<=n&&a>=t)return s<t&&a>n?"cover":!0;s=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];t+=(t?" ":"")+r+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Yo(t)}static create(t){return new Yo(t)}}class Br extends Yo{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 fx(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return mx(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],a=n[s+1];if(a>=0){n[s]=a,n[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(hn.empty);r.push(o?t.slice(i,i+o):hn.empty)}i+=o}return new Br(n,r)}compose(t){return this.empty?t:t.empty?this:DL(this,t,!0)}map(t,n=!1){return t.empty?this:mx(this,t,n,!0)}iterChanges(t,n=!1){fx(this,t,n)}get desc(){return Yo.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new D0(this);e:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let u=Math.min(i.len,l-a);gs(s,u,-1);let d=i.ins==-1?-1:i.off==0?i.ins:0;gs(n,u,d),d>0&&Bl(r,n,i.text),i.forward(u),a+=u}let c=t[o++];for(;a<c;){if(i.done)break e;let u=Math.min(i.len,c-a);gs(n,u,-1),gs(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new Br(n,r),filtered:Yo.create(s)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?t.push(r):s==0?t.push([r]):t.push([r].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,r){let s=[],i=[],o=0,a=null;function l(u=!1){if(!u&&!s.length)return;o<n&&gs(s,n-o,-1);let d=new Br(s,i);a=a?a.compose(d.map(a)):d,s=[],i=[],o=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof Br){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:d,to:f=d,insert:m}=u;if(d>f||d<0||f>n)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${n})`);let p=m?typeof m=="string"?hn.of(m.split(r||hx)):m:hn.empty,y=p.length;if(d==f&&y==0)return;d<o&&l(),d>o&&gs(s,d-o,-1),gs(s,f-d,y),Bl(i,s,p),o=f}}return c(t),l(!a),a}static empty(t){return new Br(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<s;)r.push(hn.empty);r[s]=hn.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new Br(n,r)}static createSet(t,n){return new Br(t,n)}}function gs(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 Bl(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(hn.empty);e.push(n)}}function fx(e,t,n){let r=e.inserted;for(let s=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)s+=a,i+=a;else{let c=s,u=i,d=hn.empty;for(;c+=a,u+=l,l&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(s,c,i,u,d),s=c,i=u}}}function mx(e,t,n,r=!1){let s=[],i=r?[]:null,o=new D0(e),a=new D0(t);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);gs(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(gs(s,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(gs(s,0,o.ins),i&&Bl(i,s,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;gs(s,c,l<o.i?o.ins:0),i&&l<o.i&&Bl(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?Br.createSet(s,i):Yo.create(s);throw new Error("Mismatched change set lengths")}}}function DL(e,t,n=!1){let r=[],s=n?[]:null,i=new D0(e),o=new D0(t);for(let a=!1;;){if(i.done&&o.done)return s?Br.createSet(r,s):Yo.create(r);if(i.ins==0)gs(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)gs(r,0,o.ins,a),s&&Bl(s,r,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),c=r.length;if(i.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;gs(r,l,u,a),s&&u&&Bl(s,r,o.text)}else o.ins==-1?(gs(r,i.off?0:i.len,l,a),s&&Bl(s,r,i.textBit(l))):(gs(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&Bl(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),i.forward2(l),o.forward(l)}}}}class D0{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?hn.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?hn.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 nu{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 nu(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Oe.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Oe.range(this.anchor,s,void 0,void 0,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Oe.range(t.anchor,t.head)}static create(t,n,r){return new nu(t,n,r)}}class Oe{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Oe.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(t.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Oe([this.main],0)}addRange(t,n=!0){return Oe.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,Oe.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Oe(t.ranges.map(n=>nu.fromJSON(n)),t.main)}static single(t,n=t){return new Oe([Oe.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<t.length;s++){let i=t[s];if(i.empty?i.from<=r:i.from<r)return Oe.normalized(t.slice(),n);r=i.to}return new Oe(t,n)}static cursor(t,n=0,r,s){return nu.create(t,t,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(t,n,r,s,i){let o=(r??16777215)<<6|(s==null?7:Math.min(6,s));return!i&&t!=n&&(i=n<t?1:-1),n<t?nu.create(n,t,48|o):nu.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let r=t[n];t.sort((s,i)=>s.from-i.from),n=t.indexOf(r);for(let s=1;s<t.length;s++){let i=t[s],o=t[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=n&&n--,t.splice(--s,2,i.anchor>i.head?Oe.range(l,a):Oe.range(a,l))}}return new Oe(t,n)}}function OL(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let N5=0;class Et{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=N5++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new Et(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:I5),!!t.static,t.enables)}of(t){return new mg([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new mg(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new mg(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function I5(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class mg{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=N5++}dynamicSlot(t){var n;let r=this.value,s=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=t[d.id])!==null&&n!==void 0?n:1)&1||u.push(t[d.id]);return{create(d){return d.values[o]=r(d),1},update(d,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||px(d,u)){let m=r(d);if(a?!J9(m,d.values[o],s):!s(m,d.values[o]))return d.values[o]=m,1}return 0},reconfigure:(d,f)=>{let m,p=f.config.address[i];if(p!=null){let y=M1(f,p);if(this.dependencies.every(x=>x instanceof Et?f.facet(x)===d.facet(x):x instanceof ra?f.field(x,!1)==d.field(x,!1):!0)||(a?J9(m=r(d),y,s):s(m=r(d),y)))return d.values[o]=y,0}else m=r(d);return d.values[o]=m,1}}}}function J9(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 px(e,t){let n=!1;for(let r of t)r0(e,r)&1&&(n=!0);return n}function C0e(e,t,n){let r=n.map(l=>e[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let d=M1(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)r0(l,c);return l.values[o]=a(l),1},update(l,c){if(!px(l,i))return 0;let u=a(l);return t.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=px(l,r),d=c.config.facets[t.id],f=c.facet(t);if(d&&!u&&I5(n,d))return l.values[o]=f,0;let m=a(l);return t.compare(m,f)?(l.values[o]=f,0):(l.values[o]=m,1)}}}const wp=Et.define({static:!0});class ra{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 ra(N5++,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(wp).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet(wp),o=s.facet(wp),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,wp.of({field:this,create:t})]}get extension(){return this}}const Xc={lowest:4,low:3,default:2,high:1,highest:0};function lf(e){return t=>new BL(t,e)}const Bu={highest:lf(Xc.highest),high:lf(Xc.high),default:lf(Xc.default),low:lf(Xc.low),lowest:lf(Xc.lowest)};class BL{constructor(t,n){this.inner=t,this.prec=n}}class Pu{of(t){return new gx(this,t)}reconfigure(t){return Pu.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class gx{constructor(t,n){this.compartment=t,this.inner=n}}class E1{constructor(t,n,r,s,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,r){let s=[],i=Object.create(null),o=new Map;for(let f of A0e(t,n,o))f instanceof ra?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of s)a[f.id]=c.length<<1,c.push(m=>f.slot(m));let u=r==null?void 0:r.config.facets;for(let f in i){let m=i[f],p=m[0].facet,y=u&&u[f]||[];if(m.every(x=>x.type==0))if(a[p.id]=l.length<<1|1,I5(y,m))l.push(r.facet(p));else{let x=p.combine(m.map(b=>b.value));l.push(r&&p.compare(x,r.facet(p))?r.facet(p):x)}else{for(let x of m)x.type==0?(a[x.id]=l.length<<1|1,l.push(x.value)):(a[x.id]=c.length<<1,c.push(b=>x.dynamicSlot(b)));a[p.id]=c.length<<1,c.push(x=>C0e(x,p,m))}}let d=c.map(f=>f(a));return new E1(t,o,d,a,l,i)}}function A0e(e,t,n){let r=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof gx&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof gx){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(o.compartment)||o.inner;n.set(o.compartment,c),i(c,a)}else if(o instanceof BL)i(o.inner,o.prec);else if(o instanceof ra)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof mg)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,Xc.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,a)}}return i(e,Xc.default),r.reduce((o,a)=>o.concat(a))}function r0(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 M1(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const PL=Et.define(),yx=Et.define({combine:e=>e.some(t=>t),static:!0}),zL=Et.define({combine:e=>e.length?e[0]:void 0,static:!0}),$L=Et.define(),qL=Et.define(),FL=Et.define(),UL=Et.define({combine:e=>e.length?e[0]:!1});class nl{constructor(t,n){this.type=t,this.value=n}static define(){return new E0e}}class E0e{of(t){return new nl(this,t)}}class M0e{constructor(t){this.map=t}of(t){return new In(this,t)}}class In{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 In(this.type,n)}is(t){return this.type==t}static define(t={}){return new M0e(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}}In.reconfigure=In.define();In.appendConfig=In.define();class zr{constructor(t,n,r,s,i,o){this.startState=t,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&OL(r,n.newLength),i.some(a=>a.type==zr.time)||(this.annotations=i.concat(zr.time.of(Date.now())))}static create(t,n,r,s,i,o){return new zr(t,n,r,s,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(zr.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}zr.time=nl.define();zr.userEvent=nl.define();zr.addToHistory=nl.define();zr.remote=nl.define();function N0e(e,t){let n=[];for(let r=0,s=0;;){let i,o;if(r<e.length&&(s==t.length||t[s]>=e[r]))i=e[r++],o=e[r++];else if(s<t.length)i=t[s++],o=t[s++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function HL(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=Br.empty(t.changes.length),o=e.changes.compose(t.changes)):(s=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(i):(r=e.selection)===null||r===void 0?void 0:r.map(s),effects:In.mapEffects(e.effects,s).concat(In.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function bx(e,t,n){let r=t.selection,s=Bd(t.annotations);return t.userEvent&&(s=s.concat(zr.userEvent.of(t.userEvent))),{changes:t.changes instanceof Br?t.changes:Br.of(t.changes||[],n,e.facet(zL)),selection:r&&(r instanceof Oe?r:Oe.single(r.anchor,r.head)),effects:Bd(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function VL(e,t,n){let r=bx(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;r=HL(r,bx(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=zr.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return R0e(n?I0e(s):s)}function I0e(e){let t=e.startState,n=!0;for(let s of t.facet($L)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:N0e(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=Br.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=zr.create(t,s,e.selection&&e.selection.map(i),In.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(qL);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof zr?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof zr?e=i[0]:e=VL(t,Bd(i),!1)}return e}function R0e(e){let t=e.startState,n=t.facet(FL),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=HL(r,bx(t,i,e.changes.newLength),!0))}return r==e?e:zr.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const j0e=[];function Bd(e){return e==null?j0e:Array.isArray(e)?e:[e]}var ja=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ja||(ja={}));const L0e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let wx;try{wx=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function D0e(e){if(wx)return wx.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||L0e.test(n)))return!0}return!1}function O0e(e){return t=>{if(!/\S/.test(t))return ja.Space;if(D0e(t))return ja.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ja.Word;return ja.Other}}class kn{constructor(t,n,r,s,i,o){this.config=t,this.doc=n,this.selection=r,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)r0(this,a<<1);this.computeSlot=null}field(t,n=!0){let r=this.config.address[t.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return r0(this,r),M1(this,r)}update(...t){return VL(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let a of t.effects)a.is(Pu.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,c)=>s.set(c,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(In.reconfigure)?(n=null,r=a.value):a.is(In.appendConfig)&&(n=null,r=Bd(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=E1.resolve(r,s,this),i=new kn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet(yx)?t.newSelection:t.newSelection.asSingle();new kn(n,t.newDoc,o,i,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:Oe.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=Bd(r.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),u=c.map(s);for(let f=0;f<a;f++)i[f]=i[f].map(u);let d=s.mapDesc(c,!0);i.push(l.range.map(d)),s=s.compose(u),o=In.mapEffects(o,u).concat(In.mapEffects(Bd(l.effects),d))}return{changes:s,selection:Oe.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Br?t:Br.of(t,this.doc.length,this.facet(kn.lineSeparator))}toText(t){return hn.of(t.split(this.facet(kn.lineSeparator)||hx))}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:(r0(this,n),M1(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 ra&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(t[r]),this))}return n}static fromJSON(t,n={},r){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(t,i)){let o=r[i],a=t[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return kn.create({doc:t.doc,selection:Oe.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=E1.resolve(t.extensions||[],new Map),r=t.doc instanceof hn?t.doc:hn.of((t.doc||"").split(n.staticFacet(kn.lineSeparator)||hx)),s=t.selection?t.selection instanceof Oe?t.selection:Oe.single(t.selection.anchor,t.selection.head):Oe.single(0);return OL(s,r.length),n.staticFacet(yx)||(s=s.asSingle()),new kn(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(kn.tabSize)}get lineBreak(){return this.facet(kn.lineSeparator)||`
`}get readOnly(){return this.facet(UL)}phrase(t,...n){for(let r of this.facet(kn.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(PL))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return O0e(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:s}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-r,a=t-r;for(;o>0;){let l=xs(n,o,!1);if(i(n.slice(l,o))!=ja.Word)break;o=l}for(;a<s;){let l=xs(n,a);if(i(n.slice(a,l))!=ja.Word)break;a=l}return o==a?null:Oe.range(o+r,a+r)}}kn.allowMultipleSelections=yx;kn.tabSize=Et.define({combine:e=>e.length?e[0]:4});kn.lineSeparator=zL;kn.readOnly=UL;kn.phrases=Et.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])}});kn.languageData=PL;kn.changeFilter=$L;kn.transactionFilter=qL;kn.transactionExtender=FL;Pu.reconfigure=In.define();function Vy(e,t,n={}){let r={};for(let s of e)for(let i of Object.keys(s)){let o=s[i],a=r[i];if(a===void 0)r[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in t)r[s]===void 0&&(r[s]=t[s]);return r}class cc{eq(t){return this==t}range(t,n=t){return vx.create(t,n,this)}}cc.prototype.startSide=cc.prototype.endSide=0;cc.prototype.point=!1;cc.prototype.mapMode=wi.TrackDel;function R5(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let vx=class WL{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new WL(t,n,r)}};function xx(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class j5{constructor(t,n,r,s){this.from=t,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,s=0){let i=r?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-t||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(t,n,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let r=[],s=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+t,d=this.to[l]+t,f,m;if(u==d){let p=n.mapPos(u,c.startSide,c.mapMode);if(p==null||(f=m=p,c.startSide!=c.endSide&&(m=n.mapPos(u,c.endSide),m<f)))continue}else if(f=n.mapPos(u,c.startSide),m=n.mapPos(d,c.endSide),f>m||f==m&&c.startSide>0&&c.endSide<=0)continue;(m-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,m-f)),r.push(c),s.push(f-o),i.push(m-o))}return{mapped:r.length?new j5(s,i,r,a):null,pos:o}}}class An{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 An(t,n,r,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(xx)),this.isEmpty)return n.length?An.of(n):this;let a=new GL(this,null,-1).goto(0),l=0,c=[],u=new ku;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(vx.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?An.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=t.touchesRange(a,a+l.length);if(c===!1)s=Math.max(s,l.maxPoint),n.push(l),r.push(t.mapPos(a));else if(c===!0){let{mapped:u,pos:d}=l.map(a,t);u&&(s=Math.max(s,u.maxPoint),n.push(u),r.push(d))}}let i=this.nextLayer.map(t);return n.length==0?i:new An(r,n,i||An.empty,s)}between(t,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return O0.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return O0.from(t).goto(n)}static compare(t,n,r,s,i=-1){let o=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),l=Z9(o,a,r),c=new cf(o,l,i),u=new cf(a,l,i);r.iterGaps((d,f,m)=>eT(c,d,u,f,m,s)),r.empty&&r.length==0&&eT(c,0,u,0,0,s)}static eq(t,n,r=0,s){s==null&&(s=999999999);let i=t.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&t.indexOf(u)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=Z9(i,o),l=new cf(i,a,0).goto(r),c=new cf(o,a,0).goto(r);for(;;){if(l.to!=c.to||!_x(l.active,c.active)||l.point&&(!c.point||!R5(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(t,n,r,s,i=-1){let o=new cf(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),d=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);s.point(a,c,o.point,u,d,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(t,n=!1){let r=new ku;for(let s of t instanceof vx?[t]:n?B0e(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return An.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=An.empty;s=s.nextLayer)n=new An(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}An.empty=new An([],[],null,-1);function B0e(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(xx(t,r)>0)return e.slice().sort(xx);t=r}return e}An.empty.nextLayer=An.empty;class ku{finishChunk(t){this.chunks.push(new j5(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 ku)).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(An.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=An.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function Z9(e,t,n){let r=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=r.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&s.add(i.chunk[o])}return s}class GL{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 O0{constructor(t){this.heap=t}static from(t,n=null,r=-1){let s=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new GL(o,n,r,i));return s.length==1?s[0]:new O0(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--)_4(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--)_4(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(),_4(this.heap,0)}}}function _4(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 cf{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=O0.from(t,n,r)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){vp(this.active,t),vp(this.activeTo,t),vp(this.activeRank,t),this.minActive=tT(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++;xp(this.active,n,r),xp(this.activeTo,n,s),xp(this.activeRank,n,i),t&&xp(t,n,this.cursor.from),this.minActive=tT(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&vp(r,s)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<t;s--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function eT(e,t,n,r,s,i){e.goto(t),n.goto(r);let o=r+s,a=r,l=r-t,c=!!i.boundChange;for(let u=!1;;){let d=e.to+l-n.to,f=d||e.endSide-n.endSide,m=f<0?e.to+l:n.to,p=Math.min(m,o);if(e.point||n.point?(e.point&&n.point&&R5(e.point,n.point)&&_x(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,p,e.point,n.point),u=!1):(u&&i.boundChange(a),p>a&&!_x(e.active,n.active)&&i.compareRange(a,p,e.active,n.active),c&&p<o&&(d||e.openEnd(m)!=n.openEnd(m))&&(u=!0)),m>o)break;a=m,f<=0&&e.next(),f>=0&&n.next()}}function _x(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!R5(e[n],t[n]))return!1;return!0}function vp(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function xp(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function tT(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 bm(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=xs(e,s));return r}function P0e(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=xs(e,s)}return e.length}const kx="ͼ",nT=typeof Symbol>"u"?"__"+kx:Symbol.for(kx),Sx=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),rT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class uc{constructor(t,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let u=[],d=/^@(\w+)\b/.exec(o[0]),f=d&&d[1]=="keyframes";if(d&&a==null)return l.push(o[0]+";");for(let m in a){let p=a[m];if(/&/.test(m))i(m.split(/,\s*/).map(y=>o.map(x=>y.replace(/&/,x))).reduce((y,x)=>y.concat(x)),p,l);else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");i(s(m),p,u,f)}else p!=null&&u.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(u.length||f)&&l.push((r&&!d&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in t)i(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=rT[nT]||1;return rT[nT]=t+1,kx+t.toString(36)}static mount(t,n,r){let s=t[Sx],i=r&&r.nonce;s?i&&s.setNonce(i):s=new z0e(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let sT=new Map;class z0e{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=sT.get(r);if(i)return t[Sx]=i;this.sheet=new s.CSSStyleSheet,sT.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[Sx]=this}mount(t,n){let r=this.sheet,s=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=a.rules.length,i++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var dc={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:"'"},B0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$0e=typeof navigator<"u"&&/Mac/.test(navigator.platform),q0e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var is=0;is<10;is++)dc[48+is]=dc[96+is]=String(is);for(var is=1;is<=24;is++)dc[is+111]="F"+is;for(var is=65;is<=90;is++)dc[is]=String.fromCharCode(is+32),B0[is]=String.fromCharCode(is);for(var k4 in dc)B0.hasOwnProperty(k4)||(B0[k4]=dc[k4]);function F0e(e){var t=$0e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||q0e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?B0:dc)[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 Rs=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Tx=typeof document<"u"?document:{documentElement:{style:{}}};const Cx=/Edge\/(\d+)/.exec(Rs.userAgent),KL=/MSIE \d/.test(Rs.userAgent),Ax=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rs.userAgent),Wy=!!(KL||Ax||Cx),iT=!Wy&&/gecko\/(\d+)/i.test(Rs.userAgent),S4=!Wy&&/Chrome\/(\d+)/.exec(Rs.userAgent),oT="webkitFontSmoothing"in Tx.documentElement.style,Ex=!Wy&&/Apple Computer/.test(Rs.vendor),aT=Ex&&(/Mobile\/\w+/.test(Rs.userAgent)||Rs.maxTouchPoints>2);var it={mac:aT||/Mac/.test(Rs.platform),windows:/Win/.test(Rs.platform),linux:/Linux|X11/.test(Rs.platform),ie:Wy,ie_version:KL?Tx.documentMode||6:Ax?+Ax[1]:Cx?+Cx[1]:0,gecko:iT,gecko_version:iT?+(/Firefox\/(\d+)/.exec(Rs.userAgent)||[0,0])[1]:0,chrome:!!S4,chrome_version:S4?+S4[1]:0,ios:aT,android:/Android\b/.test(Rs.userAgent),webkit:oT,webkit_version:oT?+(/\bAppleWebKit\/(\d+)/.exec(Rs.userAgent)||[0,0])[1]:0,safari:Ex,safari_version:Ex?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Rs.userAgent)||[0,0])[1]:0,tabSize:Tx.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function L5(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 N1=Object.create(null);function D5(e,t,n){if(e==t)return!0;e||(e=N1),t||(t=N1);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 U0e(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 lT(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 H0e(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 sa{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 Ps=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Ps||(Ps={}));class sn extends cc{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 wm(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 Su(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,s;if(t.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:o}=YL(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new Su(t,r,s,n,t.widget||null,!0)}static line(t){return new vm(t)}static set(t,n=!1){return An.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}sn.none=An.empty;class wm extends sn{constructor(t){let{start:n,end:r}=YL(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?L5(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||N1}eq(t){return this==t||t instanceof wm&&this.tagName==t.tagName&&D5(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)}}wm.prototype.point=!1;class vm extends sn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof vm&&this.spec.class==t.spec.class&&D5(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)}}vm.prototype.mapMode=wi.TrackBefore;vm.prototype.point=!0;class Su extends sn{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?wi.TrackBefore:wi.TrackAfter:wi.TrackDel}get type(){return this.startSide!=this.endSide?Ps.WidgetRange:this.startSide<=0?Ps.WidgetBefore:Ps.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Su&&V0e(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)}}Su.prototype.point=!0;function YL(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 V0e(e,t){return e==t||!!(e&&t&&e.compare(t))}function Pd(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 P0 extends cc{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof P0&&this.tagName==t.tagName&&D5(this.attributes,t.attributes)}static create(t){return new P0(t.tagName,t.attributes||N1,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return An.of(t,n)}}P0.prototype.startSide=P0.prototype.endSide=-1;function z0(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function Mx(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function s0(e,t){if(!t.anchorNode)return!1;try{return Mx(e,t.anchorNode)}catch{return!1}}function i0(e){return e.nodeType==3?q0(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function o0(e,t,n,r){return n?cT(e,t,n,r,-1)||cT(e,t,n,r,1):!1}function hc(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function I1(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function cT(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:Ka(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=hc(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?Ka(e):0}else return!1}}function Ka(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function $0(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function W0e(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 XL(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 G0e(e,t,n,r,s,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let f,m=u==l.body,p=1,y=1;if(m)f=W0e(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 w=u.getBoundingClientRect();({scaleX:p,scaleY:y}=XL(u,w)),f={left:w.left,right:w.left+u.clientWidth*p,top:w.top,bottom:w.top+u.clientHeight*y}}let x=0,b=0;if(s=="nearest")t.top<f.top+o?(b=t.top-(f.top+o),n>0&&t.bottom>f.bottom+b&&(b=t.bottom-f.bottom+o)):t.bottom>f.bottom-o&&(b=t.bottom-f.bottom+o,n<0&&t.top-b<f.top&&(b=t.top-(f.top+o)));else{let w=t.bottom-t.top,v=f.bottom-f.top;b=(s=="center"&&w<=v?t.top+w/2-v/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-v+o)-f.top}if(r=="nearest"?t.left<f.left+i?(x=t.left-(f.left+i),n>0&&t.right>f.right+x&&(x=t.right-f.right+i)):t.right>f.right-i&&(x=t.right-f.right+i,n<0&&t.left<f.left+x&&(x=t.left-(f.left+i))):x=(r=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:r=="start"==a?t.left-i:t.right-(f.right-f.left)+i)-f.left,x||b)if(m)c.scrollBy(x,b);else{let w=0,v=0;if(b){let _=u.scrollTop;u.scrollTop+=b/y,v=(u.scrollTop-_)*y}if(x){let _=u.scrollLeft;u.scrollLeft+=x/p,w=(u.scrollLeft-_)*p}t={left:t.left-w,top:t.top-v,right:t.right-w,bottom:t.bottom-v},w&&Math.abs(w-x)<1&&(r="nearest"),v&&Math.abs(v-b)<1&&(s="nearest")}if(m)break;(t.top<f.top||t.bottom>f.bottom||t.left<f.left||t.right>f.right)&&(t={left:Math.max(t.left,f.left),right:Math.min(t.right,f.right),top:Math.max(t.top,f.top),bottom:Math.min(t.bottom,f.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function QL(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 K0e{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?Ka(n):0),r,Math.min(t.focusOffset,r?Ka(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Uc=null;it.safari&&it.safari_version>=26&&(Uc=!1);function JL(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 uT;function q0(e,t,n=t){let r=uT||(uT=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function zd(e,t,n,r){let s={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function Y0e(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function X0e(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Ka(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Ka(n))}else{if(n==e)return!0;r=hc(n),n=n.parentNode}}function ZL(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 eD(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=Ka(n)}else if(n.parentNode&&!I1(n))r=hc(n),n=n.parentNode;else return null}}function tD(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&&!I1(n))r=hc(n)+1,n=n.parentNode;else return null}}class po{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new po(t.parentNode,hc(t),n)}static after(t,n){return new po(t.parentNode,hc(t)+1,n)}}var Yn=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Yn||(Yn={}));const Tu=Yn.LTR,O5=Yn.RTL;function nD(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const Q0e=nD("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),J0e=nD("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Nx=Object.create(null),Eo=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Nx[t]=n,Nx[n]=-t}function rD(e){return e<=247?Q0e[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?J0e[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const Z0e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Ho{get dir(){return this.level%2?O5:Tu}constructor(t,n,r){this.from=t,this.to=n,this.level=r}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,r,s){let i=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(i<0||(s!=0?s<0?a.from<n:a.to>n:t[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function sD(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||!sD(r.inner,s.inner))return!1}return!0}const Pn=[];function eme(e,t,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:t,a=i<r.length?r[i].from:n,l=i?256:s;for(let c=o,u=l,d=l;c<a;c++){let f=rD(e.charCodeAt(c));f==512?f=u:f==8&&d==4&&(f=16),Pn[c]=f==4?2:f,f&7&&(d=f),u=f}for(let c=o,u=l,d=l;c<a;c++){let f=Pn[c];if(f==128)c<a-1&&u==Pn[c+1]&&u&24?f=Pn[c]=u:Pn[c]=256;else if(f==64){let m=c+1;for(;m<a&&Pn[m]==64;)m++;let p=c&&u==8||m<n&&Pn[m]==8?d==1?1:8:256;for(let y=c;y<m;y++)Pn[y]=p;c=m-1}else f==8&&d==1&&(Pn[c]=1);u=f,f&7&&(d=f)}}}function tme(e,t,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let d=c,f,m,p;d<u;d++)if(m=Nx[f=e.charCodeAt(d)])if(m<0){for(let y=a-3;y>=0;y-=3)if(Eo[y+1]==-m){let x=Eo[y+2],b=x&2?s:x&4?x&1?i:s:0;b&&(Pn[d]=Pn[Eo[y]]=b),a=y;break}}else{if(Eo.length==189)break;Eo[a++]=d,Eo[a++]=f,Eo[a++]=l}else if((p=Pn[d])==2||p==1){let y=p==s;l=y?0:1;for(let x=a-3;x>=0;x-=3){let b=Eo[x+2];if(b&2)break;if(y)Eo[x+2]|=2;else{if(b&4)break;Eo[x+2]|=4}}}}}function nme(e,t,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t;for(let l=o;l<a;){let c=Pn[l];if(c==256){let u=l+1;for(;;)if(u==a){if(s==n.length)break;u=n[s++].to,a=s<n.length?n[s].from:t}else if(Pn[u]==256)u++;else break;let d=i==1,f=(u<t?Pn[u]:r)==1,m=d==f?d?1:2:r;for(let p=u,y=s,x=y?n[y-1].to:e;p>l;)p==x&&(p=n[--y].from,x=y?n[y-1].to:e),Pn[--p]=m;l=u}else i=c,l++}}}function Ix(e,t,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=t,c=0;l<n;){let u=!0,d=!1;if(c==i.length||l<i[c].from){let y=Pn[l];y!=a&&(u=!1,d=y==16)}let f=!u&&a==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c<i.length&&p==i[c].from){if(d)break e;let y=i[c];if(!u)for(let x=y.to,b=c+1;;){if(x==n)break e;if(b<i.length&&i[b].from==x)x=i[b++].to;else{if(Pn[x]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new Ho(l,y.from,m));let x=y.direction==Tu!=!(m%2);Rx(e,x?r+1:r,s,y.inner,y.from,y.to,o),l=y.to}p=y.to}else{if(p==n||(u?Pn[p]!=a:Pn[p]==a))break;p++}f?Ix(e,l,p,r+1,s,f,o):l<p&&o.push(new Ho(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=Pn[l-1];y!=a&&(u=!1,d=y==16)}let f=!u&&a==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c&&p==i[c-1].to){if(d)break e;let y=i[--c];if(!u)for(let x=y.from,b=c;;){if(x==t)break e;if(b&&i[b-1].to==x)x=i[--b].from;else{if(Pn[x-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new Ho(y.to,l,m));let x=y.direction==Tu!=!(m%2);Rx(e,x?r+1:r,s,y.inner,y.from,y.to,o),l=y.from}p=y.from}else{if(p==t||(u?Pn[p-1]!=a:Pn[p-1]==a))break;p--}f?Ix(e,p,l,r+1,s,f,o):p<l&&o.push(new Ho(p,l,m)),l=p}}function Rx(e,t,n,r,s,i,o){let a=t%2?2:1;eme(e,s,i,r,a),tme(e,s,i,r,a),nme(s,i,r,a),Ix(e,s,i,t,n,r,o)}function rme(e,t,n){if(!e)return[new Ho(0,0,t==O5?1:0)];if(t==Tu&&!n.length&&!Z0e.test(e))return iD(e.length);if(n.length)for(;e.length>Pn.length;)Pn[Pn.length]=256;let r=[],s=t==Tu?0:1;return Rx(e,s,s,n,0,e.length,r),r}function iD(e){return[new Ho(0,e,0)]}let oD="";function sme(e,t,n,r,s){var i;let o=r.head-e.from,a=Ho.find(t,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=t[a],c=l.side(s,n);if(o==c){let f=a+=s?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],o=l.side(!s,n),c=l.side(s,n)}let u=xs(e.text,o,l.forward(s,n));(u<l.from||u>l.to)&&(u=c),oD=e.text.slice(Math.min(o,u),Math.max(o,u));let d=a==(s?t.length-1:0)?null:t[a+(s?1:-1)];return d&&u==c&&d.level+(s?0:1)<l.level?Oe.cursor(d.side(!s,n)+e.from,d.forward(s,n)?1:-1,d.level):Oe.cursor(u+e.from,l.forward(s,n)?-1:1,l.level)}function ime(e,t,n){for(let r=t;r<n;r++){let s=rD(e.charCodeAt(r));if(s==1)return Tu;if(s==2||s==4)return O5}return Tu}const aD=Et.define(),lD=Et.define(),cD=Et.define(),uD=Et.define(),jx=Et.define(),dD=Et.define(),hD=Et.define(),B5=Et.define(),P5=Et.define(),fD=Et.define({combine:e=>e.some(t=>t)}),mD=Et.define({combine:e=>e.some(t=>t)}),pD=Et.define();class $d{constructor(t,n,r,s,i,o=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new $d(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 $d(Oe.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const _p=In.define({map:(e,t)=>e.map(t)}),gD=In.define();function xi(e,t,n){let r=e.facet(uD);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 Ca=Et.define({combine:e=>e.length?e[0]:!0});let ome=0;const kd=Et.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 ii{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(kd.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(kd.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new ii(ome++,t,r,s,a=>{let l=[];return o&&l.push(Gy.of(c=>{let u=c.plugin(a);return u?o(u):sn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return ii.define((r,s)=>new t(r,s),n)}}class T4{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(xi(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){xi(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){xi(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const yD=Et.define(),z5=Et.define(),Gy=Et.define(),bD=Et.define(),$5=Et.define(),xm=Et.define(),wD=Et.define();function dT(e,t){let n=e.state.facet(wD);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return An.spans(r,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,u=o-t.from,d=s;for(let f=a.length-1;f>=0;f--,l--){let m=a[f].spec.bidiIsolate,p;if(m==null&&(m=ime(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 vD=Et.define();function q5(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(vD)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:r,bottom:s}}const Tf=Et.define();class Ki{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new Ki(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let s=t[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),t.splice(n-1,1)}}return t.splice(n,0,r),t}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let s=0,i=0,o=0;;){let a=s<t.length?t[s].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,d=c,f=u;for(;;)if(i<n.length&&n[i]<=d){let m=n[i+1];i+=2,d=Math.max(d,m);for(let p=s;p<t.length&&t[p].fromB<=d;p++)o=t[p].toA-t[p].toB;f=Math.max(f,m+o)}else if(s<t.length&&t[s].fromB<=d){let m=t[s++];d=Math.max(d,m.toB),f=Math.max(f,m.toA),o=m.toA-m.toB}else break;r.push(new Ki(u,f,c,d))}return r}}class R1{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=Br.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new Ki(i,o,a,l))),this.changedRanges=s}static create(t,n,r){return new R1(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 ame=[];class cr{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 ame}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&&U0e(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=hc(this.dom),s=this.length?t>0:n>0;return new po(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 Yy)return t;return null}static get(t){return t.cmTile}}class Ky extends cr{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,r=null,s,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,s=r?r.nextSibling:n.firstChild,i&&s!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;s&&s!=a.dom;)s=hT(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=hT(s);this.length=o}}function hT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Yy extends Ky{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=cr.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,s=0,i=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&i++,s=n.pop()}else{let o=r.children[s++];if(o instanceof za)n.push(s),r=o,s=0;else{let a=i+o.length,l=t(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(t,n){let r,s=-1,i,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(t>=l&&t<=c){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<t||t==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=t-l),(c>t||t==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-l)}}),!r&&!i)throw new Error("No tile at position "+t);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:o}}}class za extends Ky{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 za(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class lh extends Ky{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new lh(n||document.createElement("div"),t);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,n,r){let s=null,i=-1,o=null,a=-1;function l(u,d){for(let f=0,m=0;f<u.children.length&&m<=d;f++){let p=u.children[f],y=m+p.length;y>=d&&(p.isComposite()?l(p,d-m):(!o||o.isHidden&&(n>0||r&&cme(o,p)))&&(y>d||p.flags&32)?(o=p,a=d-m):(m<d||p.flags&16&&!p.isHidden)&&(s=p,i=d-m)),m=y}}l(this,t);let c=(n<0?s:o)||s||o;return c?{tile:c,offset:c==s?i:a}:null}coordsIn(t,n){let r=this.resolveInline(t,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):lme(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 po(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new po(l.dom,0);l==r.tile&&(a=!0)}}return new po(this.dom,0)}}function lme(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=i0(t);return n[n.length-1]||null}function cme(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class ei extends Ky{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new ei(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class ru extends cr{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let r=this.dom.nodeValue.length;t>r&&(t=r);let s=t,i=t,o=0;t==0&&n<0||t==r&&n>=0?it.chrome||it.gecko||(t?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=q0(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return it.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?$0(l,o<0):l||null}static of(t,n){let r=new ru(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Cu extends cr{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 $0(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:t>0;for(let l=a?i.length-1:0;o=i[l],!(t>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return $0(o,!a)}}get overrideDOMText(){if(!this.length)return hn.empty;let{root:t}=this;if(!t)return hn.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 Cu(i,r,t,s)}}class j1 extends cr{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 hn.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class ume{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:s,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(s.isComposite())if(o){if(!t)break;r&&r.break(),t--,o=!1}else if(i==s.children.length){if(!t&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++}else{let l=s.children[i],c=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,t-=l.length):(a.push({tile:s,index:i}),s=l,i=0,r&&l.isComposite()&&r.enter(l))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++;else if(t){let l=Math.min(t,s.length-i);r&&r.skip(s,i,i+l),t-=l,i+=l}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class dme{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class hme{constructor(t,n,r){this.cache=t,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,r,s){var i;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+t.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new ru(a.dom,a.text+t);l.parent=o}else o.append(s||ru.of(t,(i=this.cache.find(ru))===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)?C4(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=s.lastChild;if(c instanceof ei&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(C4(l.dom)),s=c;else{if(this.cache.reused.get(l)){let d=cr.get(l.dom);d&&d.setDOM(C4(l.dom))}let u=ei.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=cr.get(t.text);i&&this.cache.reused.set(i,2);let o=new ru(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,s.append(o)}addInlineWidget(t,n,r){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let i=this.ensureMarks(n,r);!s&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var r;t||(t=xD);let s=lh.start(t,n||((r=this.cache.find(lh))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var r;let s=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=s.lastChild)&&a instanceof ei&&a.mark.eq(o))s=a,n--;else{let l=ei.of(o,(r=this.cache.find(ei,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!fT(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(it.ios&&fT(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(A4,0,32)||new Cu(A4.toDOM(),0,A4,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 dme(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 za&&s.wrapper.eq(r.wrapper))n=s;else{let i=za.of(r.wrapper,(t=this.cache.find(za,o=>o.wrapper.eq(r.wrapper)))===null||t===void 0?void 0:t.dom);n.append(i),n=i}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),r=this.cache.find(j1,void 0,1);return r&&(r.flags=n),r||new j1(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class fme{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(t,s.length);return i?null:s.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const L1=[Cu,lh,ru,ei,j1,za,Yy];for(let e=0;e<L1.length;e++)L1[e].bucket=e;class mme{constructor(t){this.view=t,this.buckets=L1.map(()=>[]),this.index=L1.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let s=t.bucket,i=this.buckets[s],o=this.index[s];for(let a=i.length-1;a>=0;a--){let l=(a+o)%i.length,c=i[l];if((!n||n(c))&&!this.reused.has(c))return i.splice(l,1),l<o&&this.index[s]--,this.reused.set(c,r),c}return null}findWidget(t,n,r){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let a=s[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(t):a.widget.constructor==t.constructor&&t.updateDOM(a.dom,this.view,a.widget)))return s.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new Cu(a.dom,n,t,a.flags&-498|r))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class pme{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new mme(t),this.text=new fme(t.state.doc),this.builder=new hme(this.cache,new Yy(t,t.contentDOM),An.iter(r)),this.cache.reused.set(n,2),this.old=new ume(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!o,!a),s=l,i+=c}if(!a)break;n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.forward(a.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(i,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,a.toA),this.emit(n.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(i,a.toB)),i=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,r){let s=bme(this.old),i=this.openMarks;this.old.advance(t,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?Cu.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof j1)this.cache.add(o);else if(o instanceof ei)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ei&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof ei&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,s=this.builder,i=0,o=An.spans(this.decorations,t,n,{point:(a,l,c,u,d,f)=>{if(c instanceof Su){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=u.length,d>u.length)s.continueWidget(l-a);else{let m=c.widget||(c.block?ch.block:ch.inline),p=gme(c),y=this.cache.findWidget(m,l-a,p)||Cu.of(m,this.view,l-a,p);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(y)):(s.ensureLine(r),s.addInlineWidget(y,u,d))}r=null}else r=yme(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let d=a;d<l;){let f=this.text.next(Math.min(512,l-d));f==null?(s.addLineStartIfNotCovered(r),s.addBreak(),d++):(s.ensureLine(r),s.addText(f,c,d==a?u:c.length),d+=f.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>i,this.openMarks=o}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let s=t.parentNode;;s=s.parentNode){let i=cr.get(s);if(s==this.view.contentDOM)break;i instanceof ei?n.push(i):i!=null&&i.isLine()?r=i:i instanceof za||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new lh(s,xD):r||n.push(ei.of(new wm({tagName:s.nodeName.toLowerCase(),attributes:H0e(s)}),s)))}return{line:r,marks:n}}}function fT(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 gme(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 xD={class:"cm-line"};function yme(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&L5(n,e),r&&(e.class+=" "+r)),e}function bme(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 ei&&t.push(r.mark)}return t}function C4(e){let t=cr.get(e);return t&&t.setDOM(e.cloneNode()),e}class ch extends sa{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}}ch.inline=new ch("span");ch.block=new ch("div");const A4=new class extends sa{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class mT{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=sn.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 Yy(t,t.contentDOM),this.updateInner([new Ki(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:!Ame(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?vme(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new Ki(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,(it.ie||it.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=kme(o,this.decorations,t.changes);l.length&&(r=Ki.extendWithRanges(r,l));let c=Tme(a,this.blockWrappers,t.changes);return c.length&&(r=Ki.extendWithRanges(r,c)),i&&!r.some(u=>u.fromA<=i.range.fromA&&u.toA>=i.range.toA)&&(r=i.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let o=this.tile,a=new pme(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&cr.get(n.text)&&a.cache.reused.set(cr.get(n.text),2),this.tile=a.run(t,n),Lx(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=it.chrome||it.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 E4&&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(gD)&&(this.editContextFormatting=r.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,i=s==r,o=!i&&!(this.view.state.facet(Ca)||r.tabIndex>-1)&&s0(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),it.gecko&&l.empty&&!this.hasComposition&&wme(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new po(f,0),a=!0}let d=this.view.observer.selectionRange;(a||!d.focusNode||(!o0(c.node,c.offset,d.anchorNode,d.anchorOffset)||!o0(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{it.android&&it.chrome&&r.contains(d.focusNode)&&Cme(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=z0(this.view.root);if(f)if(l.empty){if(it.gecko){let m=xme(c.node,c.offset);if(m&&m!=3){let p=(m==1?eD:tD)(c.node,c.offset);p&&(c=new po(p.node,p.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(u.node,u.offset)}catch{}}else{let m=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),m.setEnd(u.node,u.offset),m.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(m)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new po(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new po(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&o0(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=z0(t.root),{anchorNode:s,anchorOffset:i}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&r.collapse(s,i)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let i;if(t==r.dom)i=r.dom.childNodes[n];else{let o=Ka(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(t==a.firstChild?o=-1:o=1),t=a}o<0?i=t:i=t.nextSibling}if(i==r.dom.firstChild)return s;for(;i&&!cr.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return r.isText()?t==r.dom?s+n:s+(n?r.length:0):s}domAtPos(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(t,n):r.domIn(s,n)}inlineDOMNearPos(t,n){let r,s=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=t)return!0;c.flags&16&&(i=!0)}else{let d=u+c.length;if(u<=t&&(r=c,s=t-u,i=d<t),d>=t&&!o&&(o=c,a=t-u,l=u>t),u>t&&o)return!0}}),!r&&!o?this.domAtPos(t,n):(i&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(s,n):o.domIn(a,n))}coordsAt(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof E4?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function s(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=xs(i.text,o);if(a==o)return null;let l=q0(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return s(n,r)}measureVisibleLineHeights(t){let n=[],{from:r,to:s}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Yn.LTR,c=0,u=(d,f,m)=>{for(let p=0;p<d.children.length&&!(f>s);p++){let y=d.children[p],x=f+y.length,b=y.dom.getBoundingClientRect(),{height:w}=b;if(m&&!p&&(c+=b.top-m.top),y instanceof za)x>r&&u(y,f,b);else if(f>=r&&(c>0&&n.push(-c),n.push(w+c),c=0,o)){let v=y.dom.lastChild,_=v?i0(v):[];if(_.length){let S=_[_.length-1],C=l?S.right-b.left:b.right-S.left;C>a&&(a=C,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=x)}}m&&p==d.children.length-1&&(c+=m.bottom-b.bottom),f=x+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"?Yn.RTL:Yn.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=i0(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(t)return t;let n=document.createElement("div"),r,s,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=i0(n.firstChild)[0];r=n.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(sn.replace({widget:new E4(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return sn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(Gy).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet($5).map((i,o)=>{let a=typeof i=="function";return a&&(r=!0),a?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[t++]=r,n.push(An.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(bD).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(pD))try{if(u(this.view,t.range,t))return!0}catch(d){xi(this.view.state,d,"scroll handler")}let{range:r}=t,s=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),i;if(!s)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(s={left:Math.min(s.left,i.left),top:Math.min(s.top,i.top),right:Math.max(s.right,i.right),bottom:Math.max(s.bottom,i.bottom)});let o=q5(this.view),a={left:s.left-o.left,top:s.top-o.top,right:s.right+o.right,bottom:s.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(G0e(this.view.scrollDOM,a,r.head<r.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,c),-c),this.view.textDirection==Yn.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(){Lx(this.tile)}}function Lx(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)Lx(r,t)}}function wme(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 _D(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=eD(n.focusNode,n.focusOffset),s=tD(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=cr.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=cr.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function vme(e,t,n){let r=_D(e,n);if(!r)return null;let{node:s,from:i,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new Ki(l.mapPos(i),l.mapPos(o),i,o),text:s}}function xme(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 _me=class{constructor(){this.changes=[]}compareRange(t,n){Pd(t,n,this.changes)}comparePoint(t,n){Pd(t,n,this.changes)}boundChange(t){Pd(t,t,this.changes)}};function kme(e,t,n){let r=new _me;return An.compare(e,t,n,r),r.changes}class Sme{constructor(){this.changes=[]}compareRange(t,n){Pd(t,n,this.changes)}comparePoint(){}boundChange(t){Pd(t,t,this.changes)}}function Tme(e,t,n){let r=new Sme;return An.compare(e,t,n,r),r.changes}function Cme(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 Ame(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class E4 extends sa{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 Eme(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return Oe.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=xs(s.text,i,!1):a=xs(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let c=xs(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=xs(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return Oe.range(o+s.from,a+s.from)}function Mme(e,t,n,r,s){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,l=Math.floor((s-n.top-(e.defaultLineHeight-a)*.5)/a);i+=l*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+P0e(o,i,e.state.tabSize)}function Dx(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==Ps.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function Nme(e,t,n,r){let s=Dx(e,t.head,t.assoc||-1),i=!r||s.type!=Ps.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(s.from),l=e.posAtCoords({x:n==(a==Yn.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Oe.cursor(l,n?-1:1)}return Oe.cursor(n?s.to:s.from,n?-1:1)}function pT(e,t,n,r){let s=e.state.doc.lineAt(t.head),i=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let a=t,l=null;;){let c=sme(s,i,o,a,n),u=oD;if(!c){if(s.number==(n?e.state.doc.lines:1))return a;u=`
`,s=e.state.doc.line(s.number+(n?1:-1)),i=e.bidiSpans(s),c=e.visualLineSide(s,!n)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function Ime(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==ja.Space&&(s=o),s==o}}function Rme(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return Oe.cursor(s,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let p=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(s-p.from))),a=(i<0?p.top:p.bottom)+u}let d=l.left+o,f=e.viewState.heightOracle.textHeight>>1,m=r??f;for(let p=0;;p+=f){let y=a+(m+p)*i,x=Ox(e,{x:d,y},!1,i);if(n?y>l.bottom:y<l.top)return Oe.cursor(x.pos,x.assoc);let b=e.coordsAtPos(x.pos,x.assoc),w=b?(b.top+b.bottom)/2:0;if(!b||(n?w>a:w<a))return Oe.cursor(x.pos,x.assoc,void 0,o)}}function a0(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let l=r||n||(t-i<o-t?-1:1);t=l<0?i:o,r=l}});if(!r)return t}}function kD(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let s=t.ranges[r],i=null;if(s.empty){let o=a0(e,s.from,0);o!=s.from&&(i=Oe.cursor(o,-1))}else{let o=a0(e,s.from,-1),a=a0(e,s.to,1);(o!=s.from||a!=s.to)&&(i=Oe.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?Oe.create(n,t.mainIndex):t}function M4(e,t,n){let r=a0(e.state.facet(xm).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Oe.cursor(r,r<n.from?1:-1)}class Po{constructor(t,n){this.pos=t,this.assoc=n}}function Ox(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new Po(0,1);if(l>e.viewState.docHeight)return new Po(e.state.doc.length,-1);if(c=e.elementAtHeight(l),r==null)break;if(c.type==Ps.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==Ps.Text){let d=Mme(e,s,c,o,a);return new Po(d,d==c.from?1:-1)}}if(c.type!=Ps.Text)return l<(c.top+c.bottom)/2?new Po(c.from,1):new Po(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 jme(e,o,a,e.textDirectionAt(c.from)).scanTile(u,c.from)}class jme{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[Ho.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[Ho.find(s,t-r.from,-1,n)].dir}bidiIn(t,n){let{spans:r,line:s}=this.bidiSpansAt(t);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(t,n,r=!1){let s=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),l,c,u=-1,d=1e9,f;e:for(;s<i;){let p=i-s,y=s+i>>1;t:if(o.has(y)){let b=s+Math.floor(Math.random()*p);for(let w=0;w<p;w++){if(!o.has(b)){y=b;break t}b++,b==i&&(b=s)}break e}o.add(y);let x=n(y);if(x)for(let b=0;b<x.length;b++){let w=x[b],v=0;if(!(w.width==0&&x.length>1)){if(w.bottom<this.y)(!l||l.bottom<w.bottom)&&(l=w),v=1;else if(w.top>this.y)(!c||c.top>w.top)&&(c=w),v=-1;else{let _=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,S=Math.abs(_);S<d&&(u=y,d=S,f=w),_&&(v=_<0==(this.baseDir==Yn.LTR)?-1:1)}v==-1&&(!a||this.baseDirAt(t[y],1))?i=y:v==1&&(!a||this.baseDirAt(t[y+1],-1))&&(s=y+1)}}}if(!f){if(!c&&!l)return{i:t[0],after:!1};let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(t,n,!0)}if(d&&!r){let{top:p,bottom:y}=f;if(l&&l.bottom>(p+p+y)/3)return this.y=l.bottom-1,this.scan(t,n,!0);if(c&&c.top<(p+y+y)/3)return this.y=c.top+1,this.scan(t,n,!0)}let m=(a?this.dirAt(t[u],1):this.baseDir)==Yn.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=xs(t.text,i))r.push(n+i);r.push(n+t.length);let s=this.scan(r,i=>{let o=r[i]-n,a=r[i+1]-n;return q0(t.dom,o,a).getClientRects()});return s.after?new Po(r[s.i+1],-1):new Po(r[s.i],1)}scanTile(t,n){if(!t.length)return new Po(n,1);if(t.children.length==1){let a=t.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let r=[n];for(let a=0,l=n;a<t.children.length;a++)r.push(l+=t.children[a].length);let s=this.scan(r,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:q0(l.dom,0,l.length)).getClientRects()}),i=t.children[s.i],o=r[s.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):s.after?new Po(r[s.i+1],-1):new Po(o,1)}}const ld="";class Lme{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(kn.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=ld}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let s=t;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let o=cr.get(s),a=s.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=cr.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:I1(s))||I1(a)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!Ome(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=o-1);r=i+o}}readNode(t){let n=cr.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+(Dme(t,r.node,r.offset)?n:0))}}function Dme(e,t,n){for(;;){if(!t||n<Ka(t))return!1;if(t==e)return!0;n=hc(t)+1,t=t.parentNode}}function Ome(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=cr.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 gT{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class Bme{constructor(t,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=SD(t.docView.tile,n,r,0))){let l=i||o?[]:zme(t),c=new Lme(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=$me(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!Mx(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Mx(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=t.viewport;if((it.ios||it.chrome)&&a.main.empty&&c!=u&&(d.from>0||d.to<t.state.doc.length)){let f=Math.min(c,u),m=Math.max(c,u),p=d.from-f,y=d.to-m;(p==0||p==1||f==0)&&(y==0||y==-1||m==t.state.doc.length)&&(c=0,u=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Oe.range(u,c));else if(t.lineWrapping&&u==c&&!(a.main.empty&&a.main.head==c)&&t.inputState.lastTouchTime>Date.now()-100){let f=t.coordsAtPos(c,-1),m=0;f&&(m=t.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=Oe.create([Oe.cursor(c,m)])}else this.newSel=Oe.single(u,c)}}}function SD(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<e.children.length;l++){let d=e.children[l],f=c+d.length;if(c<t&&f>n)return SD(d,t,n,c);if(f>=t&&s==-1&&(s=l,i=c),c>n&&d.dom.parentNode==e.dom){o=l,a=u;break}u=f,c=f+d.breakAfter}return{from:i,to:a<0?r+e.length:a,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function TD(e,t){let n,{newSel:r}=t,{state:s}=e,i=s.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:l}=t.bounds,c=i.from,u=null;(o===8||it.android&&t.text.length<l-a)&&(c=i.to,u="end");let d=s.doc.sliceString(a,l,ld),f,m;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||d!=t.text)&&d.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&d.slice(i.to-a)==t.text.slice(f=t.text.length-(d.length-(i.to-a)))?n={from:i.from,to:i.to,insert:hn.of(t.text.slice(i.from-a,f).split(ld))}:(m=CD(d,t.text,c-a,u))&&(it.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==ld+ld&&m.toB--,n={from:a+m.from,to:a+m.toA,insert:hn.of(t.text.slice(m.from,m.toB).split(ld))})}else r&&(!e.hasFocus&&s.facet(Ca)||D1(r,i))&&(r=null);if(!n&&!r)return!1;if((it.mac||it.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Oe.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:hn.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)}:it.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=Oe.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:hn.of([" "])}),n)return F5(e,n,r,o);if(r&&!D1(r,i)){let a=!1,l="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),l=e.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=kD(s.facet(xm).map(c=>c(e)),r))),e.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function F5(e,t,n,r=-1){if(it.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(it.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&&zd(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)&&zd(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&zd(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=Pme(e,t,n));return e.state.facet(dD).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function Pme(e,t,n){let r,s=e.state,i=s.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let l=t.from<i.from?-1:1,c=l<0?i.from:i.to,u=a0(s.facet(xm).map(d=>d(e)),c,l);t.from==u&&(o=u)}if(o>-1)r={changes:t,selection:Oe.cursor(t.from+t.insert.length,-1)};else if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let l=i.from<t.from?s.sliceDoc(i.from,t.from):"",c=i.to>t.to?s.sliceDoc(t.to,i.to):"";r=s.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=s.changes(t),c=n&&n.main.to<=l.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let u=e.state.sliceDoc(t.from,t.to),d,f=n&&_D(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,x=y-u.length;if(e.state.sliceDoc(x,y)!=u||y>=d.from&&x<=d.to)return{range:p};let b=s.changes({from:x,to:y,insert:t.insert}),w=p.to-i.to;return{changes:b,range:c?Oe.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):p.map(b)}})}else r={changes:l,selection:c&&s.selection.replaceRange(c)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function CD(e,t,n,r){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==s&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&e.length<t.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function zme(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 gT(n,r)),(s!=n||i!=r)&&t.push(new gT(s,i))),t}function $me(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?Oe.single(n+t,r+t):null}function D1(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class qme{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,it.safari&&t.contentDOM.addEventListener("input",()=>null),it.gecko&&npe(t.contentDOM.ownerDocument)}handleEvent(t){!Yme(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=Fme(t),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=r[i];a&&o!=!a.handlers.length&&(s.removeEventListener(i,this.handleEvent),a=null),a||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&ED.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),it.android&&it.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return it.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=AD.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||Ume.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,zd(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:it.safari&&!it.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 yT(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){xi(n.state,s)}}}function Fme(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(yT(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(yT(r.value,l))}}for(let r in yo)n(r).handlers.push(yo[r]);for(let r in oi)n(r).observers.push(oi[r]);return t}const AD=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Ume="dthko",ED=[16,17,18,20,91,92,224,225],kp=6;function Sp(e){return Math.max(0,e)*.7+8}function Hme(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Vme{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=QL(t.contentDOM),this.atoms=t.state.facet(xm).map(o=>o(t));let i=t.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(kn.allowMultipleSelections)&&Wme(t,n),this.dragging=Kme(t,n)&&ID(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&&Hme(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,s=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=q5(this.view);t.clientX-l.left<=s+kp?n=-Sp(s-t.clientX):t.clientX+l.right>=o-kp&&(n=Sp(t.clientX-o)),t.clientY-l.top<=i+kp?r=-Sp(i-t.clientY):t.clientY+l.bottom>=a-kp&&(r=Sp(t.clientY-a)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,r=kD(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 Wme(e,t){let n=e.state.facet(aD);return n.length?n[0](t):it.mac?t.metaKey:t.ctrlKey}function Gme(e,t){let n=e.state.facet(lD);return n.length?n[0](t):it.mac?!t.altKey:!t.ctrlKey}function Kme(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=z0(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function Yme(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=cr.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const yo=Object.create(null),oi=Object.create(null),MD=it.ie&&it.ie_version<15||it.ios&&it.webkit_version<604;function Xme(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(),ND(e,n.value)},50)}function Xy(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function ND(e,t){t=Xy(e.state,B5,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(Bx!=null&&n.selection.ranges.every(l=>l.empty)&&Bx==i.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((o?i.line(s++).text:t)+n.lineBreak);return{changes:{from:u.from,insert:d},range:Oe.cursor(c.from+d.length)}})}else o?r=n.changeByRange(l=>{let c=i.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Oe.cursor(l.from+c.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}oi.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};oi.wheel=oi.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};yo.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);oi.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")};oi.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};yo.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(cD))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Jme(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Vme(e,t,n,r)),r&&e.observer.ignore(()=>{JL(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 bT(e,t,n,r){if(r==1)return Oe.cursor(t,n);if(r==2)return Eme(e.state,t,n);{let s=e.docView.lineAt(t,n),i=e.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,Oe.range(o,a)}}const Qme=it.ie&&it.ie_version<=11;let wT=null,vT=0,xT=0;function ID(e){if(!Qme)return e.detail;let t=wT,n=xT;return wT=e,xT=Date.now(),vT=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(vT+1)%3:1}function Jme(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=ID(t),s=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,a){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=bT(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let d=bT(e,n.pos,n.assoc,r),f=Math.min(d.from,u.from),m=Math.max(d.to,u.to);u=f<u.from?Oe.range(f,m,u.assoc):Oe.range(m,f,u.assoc)}return o?s.replaceRange(s.main.extend(u.from,u.to,u.assoc)):a&&r==1&&s.ranges.length>1&&(c=Zme(s,l.pos))?c:a?s.addRange(u):Oe.create([u])}}}function Zme(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:s}=e.ranges[n];if(r<=t&&s>=t)return Oe.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}yo.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.tile.nearest(t.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=Oe.range(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",Xy(e.state,P5,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};yo.dragend=e=>(e.inputState.draggedContent=null,!1);function _T(e,t,n,r){if(n=Xy(e.state,B5,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&Gme(e,t)?{from:i.from,to:i.to}:null,a={from:s,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}yo.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&&_T(e,t,r.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return _T(e,t,r,!0),!0}return!1};yo.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=MD?null:t.clipboardData;return n?(ND(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Xme(e),!1)};function epe(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 tpe(e){let t=[],n=[],r=!1;for(let s of e.selection.ranges)s.empty||(t.push(e.sliceDoc(s.from,s.to)),n.push(s));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>s&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}r=!0}return{text:Xy(e,P5,t.join(e.lineBreak)),ranges:n,linewise:r}}let Bx=null;yo.copy=yo.cut=(e,t)=>{if(!s0(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=tpe(e.state);if(!n&&!s)return!1;Bx=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=MD?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(epe(e,n),!1)};const RD=nl.define();function jD(e,t){let n=[];for(let r of e.facet(hD)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:RD.of(!0)}):null}function LD(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=jD(e.state,t);n?e.dispatch(n):e.update([])}},10)}oi.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),LD(e)};oi.blur=e=>{e.observer.clearSelectionRange(),LD(e)};oi.compositionstart=oi.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};oi.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,it.chrome&&it.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};oi.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};yo.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let a=o[0],l=e.posAtDOM(a.startContainer,a.startOffset),c=e.posAtDOM(a.endContainer,a.endOffset);return F5(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let s;if(it.chrome&&it.android&&(s=AD.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return it.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),it.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>oi.compositionend(e,t),20),!1};const kT=new Set;function npe(e){kT.has(e)||(kT.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const ST=["pre-wrap","normal","pre-line","break-spaces"];let uh=!1;function TT(){uh=!1}class rpe{constructor(t){this.lineWrapping=t,this.doc=hn.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 ST.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r<t.length;r++){let s=t[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(t,n,r,s,i,o){let a=ST.indexOf(t)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class spe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class mo{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"?Ps.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 Su?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 mo(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Hn=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Hn||(Hn={}));const pg=.001;class zs{constructor(t,n,r=2){this.length=t,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>pg&&(uh=!0),this.height=t)}replace(t,n,r){return zs.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let i=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=s[a],f=i.lineAt(l,Hn.ByPosNoHeight,r.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,Hn.ByPosNoHeight,r,0,0);for(d+=m.to-c,c=m.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,u=s[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,Hn.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let p=U5.build(r.setDoc(o),t,u,d);i=O1(i,i.replace(l,c,p))}return i.updateHeight(r,0)}static empty(){return new gi(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,s=0,i=0;for(;;)if(n==r)if(s>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(i>s*2){let a=t[r];a.break?t.splice(r,1,a.left,null,a.right):t.splice(r,1,a.left,a.right),r+=2+a.break,i-=a.size}else break;else if(s<i){let a=t[n++];a&&(s+=a.size)}else{let a=t[--r];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,r++),new ope(zs.of(t.slice(0,n)),o,zs.of(t.slice(r)))}}function O1(e,t){return e==t?e:(e.constructor!=t.constructor&&(uh=!0),t)}zs.prototype.size=1;const ipe=sn.replace({});class DD extends zs{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new mo(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 mo(s,0,r,this.spaceAbove,ipe):this.mainBlock(r,s)}lineAt(t,n,r,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(o):o}forEachLine(t,n,r,s,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,Hn.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 gi extends DD{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 mo(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 gi||s instanceof ss&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ss?s=new gi(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):zs.of(r)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ss extends zs{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,s=t.doc.lineAt(n+this.length).number,i=s-r+1,o,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(t,n,r,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s);if(n.lineWrapping){let c=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,f=Math.max(r,t-d/2);return new mo(u.from,u.length,f,d,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-r)/a))),{from:u,length:d}=n.doc.line(i+c);return new mo(u,d,r+a*c,a,0)}}lineAt(t,n,r,s,i){if(n==Hn.ByHeight)return this.blockAt(t,r,s,i);if(n==Hn.ByPosNoHeight){let{from:m,to:p}=r.doc.lineAt(t);return new mo(m,p-m,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),c=r.doc.lineAt(t),u=a+c.length*l,d=c.number-o,f=s+a*d+l*(c.from-i-d);return new mo(c.from,c.length,Math.max(s,Math.min(f,s+this.height-u)),u,0)}forEachLine(t,n,r,s,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,i);for(let u=t,d=s;u<=n;){let f=r.doc.lineAt(u);if(u==t){let p=f.number-a;d+=l*p+c*(t-i-p)}let m=l+c*f.length;o(new mo(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 ss?r[r.length-1]=new ss(i.length+s):r.push(null,new ss(s-1))}if(t>0){let i=r[0];i instanceof ss?r[0]=new ss(t+i.length):r.unshift(new ss(t-1),null)}return zs.of(r)}decomposeLeft(t,n){n.push(new ss(t-1),null)}decomposeRight(t,n){n.push(null,new ss(this.length-t-1))}updateHeight(t,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],a=Math.max(n,s.from),l=-1;for(s.from>n&&o.push(new ss(s.from-n-1).updateHeight(t,n));a<=i&&s.more;){let u=t.doc.lineAt(a).length;o.length&&o.push(null);let d=s.heights[s.index++],f=0;d<0&&(f=-d,d=s.heights[s.index++]),l==-1?l=d:Math.abs(d-l)>=pg&&(l=-2);let m=new gi(u,d,f);m.outdated=!1,o.push(m),a+=u+1}a<=i&&o.push(null,new ss(i-a).updateHeight(t,a));let c=zs.of(o);return(l<0||Math.abs(c.height-this.height)>=pg||Math.abs(l-this.heightMetrics(t,n).perLine)>=pg)&&(uh=!0),O1(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 ope extends zs{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,s){let i=r+this.left.height;return t<i?this.left.blockAt(t,n,r,s):this.right.blockAt(t,n,i,s+this.left.length+this.break)}lineAt(t,n,r,s,i){let o=s+this.left.height,a=i+this.left.length+this.break,l=n==Hn.ByHeight?t<o:t<a,c=l?this.left.lineAt(t,n,r,s,i):this.right.lineAt(t,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==Hn.ByPosNoHeight?Hn.ByPosNoHeight:Hn.ByPos;return l?c.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,s,i).join(c)}forEachLine(t,n,r,s,i,o){let a=s+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,r,s,i,o),n>=l&&this.right.forEachLine(t,n,r,a,l,o);else{let c=this.lineAt(l,Hn.ByPos,r,s,i);t<c.from&&this.left.forEachLine(t,c.from-1,r,s,i,o),c.to>=t&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(t,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(t,n,r),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,n-s,r));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of r)i.push(a);if(t>0&&CT(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),CT(i,a)}return zs.of(i)}decomposeLeft(t,n){let r=this.left.length;if(t<=r)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(r++,t>=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,s=r+this.break;if(t>=s)return this.right.decomposeRight(t-s,n);t<r&&this.left.decomposeRight(t,n),this.break&&t<s&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?zs.of(this.break?[t,null,n]:[t,n]):(this.left=O1(this.left,t),this.right=O1(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,r=!1,s){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return s&&s.from<=n+i.length&&s.more?l=i=i.updateHeight(t,n,r,s):i.updateHeight(t,n,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(t,a,r,s):o.updateHeight(t,a,r),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function CT(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof ss&&(r=e[t+1])instanceof ss&&e.splice(t-1,3,new ss(n.length+1+r.length))}const ape=5;class U5{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 gi?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new gi(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-t;r.block?this.addBlock(new DD(o,s,r)):(o||i||s>=ape)&&this.addLineDeco(s,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new gi(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new ss(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 gi)return t;let n=new gi(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 gi)&&!this.isCovered?this.nodes.push(new gi(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 gi&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new U5(r,t);return An.spans(n,r,s,i,0),i.finish(r)}}function lpe(e,t,n){let r=new cpe;return An.compare(e,t,n,r,0),r.changes}class cpe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&Pd(t,n,this.changes,5)}}function upe(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(s.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let f=u.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==e.parentNode?s.innerHeight:l,f.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function dpe(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 hpe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class N4{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 sn.replace({widget:new fpe(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class fpe extends sa{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 AT{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=ET,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Yn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(z5).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new rpe(r),this.stateDeco=MT(n),this.heightMap=zs.empty().applyChanges(this.stateDeco,hn.empty,this.heightOracle.setDoc(n.doc),[new Ki(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=sn.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!t.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);t.push(new Tp(i,o))}}return this.viewports=t.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?ET:new H5(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(Cf(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=MT(this.state);let s=t.changedRanges,i=Ki.extendWithRanges(s,lpe(r,this.stateDeco,t?t.changes:Br.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);TT(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||uh)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(c||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(mD)&&(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"?Yn.RTL:Yn.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:S,scaleY:C}=XL(n,a);(S>.005&&Math.abs(this.scaleX-S)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=S,this.scaleY=C,c|=16,o=l=!0)}let d=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,c|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=16);let m=QL(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=ZL(this.scrollParent||t.win);let y=(this.printing?hpe:upe)(n,this.paddingTop),x=y.top-this.pixelViewport.top,b=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(l=!0)),!this.inView&&!this.scrollTarget&&!dpe(t.dom))return 0;let v=a.width;if((this.contentDOMWidth!=v||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let S=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(v-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:E,textHeight:R}=t.docView.measureTextSize();o=C>0&&s.refresh(i,C,E,R,Math.max(5,v/E),S),o&&(t.docView.minWidth=0,c|=16)}x>0&&b>0?u=Math.max(x,b):x<0&&b<0&&(u=Math.min(x,b)),TT();for(let C of this.viewports){let E=C.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(C);this.heightMap=(o?zs.empty().applyChanges(this.stateDeco,hn.empty,this.heightOracle,[new Ki(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new spe(C.from,E))}uh&&(c|=2)}let _=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return _&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||_)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Tp(s.lineAt(o-r*1e3,Hn.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,Hn.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,Hn.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 Tp(s.lineAt(f-1e3/2,Hn.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,Hn.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 Tp(this.heightMap.lineAt(r,Hn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Hn.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,Hn.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Hn.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||s<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let r=[];for(let s of t)n.touchesRange(s.from,s.to)||r.push(new N4(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(t,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=Yn.LTR&&!r)return[];let a=[],l=(u,d,f,m)=>{if(d-u<i)return;let p=this.state.selection.main,y=[p.from];p.empty||y.push(p.to);for(let b of y)if(b>u&&b<d){l(u,b-10,f,m),l(b+10,d,f,m);return}let x=ppe(t,b=>b.from>=f.from&&b.to<=f.to&&Math.abs(b.from-u)<i&&Math.abs(b.to-d)<i&&!y.some(w=>b.from<w&&b.to>w));if(!x){if(d<f.to&&n&&r&&n.visibleRanges.some(v=>v.from<=d&&v.to>=d)){let v=n.moveToLineBoundary(Oe.cursor(d),!1,!0).head;v>u&&(d=v)}let b=this.gapSize(f,u,d,m),w=r||b<2e6?b:2e6;x=new N4(u,d,b,w)}a.push(x)},c=u=>{if(u.length<o||u.type!=Ps.Text)return;let d=mpe(u.from,u.to,this.stateDeco);if(d.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,m,p;if(r){let y=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,b;if(f!=null){let w=Ap(d,f),v=((this.visibleBottom-this.visibleTop)/2+y)/u.height;x=w-v,b=w+v}else x=(this.visibleTop-u.top-y)/u.height,b=(this.visibleBottom-u.top+y)/u.height;m=Cp(d,x),p=Cp(d,b)}else{let y=d.total*this.heightOracle.charWidth,x=s*this.heightOracle.charWidth,b=0;if(y>2e6)for(let C of t)C.from>=u.from&&C.from<u.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=C.size-C.displaySize);let w=this.pixelViewport.left+b,v=this.pixelViewport.right+b,_,S;if(f!=null){let C=Ap(d,f),E=((v-w)/2+x)/y;_=C-E,S=C+E}else _=(w-x)/y,S=(v+x)/y;m=Cp(d,_),p=Cp(d,S)}m>u.from&&l(u.from,m,u,d),p<u.to&&l(p,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(t,n,r,s){let i=Ap(s,r)-Ap(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){N4.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=sn.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=[];An.spans(n,this.viewport.from,this.viewport.to,{span(i,o){r.push({from:i,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i<r.length&&!(s&8);i++){let o=this.visibleRanges[i],a=r[i];(o.from!=a.from||o.to!=a.to)&&(s|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||Cf(this.heightMap.lineAt(t,Hn.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)||Cf(this.heightMap.lineAt(this.scaler.fromDOM(t),Hn.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 Cf(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 Tp{constructor(t,n){this.from=t,this.to=n}}function mpe(e,t,n){let r=[],s=e,i=0;return An.spans(n,e,t,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),i+=o-s),s=a}},20),s<t&&(r.push({from:s,to:t}),i+=t-s),{total:i,ranges:r}}function Cp({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let s=0;;s++){let{from:i,to:o}=t[s],a=o-i;if(r<=a)return i+r;r-=a}}function Ap(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 ppe(e,t){for(let n of e)if(t(n))return n}const ET={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function MT(e){let t=e.facet(Gy).filter(r=>typeof r!="function"),n=e.facet($5).filter(r=>typeof r!="function");return n.length&&t.push(An.join(n)),t}class H5{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Hn.ByPos,t,0,0).top,u=n.lineAt(l,Hn.ByPos,t,0,0).bottom;return s+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return s+(t-r)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);r=i.bottom,s=i.domBottom}}fromDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return r+(t-s)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);r=i.bottom,s=i.domBottom}}eq(t){return t instanceof H5?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 Cf(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new mo(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>Cf(s,t)):e._content)}const Ep=Et.define({combine:e=>e.join(" ")}),Px=Et.define({combine:e=>e.indexOf(!0)>-1}),zx=uc.newName(),OD=uc.newName(),BD=uc.newName(),PD={"&light":"."+OD,"&dark":"."+BD};function $x(e,t,n){return new uc(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 gpe=$x("."+zx,{"&":{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"}},PD),ype={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},I4=it.ie&&it.ie_version<=11;class bpe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new K0e,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);(it.ie&&it.ie_version<=11||it.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&&it.android&&t.constructor.EDIT_CONTEXT!==!1&&!(it.chrome&&it.chrome_version<126)&&(this.editContext=new vpe(t),t.state.facet(Ca)&&(t.contentDOM.editContext=this.editContext.editContext)),I4&&(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(Ca)?r.root.activeElement!=this.dom:!s0(this.dom,s))return;let i=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(it.ie&&it.ie_version<=11||it.android&&it.chrome)&&!r.state.selection.main.empty&&s.focusNode&&o0(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=z0(t.root);if(!n)return!1;let r=it.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&wpe(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=s0(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&X0e(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,ype),I4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),I4&&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&&zd(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&s0(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Bme(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=TD(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!D1(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=NT(n,t.previousSibling||t.target.previousSibling,-1),s=NT(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(Ca)!=t.state.facet(Ca)&&(t.view.contentDOM.editContext=t.state.facet(Ca)?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 NT(e,t,n){for(;t;){let r=cr.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 IT(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return o0(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function wpe(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return IT(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?IT(e,n):null}class vpe{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=r=>{let s=t.state.selection.main,{anchor:i,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let u=CD(t.state.sliceDoc(a,l),r.text,(c?s.from:s.to)-a,c?"end":null);if(!u){let f=Oe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));D1(f,s)||t.dispatch({selection:f,userEvent:"select"});return}let d={from:u.from+a,to:u.toA+a,insert:hn.of(r.text.slice(u.from,u.toB).split(`
`))};if((it.mac||it.android)&&d.from==o-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:a,to:l,insert:hn.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!t.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);F5(t,d,Oe.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),d.from<d.to&&!d.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=t.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(sn.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:gD.of(sn.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=z0(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,s=this.pendingContextChange;return t.changes.iterChanges((i,o,a,l,c)=>{if(r)return;let u=c.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),s&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let r=this.composing;return r&&r.drifted?r.editorBase+(t-r.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class wt{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||Y0e(t.parent)||document,this.viewState=new AT(this,t.state||kn.create(t)),t.scrollTo&&t.scrollTo.is(_p)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(kd).map(s=>new T4(s));for(let s of this.plugins)s.update(this);this.observer=new bpe(this),this.inputState=new qme(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mT(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 zr?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let f of t){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;t.some(f=>f.annotation(RD))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=jD(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(kn.phrases)!=this.state.facet(kn.phrases))return this.setState(i);s=R1.create(this,i,t),s.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:m}=f.state.selection,{x:p,y}=this.state.facet(wt.cursorScrollMargin);d=new $d(m.empty?m:Oe.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,p)}for(let m of f.effects)m.is(_p)&&(d=m.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=B1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Tf)!=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(Ep)!=s.state.facet(Ep)&&(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(jx))try{f(s)}catch(m){xi(this.state,m,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!TD(this,u)&&c.force&&zd(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 AT(this,t),this.plugins=t.facet(kd).map(r=>new T4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mT(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(kd),r=t.state.facet(kd);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new T4(i));else{let a=this.plugins[o];a.mustUpdate=t,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){xi(this.state,r,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(ZL(r||this.win))i=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(s);i=m.from,o=m.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(m=>{try{return m.read(this)}catch(p){return xi(this.state,p),RT}}),d=R1.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]!=RT)try{let p=c[m];p.write&&p.write(u[m],this)}catch(p){xi(this.state,p)}if(f&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((p>1||p<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,r?r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(jx))a(n)}get themeClasses(){return zx+" "+(this.state.facet(Px)?BD:OD)+" "+this.state.facet(Ep)}updateAttrs(){let t=jT(this,yD,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ca)?"true":"false",class:"cm-content",style:`${it.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),jT(this,z5,n);let r=this.observer.ignore(()=>{let s=lT(this.contentDOM,this.contentAttrs,n),i=lT(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(wt.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(Tf);let t=this.state.facet(wt.cspNonce);uc.mount(this.root,this.styleModules.concat(gpe).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 M4(this,t,pT(this,t,n,r))}moveByGroup(t,n){return M4(this,t,pT(this,t,n,r=>Ime(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),s=this.textDirectionAt(t.from),i=r[n?r.length-1:0];return Oe.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return Nme(this,t,n,r)}moveVertically(t,n,r){return M4(this,t,Rme(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=Ox(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),Ox(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.docView.coordsAt(t,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(t),i=this.bidiSpans(s),o=i[Ho.find(i,t-s.from,-1,n)];return $0(r,o.dir==Yn.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(fD)||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>xpe)return iD(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||sD(i.isolates,r=dT(this,t))))return i.order;r||(r=dT(this,t));let s=rme(t.text,n,r);return this.bidiCache.push(new B1(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||it.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{JL(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var r,s,i,o;return _p.of(new $d(typeof t=="number"?Oe.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return _p.of(new $d(Oe.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return ii.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ii.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=uc.newName(),s=[Ep.of(r),Tf.of($x(`.${r}`,t))];return n&&n.dark&&s.push(Px.of(!0)),s}static baseTheme(t){return Bu.lowest(Tf.of($x("."+zx,t,PD)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&cr.get(r)||cr.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}wt.styleModule=Tf;wt.inputHandler=dD;wt.clipboardInputFilter=B5;wt.clipboardOutputFilter=P5;wt.scrollHandler=pD;wt.focusChangeEffect=hD;wt.perLineTextDirection=fD;wt.exceptionSink=uD;wt.updateListener=jx;wt.editable=Ca;wt.mouseSelectionStyle=cD;wt.dragMovesSelection=lD;wt.clickAddsSelectionRange=aD;wt.decorations=Gy;wt.blockWrappers=bD;wt.outerDecorations=$5;wt.atomicRanges=xm;wt.bidiIsolatedRanges=wD;wt.cursorScrollMargin=Et.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}}});wt.scrollMargins=vD;wt.darkTheme=Px;wt.cspNonce=Et.define({combine:e=>e.length?e[0]:""});wt.contentAttributes=z5;wt.editorAttributes=yD;wt.lineWrapping=wt.contentAttributes.of({class:"cm-lineWrapping"});wt.announce=In.define();const xpe=4096,RT={};class B1{constructor(t,n,r,s,i,o){this.from=t,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let r=[],s=t.length?t[t.length-1].dir:Yn.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new B1(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function jT(e,t,n){for(let r=e.state.facet(t),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(e):i;o&&L5(o,n)}return n}const _pe=it.mac?"mac":it.windows?"win":it.linux?"linux":"key";function kpe(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Mp(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 Spe=Bu.default(wt.domEventHandlers({keydown(e,t){return Epe(Tpe(t.state),e,t,"editor")}})),F0=Et.define({enables:Spe}),LT=new WeakMap;function Tpe(e){let t=e.facet(F0),n=LT.get(t);return n||LT.set(t,n=Ape(t.reduce((r,s)=>r.concat(s),[]))),n}let El=null;const Cpe=4e3;function Ape(e,t=_pe){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,u)=>{var d,f;let m=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(b=>kpe(b,t));for(let b=1;b<p.length;b++){let w=p.slice(0,b).join(" ");s(w,!0),m[w]||(m[w]={preventDefault:!0,stopPropagation:!1,run:[v=>{let _=El={view:v,prefix:w,scope:o};return setTimeout(()=>{El==_&&(El=null)},Cpe),!0}]})}let y=p.join(" ");s(y,!1);let x=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&&x.run.push(l),c&&(x.preventDefault=!0),u&&(x.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let f in u)u[f].run.push(m=>d(m,qx))}let l=o[t]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let qx=null;function Epe(e,t,n,r){qx=t;let s=F0e(t),i=xl(s,0),o=ad(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;El&&El.view==n&&El.scope==r&&(a=El.prefix+" ",ED.indexOf(t.keyCode)<0&&(c=!0,El=null));let d=new Set,f=x=>{if(x){for(let b of x.run)if(!d.has(b)&&(d.add(b),b(n)))return x.stopPropagation&&(u=!0),!0;x.preventDefault&&(x.stopPropagation&&(u=!0),c=!0)}return!1},m=e[r],p,y;return m&&(f(m[a+Mp(s,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(it.windows&&t.ctrlKey&&t.altKey)&&!(it.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=dc[t.keyCode])&&p!=s?(f(m[a+Mp(p,t,!0)])||t.shiftKey&&(y=B0[t.keyCode])!=s&&y!=p&&f(m[a+Mp(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(m[a+Mp(s,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),qx=null,l}class hu{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=zD(t);return[new hu(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Mpe(t,n,r)}}function zD(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Yn.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function DT(e,t,n,r){let s=e.coordsAtPos(t,n*2);if(!s)return r;let i=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),l=e.posAtCoords({x:i.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function Mpe(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==Yn.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=zD(e),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=a.right-(u?parseInt(u.paddingRight):0),m=Dx(e,r,1),p=Dx(e,s,-1),y=m.type==Ps.Text?m:null,x=p.type==Ps.Text?p:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=DT(e,r,1,y)),x&&(e.lineWrapping||p.widgetLineBreaks)&&(x=DT(e,s,-1,x)),y&&x&&y.from==x.from&&y.to==x.to)return w(v(n.from,n.to,y));{let S=y?v(n.from,null,y):_(m,!1),C=x?v(null,n.to,x):_(p,!0),E=[];return(y||m).to<(x||p).from-(y&&x?1:0)||m.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2<C.top?E.push(b(d,S.bottom,f,C.top)):S.bottom<C.top&&e.elementAtHeight((S.bottom+C.top)/2).type==Ps.Text&&(S.bottom=C.top=(S.bottom+C.top)/2),w(S).concat(E).concat(w(C))}function b(S,C,E,R){return new hu(t,S-l.left,C-l.top,Math.max(0,E-S),R-C)}function w({top:S,bottom:C,horizontal:E}){let R=[];for(let j=0;j<E.length;j+=2)R.push(b(E[j],S,E[j+1],C));return R}function v(S,C,E){let R=1e9,j=-1e9,N=[];function B(H,J,O,Y,G){let ee=e.coordsAtPos(H,H==E.to?-2:2),L=e.coordsAtPos(O,O==E.from?2:-2);!ee||!L||(R=Math.min(ee.top,L.top,R),j=Math.max(ee.bottom,L.bottom,j),G==Yn.LTR?N.push(i&&J?d:ee.left,i&&Y?f:L.right):N.push(!i&&Y?d:L.left,!i&&J?f:ee.right))}let M=S??E.from,$=C??E.to;for(let H of e.visibleRanges)if(H.to>M&&H.from<$)for(let J=Math.max(H.from,M),O=Math.min(H.to,$);;){let Y=e.state.doc.lineAt(J);for(let G of e.bidiSpans(Y)){let ee=G.from+Y.from,L=G.to+Y.from;if(ee>=O)break;L>J&&B(Math.max(ee,J),S==null&&ee<=M,Math.min(L,O),C==null&&L>=$,G.dir)}if(J=Y.to+1,J>=O)break}return N.length==0&&B(M,S==null,$,C==null,e.textDirection),{top:R,bottom:j,horizontal:N}}function _(S,C){let E=a.top+(C?S.top:S.bottom);return{top:E,bottom:E,horizontal:[]}}}function Npe(e,t){return e.constructor==t.constructor&&e.eq(t)}class Ipe{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(gg)!=t.state.facet(gg)&&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(gg);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)=>!Npe(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,it.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const gg=Et.define();function $D(e){return[ii.define(t=>new Ipe(t,e)),gg.of(e)]}const dh=Et.define({combine(e){return Vy(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Rpe(e={}){return[dh.of(e),jpe,Lpe,Dpe,mD.of(!0)]}function qD(e){return e.startState.facet(dh)!=e.state.facet(dh)}const jpe=$D({above:!0,markers(e){let{state:t}=e,n=t.facet(dh),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&it.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Oe.cursor(s.head,s.assoc);for(let l of hu.forRange(e,o,a))r.push(l)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=qD(e);return n&&OT(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){OT(t.state,e)},class:"cm-cursorLayer"});function OT(e,t){t.style.animationDuration=e.facet(dh).cursorBlinkRate+"ms"}const Lpe=$D({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 hu.forRange(e,"cm-selectionBackground",s))t.push(i);if(it.ios&&!n.empty&&e.state.facet(dh).iosSelectionHandles){for(let s of hu.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Oe.cursor(n.from,1)))t.push(s);for(let s of hu.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Oe.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||qD(e)},class:"cm-selectionLayer"}),Dpe=Bu.highest(wt.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 BT(e,t,n,r,s){t.lastIndex=0;for(let i=e.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)s(o+a.index,a)}function Ope(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 Bpe{constructor(t){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(a,l,c,u)=>s(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let d=r(a,l,c);d&&u(c,c+a[0].length,d)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new ku,r=n.add.bind(n);for(let{from:s,to:i}of Ope(t,this.maxLength))BT(t.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,t,o,r));return n.finish()}updateDeco(t,n){let r=1e9,s=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),t.viewportMoved||s-r>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,n.map(t.changes),r,s):n}updateRange(t,n,r,s){for(let i of t.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=t.state.doc.lineAt(o),c=l.to<a?t.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),d=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){d=a;break}}let f=[],m,p=(y,x,b)=>f.push(b.range(y,x));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 BT(t.state.doc,this.regexp,u,d,(y,x)=>this.addMatch(x,t,y,p));n=n.update({filterFrom:u,filterTo:d,filter:(y,x)=>y<u||x>d,add:f})}}return n}}const Fx=/x/.unicode!=null?"gu":"g",Ppe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,Fx),zpe={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 R4=null;function $pe(){var e;if(R4==null&&typeof document<"u"&&document.body){let t=document.body.style;R4=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return R4||!1}const yg=Et.define({combine(e){let t=Vy(e,{render:null,specialChars:Ppe,addSpecialChars:null});return(t.replaceTabs=!$pe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,Fx)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Fx)),t}});function qpe(e={}){return[yg.of(e),Fpe()]}let PT=null;function Fpe(){return PT||(PT=ii.fromClass(class{constructor(e){this.view=e,this.decorations=sn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(yg)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Bpe({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=xl(t[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=bm(o.text,a,r-o.from);return sn.replace({widget:new Wpe((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=sn.replace({widget:new Vpe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(yg);e.startState.facet(yg)!=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 Upe="•";function Hpe(e){return e>=32?Upe:e==10?"␤":String.fromCharCode(9216+e)}class Vpe extends sa{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=Hpe(this.code),r=t.state.phrase("Control character")+" "+(zpe[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 Wpe extends sa{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 Gpe extends sa{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?i0(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=$0(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 zT(e){let t=ii.fromClass(class{constructor(n){this.view=n,this.placeholder=e?sn.set([sn.widget({widget:new Gpe(e),side:1}).range(0)]):sn.none}get decorations(){return this.view.state.doc.length?sn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,wt.contentAttributes.of({"aria-placeholder":e})]:t}const Np="-10000px";class Kpe{constructor(t,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(t,n){var r;let s=t.state.facet(this.facet),i=s.filter(l=>l);if(s===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let c=i[l],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let f=this.tooltips[d];f&&f.create==c.create&&(u=d)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let d=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),d.update&&d.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function Ype(e={}){return bg.of(e)}function Xpe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const bg=Et.define({combine:e=>{var t,n,r;return{position:it.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)||Xpe}}}),$T=new WeakMap,FD=ii.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(bg);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 Kpe(e,UD,(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(bg);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=Np,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(it.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=q5(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(bg).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=e,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,d=e.pos[a],f=e.size[a];if(!d||l.clip!==!1&&(d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1)){u.style.top=Np;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,y=f.right-f.left,x=(t=$T.get(c))!==null&&t!==void 0?t:f.bottom-f.top,b=c.offset||Jpe,w=this.view.textDirection==Yn.LTR,v=f.width>r.right-r.left?w?r.left:r.right-f.width:w?Math.max(r.left,Math.min(d.left-(m?14:0)+b.x,r.right-y)):Math.min(Math.max(r.left,d.left-y+(m?14:0)-b.x),r.right-y),_=this.above[a];!l.strictSide&&(_?d.top-x-p-b.y<r.top:d.bottom+x+p+b.y>r.bottom)&&_==r.bottom-d.bottom>d.top-r.top&&(_=this.above[a]=!_);let S=(_?d.top-r.top:r.bottom-d.bottom)-p;if(S<x&&c.resize!==!1){if(S<this.view.defaultLineHeight){u.style.top=Np;continue}$T.set(c,x),u.style.height=(x=S)/i+"px"}else u.style.height&&(u.style.height="");let C=_?d.top-x-p-b.y:d.bottom+p+b.y,E=v+y;if(c.overlap!==!0)for(let R of o)R.left<E&&R.right>v&&R.top<C+x&&R.bottom>C&&(C=_?R.top-x-2-p:R.bottom+p+2);if(this.position=="absolute"?(u.style.top=(C-e.parent.top)/i+"px",qT(u,(v-e.parent.left)/s)):(u.style.top=C/i+"px",qT(u,v/s)),m){let R=d.left+(w?b.x:-b.x)-(v+14-7);m.style.left=R/s+"px"}c.overlap!==!0&&o.push({left:v,top:C,right:E,bottom:C+x}),u.classList.toggle("cm-tooltip-above",_),u.classList.toggle("cm-tooltip-below",!_),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=Np}},{eventObservers:{scroll(){this.maybeMeasure()}}});function qT(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Qpe=wt.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"}}}),Jpe={x:0,y:0},UD=Et.define({enables:[FD,Qpe]});function HD(e,t){let n=e.plugin(FD);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}class hh extends cc{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}hh.prototype.elementClass="";hh.prototype.toDOM=void 0;hh.prototype.mapMode=wi.TrackBefore;hh.prototype.startSide=hh.prototype.endSide=-1;hh.prototype.point=!0;const Zpe=1024;let ege=0;class j4{constructor(t,n){this.from=t,this.to=n}}class un{constructor(t={}){this.id=ege++,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=ro.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}un.closedBy=new un({deserialize:e=>e.split(" ")});un.openedBy=new un({deserialize:e=>e.split(" ")});un.group=new un({deserialize:e=>e.split(" ")});un.isolate=new un({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});un.contextHash=new un({perNode:!0});un.lookAhead=new un({perNode:!0});un.mounted=new un({perNode:!0});class l0{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[un.mounted.id]}}const tge=Object.create(null);class ro{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):tge,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new ro(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(un.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(un.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}ro.none=new ro("",Object.create(null),0,8);const Ip=new WeakMap,FT=new WeakMap;var mr;(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"})(mr||(mr={}));class cs{constructor(t,n,r,s,i){if(this.type=t,this.children=n,this.positions=r,this.length=s,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=l0.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 Hx(this.topNode,t)}cursorAt(t,n=0,r=0){let s=Ip.get(this)||this.topNode,i=new Hx(s);return i.moveTo(t,n),Ip.set(this,i._tree),i}get topNode(){return new Zi(this,0,0,null)}resolve(t,n=0){let r=U0(Ip.get(this)||this.topNode,t,n,!1);return Ip.set(this,r),r}resolveInner(t,n=0){let r=U0(FT.get(this)||this.topNode,t,n,!0);return FT.set(this,r),r}resolveStack(t,n=0){return sge(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,a=(o&mr.IncludeAnonymous)>0;for(let l=this.cursor(o|mr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:G5(ro.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new cs(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new cs(ro.none,n,r,s)))}static build(t){return ige(t)}}cs.empty=new cs(ro.none,[],[],0);class V5{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 V5(this.buffer,this.index)}}class fc{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return ro.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],r=this.buffer[t+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),t+=4,r==t)return i;let o=[];for(;t<r;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=t;l!=n&&!(VD(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(t,n,r){let s=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let c=i[l++]=s[a++]-r;i[l++]=s[a++]-t,o=Math.max(o,c)}return new fc(i,o,this.set)}}function VD(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 U0(e,t,n,r){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!r&&e instanceof Zi&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:mr.IgnoreOverlays;if(r)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof Zi&&o.index<0&&((s=a.enter(t,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class WD{cursor(t=0){return new Hx(this,t)}getChild(t,n=null,r=null){let s=UT(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return UT(this,t,n,r)}resolve(t,n=0){return U0(this,t,n,!1)}resolveInner(t,n=0){return U0(this,t,n,!0)}matchContext(t){return Ux(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 Zi extends WD{constructor(t,n,r,s){super(),this._tree=t,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,s,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;t!=c;t+=n){let u=a[t],d=l[t]+o.from,f;if(!(!(i&mr.EnterBracketed&&u instanceof cs&&(f=l0.get(u))&&!f.overlay&&f.bracketed&&r>=d&&r<=d+u.length)&&!VD(s,r,d,d+u.length))){if(u instanceof fc){if(i&mr.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,n,r-d,s);if(m>-1)return new Pl(new nge(o,u,t,d),null,m)}else if(i&mr.IncludeAnonymous||!u.type.isAnonymous||W5(u)){let m;if(!(i&mr.IgnoreMounts)&&(m=l0.get(u))&&!m.overlay)return new Zi(m.tree,d,t,o);let p=new Zi(u,d,t,o);return i&mr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&mr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,r=0){let s;if(!(r&mr.IgnoreOverlays)&&(s=l0.get(this._tree))&&s.overlay){let i=t-this.from,o=r&mr.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Zi(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 UT(e,t,n,r){let s=e.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(t)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Ux(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 nge{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class Pl extends WD{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 Pl(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&mr.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 Pl(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 Pl(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 Pl(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];t.push(r.slice(s,i,o)),n.push(0)}return new cs(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function GD(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let r=n instanceof Zi&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new rge(s,n)}class rge{constructor(t,n){this.heads=t,this.node=n}get next(){return GD(this.heads)}}function sge(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof Zi?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(t,n)),i=o}else{let o=l0.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new Zi(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(U0(a,t,n,!1))}}return s?GD(s):r}class Hx{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&~mr.EnterBracketed,t instanceof Zi)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 Zi?(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&mr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:s}=this;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+t,o=t<0?-1:r._tree.children.length;i!=o;i+=t){let a=r._tree.children[i];if(this.mode&mr.IncludeAnonymous||a instanceof fc||!a.type.isAnonymous||W5(a))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,r=0;if(t&&t.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new Pl(this.buffer,n,this.stack[s]);return this.bufferNode=new Pl(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 Ux(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 Ux(this._tree,t,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[s]&&t[s]!=o.name)return!1;s--}}return!0}}function W5(e){return e.children.some(t=>t instanceof fc||!t.type.isAnonymous||W5(t))}function ige(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=Zpe,reused:i=[],minRepeatType:o=r.types.length}=e,a=Array.isArray(n)?new V5(n,n.length):n,l=r.types,c=0,u=0;function d(S,C,E,R,j,N){let{id:B,start:M,end:$,size:H}=a,J=u,O=c;if(H<0)if(a.next(),H==-1){let F=i[B];E.push(F),R.push(M-S);return}else if(H==-3){c=B;return}else if(H==-4){u=B;return}else throw new RangeError(`Unrecognized record size: ${H}`);let Y=l[B],G,ee,L=M-S;if($-M<=s&&(ee=x(a.pos-C,j))){let F=new Uint16Array(ee.size-ee.skip),P=a.pos-ee.size,A=F.length;for(;a.pos>P;)A=b(ee.start,F,A);G=new fc(F,$-ee.start,r),L=ee.start-S}else{let F=a.pos-H;a.next();let P=[],A=[],ne=B>=o?B:-1,be=0,he=$;for(;a.pos>F;)ne>=0&&a.id==ne&&a.size>=0?(a.end<=he-s&&(p(P,A,M,be,a.end,he,ne,J,O),be=P.length,he=a.end),a.next()):N>2500?f(M,F,P,A):d(M,F,P,A,ne,N+1);if(ne>=0&&be>0&&be<P.length&&p(P,A,M,be,M,he,ne,J,O),P.reverse(),A.reverse(),ne>-1&&be>0){let ye=m(Y,O);G=G5(Y,P,A,0,P.length,0,$-M,ye,ye)}else G=y(Y,P,A,$-M,J-$,O)}E.push(G),R.push(L)}function f(S,C,E,R){let j=[],N=0,B=-1;for(;a.pos>C;){let{id:M,start:$,end:H,size:J}=a;if(J>4)a.next();else{if(B>-1&&$<B)break;B<0&&(B=H-s),j.push(M,$,H),N++,a.next()}}if(N){let M=new Uint16Array(N*4),$=j[j.length-2];for(let H=j.length-3,J=0;H>=0;H-=3)M[J++]=j[H],M[J++]=j[H+1]-$,M[J++]=j[H+2]-$,M[J++]=J;E.push(new fc(M,j[2]-$,r)),R.push($-S)}}function m(S,C){return(E,R,j)=>{let N=0,B=E.length-1,M,$;if(B>=0&&(M=E[B])instanceof cs){if(!B&&M.type==S&&M.length==j)return M;($=M.prop(un.lookAhead))&&(N=R[B]+M.length+$)}return y(S,E,R,j,N,C)}}function p(S,C,E,R,j,N,B,M,$){let H=[],J=[];for(;S.length>R;)H.push(S.pop()),J.push(C.pop()+E-j);S.push(y(r.types[B],H,J,N-j,M-N,$)),C.push(j-E)}function y(S,C,E,R,j,N,B){if(N){let M=[un.contextHash,N];B=B?[M].concat(B):[M]}if(j>25){let M=[un.lookAhead,j];B=B?[M].concat(B):[M]}return new cs(S,C,E,R,B)}function x(S,C){let E=a.fork(),R=0,j=0,N=0,B=E.end-s,M={size:0,start:0,skip:0};e:for(let $=E.pos-S;E.pos>$;){let H=E.size;if(E.id==C&&H>=0){M.size=R,M.start=j,M.skip=N,N+=4,R+=4,E.next();continue}let J=E.pos-H;if(H<0||J<$||E.start<B)break;let O=E.id>=o?4:0,Y=E.start;for(E.next();E.pos>J;){if(E.size<0)if(E.size==-3||E.size==-4)O+=4;else break e;else E.id>=o&&(O+=4);E.next()}j=Y,R+=H,N+=O}return(C<0||R==S)&&(M.size=R,M.start=j,M.skip=N),M.size>4?M:void 0}function b(S,C,E){let{id:R,start:j,end:N,size:B}=a;if(a.next(),B>=0&&R<o){let M=E;if(B>4){let $=a.pos-(B-4);for(;a.pos>$;)E=b(S,C,E)}C[--E]=M,C[--E]=N-S,C[--E]=j-S,C[--E]=R}else B==-3?c=R:B==-4&&(u=R);return E}let w=[],v=[];for(;a.pos>0;)d(e.start||0,e.bufferStart||0,w,v,-1,0);let _=(t=e.length)!==null&&t!==void 0?t:w.length?v[0]+w[0].length:0;return new cs(l[e.topID],w.reverse(),v.reverse(),_)}const HT=new WeakMap;function wg(e,t){if(!e.isAnonymous||t instanceof fc||t.type!=e)return 1;let n=HT.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof cs)){n=1;break}n+=wg(e,r)}HT.set(t,n)}return n}function G5(e,t,n,r,s,i,o,a,l){let c=0;for(let p=r;p<s;p++)c+=wg(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],f=[];function m(p,y,x,b,w){for(let v=x;v<b;){let _=v,S=y[v],C=wg(e,p[v]);for(v++;v<b;v++){let E=wg(e,p[v]);if(C+E>=u)break;C+=E}if(v==_+1){if(C>u){let E=p[_];m(E.children,E.positions,0,E.children.length,y[_]+w);continue}d.push(p[_])}else{let E=y[v-1]+p[v-1].length-S;d.push(G5(e,p,y,_,v,S,E,null,l))}f.push(S+w-i)}}return m(t,n,r,s,0),(a||l)(d,f,o)}class fu{constructor(t,n,r,s,i=!1,o=!1){this.from=t,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let s=[new fu(0,t.length,t,0,!1,r)];for(let i of n)i.to>t.length&&s.push(i);return s}static applyChanges(t,n,r=128){if(!n.length)return t;let s=[],i=1,o=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;o&&o.from<d;){let f=o;if(l>=f.from||d<=f.to||c){let m=Math.max(f.from,l)-c,p=Math.min(f.to,d)-c;f=m>=p?null:new fu(m,p,f.tree,f.offset+c,a>0,!!u)}if(f&&s.push(f),o.to>d)break;o=i<t.length?t[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class oge{startParse(t,n,r){return typeof t=="string"&&(t=new age(t)),r=r?r.length?r.map(s=>new j4(s.from,s.to)):[new j4(0,0)]:[new j4(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 age{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 un({perNode:!0});let lge=0;class Fi{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=lge++}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 Fi&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new Fi(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 P1(t);return r=>r.modified.indexOf(n)>-1?r:P1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let cge=0;class P1{constructor(t){this.name=t,this.instances=[],this.id=cge++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(a=>a.base==t&&uge(n,a.modified));if(r)return r;let s=[],i=new Fi(t.name,s,t,n);for(let a of n)a.instances.push(i);let o=dge(n);for(let a of t.set)if(!a.modified.length)for(let l of o)s.push(P1.get(a,l));return i}}function uge(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function dge(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 hge(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let d=0;;){if(a=="..."&&d>0&&d+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==s.length)break;let m=s[d++];if(d==s.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+s);a=s.slice(d)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new H0(r,o,l>0?i.slice(0,l):null);t[c]=u.sort(t[c])}}return KD.add(t)}const KD=new un({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 H0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class H0{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}}H0.empty=new H0([],2,null);function YD(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:r,all:s=null}=t||{};return{style:i=>{let o=s;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function fge(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function mge(e,t,n,r=0,s=e.length){let i=new pge(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class pge{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,r,s,i){let{type:o,from:a,to:l}=t;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(m=>!m.scope||m.scope(o)));let c=s,u=gge(t)||H0.empty,d=fge(i,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(n,a),c),u.opaque)return;let f=t.tree&&t.tree.prop(un.mounted);if(f&&f.overlay){let m=t.node.enter(f.overlay[0].from+a,1),p=this.highlighters.filter(x=>!x.scope||x.scope(f.tree.type)),y=t.firstChild();for(let x=0,b=a;;x++){let w=x<f.overlay.length?f.overlay[x]:null,v=w?w.from+a:l,_=Math.max(n,b),S=Math.min(r,v);if(_<S&&y)for(;t.from<S&&(this.highlightRange(t,_,S,s,i),this.startSpan(Math.min(S,t.to),c),!(t.to>=v||!t.nextSibling())););if(!w||v>r)break;b=w.to+a,b>n&&(this.highlightRange(m.cursor(),Math.max(n,w.from+a),Math.min(r,b),"",p),this.startSpan(Math.min(r,b),c))}y&&t.parent()}else if(t.firstChild()){f&&(s="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,s,i),this.startSpan(Math.min(r,t.to),c)}while(t.nextSibling());t.parent()}}}function gge(e){let t=e.type.prop(KD);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ye=Fi.define,Rp=Ye(),_l=Ye(),VT=Ye(_l),WT=Ye(_l),kl=Ye(),jp=Ye(kl),L4=Ye(kl),jo=Ye(),Bc=Ye(jo),Mo=Ye(),No=Ye(),Vx=Ye(),uf=Ye(Vx),Lp=Ye(),Ze={comment:Rp,lineComment:Ye(Rp),blockComment:Ye(Rp),docComment:Ye(Rp),name:_l,variableName:Ye(_l),typeName:VT,tagName:Ye(VT),propertyName:WT,attributeName:Ye(WT),className:Ye(_l),labelName:Ye(_l),namespace:Ye(_l),macroName:Ye(_l),literal:kl,string:jp,docString:Ye(jp),character:Ye(jp),attributeValue:Ye(jp),number:L4,integer:Ye(L4),float:Ye(L4),bool:Ye(kl),regexp:Ye(kl),escape:Ye(kl),color:Ye(kl),url:Ye(kl),keyword:Mo,self:Ye(Mo),null:Ye(Mo),atom:Ye(Mo),unit:Ye(Mo),modifier:Ye(Mo),operatorKeyword:Ye(Mo),controlKeyword:Ye(Mo),definitionKeyword:Ye(Mo),moduleKeyword:Ye(Mo),operator:No,derefOperator:Ye(No),arithmeticOperator:Ye(No),logicOperator:Ye(No),bitwiseOperator:Ye(No),compareOperator:Ye(No),updateOperator:Ye(No),definitionOperator:Ye(No),typeOperator:Ye(No),controlOperator:Ye(No),punctuation:Vx,separator:Ye(Vx),bracket:uf,angleBracket:Ye(uf),squareBracket:Ye(uf),paren:Ye(uf),brace:Ye(uf),content:jo,heading:Bc,heading1:Ye(Bc),heading2:Ye(Bc),heading3:Ye(Bc),heading4:Ye(Bc),heading5:Ye(Bc),heading6:Ye(Bc),contentSeparator:Ye(jo),list:Ye(jo),quote:Ye(jo),emphasis:Ye(jo),strong:Ye(jo),link:Ye(jo),monospace:Ye(jo),strikethrough:Ye(jo),inserted:Ye(),deleted:Ye(),changed:Ye(),invalid:Ye(),meta:Lp,documentMeta:Ye(Lp),annotation:Ye(Lp),processingInstruction:Ye(Lp),definition:Fi.defineModifier("definition"),constant:Fi.defineModifier("constant"),function:Fi.defineModifier("function"),standard:Fi.defineModifier("standard"),local:Fi.defineModifier("local"),special:Fi.defineModifier("special")};for(let e in Ze){let t=Ze[e];t instanceof Fi&&(t.name=e)}YD([{tag:Ze.link,class:"tok-link"},{tag:Ze.heading,class:"tok-heading"},{tag:Ze.emphasis,class:"tok-emphasis"},{tag:Ze.strong,class:"tok-strong"},{tag:Ze.keyword,class:"tok-keyword"},{tag:Ze.atom,class:"tok-atom"},{tag:Ze.bool,class:"tok-bool"},{tag:Ze.url,class:"tok-url"},{tag:Ze.labelName,class:"tok-labelName"},{tag:Ze.inserted,class:"tok-inserted"},{tag:Ze.deleted,class:"tok-deleted"},{tag:Ze.literal,class:"tok-literal"},{tag:Ze.string,class:"tok-string"},{tag:Ze.number,class:"tok-number"},{tag:[Ze.regexp,Ze.escape,Ze.special(Ze.string)],class:"tok-string2"},{tag:Ze.variableName,class:"tok-variableName"},{tag:Ze.local(Ze.variableName),class:"tok-variableName tok-local"},{tag:Ze.definition(Ze.variableName),class:"tok-variableName tok-definition"},{tag:Ze.special(Ze.variableName),class:"tok-variableName2"},{tag:Ze.definition(Ze.propertyName),class:"tok-propertyName tok-definition"},{tag:Ze.typeName,class:"tok-typeName"},{tag:Ze.namespace,class:"tok-namespace"},{tag:Ze.className,class:"tok-className"},{tag:Ze.macroName,class:"tok-macroName"},{tag:Ze.propertyName,class:"tok-propertyName"},{tag:Ze.operator,class:"tok-operator"},{tag:Ze.comment,class:"tok-comment"},{tag:Ze.meta,class:"tok-meta"},{tag:Ze.invalid,class:"tok-invalid"},{tag:Ze.punctuation,class:"tok-punctuation"}]);var D4;const Af=new un,yge=new un;class Vo{constructor(t,n,r=[],s=""){this.data=t,this.name=s,kn.prototype.hasOwnProperty("tree")||Object.defineProperty(kn.prototype,"tree",{get(){return bo(this)}}),this.parser=n,this.extension=[mh.of(this),kn.languageData.of((i,o,a)=>{let l=GT(i,o,a),c=l.type.prop(Af);if(!c)return[];let u=i.facet(c),d=l.type.prop(yge);if(d){let f=l.resolve(o-l.from,a);for(let m of d)if(m.test(f,i)){let p=i.facet(m.facet);return m.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(t,n,r=-1){return GT(t,n,r).type.prop(Af)==this.data}findRegions(t){let n=t.facet(mh);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(Af)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(un.mounted);if(a){if(a.tree.prop(Af)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof cs&&s(c,i.positions[l]+o)}};return s(bo(t),0),r}get allowsNesting(){return!0}}Vo.setState=In.define();function GT(e,t,n){let r=e.facet(mh),s=bo(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,mr.ExcludeBuffers|mr.EnterBracketed))i.type.isTop&&(s=i);return s}function bo(e){let t=e.field(Vo.state,!1);return t?t.tree:cs.empty}class bge{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 df=null;class z1{constructor(t,n,r=[],s,i,o,a,l){this.parser=t,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new z1(t,n,[],cs.empty,0,r,[],null)}startParse(){return this.parser.startParse(new bge(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=cs.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(fu.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(fu.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=df;df=this;try{return t()}finally{df=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=KT(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,u,d,f)=>l.push({fromA:c,toA:u,fromB:d,toB:f})),r=fu.applyChanges(r,l),s=cs.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=t.mapPos(c.from,1),d=t.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new z1(this.parser,n,r,s,i,o,a,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<t.to&&i>t.from&&(this.fragments=KT(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 oge{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=df;if(l){for(let c of s)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new cs(ro.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return df}}function KT(e,t,n){return fu.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class fh{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 fh(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=z1.create(t.facet(mh).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new fh(r)}}Vo.state=ra.define({create:fh.init,update(e,t){for(let n of t.effects)if(n.is(Vo.setState))return n.value;return t.startState.facet(mh)!=t.state.facet(mh)?fh.init(t.state):e.apply(t)}});let XD=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(XD=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const O4=typeof navigator<"u"&&(!((D4=navigator.scheduling)===null||D4===void 0)&&D4.isInputPending)?()=>navigator.scheduling.isInputPending():null,wge=ii.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(Vo.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(Vo.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=XD(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(Vo.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!O4?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>O4&&O4()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Vo.setState.of(new fh(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>xi(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()}}}),mh=Et.define({combine(e){return e.length?e[0]:null},enables:e=>[Vo.state,wge,wt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),vge=Et.define(),K5=Et.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 $1(e){let t=e.facet(K5);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function q1(e,t){let n="",r=e.tabSize,s=e.facet(K5)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function QD(e,t){e instanceof kn&&(e=new Qy(e));for(let r of e.state.facet(vge)){let s=r(e,t);if(s!==void 0)return s}let n=bo(e.state);return n.length>=t?_ge(e,n,t):null}class Qy{constructor(t,n={}){this.state=t,this.options=n,this.unit=$1(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==t?{text:"",from:t}:(n<0?s<t:s<=t)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(t,n);return r.slice(t-s,Math.min(r.length,t+100-s))}column(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.countColumn(r,t-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(t,n=t.length){return bm(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const xge=new un;function _ge(e,t,n){let r=t.resolveStack(n),s=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return JD(r,e,n)}function JD(e,t,n){for(let r=e;r;r=r.next){let s=Sge(r.node);if(s)return s(Y5.create(t,n,r))}return 0}function kge(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Sge(e){let t=e.type.prop(xge);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(un.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>Ege(o,!0,1,void 0,i&&!kge(o)?s.from:void 0)}return e.parent==null?Tge:null}function Tge(){return 0}class Y5 extends Qy{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 Y5(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(Cge(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return JD(this.context.next,this.base,this.pos)}}function Cge(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Age(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=t.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function Ege(e,t,n,r,s){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==e.pos+o,l=Age(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}class Jy{constructor(t,n){this.specs=t;let r;function s(a){let l=uc.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof Vo?a=>a.prop(Af)==o.data:o?a=>a==o:void 0,this.style=YD(t.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new uc(r):null,this.themeType=n.themeType}static define(t,n){return new Jy(t,n||{})}}const Wx=Et.define(),ZD=Et.define({combine(e){return e.length?[e[0]]:null}});function B4(e){let t=e.facet(Wx);return t.length?t:e.facet(ZD)}function Mge(e,t){let n=[Ige],r;return e instanceof Jy&&(e.module&&n.push(wt.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(ZD.of(e)):r?n.push(Wx.computeN([wt.darkTheme],s=>s.facet(wt.darkTheme)==(r=="dark")?[e]:[])):n.push(Wx.of(e)),n}class Nge{constructor(t){this.markCache=Object.create(null),this.tree=bo(t.state),this.decorations=this.buildDeco(t,B4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=bo(t.state),r=B4(t.state),s=r!=B4(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return sn.none;let r=new ku;for(let{from:s,to:i}of t.visibleRanges)mge(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=sn.mark({class:l})))},s,i);return r.finish()}}const Ige=Bu.high(ii.fromClass(Nge,{decorations:e=>e.decorations})),Rge=Jy.define([{tag:Ze.meta,color:"#404740"},{tag:Ze.link,textDecoration:"underline"},{tag:Ze.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Ze.emphasis,fontStyle:"italic"},{tag:Ze.strong,fontWeight:"bold"},{tag:Ze.strikethrough,textDecoration:"line-through"},{tag:Ze.keyword,color:"#708"},{tag:[Ze.atom,Ze.bool,Ze.url,Ze.contentSeparator,Ze.labelName],color:"#219"},{tag:[Ze.literal,Ze.inserted],color:"#164"},{tag:[Ze.string,Ze.deleted],color:"#a11"},{tag:[Ze.regexp,Ze.escape,Ze.special(Ze.string)],color:"#e40"},{tag:Ze.definition(Ze.variableName),color:"#00f"},{tag:Ze.local(Ze.variableName),color:"#30a"},{tag:[Ze.typeName,Ze.namespace],color:"#085"},{tag:Ze.className,color:"#167"},{tag:[Ze.special(Ze.variableName),Ze.macroName],color:"#256"},{tag:Ze.definition(Ze.propertyName),color:"#00c"},{tag:Ze.comment,color:"#940"},{tag:Ze.invalid,color:"#f00"}]),jge=1e4,Lge="()[]{}",Dge=new un;function Gx(e,t,n){let r=e.prop(t<0?un.openedBy:un.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 Kx(e){let t=e.type.prop(Dge);return t?t(e.node):e}function Sd(e,t,n,r={}){let s=r.maxScanDistance||jge,i=r.brackets||Lge,o=bo(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=Gx(l.type,n,i);if(c&&l.from<l.to){let u=Kx(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return Oge(e,t,n,l,u,c,i)}}return Bge(e,t,n,o,a.type,s,i)}function Oge(e,t,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let d=Kx(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(Gx(u.type,n,o))c++;else if(Gx(u.type,-n,o)){if(c==0){let d=Kx(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 Bge(e,t,n,r,s,i,o){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let f=0;!u.next().done&&f<=i;){let m=u.value;n<0&&(f+=m.length);let p=t+f*n;for(let y=n>0?0:m.length-1,x=n>0?m.length:-1;y!=x;y+=n){let b=o.indexOf(m[y]);if(!(b<0||r.resolveInner(p+y,1).type!=s))if(b%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+y,to:p+y+1},matched:b>>1==l>>1};d--}}n>0&&(f+=m.length)}return u.done?{start:c,matched:!1}:null}const Pge=Object.create(null),YT=[ro.none],XT=[],QT=Object.create(null),zge=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"]])zge[e]=$ge(Pge,t);function P4(e,t){XT.indexOf(e)>-1||(XT.push(e),console.warn(t))}function $ge(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let u=e[c]||Ze[c];u?typeof u=="function"?l.length?l=l.map(u):P4(c,`Modifier ${c} used at start of tag`):l.length?P4(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:P4(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=QT[s];if(i)return i.id;let o=QT[s]=ro.define({id:YT.length,name:r,props:[hge({[r]:n})]});return YT.push(o),o.id}Yn.RTL,Yn.LTR;const qge=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Q5(e.state,n.from);return r.line?Fge(e):r.block?Hge(e):!1};function X5(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 Fge=X5(Gge,0),Uge=X5(eO,0),Hge=X5((e,t)=>eO(e,t,Wge(t)),0);function Q5(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const hf=50;function Vge(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-hf,r),o=e.sliceDoc(s,s+hf),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-t.length,c)==t&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,d;s-r<=2*hf?u=d=e.sliceDoc(r,s):(u=e.sliceDoc(r,r+hf),d=e.sliceDoc(s-hf,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 Wge(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 eO(e,t,n=t.selection.ranges){let r=n.map(i=>Q5(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>Vge(t,r[o],i.from,i.to));if(e!=2&&!s.every(i=>i))return{changes:t.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function Gge(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let d=t.doc.lineAt(u);if(c==null&&(c=Q5(t,d.from).line,!c))continue e;if(d.from>s&&(i==o||o>d.from)){s=d.from;let f=/^\s*/.exec(d.text)[0].length,m=f==d.length,p=d.text.slice(f,f+c.length)==c?f:-1;f<d.text.length&&f<l&&(l=f),r.push({line:d,comment:p,token:c,indent:f,empty:m,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(e!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&i.push({from:a.from+c,insert:l+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const Yx=nl.define(),Kge=nl.define(),Yge=Et.define(),tO=Et.define({combine(e){return Vy(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)})}}),nO=ra.define({create(){return Wo.empty},update(e,t){let n=t.state.facet(tO),r=t.annotation(Yx);if(r){let l=ti.fromTransaction(t,r.selection),c=r.side,u=c==0?e.undone:e.done;return l?u=F1(u,u.length,n.minDepth,l):u=oO(u,t.startState.selection),new Wo(c==0?r.rest:u,c==0?u:r.rest)}let s=t.annotation(Kge);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(zr.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=ti.fromTransaction(t),o=t.annotation(zr.time),a=t.annotation(zr.userEvent);return i?e=e.addChanges(i,o,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Wo(e.done.map(ti.fromJSON),e.undone.map(ti.fromJSON))}});function rO(e={}){return[nO,tO.of(e),wt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?sO:t.inputType=="historyRedo"?Xx:null;return r?(t.preventDefault(),r(n)):!1}})]}function Zy(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(nO,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const sO=Zy(0,!1),Xx=Zy(1,!1),Xge=Zy(0,!0),Qge=Zy(1,!0);class ti{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 ti(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 ti(t.changes&&Br.fromJSON(t.changes),[],t.mapped&&Yo.fromJSON(t.mapped),t.startSelection&&Oe.fromJSON(t.startSelection),t.selectionsAfter.map(Oe.fromJSON))}static fromTransaction(t,n){let r=Yi;for(let s of t.startState.facet(Yge)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new ti(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Yi)}static selection(t){return new ti(void 0,Yi,void 0,void 0,t)}}function F1(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 Jge(e,t){let n=[],r=!1;return e.iterChangedRanges((s,i)=>n.push(s,i)),t.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function Zge(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function iO(e,t){return e.length?t.length?e.concat(t):e:t}const Yi=[],e1e=200;function oO(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-e1e));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),F1(e,e.length-1,1e9,n.setSelAfter(r)))}else return[ti.selection([t])]}function t1e(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 z4(e,t){if(!e.length)return e;let n=e.length,r=Yi;for(;n;){let s=n1e(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?[ti.selection(r)]:Yi}function n1e(e,t,n){let r=iO(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):Yi,n);if(!e.changes)return ti.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new ti(s,In.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}const r1e=/^(input\.type|delete)($|\.)/;class Wo{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 Wo(this.done,this.undone):this}addChanges(t,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!r||r1e.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,Jge(a.changes,t.changes))||r=="input.type.compose")?o=F1(o,o.length-1,s.minDepth,new ti(t.changes.compose(a.changes),iO(In.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,Yi)):o=F1(o,o.length,s.minDepth,t),new Wo(o,Yi,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Yi;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Zge(i[i.length-1],t)?this:new Wo(oO(this.done,t),this.undone,n,r)}addMapping(t){return new Wo(z4(this.done,t),z4(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Yx.of({side:t,rest:t1e(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?Yi:s.slice(0,s.length-1);return i.mapped&&(a=z4(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Yx.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Wo.empty=new Wo(Yi,Yi);const aO=[{key:"Mod-z",run:sO,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Xx,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Xx,preventDefault:!0},{key:"Mod-u",run:Xge,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Qge,preventDefault:!0}];function Lh(e,t){return Oe.create(e.ranges.map(t),e.mainIndex)}function vo(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function xo({state:e,dispatch:t},n){let r=Lh(e.selection,n);return r.eq(e.selection,!0)?!1:(t(vo(e,r)),!0)}function eb(e,t){return Oe.cursor(t?e.to:e.from)}function lO(e,t){return xo(e,n=>n.empty?e.moveByChar(n,t):eb(n,t))}function Ss(e){return e.textDirectionAt(e.state.selection.main.head)==Yn.LTR}const cO=e=>lO(e,!Ss(e)),uO=e=>lO(e,Ss(e));function dO(e,t){return xo(e,n=>n.empty?e.moveByGroup(n,t):eb(n,t))}const s1e=e=>dO(e,!Ss(e)),i1e=e=>dO(e,Ss(e));function o1e(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 tb(e,t,n){let r=bo(e).resolveInner(t.head),s=n?un.closedBy:un.openedBy;for(let l=t.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;o1e(e,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?Sd(e,r.from,1):Sd(e,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Oe.cursor(a,n?-1:1)}const a1e=e=>xo(e,t=>tb(e.state,t,!Ss(e))),l1e=e=>xo(e,t=>tb(e.state,t,Ss(e)));function hO(e,t){return xo(e,n=>{if(!n.empty)return eb(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const fO=e=>hO(e,!1),mO=e=>hO(e,!0);function pO(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(wt.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function gO(e,t){let n=pO(e),{state:r}=e,s=Lh(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):eb(o,t));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=wt.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(vo(r,s),{effects:i}),!0}const JT=e=>gO(e,!1),Qx=e=>gO(e,!0);function xc(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&t.head!=r.from+i&&(s=Oe.cursor(r.from+i))}return s}const c1e=e=>xo(e,t=>xc(e,t,!0)),u1e=e=>xo(e,t=>xc(e,t,!1)),d1e=e=>xo(e,t=>xc(e,t,!Ss(e))),h1e=e=>xo(e,t=>xc(e,t,Ss(e))),f1e=e=>xo(e,t=>Oe.cursor(e.lineBlockAt(t.head).from,1)),m1e=e=>xo(e,t=>Oe.cursor(e.lineBlockAt(t.head).to,-1));function p1e(e,t,n){let r=!1,s=Lh(e.selection,i=>{let o=Sd(e,i.head,-1)||Sd(e,i.head,1)||i.head>0&&Sd(e,i.head-1,1)||i.head<e.doc.length&&Sd(e,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Oe.cursor(a)});return r?(t(vo(e,s)),!0):!1}const g1e=({state:e,dispatch:t})=>p1e(e,t);function so(e,t){let n=Lh(e.state.selection,r=>{let s=t(r);return Oe.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(vo(e.state,n)),!0)}function yO(e,t){return so(e,n=>e.moveByChar(n,t))}const bO=e=>yO(e,!Ss(e)),wO=e=>yO(e,Ss(e));function vO(e,t){return so(e,n=>e.moveByGroup(n,t))}const y1e=e=>vO(e,!Ss(e)),b1e=e=>vO(e,Ss(e)),w1e=e=>so(e,t=>tb(e.state,t,!Ss(e))),v1e=e=>so(e,t=>tb(e.state,t,Ss(e)));function xO(e,t){return so(e,n=>e.moveVertically(n,t))}const _O=e=>xO(e,!1),kO=e=>xO(e,!0);function SO(e,t){return so(e,n=>e.moveVertically(n,t,pO(e).height))}const ZT=e=>SO(e,!1),eC=e=>SO(e,!0),x1e=e=>so(e,t=>xc(e,t,!0)),_1e=e=>so(e,t=>xc(e,t,!1)),k1e=e=>so(e,t=>xc(e,t,!Ss(e))),S1e=e=>so(e,t=>xc(e,t,Ss(e))),T1e=e=>so(e,t=>Oe.cursor(e.lineBlockAt(t.head).from)),C1e=e=>so(e,t=>Oe.cursor(e.lineBlockAt(t.head).to)),tC=({state:e,dispatch:t})=>(t(vo(e,{anchor:0})),!0),nC=({state:e,dispatch:t})=>(t(vo(e,{anchor:e.doc.length})),!0),rC=({state:e,dispatch:t})=>(t(vo(e,{anchor:e.selection.main.anchor,head:0})),!0),sC=({state:e,dispatch:t})=>(t(vo(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),A1e=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),E1e=({state:e,dispatch:t})=>{let n=nb(e).map(({from:r,to:s})=>Oe.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Oe.create(n),userEvent:"select"})),!0},M1e=({state:e,dispatch:t})=>{let n=Lh(e.selection,r=>{let s=bo(e),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Oe.range(a.to,a.from)}return r});return n.eq(e.selection)?!1:(t(vo(e,n)),!0)};function TO(e,t){let{state:n}=e,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let a=i;;){let l=e.moveVertically(a,t);if(l.head<o.from||l.head>o.to){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(e.dispatch(vo(n,Oe.create(s,s.length-1))),!0)}const N1e=e=>TO(e,!1),I1e=e=>TO(e,!0),R1e=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Oe.create([n.main]):n.main.empty||(r=Oe.create([Oe.cursor(n.main.head)])),r?(t(vo(e,r)),!0):!1};function _m(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=t(i);l<o?(n="delete.backward",l=Dp(e,l,!1)):l>o&&(n="delete.forward",l=Dp(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Dp(e,o,!1),a=Dp(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Oe.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?wt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Dp(e,t,n){if(e instanceof wt)for(let r of e.state.facet(wt.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const CO=(e,t,n)=>_m(e,r=>{let s=r.from,{state:i}=e,o=i.doc.lineAt(s),a,l;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]=="	")return s-1;let c=bm(a,i.tabSize),u=c%$1(i)||$1(i);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)s--;l=s}else l=xs(o.text,s-o.from,t,t)+o.from,l==s&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=xs(o.text,l-o.from,!1,!1)+o.from);return l}),Jx=e=>CO(e,!1,!0),AO=e=>CO(e,!0,!1),EO=(e,t)=>_m(e,n=>{let r=n.head,{state:s}=e,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let l=xs(i.text,r-i.from,t)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),MO=e=>EO(e,!1),j1e=e=>EO(e,!0),L1e=e=>_m(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),D1e=e=>_m(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),O1e=e=>_m(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),B1e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:hn.of(["",""])},range:Oe.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},P1e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,i=e.doc.lineAt(s),o=s==i.from?s-1:xs(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:xs(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(s,a).append(e.doc.slice(o,s))},range:Oe.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function nb(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(r)}else t.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return t}function NO(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of nb(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let l of i.ranges)s.push(Oe.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)s.push(Oe.range(l.anchor-a,l.head-a))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Oe.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const z1e=({state:e,dispatch:t})=>NO(e,t,!1),$1e=({state:e,dispatch:t})=>NO(e,t,!0);function IO(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of nb(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 q1e=({state:e,dispatch:t})=>IO(e,t,!1),F1e=({state:e,dispatch:t})=>IO(e,t,!0),U1e=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(nb(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=Lh(t.selection,s=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(s.head),a=e.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,i)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function H1e(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=bo(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(un.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 iC=RO(!1),V1e=RO(!0);function RO(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:i,to:o}=s,a=t.doc.lineAt(i),l=!e&&i==o&&H1e(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new Qy(t,{simulateBreak:i,simulateDoubleBreak:!!l}),u=QD(c,i);for(u==null&&(u=bm(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let d=["",q1(t,u)];return l&&d.push(q1(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:hn.of(d)},range:Oe.cursor(i+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function J5(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=e.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(t(a,s,r),n=a.number),o=a.to+1}let i=e.changes(s);return{changes:s,range:Oe.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const W1e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Qy(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=J5(e,(i,o,a)=>{let l=QD(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=q1(e,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},G1e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(J5(e,(n,r)=>{r.push({from:n.from,insert:e.facet(K5)})}),{userEvent:"input.indent"})),!0),K1e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(J5(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=bm(s,e.tabSize),o=0,a=q1(e,Math.max(0,i-$1(e)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),Y1e=e=>(e.setTabFocusMode(),!0),X1e=[{key:"Ctrl-b",run:cO,shift:bO,preventDefault:!0},{key:"Ctrl-f",run:uO,shift:wO},{key:"Ctrl-p",run:fO,shift:_O},{key:"Ctrl-n",run:mO,shift:kO},{key:"Ctrl-a",run:f1e,shift:T1e},{key:"Ctrl-e",run:m1e,shift:C1e},{key:"Ctrl-d",run:AO},{key:"Ctrl-h",run:Jx},{key:"Ctrl-k",run:L1e},{key:"Ctrl-Alt-h",run:MO},{key:"Ctrl-o",run:B1e},{key:"Ctrl-t",run:P1e},{key:"Ctrl-v",run:Qx}],Q1e=[{key:"ArrowLeft",run:cO,shift:bO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:s1e,shift:y1e,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:d1e,shift:k1e,preventDefault:!0},{key:"ArrowRight",run:uO,shift:wO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:i1e,shift:b1e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:h1e,shift:S1e,preventDefault:!0},{key:"ArrowUp",run:fO,shift:_O,preventDefault:!0},{mac:"Cmd-ArrowUp",run:tC,shift:rC},{mac:"Ctrl-ArrowUp",run:JT,shift:ZT},{key:"ArrowDown",run:mO,shift:kO,preventDefault:!0},{mac:"Cmd-ArrowDown",run:nC,shift:sC},{mac:"Ctrl-ArrowDown",run:Qx,shift:eC},{key:"PageUp",run:JT,shift:ZT},{key:"PageDown",run:Qx,shift:eC},{key:"Home",run:u1e,shift:_1e,preventDefault:!0},{key:"Mod-Home",run:tC,shift:rC},{key:"End",run:c1e,shift:x1e,preventDefault:!0},{key:"Mod-End",run:nC,shift:sC},{key:"Enter",run:iC,shift:iC},{key:"Mod-a",run:A1e},{key:"Backspace",run:Jx,shift:Jx,preventDefault:!0},{key:"Delete",run:AO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:MO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:j1e,preventDefault:!0},{mac:"Mod-Backspace",run:D1e,preventDefault:!0},{mac:"Mod-Delete",run:O1e,preventDefault:!0}].concat(X1e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),jO=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:a1e,shift:w1e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:l1e,shift:v1e},{key:"Alt-ArrowUp",run:z1e},{key:"Shift-Alt-ArrowUp",run:q1e},{key:"Alt-ArrowDown",run:$1e},{key:"Shift-Alt-ArrowDown",run:F1e},{key:"Mod-Alt-ArrowUp",run:N1e},{key:"Mod-Alt-ArrowDown",run:I1e},{key:"Escape",run:R1e},{key:"Mod-Enter",run:V1e},{key:"Alt-l",mac:"Ctrl-l",run:E1e},{key:"Mod-i",run:M1e,preventDefault:!0},{key:"Mod-[",run:K1e},{key:"Mod-]",run:G1e},{key:"Mod-Alt-\\",run:W1e},{key:"Shift-Mod-k",run:U1e},{key:"Shift-Mod-\\",run:g1e},{key:"Mod-/",run:qge},{key:"Alt-A",run:Uge},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Y1e}].concat(Q1e);class LO{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=bo(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(DO(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 oC(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 J1e(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=oC(t)+oC(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Z1e(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:J1e(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class aC{constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function mu(e){return e.selection.main.from}function DO(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 OO=nl.define();function eye(e,t,n,r){let{main:s}=e.selection,i=n-s.from,o=r-s.from;return{...e.changeByRange(a=>{if(a!=s&&n!=r&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Oe.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const lC=new WeakMap;function tye(e){if(!Array.isArray(e))return e;let t=lC.get(e);return t||lC.set(e,t=Z1e(e)),t}const U1=In.define(),V0=In.define();class nye{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=xl(t,n),s=ad(r);this.chars.push(r);let i=t.slice(n,n+s),o=i.toUpperCase();this.folded.push(xl(o==i?i.toLowerCase():o,0)),n+=s}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let w=xl(t,0),v=ad(w),_=v==t.length?0:-100;if(w!=n[0])if(w==r[0])_+=-200;else return null;return this.ret(_,[0,v])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let w=0,v=Math.min(t.length,200);w<v&&c<l;){let _=xl(t,w);(_==n[c]||_==r[c])&&(s[c++]=w),w+=ad(_)}if(c<l)return null}let u=0,d=0,f=!1,m=0,p=-1,y=-1,x=/[a-z]/.test(t),b=!0;for(let w=0,v=Math.min(t.length,200),_=0;w<v&&d<l;){let S=xl(t,w);a<0&&(u<l&&S==n[u]&&(i[u++]=w),m<l&&(S==n[m]||S==r[m]?(m==0&&(p=w),y=w+1,m++):m=0));let C,E=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(C=T0e(S))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!w||E==1&&x||_==0&&E!=0)&&(n[d]==S||r[d]==S&&(f=!0)?o[d++]=w:o.length&&(b=!1)),_=E,w+=ad(S)}return d==l&&o[0]==0&&b?this.result(-100+(f?-200:0),o,t):m==l&&p==0?this.ret(-200-t.length+(y==t.length?0:-100),[0,y]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):m==l?this.ret(-900-t.length,[p,y]):d==l?this.result(-100+(f?-200:0)+-700+(b?0:-1100),o,t):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,t)}result(t,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?ad(xl(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(t-r.length,s)}}class rye{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 Kr=Et.define({combine(e){return Vy(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:sye,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=>cC(t(r),n(r)),optionClass:(t,n)=>r=>cC(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function cC(e,t){return e?t?e+" "+t:e:t}function sye(e,t,n,r,s,i){let o=e.textDirection==Yn.RTL,a=o,l=!1,c="top",u,d,f=t.left-s.left,m=s.right-t.right,p=r.right-r.left,y=r.bottom-r.top;if(a&&f<Math.min(p,m)?a=!1:!a&&m<Math.min(p,f)&&(a=!0),p<=(a?f:m))u=Math.max(s.top,Math.min(n.top,s.bottom-y))-t.top,d=Math.min(400,a?f:m);else{l=!0,d=Math.min(400,(o?t.right:s.right-t.left)-30);let w=s.bottom-t.bottom;w>=y||w>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let x=(t.bottom-t.top)/i.offsetHeight,b=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${u/x}px; max-width: ${d/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const Z5=In.define();function iye(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let u=i[c++],d=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(u,d))),f.className="cm-completionMatchedText",l=d}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),t.sort((n,r)=>n.position-r.position).map(n=>n.render)}function $4(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 oye{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=t.state.field(n),{options:i,selected:o}=s.open,a=t.state.facet(Kr);this.optionContent=iye(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=$4(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=t.state.field(n).open;for(let u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(t,c[+d[1]]),l.preventDefault();return}if(l.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;u!=null&&(t.dispatch({effects:Z5.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(Kr).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:V0.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=$4(i.length,o,t.state.facet(Kr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=$4(n.options.length,n.selected,this.view.state.facet(Kr).maxRenderedOptions),this.showOptions(n.options,t.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,s)}).catch(a=>xi(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:s,destroy:i}=t;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&lye(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=t.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(Kr).positionInfo(this.view,n,s,r,i,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=t[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(o>r.from||r.from==0))if(i=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let m=s.appendChild(document.createElement("completion-section"));m.textContent=f}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let d=this.optionClass(a);d&&(u.className=d);for(let f of this.optionContent){let m=f(a,this.view.state,this.view,l);m&&u.appendChild(m)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function aye(e,t){return n=>new oye(n,e,t)}function lye(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 uC(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function cye(e,t){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:d}=u.completion;if(d){r||(r=[]);let f=typeof d=="string"?d:d.name;r.some(m=>m.name==f)||r.push(typeof d=="string"?{name:f}:d)}},o=t.facet(Kr);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 aC(f,u.source,d?d(f):[],1e9-n.length));else{let f=t.sliceDoc(u.from,u.to),m,p=o.filterStrict?new rye(f):new nye(f);for(let y of u.result.options)if(m=p.match(y.label)){let x=y.displayLabel?d?d(y,m.matched):[]:m.matched,b=m.score+(y.boost||0);if(i(new aC(y,u.source,x,b)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:w}=y.section;s||(s=Object.create(null)),s[w]=Math.max(b,s[w]||-1e9)}}}}if(r){let u=Object.create(null),d=0,f=(m,p)=>(m.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(m.name<p.name?-1:1);for(let m of r.sort(f))d-=1e5,u[m.name]=d;for(let m of n){let{section:p}=m.completion;p&&(m.score+=u[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((d,f)=>f.score-d.score||c(d.completion,f.completion))){let d=u.completion;!l||l.label!=d.label||l.detail!=d.detail||l.type!=null&&d.type!=null&&l.type!=d.type||l.apply!=d.apply||l.boost!=d.boost?a.push(u):uC(u.completion)>uC(l)&&(a[a.length-1]=u),l=u.completion}return a}class Td{constructor(t,n,r,s,i,o){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Td(this.options,dC(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,s,i,o){if(s&&!o&&t.some(c=>c.isPending))return s.setDisabled();let a=cye(t,n);if(!a.length)return s&&t.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(Kr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new Td(a,dC(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:pye,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(t){return new Td(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Td(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class H1{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new H1(fye,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Kr),i=(r.override||n.languageDataAt("autocomplete",mu(n)).map(tye)).map(l=>(this.active.find(u=>u.source==l)||new Xi(l,this.active.some(u=>u.state!=0)?1:0)).update(t,r));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=t.effects.some(l=>l.is(e6));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!uye(i,this.active)||a?o=Td.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Xi(l.source,0):l));for(let l of t.effects)l.is(Z5)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new H1(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?dye:hye}}function uye(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 dye={"aria-autocomplete":"list"},hye={};function dC(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const fye=[];function BO(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(OO);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 Xi{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=BO(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new Xi(s.source,0)),r&4&&s.state==0&&(s=new Xi(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(U1))s=new Xi(s.source,1,i.value);else if(i.is(V0))s=new Xi(s.source,0);else if(i.is(e6))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(mu(t.state))}}class qd extends Xi{constructor(t,n,r,s,i,o){super(t,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let s=this.result;s.map&&!t.changes.empty&&(s=s.map(s,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=mu(t.state);if(a>o||!s||n&2&&(mu(t.startState)==this.from||a<this.limit))return new Xi(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return mye(s.validFor,t.state,i,o)?new qd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new LO(t.state,a,!1)))?new qd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:mu(t.state)):new Xi(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 qd(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Xi(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function mye(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):DO(e,!0).test(s)}const e6=In.define({map(e,t){return e.map(n=>n.map(t))}}),Ls=ra.define({create(){return H1.start()},update(e,t){return e.update(t)},provide:e=>[UD.from(e,t=>t.tooltip),wt.contentAttributes.from(e,t=>t.attrs)]});function t6(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Ls).active.find(s=>s.source==t.source);return r instanceof qd?(typeof n=="string"?e.dispatch({...eye(e.state,n,r.from,r.to),annotations:OO.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const pye=aye(Ls,t6);function zl(e,t="option"){return n=>{let r=n.state.field(Ls,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Kr).interactionDelay)return!1;let s=1,i;t=="page"&&(i=HD(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(e?1:-1):e?0:o-1;return a<0?a=t=="page"?0:o-1:a>=o&&(a=t=="page"?o-1:0),n.dispatch({effects:Z5.of(a)}),!0}}const PO=e=>{let t=e.state.field(Ls,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Kr).interactionDelay?!1:t6(e,t.open.options[t.open.selected])},Fd=e=>e.state.field(Ls,!1)?(e.dispatch({effects:U1.of(!0)}),!0):!1,vg=e=>{let t=e.state.field(Ls,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:V0.of(null)}),!0)};class gye{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const yye=50,bye=1e3,wye=ii.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(Ls).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ls),n=e.state.facet(Kr);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ls)==t)return;let r=e.transactions.some(i=>{let o=BO(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(r||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>yye&&Date.now()-o.time>bye){for(let a of o.context.abortListeners)try{a()}catch(l){xi(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(o=>o.is(U1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of e.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Ls);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(Kr).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=mu(t),r=new LO(t,n,e.explicit,this.view),s=new gye(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:V0.of(null)}),xi(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(Kr).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Kr),r=this.view.state.field(Ls);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=mu(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new qd(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){t.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Xi(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:e6.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ls,!1);if(t&&t.tooltip&&this.view.state.facet(Kr).closeOnBlur){let n=t.open&&HD(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:V0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:U1.of(!1)}),20),this.composing=0}}}),vye=typeof navigator=="object"&&/Win/.test(navigator.platform),xye=Bu.highest(wt.domEventHandlers({keydown(e,t){let n=t.state.field(Ls,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(vye&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&t6(t,r),!1}})),_ye=wt.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"}}}),zO=new class extends cc{};zO.startSide=1;zO.endSide=-1;function kye(e={}){return[xye,Ls,Kr.of(e),wye,Tye,_ye]}const Sye=[{key:"Ctrl-Space",run:Fd},{mac:"Alt-`",run:Fd},{mac:"Alt-i",run:Fd},{key:"Escape",run:vg},{key:"ArrowDown",run:zl(!0)},{key:"ArrowUp",run:zl(!1)},{key:"PageDown",run:zl(!0,"page")},{key:"PageUp",run:zl(!1,"page")},{key:"Enter",run:PO}],Tye=Bu.highest(F0.computeN([Kr],e=>e.facet(Kr).defaultKeymap?[Sye]:[]));function hi(e){let t=e.field(Ls,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const Cye=[qpe(),rO(),Rpe(),Mge(Rge,{fallback:!0}),F0.of([...jO,...aO])],W0=["custom","skill","system"];function Zx(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function Aye(e,t,n=W0){return hC(Zx(e),n)-hC(Zx(t),n)}function hC(e,t=W0){const n=t.indexOf(e);return n>=0?n:t.length+W0.indexOf(e)}const n6=String.raw`([^\s/]+)`,rb={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:"安装扩展"}]},sb={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"}]},ib={context:[{name:"detail",description:"显示详细上下文信息"}],copy:[{name:"code",description:"复制代码块"},{name:"latex",description:"复制 LaTeX 公式"},{name:"inline-latex",description:"复制行内 LaTeX 公式"}],tools:[{name:"desc",description:"显示工具详细描述"}],stats:[{name:"model",description:"显示各模型使用统计"},{name:"tools",description:"显示工具使用统计"}],mcp:[{name:"desc",description:"显示 MCP server 和工具描述"},{name:"nodesc",description:"隐藏 MCP server 和工具描述"},{name:"schema",description:"显示工具参数 schema"}],memory:[{name:"show",description:"查看 memory 文件"},{name:"add",description:"新增 memory"},{name:"refresh",description:"刷新 memory 文件列表"}]},ob={context:[{name:"detail",description:"Show detailed context info"}],copy:[{name:"code",description:"Copy code blocks"},{name:"latex",description:"Copy LaTeX formula"},{name:"inline-latex",description:"Copy inline LaTeX formula"}],tools:[{name:"desc",description:"Show tool descriptions"}],stats:[{name:"model",description:"Show per-model usage statistics"},{name:"tools",description:"Show tool usage statistics"}],mcp:[{name:"desc",description:"Show MCP server and tool descriptions"},{name:"nodesc",description:"Hide MCP server and tool descriptions"},{name:"schema",description:"Show tool parameter schemas"}],memory:[{name:"show",description:"Show memory files"},{name:"add",description:"Add memory"},{name:"refresh",description:"Refresh memory files"}]};function Eye(e,t,n,r,s){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(r==="zh-CN"?rb:sb)[e];if(o||(o=(r==="zh-CN"?ib:ob)[e]),!o&&t.length===0&&(s!=null&&s.length)&&(o=s.map(a=>({name:a,description:""}))),!o)return null;for(const a of t){const l=o.find(c=>c.name===a);if(!(l!=null&&l.children))return null;o=l.children}return o}function $O(e,t,n){const r=e.toLowerCase(),s=t.toLowerCase(),i=r.startsWith(n),o=s.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function Mye(e,t,n,r){const s=Aye(e,t,r);return s!==0?s:n?$O(e.name,t.name,n):0}const Nye={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function Iye(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 Rye(e,t,n){var c;const r=e.match(new RegExp(`^/${n6}\\s+$`));if(!r)return null;const s=r[1],i=t.find(u=>u.name===s),o=n==="zh-CN"?rb:sb;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[s]||s==="skills")return null;const l=(n==="zh-CN"?ib:ob)[s];return!l||l.length===0?null:`/${s} ${l[0].name} `}function jye(e,t,n){var u,d;const r=e.match(new RegExp(`^/${n6}(\\s*)$`));if(!r)return null;const s=r[1],i=t.find(f=>f.name===s);if(!i)return null;const o=(u=i.argumentHint)==null?void 0:u.trim();if(o)return o;const a=n==="zh-CN"?rb:sb;if((d=i.subcommands)!=null&&d.length||a[s]||s==="skills")return null;const c=(n==="zh-CN"?ib:ob)[s];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function Lye(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 Dye(e,t,n,r=[],s="en",i=a=>a,o=W0){var w,v;const{lineStart:a,lineEnd:l,lineText:c,textBefore:u,cursor:d}=Lye(e,t),f=u.match(new RegExp(`^/${n6}\\s+(.*)$`));if(f){const[,_,S]=f,C=n.find(L=>L.name===_),E=s==="zh-CN"?rb:sb,R=s==="zh-CN"?ib:ob,j=!!E[_]||_==="skills",N=!!R[_];if(!((w=C==null?void 0:C.subcommands)!=null&&w.length)&&!j&&!N)return null;const B=S.split(/\s+/),M=B.pop()||"",$=B;if(!((v=C==null?void 0:C.subcommands)!=null&&v.length)&&!j&&N&&!M)return null;const H=Eye(_,$,r,s,C==null?void 0:C.subcommands);if(!H)return null;const J=M.toLowerCase(),O=`/${_} ${$.length>0?$.join(" ")+" ":""}`,Y=H.filter(L=>!M||L.name.toLowerCase().includes(J)).sort((L,F)=>M?$O(L.name,F.name,J):0),G=_==="skills"&&$.length===0,ee=Y.map(L=>{const F=`${O}${L.name}`;return{id:F,label:L.name,detail:L.description||void 0,apply:`${F} `,...G?{type:"skill"}:{}}});return ee.length===0?null:{kind:"subcommand",from:a,to:d,query:M,items:ee}}const m=c.match(/^\/([^\s/]*)$/);if(!m)return null;const p=m[1],y=p.toLowerCase(),b=n.filter(_=>p?_.name.toLowerCase().includes(y):!0).sort((_,S)=>Mye(_,S,y,o)).map(_=>{const S=`/${_.name} `,C=Zx(_),E=C==="custom"||C==="skill";return{id:_.name,label:`/${_.name}`,detail:_.description||void 0,apply:S,category:C,section:i(Nye[C]),...E&&_.description?{type:"command-info"}:{}}});return b.length===0?null:{kind:"command",from:a,to:l,query:p,items:b}}function Oye(e,t=()=>{}){return n=>Bye(n,e,t)}function Bye(e,t,n=()=>{}){const r=e.state.doc.lineAt(e.pos),i=r.text.slice(0,e.pos-r.from).match(/@([\w./:-]*)$/);if(!i)return null;const o=i[1],a=e.pos-i[0].length,l=o.startsWith("ext:"),c=l?o.slice(4):o,u=l?void 0:t(),d=n();return Promise.all([zye(c,d),u?Pye(o,u):Promise.resolve([])]).then(([f,m])=>f.length===0&&m.length===0?null:{from:a,options:[...f.map(p=>({label:`@ext:${p.name}`,apply:`@ext:${p.name} `,detail:$ye(p),type:"keyword",section:"Extensions",boost:20})),...m.map(p=>({label:`@${p}`,apply:`@${p} `,type:"file",section:"Files"}))],filter:!1})}async function Pye(e,t){try{const n=e?`${e}*`:"**/*";return(await t(n,{maxResults:50})).matches.filter(s=>s!==".")}catch{return[]}}async function zye(e,t){if(!t)return[];try{const n=await t(),r=e.toLowerCase();return n.extensions.filter(s=>s.isActive).map(s=>({...s,displayName:fC(s.displayName??"")??void 0,description:fC(s.description??"")??void 0})).filter(s=>{var a;const i=s.name.toLowerCase(),o=((a=s.displayName)==null?void 0:a.toLowerCase())??"";return i.includes(r)||o.includes(r)}).sort((s,i)=>{const o=(s.displayName||s.name).toLowerCase(),a=(i.displayName||i.name).toLowerCase(),l=o.startsWith(r)?0:1,c=a.startsWith(r)?0:1;return l!==c?l-c:o.localeCompare(a)}).slice(0,50)}catch{return[]}}function $ye(e){const t=e.displayName&&e.displayName!==e.name?e.displayName:void 0;return t&&e.description?`${t} - ${e.description}`:t??e.description}const qye="\x1B",Fye=new RegExp(`${qye}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),Uye=/[‎‏؜⁦⁧⁨⁩‪‫‬‭‮]/g;function fC(e){const t=e.replace(Fye,"").replace(Uye,"").replace(/\s+/g," ").trim();return t.length>0?t:null}const Hye="qwen-web-shell-history",qO=100;function Vye(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 Wye(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-qO)))}catch{}}function mC(e=Hye){const t=g.useRef(e);t.current=e;const n=g.useRef(Vye(e)),r=g.useRef(-1),s=g.useRef(""),i=g.useRef(-1),[o,a]=g.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=g.useCallback(()=>{const w=n.current,v=r.current;a({canUp:w.length>0&&(v===-1||v>0),canDown:v!==-1})},[]),c=g.useCallback(w=>{const v=n.current;v[v.length-1]!==w&&(v.push(w),v.length>qO&&v.shift(),Wye(t.current,v),r.current=-1,l())},[l]),u=g.useCallback(w=>{const v=n.current;if(v.length===0)return null;if(r.current===-1)s.current=w,r.current=v.length-1;else if(r.current>0)r.current--;else return null;return l(),v[r.current]},[l]),d=g.useCallback(()=>{const w=n.current;return r.current===-1?null:r.current<w.length-1?(r.current++,l(),w[r.current]):(r.current=-1,l(),s.current)},[l]),f=g.useCallback(()=>r.current!==-1,[]),m=g.useCallback(()=>{r.current=-1,i.current=-1,l()},[l]),p=g.useCallback(w=>{const v=n.current;if(v.length===0||!w)return null;const _=i.current===-1?v.length-1:i.current-1;if(_<0)return i.current=-1,null;const S=w.toLowerCase();for(let C=_;C>=0;C--)if(v[C].toLowerCase().includes(S))return i.current=C,v[C];return i.current=-1,null},[]),y=g.useCallback(w=>{const v=w.trim().toLowerCase();return n.current.slice().reverse().filter(_=>!v||_.toLowerCase().includes(v))},[]),x=g.useCallback(w=>{const v=n.current;if(!w)return v.length>0?v[v.length-1]:null;for(let _=v.length-1;_>=0;_--)if(w(v[_]))return v[_];return null},[]),b=g.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:u,navigateDown:d,isNavigating:f,reset:m,searchReverse:p,getReverseMatches:y,getLastEntry:x,resetSearch:b,nav:o}}const Gye=sn.mark({class:"cm-input-slash"}),Kye=sn.mark({class:"cm-input-at"}),Yye=sn.mark({class:"cm-input-code"});class Xye extends sa{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 pC(e,t,n){const r=new ku,s=e.state.doc,i=[];for(let o=1;o<=s.lines;o++){const a=s.line(o),l=a.text,c=a.from;if(l.startsWith("/")){const p=l.indexOf(" "),y=p===-1?l.length:p;i.push({from:c,to:c+y,deco:Gye})}const u=jye(l,t(),n());if(u){const p=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:sn.widget({widget:new Xye(`${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:Kye});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:Yye})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:l}of i)r.add(o,a,l);return r.finish()}function Qye(e=()=>[],t=()=>"en"){return ii.fromClass(class{constructor(n){le(this,"decorations");this.decorations=pC(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=pC(n.view,e,t))}},{decorations:n=>n.decorations})}const Jye=wt.baseTheme({".cm-input-slash":{color:"var(--agent-blue-500, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--muted-foreground, #a0aec0)"},".cm-input-slash-argument-hint":{color:"color-mix(in srgb, var(--muted-foreground) 70%, transparent)",pointerEvents:"none"}}),Zye=1e3,ebe=10,gC="web-shell-tooltip-styles",tbe=`
[data-web-shell-tooltip-portal] {
  pointer-events: none;
}

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

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

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

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

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

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

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

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

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

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

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section {
  display: block !important;
  height: 0;
  margin: 6px 10px 3px;
  padding: 0 !important;
  border-bottom: 1px solid var(--border) !important;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left-narrow {
  right: var(--web-shell-completion-detail-start);
}
`;function nbe(){if(document.getElementById(gC))return;const e=document.createElement("style");e.id=gC,e.textContent=tbe,document.head.appendChild(e)}function rbe(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function sbe(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function r6(e){return sbe(e)}function ibe(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function obe(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function abe(e,t,n){if(!t.detail||!r6(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=`${ibe(t)}

${t.detail}`;const i=s.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete s.dataset.hideTimerId);const o=s.getBoundingClientRect(),a=18,l=12,c=12,u=window.innerWidth,d=window.innerHeight,f=n.clientX+a,m=f+o.width+c>u?Math.max(c,n.clientX-o.width-a):f,p=Math.min(Math.max(c,n.clientY+l),Math.max(c,d-o.height-c));s.style.position="fixed",s.style.left=`${m}px`,s.style.top=`${p}px`,s.style.right="auto",s.style.bottom="auto"}function lbe(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 cbe(e){if(!e.detail||!r6(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=>{abe(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&lbe(r)}))}),t}function ube(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function dbe(e){return[...e].length>Zye||e.split(`
`).length>ebe}function hbe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fbe(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 mbe(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function pbe(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(hbe).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function xg(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function gbe(e){return e.map(xg).join(`
`)}function s6(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function i6(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function FO(e){return i6(e)||s6(e)||e.id}function q4(e,t){const n=gbe(t);return n?e?`${n}

${e}`:n:e}const e3=In.define({map:e=>e}),o6=In.define(),Hc=In.define();class ybe extends sa{constructor(t){super(),this.tag=t}eq(t){return this.tag.id===t.tag.id&&this.tag.label===t.tag.label&&this.tag.value===t.tag.value&&this.tag.removable===t.tag.removable}toDOM(t){const n=document.createElement("span");n.style.cssText="display:inline-flex;align-items:center;max-width:min(44ch,100%);min-height:20px;margin:0 0.25ch;border:1px solid var(--border);border-radius:4px;background:var(--secondary);color:var(--foreground);font-family:var(--font-mono,monospace);font-size:12px;line-height:1.2;vertical-align:baseline;";const r=s6(this.tag),s=i6(this.tag);if(r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=r,n.appendChild(i)}if(s){const i=document.createElement("span");i.style.cssText="max-width:32ch;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 0.5ch;color:var(--muted-foreground);",i.textContent=s,n.appendChild(i)}else if(!r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=this.tag.id,n.appendChild(i)}if(this.tag.removable!==!1){const i=document.createElement("button");i.type="button",i.setAttribute("aria-label",`Remove ${FO(this.tag)}`),i.style.cssText="flex:0 0 auto;width:22px;height:22px;padding:0;border:0;background:transparent;color:var(--muted-foreground);font:inherit;line-height:22px;cursor:pointer;",i.textContent="×",i.addEventListener("mousedown",o=>o.preventDefault()),i.addEventListener("click",o=>{o.stopPropagation();const a=[];t.state.field(Cd).between(0,t.state.doc.length,(l,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&a.push({from:l,to:c,insert:""})}),a.length!==0&&(t.dispatch({changes:a,effects:o6.of({predicate:l=>l.id===this.tag.id}),scrollIntoView:!0}),t.focus())}),i.addEventListener("mouseenter",()=>{i.style.color="var(--error-color)"}),i.addEventListener("mouseleave",()=>{i.style.color="var(--muted-foreground)"}),n.appendChild(i)}return n}ignoreEvent(){return!1}}function bbe(e){const t={widget:new ybe(e.tag),inclusive:!1,tag:e.tag};return sn.replace(t).range(e.from,e.to)}const Cd=ra.define({create(){return sn.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is(e3)?n=n.update({add:[bbe(r.value)]}):r.is(o6)?n=n.update({filter:(s,i,o)=>{const a=o.spec.tag;return a&&r.value.predicate?!r.value.predicate(a):!0}}):r.is(Hc)&&(n=sn.none);return n},provide:e=>[wt.decorations.from(e),wt.atomicRanges.of(t=>t.state.field(e))]});function wbe(e){const t=[];return e.state.field(Cd).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push(i)}),t}const yC=new Pu,bC=new Pu,wC=new Pu;function Vc(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function vbe(e,t){const n=Vc(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class xbe extends sa{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 vC(e){return ii.fromClass(class{constructor(t){le(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return sn.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=vbe(r,e);return!s||!n.empty||n.head!==r.length?sn.none:sn.set([sn.widget({widget:new xbe(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}function xC(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 _be(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:r,disabled:s=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:u,currentMode:d="default",onFocusFooter:f,dialogOpen:m=!1,followupState:p,onAcceptFollowup:y,onDismissFollowup:x,sessionName:b,composerInput:w,composerInputVersion:v,editorTheme:_}=e,S=TN(),{language:C,t:E}=at(),R=g.useRef(null),j=g.useRef(null),N=g.useRef(t);N.current=t;const B=g.useRef(n);B.current=n;const M=g.useRef(r);M.current=r;const $=g.useRef(s);$.current=s;const H=g.useRef(o);H.current=o;const J=g.useRef(a);J.current=a;const O=g.useRef(l);O.current=l;const Y=g.useRef(E);Y.current=E;const G=g.useRef(c);G.current=c;const ee=g.useRef(u);ee.current=u;const L=g.useRef(p);L.current=p;const F=g.useRef(y);F.current=y;const P=g.useRef(x);P.current=x;const A=g.useRef(f);A.current=f;const ne=g.useRef(C);ne.current=C;const be=g.useRef(S==null?void 0:S.actions);be.current=S==null?void 0:S.actions;const[he,ye]=g.useState(!1),me=g.useRef(he);me.current=he;const se=g.useCallback(()=>{var Q,de,je;(Q=L.current)!=null&&Q.isVisible&&((de=P.current)==null||de.call(P)),ye(et=>!et),(je=j.current)==null||je.focus()},[]),[re,oe]=g.useState(!1),[ke,He]=g.useState(""),[Ve,ce]=g.useState([]),[xe,Me]=g.useState(0),Re=g.useRef(null),ct=g.useRef(null),Ct=g.useRef(""),[vt,Rt]=g.useState([]),Ke=g.useRef([]),pt=g.useRef(new Map),yt=g.useRef(1),[ae,V]=g.useState([]),ue=g.useRef([]);ue.current=ae;const Ne=g.useRef(w);Ne.current=w;const ut=g.useRef(()=>!0),ht=g.useRef(null),[ft,pe]=g.useState(null),Ae=g.useRef(null),te=g.useRef(!1),K=g.useCallback(Q=>{Ae.current=Q,pe(Q)},[]),ie=g.useCallback((Q,de)=>{var At;if(!Q||$.current||me.current){K(null);return}if(te.current){K(null);return}const je=Q.state.selection.main;if(!je.empty){K(null);return}const et=Dye(Q.state.doc.toString(),je.head,H.current,J.current,ne.current,tn=>Y.current(tn),O.current??W0);if(!et){K(null);return}const De=de??((At=Ae.current)==null?void 0:At.selectedIndex)??0,rt=Math.max(0,Math.min(De,et.items.length-1));K({...et,selectedIndex:rt})},[K]),fe=g.useCallback(()=>{K(null)},[K]),We=g.useCallback(Q=>{const de=Ae.current;return!de||Q<0||Q>=de.items.length?!1:(de.selectedIndex===Q||K({...de,selectedIndex:Q}),!0)},[K]),Mt=g.useCallback(Q=>{const de=Ae.current;if(!de)return!1;const je=rbe(de.selectedIndex,de.items.length,Q);return je===null?!1:(K({...de,selectedIndex:je}),!0)},[K]),_t=g.useCallback(Q=>{const de=j.current,je=Ae.current;if(!de||!je)return!1;const et=je.items[Q??je.selectedIndex];return et?(de.dispatch({changes:{from:je.from,to:je.to,insert:et.apply},selection:{anchor:je.from+et.apply.length},scrollIntoView:!0}),de.focus(),!0):!1},[]),[jn,ur]=g.useState(!1);g.useEffect(()=>{const Q=j.current,de=(Q==null?void 0:Q.state.doc.toString())??"",je=Vc(de,p!=null&&p.isVisible?p.suggestion:null);ur(de.trim().length>0||!!je||ae.length>0||vt.length>0)},[ae,vt,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]);const Xr=mC(),on=mC("qwen-web-shell-command-history"),{push:Be,navigateUp:gt,navigateDown:dn,isNavigating:Ts,reset:_o,getReverseMatches:rl,getLastEntry:_c,resetSearch:kc}=Xr,xn=g.useRef({push:Be,navigateUp:gt,navigateDown:dn,isNavigating:Ts,reset:_o,getReverseMatches:rl,getLastEntry:_c,resetSearch:kc});xn.current={push:Be,navigateUp:gt,navigateDown:dn,isNavigating:Ts,reset:_o,getReverseMatches:rl,getLastEntry:_c,resetSearch:kc};const Fn=g.useRef(on);Fn.current=on,Ke.current=vt;const Qr=g.useCallback(Q=>{const de=me.current,et=(de?Fn.current:xn.current).getReverseMatches(Q);return de?et:et.filter(De=>!De.trimStart().startsWith("/"))},[]),ds=g.useCallback(()=>{if($.current)return;const Q=j.current;if(!Q)return;fe();const de=Q.state.doc.toString();Ct.current=de,oe(!0),He("");const je=me.current?Fn.current:xn.current;ce(Qr("")),Me(0),je.resetSearch(),setTimeout(()=>{var et;return(et=Re.current)==null?void 0:et.focus()},0)},[fe,Qr]),ci=g.useRef(ds);ci.current=ds;const Xt=g.useCallback(()=>{if($.current)return;const Q=j.current;if(!Q)return;if(hi(Q.state)==="active"){zl(!1)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const de=me.current?Fn.current:xn.current,je=Q.state.doc.toString(),et=de.navigateUp(je);et!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:et},selection:{anchor:et.length}}),Q.focus()},[]),ui=g.useCallback(()=>{if($.current)return;const Q=j.current;if(!Q)return;if(hi(Q.state)==="active"){zl(!0)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const je=(me.current?Fn.current:xn.current).navigateDown();je!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:je},selection:{anchor:je.length}}),Q.focus()},[]);g.useEffect(()=>{var Tc,ol;if(!R.current)return;nbe();const Q=document.createElement("div");Q.setAttribute("data-web-shell-tooltip-portal",""),Q.style.position="fixed",Q.style.inset="0",Q.style.zIndex="var(--web-shell-tooltip-z-index)",Q.style.pointerEvents="none";const de=/\b\S*theme(?:Dark|Light)\S*/gi,je=()=>{var Nt,Bt;let Ee=R.current,St=null;if(R.current){const $t=getComputedStyle(R.current);for(let Kt=0;Kt<$t.length;Kt+=1){const _n=$t[Kt];_n.startsWith("--")&&Q.style.setProperty(_n,$t.getPropertyValue(_n))}$t.getPropertyValue("--web-shell-tooltip-z-index").trim()||Q.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;Ee;){const $t=(Bt=(Nt=Ee.className)==null?void 0:Nt.match)==null?void 0:Bt.call(Nt,de);if($t){St=$t[0];break}Ee=Ee.parentElement}St&&(Q.className=St)};je(),document.body.appendChild(Q);const et=new MutationObserver(je);let De=R.current;for(;De&&(et.observe(De,{attributes:!0,attributeFilter:["class","style"]}),!((ol=(Tc=De.className)==null?void 0:Tc.match)!=null&&ol.call(Tc,de)));)De=De.parentElement;const rt=(Ee,St,Nt)=>{var Cc,ua;const Bt=Ee.state.doc.toString(),$t=L.current,Kt=St===void 0&&($t!=null&&$t.isVisible)?Vc(Bt,$t.suggestion):null,_n=(St??Kt??Bt).trim(),yr=Nt??ue.current;if(!_n&&yr.length===0)return!0;const Cs=pbe(pt.current,_n),oo=q4(Cs,yr),al=Ke.current,ao=me.current;return N.current(ao?`!${oo}`:oo,al.length>0?[...al]:void 0)===!1||(K(null),Kt&&((Cc=F.current)==null||Cc.call(F,"enter",{skipOnAccept:!0})),(ua=P.current)==null||ua.call(P),pt.current.clear(),yt.current=1,ao?(Fn.current.push(Cs),Fn.current.reset()):(xn.current.push(Cs),xn.current.reset()),te.current=!1,V([]),Rt([]),Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:""},effects:Hc.of()})),!0};ut.current=rt;const At=[Oye(()=>{var Ee;return(Ee=be.current)==null?void 0:Ee.globWorkspace},()=>{var Ee;return(Ee=be.current)==null?void 0:Ee.loadExtensionsStatus})],tn=Ee=>(Ee.dispatch(Ee.state.replaceSelection(`
`)),!0),nn=(Ee,St)=>{var Kt;const Nt=L.current,Bt=Nt==null?void 0:Nt.suggestion,$t=Vc(Ee.state.doc.toString(),Bt);return!(Nt!=null&&Nt.isVisible)||!$t?!1:(Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:$t},selection:{anchor:$t.length},scrollIntoView:!0}),Ee.focus(),(Kt=F.current)==null||Kt.call(F,St,{skipOnAccept:!0}),!0)},Gt=F0.of([{key:"Backspace",run:Ee=>{var $t;const St=Ee.state.selection.main;if(!St.empty||St.from!==0)return!1;let Nt=!1;if(Ee.state.field(Cd).between(0,1,Kt=>{Kt===0&&(Nt=!0)}),Nt)return!1;let Bt=-1;for(let Kt=ue.current.length-1;Kt>=0;Kt-=1)if((($t=ue.current[Kt])==null?void 0:$t.removable)!==!1){Bt=Kt;break}return Bt<0?!1:(V(Kt=>Kt.filter((_n,yr)=>yr!==Bt)),!0)}},{key:"Delete",run:Ee=>{const St=Ee.state.selection.main;if(!St.empty||St.from!==0)return!1;let Nt=!1;if(Ee.state.field(Cd).between(0,1,$t=>{$t===0&&(Nt=!0)}),Nt)return!1;const Bt=ue.current.findIndex($t=>$t.removable!==!1);return Bt<0?!1:(V($t=>$t.filter((Kt,_n)=>_n!==Bt)),!0)}},{key:"Enter",run:Ee=>{var Bt;if(Ae.current)return _t();if(hi(Ee.state)==="active")return!1;const St=L.current,Nt=Vc(Ee.state.doc.toString(),St==null?void 0:St.suggestion);return St!=null&&St.isVisible&&Nt?((Bt=F.current)==null||Bt.call(F,"enter",{skipOnAccept:!0}),rt(Ee,Nt)):rt(Ee)}},{key:"Shift-Enter",run:tn},{key:"Ctrl-j",run:tn},{key:"Mod-Enter",run:tn},{key:"Alt-Enter",run:tn},{key:"Escape",run:()=>Ae.current?(fe(),!0):me.current?(ye(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:Ee=>{var _n;const St=me.current?Fn.current:xn.current;if(te.current)vg(Ee),fe();else{if(Mt("up"))return!0;if(hi(Ee.state)==="active")return zl(!1)(Ee)}const Bt=xC(Ee,"up");if(Bt==="handled")return!0;if(Bt==="editor")return!1;if(me.current){const yr=Ee.state.doc.toString(),Cs=St.navigateUp(yr);return Cs===null||(te.current=!0,Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:Cs},selection:{anchor:Cs.length}})),!0}if(G.current.length>0&&(_n=ee.current)!=null&&_n.call(ee))return!0;const $t=Ee.state.doc.toString(),Kt=St.navigateUp($t);return Kt===null?!1:(te.current=!0,Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:Kt},selection:{anchor:Kt.length}}),!0)}},{key:"ArrowDown",run:Ee=>{var Kt;const St=me.current?Fn.current:xn.current;if(te.current)vg(Ee),fe();else{if(Mt("down"))return!0;if(hi(Ee.state)==="active")return zl(!0)(Ee)}const Bt=xC(Ee,"down");if(Bt==="handled")return!0;if(Bt==="editor")return!1;if(me.current){const _n=St.navigateDown();return _n===null||(te.current=St.isNavigating(),Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:_n},selection:{anchor:_n.length}})),!0}const $t=St.navigateDown();return $t===null?((Kt=A.current)==null?void 0:Kt.call(A))??!1:(te.current=St.isNavigating(),Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:$t},selection:{anchor:$t.length}}),!0)}},{key:"Ctrl-r",run:()=>(ci.current(),!0)},{key:"Tab",run:Ee=>{if(nn(Ee,"tab"))return!0;if(Ae.current)return _t();if(hi(Ee.state)==="active")return PO(Ee);const St=Ee.state.doc.toString(),Nt=Rye(St,H.current,ne.current);if(Nt)return Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:Nt},selection:{anchor:Nt.length}}),!0;const Bt=Iye(St,H.current);return Bt&&Ee.dispatch({changes:{from:0,to:Ee.state.doc.length,insert:Bt},selection:{anchor:Bt.length}}),!0}},{key:"ArrowRight",run:Ee=>!!(hi(Ee.state)!=="active"&&nn(Ee,"right"))},{key:"Shift-Tab",run:()=>{var Ee;return(Ee=B.current)==null||Ee.call(B),!0}}]),fn=wt.updateListener.of(Ee=>{if(Ee.docChanged&&pt.current.size>0){const Nt=mbe(pt.current,Ee.state.doc.toString());Nt!==null&&(yt.current=Nt)}Ee.transactions.some(Nt=>Nt.isUserEvent("input")||Nt.isUserEvent("delete"))&&(te.current=!1),(Ee.docChanged||Ee.selectionSet)&&ie(Ee.view)});let fs=!1;const Rr=wt.updateListener.of(Ee=>{const St=ht.current,Nt=hi(Ee.state)==="active";if(St){const Bt=Ee.state.doc;if(!(Bt.length===St.from+St.text.length&&Bt.sliceString(St.from)===St.text))ht.current=null;else if(fs&&!Nt){ht.current=null;const{view:Kt}=Ee,{from:_n}=St;window.setTimeout(()=>{if(j.current!==Kt)return;const yr=Kt.state.doc;yr.length===_n+St.text.length&&yr.sliceString(_n)===St.text&&Kt.dispatch({changes:{from:_n,to:yr.length,insert:""}})},0)}}fs=Nt,Nt||obe(Q)}),jr=kn.create({doc:"",extensions:[Bu.highest(Gt),Cye,rO(),F0.of([...jO,...aO]),kye({override:At,activateOnTyping:!0,icons:!1,optionClass:Ee=>Ee.type==="file"?"cm-file-completion":r6(Ee)?"cm-command-info-completion":"",addToOptions:[{render:cbe,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(Ee,St,Nt,Bt,$t)=>{const Kt=Bt.bottom-Bt.top,_n=$t.bottom-St.bottom,yr=_n>=Kt||_n>St.top,Cs=yr?"top":"bottom",oo=yr?Nt.bottom-St.top:St.bottom-Nt.top;return{style:`${Cs}: ${oo}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:Ee=>typeof Ee.apply=="string"&&Ee.apply.endsWith(" ")}),Ype({parent:Q}),bC.of(zT("")),wC.of(vC(null)),wt.lineWrapping,yC.of(wt.editable.of(!0)),Qye(()=>H.current,()=>ne.current),Jye,Cd,fn,Rr,wt.updateListener.of(Ee=>{if(Ee.docChanged){const St=Ee.state.doc.toString(),Nt=L.current,Bt=Vc(St,Nt!=null&&Nt.isVisible?Nt.suggestion:null);ur(St.trim().length>0||!!Bt||ue.current.length>0||Ke.current.length>0)}}),wt.inputHandler.of((Ee,St,Nt,Bt)=>{var $t;return Bt==="!"&&Ee.state.doc.toString()===""&&hi(Ee.state)!=="active"?(se(),!0):Bt==="?"&&Ee.state.doc.toString()===""&&hi(Ee.state)!=="active"?(($t=M.current)==null||$t.call(M),!0):!1}),wt.domEventHandlers({blur(){return fe(),!1},paste(Ee){var yr,Cs,oo,al;const St=(yr=Ee.clipboardData)==null?void 0:yr.items;if(!St)return!1;let Nt=!1;for(const ao of St)if(ao.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(ao.type)){Nt=!0;const Fu=ao.getAsFile();if(!Fu)continue;const Cc=ao.type,ua=new FileReader;ua.onload=()=>{const km=ua.result.split(",")[1];Rt(Bh=>[...Bh,{data:km,media_type:Cc}])},ua.readAsDataURL(Fu)}if(Nt)return Ee.preventDefault(),!0;const Bt=ube(((Cs=Ee.clipboardData)==null?void 0:Cs.getData("text/plain"))??"");if(!Bt||!dbe(Bt))return!1;Ee.preventDefault(),Dn.state.doc.toString()===""&&((oo=L.current)!=null&&oo.isVisible)&&((al=P.current)==null||al.call(P));const{placeholderText:$t,nextPasteId:Kt}=fbe(pt.current,yt.current,Bt);yt.current=Kt;const _n=Dn.state.selection.main;return Dn.dispatch({changes:{from:_n.from,to:_n.to,insert:$t},selection:{anchor:_n.from+$t.length},scrollIntoView:!0}),!0}}),wt.theme(_)]}),Dn=new wt({state:jr,parent:R.current});j.current=Dn,Dn.focus();const dr=Dn.state.doc.toString().trim();return ur(dr.length>0||ue.current.length>0||Ke.current.length>0),()=>{Dn.destroy(),j.current=null,et.disconnect(),Q.remove()}},[]),g.useEffect(()=>{const Q=j.current;Q&&(Q.dispatch({effects:yC.reconfigure(wt.editable.of(!s))}),s||Q.focus())},[s]),g.useEffect(()=>{const Q=j.current;if(!Q)return;const de=!s&&(p!=null&&p.isVisible)&&p.suggestion?p.suggestion:null,je=de??(he?E("editor.shellPlaceholder"):i);Q.dispatch({effects:[bC.reconfigure(zT(je)),wC.reconfigure(vC(de))]})},[s,i,he,E,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]),g.useEffect(()=>{const Q=j.current;!Q||hi(Q.state)!=="active"||(vg(Q),window.setTimeout(()=>{j.current===Q&&Fd(Q)},0))},[C]);const Jr=[o.map(Q=>{var de;return[Q.name,Q.description??"",Q.source??"",Q.displayCategory??"",Q.argumentHint??"",((de=Q.subcommands)==null?void 0:de.join(","))??""].join("\0")}).join(""),a.map(Q=>[Q.name,Q.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");g.useEffect(()=>{Ae.current&&ie(j.current)},[Jr,C,ie]),g.useEffect(()=>{const Q=j.current;Q&&(m?(fe(),Q.contentDOM.blur()):Q.focus())},[m,fe]),g.useEffect(()=>{const Q=de=>{var Gt,fn,fs;if($.current||re||m||de.defaultPrevented)return;const je=de.target,et=(Gt=R.current)==null?void 0:Gt.contains(je),De=document.activeElement===document.body;if(!et&&!De)return;const rt=j.current,At=L.current,tn=Vc((rt==null?void 0:rt.state.doc.toString())??"",At==null?void 0:At.suggestion);if(rt&&!rt.hasFocus&&(At!=null&&At.isVisible)&&tn&&!j0(de.target)){if(de.key==="Tab"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&hi(rt.state)!=="active"){de.preventDefault(),rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:tn},selection:{anchor:tn.length},scrollIntoView:!0}),rt.focus(),(fn=F.current)==null||fn.call(F,"tab",{skipOnAccept:!0});return}if(de.key==="ArrowRight"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&hi(rt.state)!=="active"){de.preventDefault(),rt.dispatch({changes:{from:0,to:rt.state.doc.length,insert:tn},selection:{anchor:tn.length},scrollIntoView:!0}),rt.focus(),(fs=F.current)==null||fs.call(F,"right",{skipOnAccept:!0});return}}if(de.metaKey||de.ctrlKey||de.altKey||de.key.length!==1||j0(de.target)||!rt||rt.hasFocus)return;if(de.preventDefault(),de.key==="!"&&rt.state.doc.toString()===""){se();return}const nn=rt.state.selection.main;rt.dispatch({changes:{from:nn.from,to:nn.to,insert:de.key},selection:{anchor:nn.from+de.key.length},scrollIntoView:!0}),rt.focus(),de.key==="/"?window.setTimeout(()=>{ie(j.current)},0):de.key==="@"&&window.setTimeout(()=>{const Rr=j.current;Rr&&Rr.hasFocus&&Fd(Rr)},0)};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[re,m,ie,se]);const ia=g.useCallback(()=>{var Q;(Q=j.current)==null||Q.focus()},[]),Zr=g.useCallback((Q,de)=>{const je=j.current;if(!je||!Q){je==null||je.focus();return}if((de==null?void 0:de.mode)==="replace"){je.dispatch({changes:{from:0,to:je.state.doc.length,insert:Q},effects:Hc.of(),selection:{anchor:Q.length},scrollIntoView:!0}),je.focus();return}const et=je.state.selection.main;let De=Q,rt=!1,At=null;const tn=Q==="@";let nn=Q==="/";if(Q==="/")je.state.doc.lineAt(et.head).text.startsWith("/")?rt=!0:je.state.doc.length>0&&(rt=!0,nn=!1);else if(Q==="@"){const Gt=et.from>0?je.state.doc.sliceString(et.from-1,et.from):"";je.state.doc.sliceString(et.from,et.from+1)==="@"?(rt=!0,At=et.from+1):Gt==="@"?rt=!0:Gt&&!/\s/.test(Gt)&&(De=" @")}rt?At!==null&&je.dispatch({selection:{anchor:At},scrollIntoView:!0}):(je.dispatch({changes:{from:et.from,to:et.to,insert:De},selection:{anchor:et.from+De.length},scrollIntoView:!0}),tn&&(ht.current={text:De,from:et.from})),je.focus(),nn?window.setTimeout(()=>{ie(j.current)},0):tn&&window.setTimeout(()=>{const Gt=j.current;Gt&&Gt.hasFocus&&Fd(Gt)},0)},[ie]),hs=g.useCallback(()=>{var Q;return((Q=j.current)==null?void 0:Q.state.doc.toString())??""},[]),oa=g.useCallback(Q=>{const de=j.current;de&&(de.dispatch({changes:{from:0,to:de.state.doc.length,insert:Q},effects:Hc.of(),selection:{anchor:Q.length},scrollIntoView:!0}),de.focus())},[]),ji=g.useCallback(Q=>{const de=j.current;if(!de)return;const je=[];de.state.field(Cd).between(0,de.state.doc.length,(et,De,rt)=>{const At=rt.spec.tag;At&&(!Q||Q(At))&&je.push({from:et,to:De,insert:""})}),de.dispatch({...je.length>0?{changes:je}:{},effects:o6.of({predicate:Q}),scrollIntoView:!0})},[]),aa=g.useCallback(Q=>{const de=(Q==null?void 0:Q.text)??!0,je=(Q==null?void 0:Q.tags)??!0,et=j.current;de&&et&&et.state.doc.length>0&&et.dispatch({changes:{from:0,to:et.state.doc.length,insert:""},effects:Hc.of()}),de&&(Rt([]),pt.current.clear(),yt.current=1),je&&(V([]),de||ji())},[ji]),sl=g.useCallback(()=>{aa({text:!0,tags:!1})},[aa]),la=g.useCallback((Q,de)=>{if(Q.length!==0){if((de==null?void 0:de.placement)==="inline"){const je=j.current;if(!je)return;const et=je.state.selection.main;let De=et.from;const rt=[],At=Q.map(nn=>{const Gt=xg(nn);return rt.push({from:De,to:De+Gt.length,tag:nn}),De+=Gt.length+1,Gt}).join(" "),tn=At?`${At} `:"";je.dispatch({changes:{from:et.from,to:et.to,insert:tn},effects:rt.length>0?rt.map(nn=>e3.of(nn)):void 0,selection:{anchor:et.from+tn.length},scrollIntoView:!0}),je.focus();return}V(je=>{const et=[...je];for(const De of Q){const rt=et.findIndex(At=>At.id===De.id);rt>=0?et[rt]=De:et.push(De)}return et})}},[]),il=g.useCallback(Q=>{V(de=>de.filter(je=>je.id!==Q||je.removable===!1)),ji(de=>de.id===Q&&de.removable!==!1)},[ji]),Nr=g.useCallback(()=>{var Q;return(((Q=j.current)==null?void 0:Q.state.doc.toString().trim().length)??0)>0||ue.current.length>0||Ke.current.length>0},[]),Fs=g.useCallback(Q=>{const de=j.current;if(!de)return;const je=wbe(de);if((Q==null?void 0:Q.tagPlacement)==="inline"){ut.current(de,q4(Q.text??"",Q.tags??je),[]);return}if((Q==null?void 0:Q.text)!==void 0&&Q.tags===void 0&&je.length>0){ut.current(de,q4(Q.text,je),[]);return}ut.current(de,Q==null?void 0:Q.text,Q?Q.tags??[]:void 0)},[]),ca=g.useCallback(()=>{const Q=xn.current.getLastEntry(je=>!je.startsWith("/")&&!je.startsWith("!"));!Q||N.current(Q)===!1||Rt([])},[]),Ir=g.useCallback(Q=>{const de=j.current;de&&de.dispatch({changes:{from:0,to:de.state.doc.length,insert:Q},selection:{anchor:Q.length},scrollIntoView:!0})},[]);g.useEffect(()=>{const Q=Ne.current;if(!Q)return;const de=j.current;if(!de)return;const je=Q.tagPlacement??"top";if(Q.tags!==void 0&&je==="top"&&V([...Q.tags]),Q.text!==void 0||je==="inline"){const De=je==="inline"?[...Q.tags??[]]:[],rt=De.map(xg).join(" "),At=je==="inline"?rt&&Q.text?`${rt} ${Q.text}`:rt||(Q.text??""):Q.text??"",tn=[Hc.of()];if(De.length>0){let nn=0;for(const Gt of De){const fn=xg(Gt);tn.push(e3.of({from:nn,to:nn+fn.length,tag:Gt})),nn+=fn.length+1}}de.dispatch({changes:{from:0,to:de.state.doc.length,insert:At},effects:tn,selection:{anchor:At.length},scrollIntoView:!0})}else de.dispatch({effects:Hc.of()});(Q.text!==void 0||Q.submit)&&de.focus();let et=null;return Q.submit&&(et=window.setTimeout(()=>{j.current&&Fs(Q)},0)),()=>{et!==null&&window.clearTimeout(et)}},[v,Fs]);const di=g.useCallback((Q,de=!0)=>{var et;Q&&Ir(Ct.current),oe(!1),He(""),ce([]),Me(0),(me.current?Fn.current:xn.current).resetSearch(),de&&((et=j.current)==null||et.focus())},[Ir]);g.useEffect(()=>{if(!re)return;const Q=de=>{if(de instanceof MouseEvent&&de.button!==0||de.defaultPrevented)return;const je=ct.current,et=de.target;je&&et instanceof Node&&!je.contains(et)&&di(!0,!1)};return window.addEventListener("mousedown",Q),window.addEventListener("touchstart",Q),()=>{window.removeEventListener("mousedown",Q),window.removeEventListener("touchstart",Q)}},[re,di]);const zu=g.useCallback(Q=>{var At;if(!j.current)return;di(!1);const je=Q.trim();if(!je)return;const et=Ke.current,De=me.current;if(N.current(De?`!${je}`:je,et.length>0?[...et]:void 0)===!1){Ir(Q);return}(At=P.current)==null||At.call(P),De?(Fn.current.push(je),Fn.current.reset()):(xn.current.push(je),xn.current.reset()),Rt([]),Ir("")},[di,Ir]),Oh=Q=>{if(!Q.nativeEvent.isComposing)if(Q.key==="Escape")Q.preventDefault(),di(!0);else if(Q.key==="Tab"){Q.preventDefault();const de=Ve[xe];de&&Ir(de),di(!1)}else if(Q.key==="Enter"){Q.preventDefault();const de=Ve[xe];de?zu(de):di(!1)}else Q.key==="r"&&Q.ctrlKey&&(Q.preventDefault(),Ve.length>0&&Me(de=>(de+1)%Ve.length))},$u=Q=>{const de=me.current?Fn.current:xn.current;ce(Qr(Q)),Me(0),de.resetSearch()},qu=Q=>{const de=Q.target.value;He(de),!Q.nativeEvent.isComposing&&$u(de)},Ln=Q=>{const de=Q.currentTarget.value;He(de),$u(de)},Sn=g.useCallback(Q=>{Rt(de=>de.filter((je,et)=>et!==Q))},[]),io=!he&&!re&&!(p!=null&&p.isVisible)&&!s&&!m,Sc={clearText:sl,clear:aa,focus:ia,getText:hs,hasInput:Nr,setText:oa,addTags:la,removeTag:il,insertText:Zr,retryLast:ca,restoreImages:Q=>{Rt(de=>[...de,...Q])},submit:Fs};return{containerRef:R,viewRef:j,focus:ia,submitText:g.useCallback(()=>{const Q=j.current;Q&&ut.current(Q)},[]),clearText:sl,getText:hs,hasInput:Nr,hasContent:jn,handle:Sc,pastedImages:vt,removeImage:Sn,composerTags:ae,removeTopTag:il,addTags:la,removeInlineTags:ji,insertText:Zr,setText:oa,submit:Fs,clear:aa,retryLast:ca,replaceEditorText:Ir,shellMode:he,setShellMode:ye,toggleShellMode:se,currentMode:d,sessionName:b,searchState:{searchMode:re,searchQuery:ke,searchMatches:Ve,searchActiveIndex:xe,searchInputRef:Re,searchUiRef:ct,openHistorySearch:ds,closeSearch:di,submitSearchMatch:zu,handleSearchKeyDown:Oh,handleSearchInput:qu,handleSearchCompositionEnd:Ln},navigatePrevHistory:Xt,navigateNextHistory:ui,showShortcutHints:io,followupState:p,disabled:s,onAcceptFollowup:y,onDismissFollowup:x,slashMenu:ft,closeSlashMenu:fe,selectSlashCompletion:We,acceptSlashCompletion:_t}}const kbe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_46_02846'%3e%3crect%20x='-1.2000000476837158'%20y='-1.2000000476837158'%20width='18.40000009536743'%20height='18.40000009536743'%20rx='0'/%3e%3c/clipPath%3e%3cclipPath%20id='master_svg1_46_02850'%3e%3crect%20x='3.299999952316284'%20y='3.299999952316284'%20width='9.400000095367432'%20height='9.400000095367432'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_46_02846)'%3e%3cpath%20d='M2.40314639,2.758413L2.40292972,3.1950147L2.40178722,5.4973922L2.4000000999999997,8.3332543Q2.39999998,10.5420713,3.90192288,12.266657Q5.402200000000001,13.989353,8.1462374,14.904664L8.3362594,14.968048L8.526247999999999,14.904564Q11.2532721,13.993322,12.7668409,12.240547Q14.266665,10.5036879,14.266665,8.333632L14.266147,5.4975739L14.262505,2.7582424000000003L13.847304,2.6242929Q9.977867100000001,1.37595743,8.6663413,0.50089496L8.3334417,0.27878135000000004L8.0004754,0.5007948Q6.6891963,1.37512314,2.81864448,2.624314L2.40314639,2.758413ZM3.60271364,3.6308396L3.60178709,5.4979882L3.5999999000000003,8.3340111Q3.60000002,10.0927849,4.8068562,11.47856Q6.0415909,12.896347,8.3358369,13.701283Q10.6119351,12.899953,11.8586035,11.45626Q13.066666,10.0572739,13.066666,8.333632L13.066147,5.4977932L13.063664,3.6310089Q9.7833066,2.5506459,8.3332324,1.70592678Q6.8834386,2.5499707000000003,3.60271364,3.6308396Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3cg%20clip-path='url(%23master_svg1_46_02850)'%3e%3cg%20transform='matrix(0,-0.9999712705612183,0.9999712705612183,0,-4.155969887971878,15.343589294701815)'%3e%3cpath%20d='M4.74521804,9.75L5.16948596,10.1742641L7.3436494,12.3484278L9.5178127,10.1742641L9.9420805,9.75L9.0935488,8.90146804L8.669284600000001,9.32573596L7.3436494,10.65137106L6.0180141,9.3257359L5.59375,8.90146804L4.74521804,9.75Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3cline%20x1='8.299999952316284'%20y1='9.587499976158142'%20x2='11.362499952316284'%20y2='9.587499976158142'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%230A0A0B'%20fill='none'%20stroke-width='1.2000000476837158'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Sbe="/assets/default-aEtf0G7-.svg",UO="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='13.101718187332153'%20height='12.118681192398071'%20viewBox='0%200%2013.101718187332153%2012.118681192398071'%3e%3cpath%20d='M3.728619923841858,11.142287023841858L11.844652023841858,3.025579823841858L12.268880023841858,2.6013156238418578L9.419035523841858,-0.24852800615814208L0.8780930338418579,8.292414323841857L-0.27773314615814204,12.298048023841858L3.728619923841858,11.142287023841858ZM10.571859023841858,2.6013509238418577L3.098784523841858,10.075047123841857L1.4777333738418579,10.542690823841857L1.945311323841858,8.922252323841859L9.419035523841858,1.448528053841858L10.571859023841858,2.6013509238418577ZM5.901715423841858,12.118684023841858L6.501718123841858,12.118682023841858L12.501718023841859,12.118682023841858L13.101720023841859,12.118684023841858L13.101720023841859,10.918678023841858L12.501718023841859,10.918681023841858L6.501718123841858,10.918682023841859L5.901715423841858,10.918678023841858L5.901715423841858,12.118684023841858Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/svg%3e",Tbe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_26_21323'%3e%3crect%20x='-0.6000000238418579'%20y='-0.6000000238418579'%20width='17.200000047683716'%20height='17.200000047683716'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_26_21323)'%3e%3cpath%20d='M6,2.484801532279053L5.5757358,2.9090694522790526L3.3333334,5.151471992279053L2.42426407,4.242402732279053L2,3.818134902279053L1.1514680400000001,4.666666892279053L1.57573596,5.090930892279053L3.3333334,6.848528392279053L6.424264,3.7575975622790527L6.8485317,3.3333334922790527L6,2.484801532279053ZM8.0666642,4.600002992279053L8.666667,4.600000192279053L14,4.600000292279053L14.600002,4.600002992279053L14.600002,3.3999974132790527L14,3.4000001552790526L8.666667499999999,3.4000001922790526L8.0666642,3.3999974132790527L8.0666642,4.600002992279053ZM8.0666642,8.600003292279052L8.666667,8.600000392279053L14,8.600000892279052L14.600002,8.600003292279052L14.600002,7.399997692279053L14,7.400000592279053L8.666667499999999,7.400000592279053L8.0666642,7.399997692279053L8.0666642,8.600003292279052ZM6,9.151468792279053L5.5757358,9.575736492279052L3.3333335,11.818139592279053L2.42426419,10.909069992279052L2,10.484801292279052L1.15146798,11.333333492279053L1.57573584,11.757597492279054L3.3333334,13.515196492279053L6.424264,10.424265392279054L6.8485317,10.000000492279053L6,9.151468792279053ZM8.0666642,12.600003692279053L8.666667,12.600000892279052L14,12.600000892279052L14.600002,12.600003692279053L14.600002,11.399997192279052L14,11.400000092279052L8.666667499999999,11.400001092279053L8.0666642,11.399997192279052L8.0666642,12.600003692279053Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",Cbe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='11.86667275428772'%20height='14.535494089126587'%20viewBox='0%200%2011.86667275428772%2014.535494089126587'%3e%3cpath%20d='M5.933441723841858,-0.12121862615814205L5.600475423841858,0.1007948238418579Q4.289196323841858,0.9751231638418579,0.4186445038418579,2.224314023841858L0.0031464138418578758,2.358413023841858L0.0017872438418579106,5.097392223841858L1.2384185787972513e-7,7.933254323841858Q3.8418579428878274e-9,10.142071323841858,1.5019229038418578,11.866657023841858Q3.002200023841858,13.589353023841857,5.746237423841858,14.504664023841858L5.936259423841858,14.568048023841857L6.126248023841858,14.504564023841858Q8.853272123841858,13.593322023841857,10.366840923841858,11.840547023841857Q11.866665023841858,10.103687923841857,11.866665023841858,7.933632023841858L11.866147023841858,5.097573923841858L11.862505023841859,2.3582424238418582L11.447304023841857,2.224292923841858Q7.577867123841858,0.9759574538418578,6.266341323841858,0.10089498384185791L5.933441723841858,-0.12121862615814205ZM5.933233823841858,1.3059267438418578Q4.483438623841858,2.149970723841858,1.202713663841858,3.2308396238418577L1.2017871138418579,5.097988223841858L1.199999923841858,7.934011123841858Q1.2000000438418579,9.692784923841858,2.406856223841858,11.078560023841858Q3.641590923841858,12.496347023841858,5.935836923841858,13.301283023841858Q8.211935123841858,12.499953023841858,9.458603523841857,11.056260023841858Q10.666666023841858,9.657273923841858,10.666666023841858,7.933632023841858L10.666147023841859,5.097793223841858L10.663664023841857,3.231008923841858Q7.383306623841858,2.150645923841858,5.933233823841858,1.3059267438418578ZM5.333330723841858,4.000322923841858L5.333333623841858,4.600325723841858L5.333333623841858,7.266992223841858L5.333330723841858,7.866995023841858L6.533336323841858,7.866995023841858L6.533333423841858,7.266992223841858L6.533333923841858,4.600325723841858L6.533336323841858,4.000322923841858L5.333330723841858,4.000322923841858ZM5.333330723841858,10.533662423841857L5.933333523841858,10.533659623841858L5.940000223841858,10.533659623841858L6.5400029238418576,10.533662423841857L6.5400029238418576,9.333655923841858L5.940000223841858,9.333658823841859L5.933333523841858,9.333659723841858L5.333330723841858,9.333655923841858L5.333330723841858,10.533662423841857Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3c/svg%3e";function Ef(e,t){return{[e]:`url("${t}")`}}const Abe="_icon_i7y0u_1",Ebe={icon:Abe},Mbe={auto:kbe,"auto-edit":UO,default:Sbe,plan:Tbe,yolo:Cbe};function t3({mode:e}){const t=Mbe[e];return t?h.jsx("span",{className:Ebe.icon,style:Ef("--mode-icon-url",t),"aria-hidden":"true"}):h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M6 18c.7-2.7 2.2-4 4.5-4H12M7 6h10M7 10h7M17.5 14.5l2 2-2 2",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function V1(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const F4=16e3,Nbe=4096,_C=6e4;function Ibe(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 Rbe="qwen-bearer.",jbe="qwen-ws";function Lbe(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`${Rbe}${r}`}function Dbe(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 Obe(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 Bbe(e){const{baseUrl:t,token:n,onFinal:r,onError:s}=e,[i,o]=g.useState("idle"),[a,l]=g.useState(""),[c,u]=g.useState(0),[d,f]=g.useState(void 0),m=g.useRef({}),p=g.useRef(!0),y=g.useRef(0),x=g.useRef("idle"),b=g.useRef(r);b.current=r;const w=g.useRef(s);w.current=s;const v=g.useCallback(M=>{x.current=M,o(M)},[]),_=g.useCallback(()=>{const M=m.current;M.transcribeTimeout&&(clearTimeout(M.transcribeTimeout),M.transcribeTimeout=void 0)},[]),S=g.useCallback(()=>{var $;const M=m.current;M.processor&&(M.processor.onaudioprocess=null);for(const H of[M.processor,M.source,M.sink])try{H==null||H.disconnect()}catch{}($=M.stream)==null||$.getTracks().forEach(H=>H.stop()),M.context&&M.context.state!=="closed"&&M.context.close().catch(()=>{}),M.processor=void 0,M.sink=void 0,M.source=void 0,M.stream=void 0,M.context=void 0},[]),C=g.useCallback(()=>{y.current++,S();const M=m.current;if(_(),M.ws){try{M.ws.onmessage=null,M.ws.onerror=null,M.ws.onclose=null,M.ws.close()}catch{}M.ws=void 0}},[S,_]),E=g.useCallback((M,$)=>{var H;!p.current||$!==void 0&&y.current!==$||(C(),v("error"),l(""),u(0),f(M),(H=w.current)==null||H.call(w,M))},[C,v]),R=g.useCallback((M,$)=>{$!==void 0&&y.current!==$||(C(),p.current&&(v("idle"),l(""),u(0),b.current(M)))},[C,v]),j=g.useCallback(()=>{if(x.current!=="idle"&&x.current!=="error")return;f(void 0),l(""),v("connecting");const M=++y.current,$=()=>!p.current||y.current!==M;(async()=>{var H;try{if(!((H=navigator.mediaDevices)!=null&&H.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(F){throw new Error(Dbe(F))}if($()){J.getTracks().forEach(F=>F.stop());return}m.current.stream=J;const O=new AudioContext({sampleRate:F4});if(O.sampleRate!==F4)throw J.getTracks().forEach(F=>F.stop()),O.close().catch(()=>{}),new Error(`Browser audio rate ${O.sampleRate} Hz is not the required ${F4} Hz.`);if(m.current.context=O,O.state==="suspended"&&await O.resume(),$()){J.getTracks().forEach(F=>F.stop()),O.close().catch(()=>{});return}const Y=O.createMediaStreamSource(J),G=O.createScriptProcessor(Nbe,1,1),ee=O.createGain();ee.gain.value=0,m.current.source=Y,m.current.processor=G,m.current.sink=ee;const L=new WebSocket(Ibe(t),n?[jbe,Lbe(n)]:void 0);L.binaryType="arraybuffer",m.current.ws=L,G.onaudioprocess=F=>{const{pcm:P,level:A}=Obe(F.inputBuffer.getChannelData(0));p.current&&u(A),L.readyState===WebSocket.OPEN&&L.send(P)},L.onopen=()=>{if($()){G.onaudioprocess=null;for(const P of[G,Y,ee])try{P.disconnect()}catch{}J.getTracks().forEach(P=>P.stop()),O.state!=="closed"&&O.close().catch(()=>{});const F=m.current;F.ws===L&&(F.ws=void 0),F.processor===G&&(F.processor=void 0),F.source===Y&&(F.source=void 0),F.sink===ee&&(F.sink=void 0),F.stream===J&&(F.stream=void 0),F.context===O&&(F.context=void 0);try{L.close()}catch{}return}L.send(JSON.stringify({type:"start"})),Y.connect(G),G.connect(ee),ee.connect(O.destination),_(),m.current.transcribeTimeout=setTimeout(()=>{x.current==="recording"&&E("No response from server. Check that the voice model is running.",M)},_C),p.current&&v("recording")},L.onmessage=F=>{(x.current==="connecting"||x.current==="recording")&&_();let P;try{P=JSON.parse(String(F.data))}catch{return}P.type==="interim"?p.current&&l(P.text??""):P.type==="final"?R(P.text??"",M):P.type==="error"&&E(P.message??P.text??"Voice transcription failed.",M)},L.onerror=()=>{},L.onclose=F=>{if(p.current&&(x.current==="recording"||x.current==="connecting"||x.current==="transcribing")){const P=F.code||1006,A=F.reason||"none";E(`Voice connection closed (code=${P}, reason=${A}).`,M)}}}catch(J){E(J instanceof Error?J.message:String(J),M)}})()},[t,n,E,R,v,_]),N=g.useCallback(()=>{const M=m.current.ws;if(!M||M.readyState!==WebSocket.OPEN){C(),v("idle");return}S(),u(0),v("transcribing");const $=y.current;try{M.send(JSON.stringify({type:"stop"})),_(),m.current.transcribeTimeout=setTimeout(()=>{x.current==="transcribing"&&E("Transcription timed out.",$)},_C)}catch{E("Failed to finalize voice transcription.",$)}},[C,S,E,v,_]),B=g.useCallback(()=>{const M=m.current.ws;if(M&&M.readyState===WebSocket.OPEN)try{M.send(JSON.stringify({type:"abort"}))}catch{}C(),v("idle"),l(""),u(0)},[C,v]);return g.useEffect(()=>(p.current=!0,()=>{p.current=!1,C()}),[C]),{status:i,interimText:a,audioLevel:c,errorMessage:d,start:j,stop:N,abort:B}}const Pbe="_root_9hwm9_7",zbe="_iconBtn_9hwm9_14",$be="_error_9hwm9_47",qbe="_connecting_9hwm9_51",Fbe="_pill_9hwm9_56",Ube="_transcribing_9hwm9_75",Hbe="_recDot_9hwm9_79",Vbe="_wave_9hwm9_88",Wbe="_bar_9hwm9_95",Gbe="_time_9hwm9_103",Kbe="_stop_9hwm9_111",Ybe="_spinner_9hwm9_118",Xbe="_interim_9hwm9_128",ms={root:Pbe,iconBtn:zbe,error:$be,connecting:qbe,pill:Fbe,transcribing:Ube,recDot:Hbe,wave:Vbe,bar:Wbe,time:Gbe,stop:Kbe,spinner:Ybe,interim:Xbe},Qbe="voice_transcribe",kC=16,Jbe=()=>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"})]}),Zbe=()=>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 e2e(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function t2e({onInsert:e,disabled:t}){var N;const n=b_(),r=((N=n.capabilities)==null?void 0:N.features)??[],[s,i]=g.useState(void 0),{status:o,interimText:a,audioLevel:l,errorMessage:c,start:u,stop:d,abort:f}=Bbe({baseUrl:n.baseUrl,token:n.token,onFinal:B=>{const M=B.trim();M?(i(void 0),e(M)):i("No speech detected.")}}),m=o==="recording",[p,y]=g.useState(()=>new Array(kC).fill(0));g.useEffect(()=>{if(!m){y(new Array(kC).fill(0));return}y(B=>[...B.slice(1),Math.min(1,l*8)])},[l,m]);const[x,b]=g.useState(0);if(g.useEffect(()=>{if(!m){b(0);return}const B=performance.now(),M=setInterval(()=>b(performance.now()-B),200);return()=>clearInterval(M)},[m]),!r.includes(Qbe))return null;const w=o==="connecting",v=o==="transcribing",_=o==="error",S=!!s&&!_,C=m||w,E=m?"Stop dictation":v?"Transcribing…":w?"Starting…":_?`Voice error — click to retry${c?`: ${c}`:""}`:S?"No speech detected — click to retry":"Start voice dictation";let R;if(m)R=h.jsxs("button",{type:"button",className:ms.pill,onClick:()=>d(),"aria-label":E,title:E,children:[h.jsx("span",{className:ms.recDot,"aria-hidden":"true"}),h.jsx("span",{className:ms.wave,"aria-hidden":"true",children:p.map((B,M)=>h.jsx("span",{className:ms.bar,style:{height:`${2+Math.round(B*14)}px`}},M))}),h.jsx("span",{className:ms.time,children:e2e(x)}),h.jsx("span",{className:ms.stop,"aria-hidden":"true",children:h.jsx(Zbe,{})})]});else if(v)R=h.jsxs("span",{className:`${ms.pill} ${ms.transcribing}`,role:"status","aria-label":E,children:[h.jsx("span",{className:ms.spinner,"aria-hidden":"true"}),h.jsx("span",{className:ms.time,children:"…"})]});else{const B=[ms.iconBtn,_?ms.error:"",w?ms.connecting:""].filter(Boolean).join(" ");R=h.jsx("button",{type:"button",className:B,onClick:()=>{if(w)f();else{if(t)return;i(void 0),u()}},disabled:!!t&&!C,"aria-label":E,title:c??s??E,children:h.jsx(Jbe,{})})}const j=m&&a||_||S;return h.jsxs("span",{className:ms.root,children:[R,j&&h.jsx("span",{role:"status","aria-live":"polite",className:`${ms.interim}${_?` ${ms.error}`:""}`,children:_?c||"Voice error":S?s:a})]})}const n2e="_editorShell_1s403_1",r2e="_container_1s403_7",s2e="_content_1s403_22",i2e="_dacAura_1s403_35",o2e="_dacHalo_1s403_36",a2e="_slashPortalLayer_1s403_177",l2e="_slashPanel_1s403_181",c2e="_slashPanelBody_1s403_219",u2e="_slashList_1s403_225",d2e="_slashEntry_1s403_253",h2e="_slashSection_1s403_259",f2e="_slashItem_1s403_265",m2e="_slashItemActive_1s403_286",p2e="_slashCommand_1s403_290",g2e="_slashDetail_1s403_295",y2e="_slashDetailCommand_1s403_314",b2e="_slashDetailText_1s403_324",w2e="_slashDescription_1s403_344",v2e="_tags_1s403_373",x2e="_tag_1s403_373",_2e="_tagLabel_1s403_394",k2e="_tagValue_1s403_395",S2e="_tagRemove_1s403_413",T2e="_editorArea_1s403_433",C2e="_shellPrefix_1s403_448",A2e="_toolbar_1s403_485",E2e="_toolbarLeading_1s403_494",M2e="_toolbarStart_1s403_495",N2e="_toolbarEnd_1s403_496",I2e="_toolbarLeft_1s403_497",R2e="_toolbarRight_1s403_498",j2e="_toolbarRightCustom_1s403_526",L2e="_toolBtn_1s403_533",D2e="_toolBtnText_1s403_539",O2e="_dropdownWrapper_1s403_544",B2e="_dropdown_1s403_544",P2e="_dropdownRich_1s403_566",z2e="_dropdownCheck_1s403_572",$2e="_dropdownItem_1s403_578",q2e="_dropdownItemActive_1s403_616",F2e="_dropdownItemIcon_1s403_621",U2e="_dropdownItemCheck_1s403_622",H2e="_dropdownItemContent_1s403_639",V2e="_dropdownItemLabel_1s403_646",W2e="_dropdownItemDesc_1s403_656",G2e="_toolBtnIcon_1s403_714",K2e="_widthModeBtn_1s403_730",Y2e="_quickActionsBtn_1s403_739",X2e="_toolBtnModeIcon_1s403_748",Q2e="_toolBtnModelIcon_1s403_749",J2e="_toolBtnArrow_1s403_776",Z2e="_chevronDown_1s403_789",e4e="_quickActionsPanel_1s403_798",t4e="_quickActionsHeader_1s403_811",n4e="_quickActionsLayout_1s403_818",r4e="_quickActionsGrid_1s403_825",s4e="_quickAction_1s403_739",i4e="_quickActionLabel_1s403_856",o4e="_quickKeysGrid_1s403_871",a4e="_quickKey_1s403_871",l4e="_quickKeyLabel_1s403_900",c4e="_sendBtn_1s403_913",u4e="_sendBtnRunning_1s403_951",d4e="_sendIcon_1s403_964",h4e="_stopIcon_1s403_970",f4e="_srOnly_1s403_1046",m4e="_images_1s403_1068",p4e="_imageThumb_1s403_1075",g4e="_imageRemove_1s403_1090",y4e="_searchPanel_1s403_1111",b4e="_searchBar_1s403_1128",w4e="_searchLabel_1s403_1136",v4e="_searchInput_1s403_1141",x4e="_searchResults_1s403_1155",_4e="_searchResult_1s403_1155",k4e="_searchResultActive_1s403_1188",S4e="_searchResultMarker_1s403_1193",T4e="_searchResultText_1s403_1198",C4e="_searchEmpty_1s403_1205",qe={editorShell:n2e,container:r2e,content:s2e,dacAura:i2e,dacHalo:o2e,slashPortalLayer:a2e,slashPanel:l2e,slashPanelBody:c2e,slashList:u2e,slashEntry:d2e,slashSection:h2e,slashItem:f2e,slashItemActive:m2e,slashCommand:p2e,slashDetail:g2e,slashDetailCommand:y2e,slashDetailText:b2e,slashDescription:w2e,tags:v2e,tag:x2e,tagLabel:_2e,tagValue:k2e,tagRemove:S2e,editorArea:T2e,shellPrefix:C2e,toolbar:A2e,toolbarLeading:E2e,toolbarStart:M2e,toolbarEnd:N2e,toolbarLeft:I2e,toolbarRight:R2e,toolbarRightCustom:j2e,toolBtn:L2e,toolBtnText:D2e,dropdownWrapper:O2e,dropdown:B2e,dropdownRich:P2e,dropdownCheck:z2e,dropdownItem:$2e,dropdownItemActive:q2e,dropdownItemIcon:F2e,dropdownItemCheck:U2e,dropdownItemContent:H2e,dropdownItemLabel:V2e,dropdownItemDesc:W2e,toolBtnIcon:G2e,widthModeBtn:K2e,quickActionsBtn:Y2e,toolBtnModeIcon:X2e,toolBtnModelIcon:Q2e,toolBtnArrow:J2e,chevronDown:Z2e,quickActionsPanel:e4e,quickActionsHeader:t4e,quickActionsLayout:n4e,quickActionsGrid:r4e,quickAction:s4e,quickActionLabel:i4e,quickKeysGrid:o4e,quickKey:a4e,quickKeyLabel:l4e,sendBtn:c4e,sendBtnRunning:u4e,sendIcon:d4e,stopIcon:h4e,srOnly:f4e,images:m4e,imageThumb:p4e,imageRemove:g4e,searchPanel:y4e,searchBar:b4e,searchLabel:w4e,searchInput:v4e,searchResults:x4e,searchResult:_4e,searchResultActive:k4e,searchResultMarker:S4e,searchResultText:T4e,searchEmpty:C4e},A4e=["approvalMode","model","widthMode","voice"],E4e=new Set(A4e),M4e={"&":{fontSize:"14px",background:"transparent",border:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{maxHeight:"var(--chat-editor-input-max-height, 300px)",overflowX:"hidden",overflowY:"auto"},".cm-content":{padding:"0",fontFamily:"var(--font-sans, system-ui, sans-serif)",color:"var(--chat-editor-text-primary, #e0e0e0)",caretColor:"var(--chat-editor-accent-color, #4a9eff)",fontSize:"14px",lineHeight:"1.6"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--chat-editor-text-dimmed, #666)"},".cm-followup-ghost":{color:"var(--chat-editor-text-dimmed, #666)",opacity:"0.72",pointerEvents:"none",userSelect:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused .cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-cursor":{borderLeftColor:"var(--chat-editor-accent-color, #4a9eff)",borderLeftWidth:"2px"}};function SC(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}const N4e=["--chat-editor-accent-color","--accent","--background","--chat-editor-bg-tertiary","--chat-editor-border-color","--foreground","--font-mono","--font-sans","--muted-foreground","--chat-editor-text-primary","--chat-editor-text-secondary"];function I4e(){return h.jsx("svg",{className:qe.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:h.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function R4e(){return h.jsx("span",{className:qe.stopIcon,"aria-hidden":"true"})}function j4e(){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 L4e(e,t){let n,r,s,i,o=0,a=0;const l=(y,x)=>{e.style.setProperty("--dac-glow-on",y.toFixed(4)),e.style.setProperty("--dac-glow-pulse",x.toFixed(4))},c=y=>{n!==void 0&&window.cancelAnimationFrame(n);const x=o,b=y-x;if(Math.abs(b)<.001){o=y,l(y,a);return}const w=performance.now(),v=_=>{const S=Math.min((_-w)/220,1);o=x+b*(1-(1-S)**2),l(o,a),n=S<1?window.requestAnimationFrame(v):void 0};n=window.requestAnimationFrame(v)},u=()=>{r!==void 0&&window.cancelAnimationFrame(r);const y=a,x=performance.now(),b=w=>{const v=Math.min((w-x)/300,1);a=y*(1-v),l(o,a),r=v<1?window.requestAnimationFrame(b):void 0};r=window.requestAnimationFrame(b)},d=y=>{y?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},f=()=>c(1),m=()=>{c(0),d(!1),i!==void 0&&window.clearTimeout(i)},p=()=>{r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),a=1,l(o,1),s=window.setTimeout(u,100),d(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>d(!1),650)};return t.addEventListener("focus",f),t.addEventListener("blur",m),t.addEventListener("keydown",p),document.activeElement===t&&c(1),()=>{n!==void 0&&window.cancelAnimationFrame(n),r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",f),t.removeEventListener("blur",m),t.removeEventListener("keydown",p),l(0,0),d(!1)}}function D4e({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 TC(){return h.jsx("span",{className:qe.chevronDown,"aria-hidden":"true"})}function O4e(){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 B4e(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 P4e=[{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 z4e(){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 HO(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 $4e(e,t){return{plan:t("mode.listLabel.plan"),default:t("mode.listLabel.default"),"auto-edit":t("mode.listLabel.auto-edit"),auto:t("mode.listLabel.auto"),yolo:t("mode.listLabel.yolo")}[e]??HO(e,t)}function CC({open:e,items:t,activeId:n,onClose:r,onSelect:s,anchorRef:i,showCheck:o=!1,maxHeight:a}){const l=g.useRef(null);if(g.useEffect(()=>{if(!e)return;const d=f=>{if(f instanceof MouseEvent&&f.button!==0||f.defaultPrevented)return;const m=l.current,p=i.current,y=f.target;m&&y instanceof Node&&!m.contains(y)&&p&&!p.contains(y)&&r()};return window.addEventListener("mousedown",d),()=>window.removeEventListener("mousedown",d)},[e,r,i]),g.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),r())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,r]),!e)return null;const c=t.some(d=>d.description||d.icon),u=c||o;return h.jsx("div",{ref:l,className:`${qe.dropdown} ${c?qe.dropdownRich:o?qe.dropdownCheck:""}`,style:a?{maxHeight:a,overflowY:"auto"}:void 0,children:t.map(d=>h.jsx("button",{type:"button",className:`${qe.dropdownItem} ${d.id===n?qe.dropdownItemActive:""}`,onMouseDown:f=>{f.preventDefault(),s(d.id)},children:u?h.jsxs(h.Fragment,{children:[c&&h.jsx("span",{className:qe.dropdownItemIcon,children:d.icon}),h.jsxs("span",{className:qe.dropdownItemContent,children:[h.jsx("span",{className:qe.dropdownItemLabel,children:d.label}),d.description&&h.jsx("span",{className:qe.dropdownItemDesc,children:d.description})]}),h.jsx("span",{className:qe.dropdownItemCheck,children:d.id===n?h.jsx(z4e,{}):null})]}):d.label},d.id))})}function q4e({menu:e,anchorRef:t,panelRef:n,onSelect:r,onAccept:s}){const i=g.useRef([]),[o,a]=g.useState(null),[l,c]=g.useState({}),[u,d]=g.useState(null),f=g.useRef(null);g.useEffect(()=>{var _;(_=i.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),g.useLayoutEffect(()=>{const _=t.current;if(!_)return;const S=()=>{const E=_.getBoundingClientRect(),R=getComputedStyle(_),j=Object.fromEntries(N4e.map(N=>[N,R.getPropertyValue(N)]));a({left:Math.max(12,Math.min(E.left+16,window.innerWidth-252)),bottom:window.innerHeight-E.top+8,width:E.width}),c(j)};S();const C=new ResizeObserver(S);return C.observe(_),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{C.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[t,e.items]),g.useEffect(()=>{d(null)},[e.items]);const m=_=>Array.from(_).length,p=Math.max(...e.items.map(_=>m(_.label)),0),y=Math.max(...e.items.map(_=>m(_.detail??"")),0),x=y>0,b={"--slash-command-col":`${Math.min(Math.max(p+1,10),24)}ch`,"--slash-desc-col":x?`${Math.min(Math.max(y+1,18),36)}ch`:"0px","--slash-column-gap":x?"2ch":"0px"};let w;if(!o)return null;const v={...b,...l,left:o.left,bottom:o.bottom,"--slash-anchor-width":`${o.width}px`};return Q1.createPortal(h.jsxs("div",{ref:n,className:qe.slashPortalLayer,style:l,children:[h.jsx("div",{className:qe.slashPanel,style:v,role:"listbox",onMouseDown:_=>_.preventDefault(),onMouseLeave:_=>{var C;const S=_.relatedTarget;S instanceof Node&&((C=f.current)!=null&&C.contains(S))||d(null)},children:h.jsx("div",{className:qe.slashPanelBody,children:h.jsx("div",{className:qe.slashList,onScroll:()=>d(null),children:e.items.map((_,S)=>{const C=_.section,E=e.kind==="command"&&S>0&&C!==void 0&&C!==w;return w=C??w,h.jsxs("div",{className:qe.slashEntry,children:[E&&h.jsx("div",{className:qe.slashSection}),h.jsxs("button",{ref:R=>{i.current[S]=R},type:"button",role:"option","aria-selected":S===e.selectedIndex,className:`${qe.slashItem} ${S===e.selectedIndex?qe.slashItemActive:""}`,onMouseEnter:R=>{if(r(S),!_.detail){d(null);return}const j=R.currentTarget,N=8,B=180,M=j.getBoundingClientRect(),H=Math.min(M.left+Math.min(220,M.width*.34),window.innerWidth-320-12),J=window.innerHeight-M.bottom-N-12,O=M.top-N-12,Y=J>=96||J>=O,G=Math.max(72,Math.min(B,Y?J:O));d({label:_.label,detail:_.detail,left:Math.max(12,H),...Y?{top:M.bottom+N}:{bottom:window.innerHeight-M.top+N},maxHeight:G})},onMouseDown:R=>{R.preventDefault(),R.stopPropagation(),s(S)},children:[h.jsx("span",{className:qe.slashCommand,children:_.label}),_.detail&&h.jsx("span",{className:qe.slashDescription,children:_.detail})]})]},`${_.id}:${S}`)})})})}),u&&h.jsxs("div",{ref:f,className:qe.slashDetail,style:{...l,left:u.left,top:u.top,bottom:u.bottom,maxHeight:u.maxHeight},children:[h.jsx("div",{className:qe.slashDetailCommand,children:u.label}),h.jsx("div",{className:qe.slashDetailText,children:u.detail})]})]}),document.body)}function F4e({actions:e,onRun:t,onPressKey:n}){const{t:r}=at();return h.jsxs("div",{className:qe.quickActionsPanel,onMouseDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[h.jsx("div",{className:qe.quickActionsHeader,children:r("quickActions.title")}),h.jsxs("div",{className:qe.quickActionsLayout,children:[h.jsx("div",{className:qe.quickActionsGrid,children:e.map(s=>h.jsx("button",{type:"button",className:qe.quickAction,onClick:()=>t(s),children:h.jsx("span",{className:qe.quickActionLabel,children:s.label})},s.id))}),h.jsx("div",{className:qe.quickKeysGrid,children:P4e.map(s=>h.jsx("button",{type:"button",className:qe.quickKey,title:r(s.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(s),children:h.jsx("span",{className:qe.quickKeyLabel,children:s.label})},s.id))})]})]})}const U4e=g.memo(g.forwardRef(function(t,n){const{onSubmit:r,onCycleMode:s,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,cancelArmed:l=!1,disabled:c=!1,placeholderText:u="Type a message...",commands:d,skills:f=[],slashCommandCategoryOrder:m,queuedMessages:p=[],onPopQueuedMessages:y,currentMode:x="default",currentModel:b="",chatWidthMode:w="1000",showChatWidthToggle:v=!0,chatWidthToggleMin:_,visibleToolbarActions:S,availableModels:C=[],onSelectMode:E,onSelectModel:R,onChatWidthModeChange:j,onFocusFooter:N,dialogOpen:B=!1,followupState:M,onAcceptFollowup:$,onDismissFollowup:H,sessionName:J,composerInput:O,composerInputVersion:Y}=t,G=_be({onSubmit:r,onCycleMode:s,onToggleShortcuts:i,disabled:c,placeholderText:u,commands:d,skills:f,slashCommandCategoryOrder:m,queuedMessages:p,onPopQueuedMessages:y,currentMode:x,onFocusFooter:N,dialogOpen:B,followupState:M,onAcceptFollowup:$,onDismissFollowup:H,sessionName:J,composerInput:O,composerInputVersion:Y,editorTheme:M4e}),{t:ee}=at(),{renderComposerToolbarStart:L,renderComposerToolbarEnd:F,renderComposerToolbarRight:P}=bc();g.useImperativeHandle(n,()=>G.handle,[G.handle]);const[A,ne]=g.useState(!1),[be,he]=g.useState(!1),[ye,me]=g.useState(!1),[se,re]=g.useState(SC),oe=g.useRef(null),ke=g.useRef(null),He=g.useRef(null),Ve=g.useRef(null),[ce,xe]=g.useState(!1),Me=G.slashMenu,Re=G.closeSlashMenu,ct=G.viewRef;g.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Be=window.matchMedia("(hover: none), (pointer: coarse)"),gt=()=>re(SC());return gt(),Be.addEventListener("change",gt),()=>Be.removeEventListener("change",gt)},[]),g.useEffect(()=>{se||me(!1)},[se]),g.useEffect(()=>{if(!Me)return;const Be=gt=>{var _o;const dn=gt.target,Ts=oe.current;dn instanceof Node&&Ts&&!Ts.contains(dn)&&!((_o=ke.current)!=null&&_o.contains(dn))&&Re()};return window.addEventListener("mousedown",Be),window.addEventListener("touchstart",Be),()=>{window.removeEventListener("mousedown",Be),window.removeEventListener("touchstart",Be)}},[Me,Re]),g.useEffect(()=>{var dn;const Be=oe.current,gt=(dn=ct.current)==null?void 0:dn.contentDOM;if(!(!Be||!gt))return L4e(Be,gt)},[ct]),g.useEffect(()=>{const Be=oe.current,gt=_;if(!Be||gt===void 0){xe(!1);return}const dn=()=>{xe(Be.getBoundingClientRect().width>=gt-50)};dn();const Ts=new ResizeObserver(dn);return Ts.observe(Be),()=>Ts.disconnect()},[_]);const Ct=g.useMemo(()=>my.map(Be=>({id:Be,label:$4e(Be,ee),description:ee(`mode.desc.${Be}`),icon:h.jsx(t3,{mode:Be})})),[ee]),vt=g.useMemo(()=>{if(!S)return null;const Be=S.filter(gt=>E4e.has(gt));return new Set(Be)},[S]),Rt=Be=>vt?vt.has(Be):!0,Ke=g.useMemo(()=>new Set(d.map(Be=>Be.name.replace(/^\/+/,""))),[d]),pt=g.useCallback(Be=>Ke.has(Be),[Ke]),yt=g.useMemo(()=>[{id:"new",label:ee("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:ee("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:ee("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:ee("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:ee("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:ee("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:ee("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:ee("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:ee("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:ee("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:ee("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:ee("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:ee("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:ee("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:ee("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:ee("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:G.shellMode?ee("quickActions.exitShellMode"):ee("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:ee("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Be=>{const gt=B4e(Be);return!gt||pt(gt)}),[G.shellMode,pt,ee]),ae=g.useMemo(()=>C.map(Be=>({id:Be.id,label:V1(Be.label||Be.id)})),[C]),V=g.useCallback(Be=>{E==null||E(Be),ne(!1),G.focus()},[E,G]),ue=g.useCallback(Be=>{R==null||R(Be),he(!1),G.focus()},[R,G]),Ne=g.useCallback(Be=>{const gt=G.viewRef.current;gt&&(gt.focus(),gt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Be,bubbles:!0,cancelable:!0})))},[G]),ut=g.useCallback(Be=>{if(me(!1),ne(!1),he(!1),G.closeSlashMenu(),Be.action.type==="insert"){G.insertText(Be.action.text,{mode:"replace"});return}if(Be.action.type==="shell"){G.toggleShellMode();return}if(Be.action.type==="key"){Ne(Be.action.item.event);return}r(Be.action.command)},[G,Ne,r]),ht=g.useCallback(Be=>{Ne(Be.event),Be.id==="ctrl-r"&&me(!1)},[Ne]),{searchMode:ft,searchQuery:pe,searchMatches:Ae,searchActiveIndex:te,searchInputRef:K,searchUiRef:ie,closeSearch:fe,handleSearchKeyDown:We,handleSearchInput:Mt,handleSearchCompositionEnd:_t}=G.searchState,jn=Be=>{const gt=s6(Be),dn=i6(Be);return!gt&&!dn?h.jsx("span",{className:qe.tagLabel,children:Be.id}):h.jsxs(h.Fragment,{children:[gt&&h.jsx("span",{className:qe.tagLabel,children:gt}),dn&&h.jsx("span",{className:qe.tagValue,children:dn})]})},ur=HO(x,ee),Xr=V1(b),on=a&&!G.hasContent;return h.jsxs("div",{className:qe.editorShell,children:[h.jsxs("div",{ref:oe,className:qe.container,"data-dac-glow":!0,onClick:()=>{ne(!1),he(!1),me(!1),G.focus()},children:[h.jsx("div",{className:qe.dacAura,"aria-hidden":"true"}),h.jsx("div",{className:qe.dacHalo,"aria-hidden":"true"}),ft&&h.jsxs("div",{ref:ie,className:qe.searchPanel,onMouseDown:Be=>Be.stopPropagation(),onClick:Be=>Be.stopPropagation(),children:[h.jsxs("div",{className:qe.searchBar,children:[h.jsx("span",{className:qe.searchLabel,children:ee("editor.searchLabel")}),h.jsx("input",{ref:K,className:qe.searchInput,value:pe,onChange:Mt,onCompositionEnd:_t,onKeyDown:We,placeholder:ee("editor.searchPlaceholder")})]}),Ae.length>0&&h.jsx("div",{className:qe.searchResults,children:Ae.map((Be,gt)=>h.jsxs("button",{type:"button",className:`${qe.searchResult} ${gt===te?qe.searchResultActive:""}`,onMouseDown:dn=>{dn.preventDefault(),G.replaceEditorText(Be),fe(!1)},children:[h.jsx("span",{className:qe.searchResultMarker,children:gt===te?"›":""}),h.jsx("span",{className:qe.searchResultText,children:Be})]},`${Be}-${gt}`))}),Ae.length===0&&h.jsx("div",{className:qe.searchEmpty,children:ee("editor.noHistory")})]}),h.jsxs("div",{className:qe.content,children:[G.composerTags.length>0&&h.jsx("div",{className:qe.tags,children:G.composerTags.map(Be=>h.jsxs("span",{className:qe.tag,children:[jn(Be),Be.removable!==!1&&h.jsx("button",{type:"button",className:qe.tagRemove,"aria-label":`Remove ${FO(Be)}`,onMouseDown:gt=>gt.preventDefault(),onClick:gt=>{var dn;gt.stopPropagation(),G.removeTopTag(Be.id),(dn=G.viewRef.current)==null||dn.focus()},onKeyDown:gt=>{var dn;gt.key!=="Backspace"&&gt.key!=="Delete"||(gt.preventDefault(),G.removeTopTag(Be.id),(dn=G.viewRef.current)==null||dn.focus())},children:"×"})]},Be.id))}),G.pastedImages.length>0&&h.jsx("div",{className:qe.images,children:G.pastedImages.map((Be,gt)=>h.jsxs("div",{className:qe.imageThumb,children:[h.jsx("img",{src:`data:${Be.media_type};base64,${Be.data}`,alt:""}),h.jsx("button",{className:qe.imageRemove,onClick:dn=>{dn.stopPropagation(),G.removeImage(gt)},children:"×"})]},gt))}),G.slashMenu&&h.jsx(q4e,{menu:G.slashMenu,anchorRef:oe,panelRef:ke,onSelect:G.selectSlashCompletion,onAccept:G.acceptSlashCompletion}),h.jsxs("div",{className:qe.editorArea,children:[G.shellMode&&h.jsx("span",{className:qe.shellPrefix,"aria-hidden":"true",children:"!"}),h.jsx("div",{ref:G.containerRef})]}),h.jsxs("div",{className:qe.toolbar,children:[h.jsxs("div",{className:qe.toolbarLeading,children:[L&&h.jsx("div",{className:qe.toolbarStart,children:h.jsx(L,{disabled:c,isRunning:a,currentMode:x,currentModel:b,sessionName:J})}),h.jsxs("div",{className:qe.toolbarLeft,children:[Rt("approvalMode")&&h.jsxs("div",{className:qe.dropdownWrapper,children:[h.jsx(CC,{open:A,items:Ct,activeId:x,onClose:()=>ne(!1),onSelect:V,anchorRef:He}),h.jsxs("button",{ref:He,className:qe.toolBtn,onClick:Be=>{Be.stopPropagation(),G.closeSlashMenu(),me(!1),ne(gt=>!gt),he(!1)},"aria-label":ee("status.mode"),children:[h.jsx("span",{className:qe.toolBtnModeIcon,children:h.jsx(t3,{mode:x})}),h.jsx("span",{className:qe.toolBtnText,children:ur}),h.jsx("span",{className:qe.toolBtnArrow,children:h.jsx(TC,{})})]})]}),Rt("model")&&h.jsxs("div",{className:qe.dropdownWrapper,children:[h.jsx(CC,{open:be,items:ae,activeId:b,onClose:()=>he(!1),onSelect:ue,anchorRef:Ve,showCheck:!0,maxHeight:300}),h.jsxs("button",{ref:Ve,className:qe.toolBtn,onClick:Be=>{Be.stopPropagation(),G.closeSlashMenu(),me(!1),he(gt=>!gt),ne(!1)},"aria-label":ee("model.select"),children:[h.jsx("span",{className:qe.toolBtnModelIcon,children:h.jsx(O4e,{})}),h.jsx("span",{className:qe.toolBtnText,children:Xr}),h.jsx("span",{className:qe.toolBtnArrow,children:h.jsx(TC,{})})]})]}),F&&h.jsx("div",{className:qe.toolbarEnd,children:h.jsx(F,{disabled:c,isRunning:a,currentMode:x,currentModel:b,sessionName:J})})]})]}),h.jsxs("div",{className:qe.toolbarRight,children:[se&&yt.length>0&&h.jsx("button",{className:`${qe.toolBtn} ${qe.quickActionsBtn}`,onClick:Be=>{Be.stopPropagation(),G.closeSlashMenu(),ne(!1),he(!1),me(gt=>!gt)},"aria-expanded":ye,"aria-label":ee("quickActions.open"),title:ee("quickActions.open"),"data-tooltip":ee("quickActions.open"),children:h.jsx("span",{className:qe.toolBtnIcon,children:h.jsx(j4e,{})})}),P&&h.jsx("div",{className:qe.toolbarRightCustom,children:h.jsx(P,{disabled:c,isRunning:a,currentMode:x,currentModel:b,sessionName:J})}),v&&ce&&Rt("widthMode")&&h.jsx("button",{className:`${qe.toolBtn} ${qe.widthModeBtn}`,onClick:Be=>{Be.stopPropagation(),j==null||j(w==="wide"?"1000":"wide")},disabled:!j,"aria-label":ee(w==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:ee(w==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":ee(w==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:h.jsx("span",{className:qe.toolBtnIcon,children:h.jsx(D4e,{mode:w})})}),Rt("voice")&&h.jsx(t2e,{disabled:c,onInsert:Be=>{const gt=G.getText(),dn=gt&&!/\s$/.test(gt)?" ":"";G.insertText(`${dn}${Be} `),G.focus()}}),h.jsx("button",{className:on?`${qe.sendBtn} ${qe.sendBtnRunning}`:qe.sendBtn,disabled:on?!o:G.disabled||!G.hasContent,onClick:Be=>{if(Be.stopPropagation(),on){o==null||o();return}G.submitText()},"aria-label":ee(on?"stream.cancel":"editor.send"),children:on?h.jsx(R4e,{}):h.jsx(I4e,{})}),h.jsx("span",{role:"status","aria-live":"polite",className:qe.srOnly,children:a&&l?ee("stream.cancelArmed"):""})]})]})]})]}),se&&ye&&yt.length>0&&h.jsx(F4e,{actions:yt,onRun:ut,onPressKey:ht})]})})),H4e="_bar_agzxl_1",V4e="_left_agzxl_12",W4e="_right_agzxl_13",G4e="_settingsButton_agzxl_23",K4e="_modeButton_agzxl_49",Y4e="_modeHint_agzxl_62",X4e="_modeLabel_agzxl_67",Q4e="_modeDefault_agzxl_71",J4e="_modePlan_agzxl_75",Z4e="_modeAutoEdit_agzxl_79",ewe="_modeAuto_agzxl_79",twe="_modeYolo_agzxl_87",nwe="_shortcutsButton_agzxl_96",rwe="_modelButton_agzxl_114",swe="_model_agzxl_114",iwe="_contextButton_agzxl_138",owe="_context_agzxl_138",awe="_goal_agzxl_161",lwe="_separator_agzxl_167",cwe="_taskPill_agzxl_171",wr={bar:H4e,left:V4e,right:W4e,settingsButton:G4e,modeButton:K4e,modeHint:Y4e,modeLabel:X4e,modeDefault:Q4e,modePlan:J4e,modeAutoEdit:Z4e,modeAuto:ewe,modeYolo:twe,shortcutsButton:nwe,modelButton:rwe,model:swe,contextButton:iwe,context:owe,goal:awe,separator:lwe,taskPill:cwe},uwe=1e3;function dwe(e,t){switch(e){case"default":return{label:t("mode.default"),className:wr.modeDefault};case"plan":return{label:t("mode.plan"),className:wr.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:wr.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:wr.modeAuto};case"yolo":return{label:t("mode.yolo"),className:wr.modeYolo};default:return null}}function hwe(){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 U4(e,t,n,r){return r(e===1?t:n,{count:e})}function fwe(e,t){if(e.length===0)return"";const n=e.filter(s=>s.status==="running");if(n.length>0){const s={agent:0,shell:0,monitor:0};for(const o of n)s[o.kind]++;const i=[];return s.shell>0&&i.push(U4(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.agent>0&&i.push(U4(s.agent,"tasks.pill.agent","tasks.pill.agents",t)),s.monitor>0&&i.push(U4(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 mwe(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 pwe=g.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:r,onOpenSettings:s,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:c,onToggleShortcuts:u,compact:d=!1},f){const m=Xa(),p=m.status==="connected",y=m.currentModel??"",x=m.currentMode??"",b=m.tokenCount??0,w=m.contextWindow??0,{t:v}=at(),S=(w>0?b/w*100:0).toFixed(1),C=dwe(x,v),[,E]=g.useState(0),R=g.useRef(null);g.useEffect(()=>{if(!l)return;const O=setInterval(()=>E(Y=>(Y+1)%1e6),uwe);return()=>clearInterval(O)},[l]);const j=g.useMemo(()=>fwe(a,v),[a,v]),N=!d&&(p||!!C),B=l?mwe(Date.now()-l.setAt):"",M=l?`◎ ${v("goal.statusActive")}${B?` (${B})`:""}`:"",$=!!j||!d,H=!d&&!!y||!d&&w>0&&b>0||!!M;if(g.useImperativeHandle(f,()=>({focusTaskPill(){var O;return j?((O=R.current)==null||O.focus({preventScroll:!0}),!0):!1}}),[j]),!$&&!H)return null;const J=O=>{if(O.key==="Enter"||O.key==="ArrowDown"||O.key==="n"&&O.ctrlKey){O.preventDefault(),O.stopPropagation(),i==null||i();return}if(O.key==="ArrowUp"||O.key==="Escape"||O.key==="p"&&O.ctrlKey){O.preventDefault(),O.stopPropagation(),o==null||o();return}O.key.length===1&&!O.metaKey&&!O.ctrlKey&&!O.altKey&&(O.preventDefault(),O.stopPropagation(),o==null||o(O.key))};return h.jsxs("div",{className:wr.bar,children:[h.jsxs("div",{className:wr.left,children:[p&&!c&&!d&&h.jsx("button",{type:"button",className:wr.settingsButton,onClick:s,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),title:v("settings.title"),"aria-label":v("settings.title"),"aria-haspopup":"dialog",children:h.jsx(hwe,{})}),C&&!d&&h.jsxs("button",{type:"button",className:wr.modeButton,onClick:t,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),title:v("mode.select"),"aria-haspopup":"listbox",children:[h.jsx("span",{className:`${wr.modeLabel} ${C.className}`,children:C.label}),!d&&h.jsx("span",{className:wr.modeHint,children:v("status.modeHint")})]}),!d&&h.jsx(h.Fragment,{children:u?h.jsx("button",{type:"button",className:wr.shortcutsButton,onClick:u,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),"aria-haspopup":"dialog","aria-label":v("status.shortcuts"),children:v("status.shortcuts")}):h.jsx("span",{children:v("status.shortcuts")})}),j&&h.jsxs(h.Fragment,{children:[N&&h.jsx("span",{className:wr.separator,children:"·"}),h.jsx("button",{ref:R,type:"button",className:wr.taskPill,onClick:i,onKeyDown:J,disabled:!i,children:j})]})]}),h.jsxs("div",{className:wr.right,children:[!d&&y&&h.jsx("button",{type:"button",className:wr.modelButton,onClick:n,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),title:v("model.select"),"aria-haspopup":"listbox",children:h.jsx("span",{className:wr.model,children:y})}),!d&&w>0&&b>0&&h.jsx("button",{type:"button",className:wr.contextButton,onClick:r,title:v("contextUsage.title"),children:h.jsx("span",{className:wr.context,children:v("status.contextUsed",{pct:S})})}),M&&h.jsx("span",{className:wr.goal,title:l==null?void 0:l.condition,children:M})]})]})}),gwe=15e3,ywe=["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."],bwe=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function AC(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?bwe:ywe}function wwe(){const e=x_(),t=yy(),n=e!=="idle",r=g.useRef(0),s=g.useRef(0),[i,o]=g.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=g.useMemo(()=>{let c=0,u=0,d=!1;const f=new Set;let m=-1;for(let p=t.length-1;p>=0;p--)if(t[p].kind==="user"){m=p;break}for(let p=m+1;p<t.length;p++){const y=t[p];if(y.kind==="assistant"&&!y.parentToolCallId&&(c+=y.text.length,y.streaming&&(d=!0)),y.kind==="tool"&&!y.parentToolCallId){if(y.rawInput!==void 0)try{c+=JSON.stringify(y.rawInput).length}catch{}const x=vwe(y.rawOutput);x!==void 0&&!f.has(y.toolCallId)&&(u+=x,f.add(y.toolCallId))}}return{chars:c,agentTokens:u,isReceiving:d}},[t]),l=g.useRef(a);return l.current=a,a.chars<s.current&&(r.current=a.chars),s.current=a.chars,g.useEffect(()=>{if(!n){r.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:u,agentTokens:d,isReceiving:f}=l.current;if(u<r.current){r.current=u,o({estimatedOutputTokens:d+Math.round(u/4),isReceivingContent:f});return}const m=u-r.current;if(m<=0){o(x=>{const b={estimatedOutputTokens:d+Math.round(r.current/4),isReceivingContent:f};return x.estimatedOutputTokens===b.estimatedOutputTokens&&x.isReceivingContent===b.isReceivingContent?x:b});return}let p;m<70?p=3:m<=200?p=Math.max(3,Math.round(m*.2)):p=50;const y=Math.min(r.current+p,u);r.current=y,o({estimatedOutputTokens:d+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function vwe(e){if(typeof e!="object"||e===null||!("type"in e)||e.type!=="task_execution")return;const t=e,n=t.tokenCount;if(typeof n=="number"&&n>0)return n;const r=t.executionSummary;if(typeof r=="object"&&r!==null){const s=r.outputTokens;if(typeof s=="number"&&s>0)return s}}function xwe(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}const _we="_status_zld2v_1",kwe="_spinner_zld2v_11",Swe="_label_zld2v_15",Twe="_meta_zld2v_19",Op={status:_we,spinner:kwe,label:Swe,meta:Twe},H4=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Cwe({startedAt:e}){const t=x_(),{estimatedOutputTokens:n,isReceivingContent:r}=wwe(),{language:s,t:i}=at(),{loadingPhrases:o}=bc(),a=g.useRef(o);a.current=o;const l=g.useCallback(S=>{var C;try{return((C=a.current)==null?void 0:C.call(a,S))??AC(S)}catch(E){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",E),AC(S)}},[]),[c,u]=g.useState(0),d=g.useRef(Date.now()),[f,m]=g.useState(0),[p,y]=g.useState(()=>l(s)[0]??""),x=t!=="idle";if(g.useEffect(()=>{if(!x){u(0);return}d.current=e??Date.now(),u(EC(d.current));const S=setInterval(()=>{u(EC(d.current))},1e3);return()=>clearInterval(S)},[x,e]),g.useEffect(()=>{if(t==="idle"){y(l(s)[0]??"");return}const S=()=>{const E=l(s),R=Math.floor(Math.random()*E.length);y(E[R]??"")};S();const C=setInterval(S,gwe);return()=>clearInterval(C)},[s,t,l]),g.useEffect(()=>{if(t==="idle")return;const S=setInterval(()=>{m(C=>(C+1)%H4.length)},250);return()=>clearInterval(S)},[t]),t==="idle")return null;const b=H4[f%H4.length],w=r?"↓":"↑",v=c<60?`${c}s`:Awe(c*1e3),_=n>0?` · ${w} ${i("stream.tokens",{count:xwe(n)})}`:"";return h.jsxs("div",{className:Op.status,children:[h.jsx("span",{className:Op.spinner,children:b}),p&&h.jsx("span",{className:Op.label,children:p}),h.jsxs("span",{className:Op.meta,children:["(",v,_," · ",i("stream.cancel"),")"]})]})}function Awe(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 EC(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const Ewe="_host_1njbk_1",Mwe="_toast_1njbk_13",Nwe="_message_1njbk_31",Iwe="_close_1njbk_39",Rwe="_info_1njbk_58",jwe="_success_1njbk_66",Lwe="_warning_1njbk_74",Dwe="_error_1njbk_82",Mf={host:Ewe,toast:Mwe,message:Nwe,close:Iwe,info:Rwe,success:jwe,warning:Lwe,error:Dwe};function Owe({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:h.jsx("div",{className:Mf.host,role:"status","aria-live":"polite",children:e.map(r=>h.jsx(Bwe,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function Bwe({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=at();return g.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),h.jsxs("div",{className:`${Mf.toast} ${Mf[e.tone]}`,children:[h.jsx("div",{className:Mf.message,children:e.message}),h.jsx("button",{type:"button",className:Mf.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const Pwe="_panel_k9l9d_1",zwe="_summary_k9l9d_10",$we="_progressRing_k9l9d_27",qwe="_stepText_k9l9d_41",Fwe="_fullText_k9l9d_48",Uwe="_compactText_k9l9d_52",Hwe="_detail_k9l9d_71",Vwe="_item_k9l9d_103",Wwe="_icon_k9l9d_113",Gwe="_content_k9l9d_121",Kwe="_completed_k9l9d_129",Ywe="_inProgress_k9l9d_134",Xwe="_pending_k9l9d_140",mi={panel:Pwe,summary:zwe,progressRing:$we,stepText:qwe,fullText:Fwe,compactText:Uwe,detail:Hwe,item:Vwe,icon:Wwe,content:Gwe,completed:Kwe,inProgress:Ywe,pending:Xwe};function Qwe(e){switch(e){case"completed":return mi.completed;case"in_progress":return mi.inProgress;case"pending":return mi.pending}}const Jwe=g.memo(function({todos:t,title:n}){const{t:r}=at();if(t.length===0)return null;const s=t.length,i=t.findIndex(c=>c.status==="in_progress"),o=i>=0?i:t.findIndex(c=>c.status==="pending"),a=o>=0?o+1:s,l=s>0?a/s:0;return h.jsxs("section",{className:mi.panel,"aria-label":n??r("todo.title"),tabIndex:0,children:[h.jsxs("div",{className:mi.summary,"aria-label":r("todo.stepProgress",{current:a,total:s}),children:[h.jsx("span",{className:mi.progressRing,style:{"--todo-progress":String(l)},"aria-hidden":"true"}),h.jsxs("span",{className:mi.stepText,children:[h.jsx("span",{className:mi.fullText,children:r("todo.stepProgress",{current:a,total:s})}),h.jsx("span",{className:mi.compactText,children:r("todo.stepFraction",{current:a,total:s})})]})]}),h.jsx("div",{className:mi.detail,role:"tooltip",children:t.map((c,u)=>h.jsxs("div",{className:`${mi.item} ${Qwe(c.status)}`,children:[h.jsx("span",{className:mi.icon,"aria-hidden":"true",children:C1(c.status)}),h.jsx("span",{className:mi.content,title:c.content,children:c.content})]},`${c.id||u}:${c.content}`))})]})}),Zwe="_header_leiy3_1",eve="_titleRow_leiy3_11",tve="_title_leiy3_11",nve="_subtitle_leiy3_31",Bp={header:Zwe,titleRow:eve,title:tve,subtitle:nve};function rve(e){const{t}=at();return h.jsxs("div",{className:Bp.header,children:[h.jsxs("div",{className:Bp.titleRow,children:[h.jsx("span",{children:t("welcome.titlePrefix")}),h.jsx("span",{className:Bp.title,children:"Qwen Code"})]}),h.jsx("div",{className:Bp.subtitle,children:t("welcome.prompt")})]})}const sve="_list_j868d_1",ive="_row_j868d_10",ove="_selected_j868d_26",ave="_modeName_j868d_30",lve="_modeIcon_j868d_34",cve="_modeText_j868d_50",uve="_modeDesc_j868d_66",Pc={list:sve,row:ive,selected:ove,modeName:ave,modeIcon:lve,modeText:cve,modeDesc:uve};function dve({currentMode:e,onSelect:t}){const{t:n}=at(),r=g.useRef(null),s=my.map(o=>({id:o,name:n(`mode.listLabel.${o}`),description:n(`mode.desc.${o}`)})),i=s.findIndex(o=>o.id===e);return g.useEffect(()=>{var a;const o=(a=r.current)==null?void 0:a.children[i];o==null||o.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:Pc.list,ref:r,role:"listbox","aria-label":n("mode.select"),children:s.map(o=>{const a=o.id===e;return h.jsxs("button",{type:"button",role:"option","aria-selected":a,className:`${Pc.row} ${a?Pc.selected:""}`,onClick:()=>t(o.id),children:[h.jsx("span",{className:Pc.modeIcon,children:h.jsx(t3,{mode:o.id})}),h.jsxs("span",{className:Pc.modeText,children:[h.jsx("span",{className:Pc.modeName,children:o.name}),h.jsx("span",{className:Pc.modeDesc,children:o.description})]})]},o.id)})})}const hve="_selected_1hdqc_154",fve="_disabled_1hdqc_175",mve={"resume-picker":"_resume-picker_1hdqc_4","resume-picker-in-shell":"_resume-picker-in-shell_1hdqc_15","resume-picker-header":"_resume-picker-header_1hdqc_22","resume-picker-close":"_resume-picker-close_1hdqc_29","resume-picker-title":"_resume-picker-title_1hdqc_69","resume-picker-count":"_resume-picker-count_1hdqc_75","resume-picker-search":"_resume-picker-search_1hdqc_80","resume-picker-search-label":"_resume-picker-search-label_1hdqc_89","resume-picker-search-input":"_resume-picker-search-input_1hdqc_93","resume-picker-search-value":"_resume-picker-search-value_1hdqc_103","resume-picker-search-hint":"_resume-picker-search-hint_1hdqc_107","resume-picker-sep":"_resume-picker-sep_1hdqc_111","resume-picker-list":"_resume-picker-list_1hdqc_116","resume-picker-list-compact":"_resume-picker-list-compact_1hdqc_123","resume-picker-empty":"_resume-picker-empty_1hdqc_127","resume-picker-item":"_resume-picker-item_1hdqc_133","resume-picker-session-item":"_resume-picker-session-item_1hdqc_149",selected:hve,"resume-picker-item-current":"_resume-picker-item-current_1hdqc_162","resume-picker-keyboard-only":"_resume-picker-keyboard-only_1hdqc_167",disabled:fve,"resume-picker-item-row":"_resume-picker-item-row_1hdqc_180","resume-picker-item-prefix":"_resume-picker-item-prefix_1hdqc_189","resume-picker-item-title":"_resume-picker-item-title_1hdqc_199","resume-picker-item-checkbox":"_resume-picker-item-checkbox_1hdqc_212","resume-picker-item-number":"_resume-picker-item-number_1hdqc_224","resume-picker-item-provider":"_resume-picker-item-provider_1hdqc_232","resume-picker-item-meta":"_resume-picker-item-meta_1hdqc_245","resume-picker-item-detail":"_resume-picker-item-detail_1hdqc_253","resume-picker-item-check":"_resume-picker-item-check_1hdqc_212","resume-picker-item-badge":"_resume-picker-item-badge_1hdqc_269","tools-status-badge":"_tools-status-badge_1hdqc_278","tools-status-badge-enabled":"_tools-status-badge-enabled_1hdqc_289","tools-status-badge-disabled":"_tools-status-badge-disabled_1hdqc_293","tools-status-badge-busy":"_tools-status-badge-busy_1hdqc_297","tools-picker-item":"_tools-picker-item_1hdqc_301","tools-picker-item-expanded":"_tools-picker-item-expanded_1hdqc_312","tools-item-icon":"_tools-item-icon_1hdqc_316","tools-item-chevron":"_tools-item-chevron_1hdqc_348","tools-item-chevron-expanded":"_tools-item-chevron-expanded_1hdqc_360","tools-item-detail":"_tools-item-detail_1hdqc_364","mcp-status":"_mcp-status_1hdqc_369","mcp-status-connected":"_mcp-status-connected_1hdqc_373","mcp-status-connecting":"_mcp-status-connecting_1hdqc_377","mcp-status-disconnected":"_mcp-status-disconnected_1hdqc_381","mcp-status-disabled":"_mcp-status-disabled_1hdqc_385","mcp-status-unknown":"_mcp-status-unknown_1hdqc_386","resume-picker-detail-panel":"_resume-picker-detail-panel_1hdqc_389","resume-picker-detail-row":"_resume-picker-detail-row_1hdqc_399","resume-picker-detail-label":"_resume-picker-detail-label_1hdqc_406","resume-picker-detail-value":"_resume-picker-detail-value_1hdqc_411","dialog-inline-button":"_dialog-inline-button_1hdqc_416","dialog-primary-button":"_dialog-primary-button_1hdqc_417","dialog-danger-button":"_dialog-danger-button_1hdqc_418","dialog-inline-actions":"_dialog-inline-actions_1hdqc_441","dialog-footer-actions":"_dialog-footer-actions_1hdqc_447","dialog-form":"_dialog-form_1hdqc_465","dialog-form-row":"_dialog-form-row_1hdqc_493","dialog-textarea":"_dialog-textarea_1hdqc_499","dialog-split":"_dialog-split_1hdqc_504","dialog-split-list":"_dialog-split-list_1hdqc_511","tools-desc-expanded":"_tools-desc-expanded_1hdqc_515","tools-desc-body":"_tools-desc-body_1hdqc_525","extensions-toolbar":"_extensions-toolbar_1hdqc_532","extensions-row-button":"_extensions-row-button_1hdqc_536","extensions-detail":"_extensions-detail_1hdqc_551","extensions-detail-actions":"_extensions-detail-actions_1hdqc_562","extensions-detail-grid":"_extensions-detail-grid_1hdqc_569","extensions-detail-field":"_extensions-detail-field_1hdqc_575","extensions-detail-label":"_extensions-detail-label_1hdqc_582","extensions-detail-value":"_extensions-detail-value_1hdqc_588","extensions-confirm":"_extensions-confirm_1hdqc_595","dialog-detail":"_dialog-detail_1hdqc_605","dialog-detail-title":"_dialog-detail-title_1hdqc_613","dialog-detail-shortcut":"_dialog-detail-shortcut_1hdqc_621","dialog-detail-meta":"_dialog-detail-meta_1hdqc_628","dialog-detail-body":"_dialog-detail-body_1hdqc_633"};function ve(...e){return e.filter(t=>!!t).map(t=>mve[t]).filter(Boolean).join(" ")}function ab(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 pve({onSelect:e,onClose:t}){const{t:n}=at(),r=Xa(),{sessions:s,loading:i,error:o}=wy({autoLoad:!0}),a=r.sessionId,[l,c]=g.useState(0),[u,d]=g.useState(""),f=g.useRef(null),m=g.useRef(null),p=u?s.filter(y=>{const x=u.toLowerCase();return(y.displayName||"").toLowerCase().includes(x)||y.sessionId.toLowerCase().includes(x)}):s;return g.useEffect(()=>{l>=p.length&&p.length>0&&c(p.length-1)},[p.length,l]),g.useEffect(()=>{var x;const y=(x=f.current)==null?void 0:x.children[l];y==null||y.scrollIntoView({block:"nearest"})},[l]),g.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]),h.jsxs("div",{className:ve("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ve("resume-picker-search"),children:[h.jsxs("span",{className:ve("resume-picker-search-label"),children:[n("resume.search"),":"," "]}),h.jsx("input",{ref:m,className:ve("resume-picker-search-input"),value:u,onChange:y=>{d(y.target.value),c(0)},placeholder:""})]}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("resume-picker-list"),ref:f,children:[i&&h.jsx("div",{className:ve("resume-picker-empty"),children:n("common.loading")}),!i&&o&&h.jsx("div",{className:ve("resume-picker-empty"),children:o.message||"Failed to load sessions"}),!i&&!o&&p.length===0&&h.jsx("div",{className:ve("resume-picker-empty"),children:u?n("resume.noMatch",{query:u}):n("resume.none")}),!i&&p.map(y=>{const x=y.sessionId===a;return h.jsxs("div",{className:ve("resume-picker-item","resume-picker-session-item",x?"resume-picker-item-current":void 0),onClick:()=>{e(y.sessionId),t()},children:[h.jsxs("div",{className:ve("resume-picker-item-row"),children:[h.jsx("span",{className:ve("resume-picker-item-title"),children:y.displayName||y.sessionId.slice(0,8)}),x&&h.jsx("span",{className:ve("resume-picker-item-badge"),children:n("resume.current")})]}),h.jsxs("div",{className:ve("resume-picker-item-meta"),children:[h.jsx("span",{children:(y.updatedAt||y.createdAt)&&ab(y.updatedAt||y.createdAt||"",n)}),h.jsx("span",{className:ve("resume-picker-item-detail"),children:n("common.clients",{count:y.clientCount??0})}),y.hasActivePrompt&&h.jsx("span",{className:ve("resume-picker-item-detail"),children:n("resume.activePrompt")})]})]},y.sessionId)})]})]})}const gve="_themeDark_1qz6x_1",yve="_themeLight_1qz6x_20",bve="_backdrop_1qz6x_39",wve="_panel_1qz6x_59",vve="_sizeSm_1qz6x_71",xve="_sizeMd_1qz6x_75",_ve="_sizeLg_1qz6x_79",kve="_sizeXl_1qz6x_83",Sve="_header_1qz6x_87",Tve="_titleWrap_1qz6x_96",Cve="_title_1qz6x_96",Ave="_subtitle_1qz6x_108",Eve="_close_1qz6x_115",Mve="_body_1qz6x_154",Ys={themeDark:gve,themeLight:yve,backdrop:bve,panel:wve,sizeSm:vve,sizeMd:xve,sizeLg:_ve,sizeXl:kve,header:Sve,titleWrap:Tve,title:Cve,subtitle:Ave,close:Eve,body:Mve},Nve={sm:Ys.sizeSm,md:Ys.sizeMd,lg:Ys.sizeLg,xl:Ys.sizeXl};function ns({title:e,subtitle:t,size:n="md",onClose:r,children:s}){const{t:i}=at(),a=T_()===bs.Light?Ys.themeLight:Ys.themeDark,l=h.jsx("div",{className:`${Ys.backdrop} ${a}`,"data-keyboard-scope":!0,children:h.jsxs("section",{className:`${Ys.panel} ${Nve[n]}`,role:"dialog","aria-modal":"true","aria-label":e,children:[h.jsxs("header",{className:Ys.header,children:[h.jsxs("div",{className:Ys.titleWrap,children:[h.jsx("div",{className:Ys.title,children:e}),t&&h.jsx("div",{className:Ys.subtitle,children:t})]}),h.jsx("button",{type:"button",className:Ys.close,onClick:r,"aria-label":i("common.close"),title:i("common.close")})]}),h.jsx("div",{className:Ys.body,children:s})]})});return typeof document>"u"?l:Q1.createPortal(l,document.body)}const Ive="_layout_10a96_1",Rve="_list_10a96_9",jve="_row_10a96_17",Lve="_selected_10a96_33",Dve="_label_10a96_37",Ove="_divider_10a96_41",Bve="_number_10a96_48",Pve="_provider_10a96_54",zve="_badge_10a96_69",$ve="_detail_10a96_75",qve="_detailRow_10a96_87",Fve="_detailLabel_10a96_94",Uve="_detailValue_10a96_100",Hve="_empty_10a96_105",Gs={layout:Ive,list:Rve,row:jve,selected:Lve,label:Dve,divider:Ove,number:Bve,provider:Pve,badge:zve,detail:$ve,detailRow:qve,detailLabel:Fve,detailValue:Uve,empty:Hve};function Vve(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function Wve(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 MC(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function Gve(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function Kve(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function Yve(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function Pp({label:e,value:t}){return h.jsxs("div",{className:Gs.detailRow,children:[h.jsx("span",{className:Gs.detailLabel,children:e}),h.jsx("span",{className:Gs.detailValue,children:t})]})}function Xve({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=Xa(),i=r??s.currentModel??"",o=g.useMemo(()=>n??s.models??[],[n,s.models]),{t:a}=at(),l=g.useRef(null),c=e==="fast",u=e==="voice",d=o.findIndex(m=>m.id===i),f=d>=0?o[d]:o[0];return g.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:Gs.layout,children:[h.jsxs("div",{className:Gs.list,ref:l,role:"listbox","aria-label":a(c?"model.setFast":u?"model.setVoice":"model.select"),children:[o.length===0?h.jsx("div",{className:Gs.empty,children:a("model.none")}):null,o.map((m,p)=>{const y=m.id===i,x=MC(m);return h.jsxs("button",{type:"button",role:"option","aria-selected":y,className:`${Gs.row} ${y?Gs.selected:""}`,onClick:()=>t(Yve(m,c)),children:[h.jsxs("span",{className:Gs.number,children:[p+1,"."]}),x?h.jsxs("span",{className:Gs.provider,children:["[",x,"]"]}):null,h.jsx("span",{className:Gs.label,children:Gve(m)}),m.isRuntime?h.jsx("span",{className:Gs.badge,children:"Runtime"}):null]},Kve(m))})]}),f?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Gs.divider}),h.jsxs("div",{className:Gs.detail,children:[h.jsx(Pp,{label:a("model.modality"),value:Wve(f.modalities,a)}),h.jsx(Pp,{label:a("model.contextWindow"),value:Vve(f.contextWindow,a)}),MC(f)!=="qwen-oauth"?h.jsxs(h.Fragment,{children:[h.jsx(Pp,{label:a("model.baseUrl"),value:f.baseUrl??a("model.default")}),h.jsx(Pp,{label:a("model.apiKey"),value:f.envKey??a("model.notSet")})]}):null]})]}):null]})}function a6(e){return e.replace(/[：:\s]+$/u,"")}const Qve="_panel_irhhk_1",Jve="_embedded_irhhk_13",Zve="_footer_irhhk_21",exe="_titleLine_irhhk_25",txe="_icon_irhhk_32",nxe="_title_irhhk_25",rxe="_subtitle_irhhk_44",sxe="_text_irhhk_49",ixe="_options_irhhk_55",oxe="_option_irhhk_55",axe="_optionActive_irhhk_77",lxe="_optionLabel_irhhk_81",cxe="_optionIcon_irhhk_86",uxe="_optionContent_irhhk_119",dxe="_optionDesc_irhhk_129",hxe="_badge_irhhk_135",fxe="_toolDetail_irhhk_170",mxe="_toolDetailTitle_irhhk_175",pxe="_toolDetailBody_irhhk_180",gxe="_toolList_irhhk_181",yxe="_textInput_irhhk_193",bxe="_textArea_irhhk_211",wxe="_summary_irhhk_231",vxe="_summaryRow_irhhk_238",xxe="_summaryLabel_irhhk_244",_xe="_summaryValue_irhhk_250",kxe="_summaryBlockTitle_irhhk_255",Sxe="_summaryBlock_irhhk_255",Txe="_manageList_irhhk_295",Cxe="_manageItem_irhhk_301",Axe="_manageItemExpanded_irhhk_307",Exe="_manageRow_irhhk_312",Mxe="_manageRowActive_irhhk_329",Nxe="_manageIcon_irhhk_333",Ixe="_manageName_irhhk_362",Rxe="_levelTag_irhhk_370",jxe="_manageChevron_irhhk_380",Lxe="_manageChevronExpanded_irhhk_398",Dxe="_manageDetail_irhhk_402",Oxe="_manageDetailInner_irhhk_409",Bxe="_manageDetailHeader_irhhk_419",Pxe="_manageActions_irhhk_426",zxe="_manageButton_irhhk_433",$xe="_dangerButton_irhhk_453",qxe="_deleteText_irhhk_457",Fxe="_viewerRow_irhhk_487",Uxe="_viewerLabel_irhhk_500",Hxe="_viewerField_irhhk_507",Vxe="_viewerSectionTitle_irhhk_512",Wxe="_viewerBlock_irhhk_518",Gxe="_closed_irhhk_524",Kxe="_closedText_irhhk_528",Yxe="_loading_irhhk_534",Xxe="_error_irhhk_539",Qxe="_createWizard_irhhk_545",Jxe="_createSteps_irhhk_551",Zxe="_createStepPill_irhhk_559",e3e="_createStepPillActive_irhhk_571",t3e="_createStepPillDone_irhhk_576",n3e="_createStepNumber_irhhk_580",r3e="_createStepLabel_irhhk_591",s3e="_createBody_irhhk_597",i3e="_createActions_irhhk_601",_e={panel:Qve,embedded:Jve,footer:Zve,titleLine:exe,icon:txe,title:nxe,subtitle:rxe,text:sxe,options:ixe,option:oxe,optionActive:axe,optionLabel:lxe,optionIcon:cxe,optionContent:uxe,optionDesc:dxe,badge:hxe,toolDetail:fxe,toolDetailTitle:mxe,toolDetailBody:pxe,toolList:gxe,textInput:yxe,textArea:bxe,summary:wxe,summaryRow:vxe,summaryLabel:xxe,summaryValue:_xe,summaryBlockTitle:kxe,summaryBlock:Sxe,manageList:Txe,manageItem:Cxe,manageItemExpanded:Axe,manageRow:Exe,manageRowActive:Mxe,manageIcon:Nxe,manageName:Ixe,levelTag:Rxe,manageChevron:jxe,manageChevronExpanded:Lxe,manageDetail:Dxe,manageDetailInner:Oxe,manageDetailHeader:Bxe,manageActions:Pxe,manageButton:zxe,dangerButton:$xe,deleteText:qxe,viewerRow:Fxe,viewerLabel:Uxe,viewerField:Hxe,viewerSectionTitle:Vxe,viewerBlock:Wxe,closed:Gxe,closedText:Kxe,loading:Yxe,error:Xxe,createWizard:Qxe,createSteps:Jxe,createStepPill:Zxe,createStepPillActive:e3e,createStepPillDone:t3e,createStepNumber:n3e,createStepLabel:r3e,createBody:s3e,createActions:i3e};function VO(e){if(e==="project")return"workspace";if(e==="user")return"global"}function WO(e){return VO(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function o3e(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 zo=a6;function a3e(e){return e.displayName||e.name}function GO(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 KO(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function YO(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function l3e(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 c3e({mode:e,embedded:t=!1,onMessage:n,onClose:r}){const{t:s}=at(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:u,deleteAgent:d}=rH({autoLoad:!0}),{tools:f}=zN({autoLoad:!0}),[m,p]=g.useState(!1),[y,x]=g.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[b,w]=g.useState(0),[v,_]=g.useState(0),[S,C]=g.useState(null),[E,R]=g.useState(null),[j,N]=g.useState(!1),[B,M]=g.useState(null),[$,H]=g.useState(1),[J,O]=g.useState(()=>e==="create-user"?"global":"workspace"),[Y,G]=g.useState("manual"),[ee,L]=g.useState(""),[F,P]=g.useState(""),[A,ne]=g.useState(""),[be,he]=g.useState([]),[ye,me]=g.useState(0),[se,re]=g.useState(!1),[oe,ke]=g.useState(!1),He=g.useRef(0),Ve=g.useCallback(()=>{p(!0),r()},[r]),ce=g.useMemo(()=>{const Ke=i.filter(V=>V.level==="project"),pt=i.filter(V=>V.level==="user"),yt=i.filter(V=>V.level==="builtin"),ae=i.filter(V=>V.level==="extension");return{project:Ke,user:pt,builtin:yt,extension:ae}},[i]),xe=g.useMemo(()=>[...ce.project,...ce.user,...ce.builtin,...ce.extension],[ce]),Me=g.useMemo(()=>{const Ke=f.filter(V=>V.enabled).map(a3e).sort((V,ue)=>V.localeCompare(ue)),pt=Ke.filter(GO),yt=Ke.filter(KO),ae=Ke.filter(YO);return[{id:"all",label:s("agent.create.tools.all"),tools:[]},{id:"read",label:s("agent.create.tools.readOnly"),tools:pt},{id:"edit",label:s("agent.create.tools.readEdit"),tools:[...new Set([...pt,...yt])]},{id:"execute",label:s("agent.create.tools.readEditExecute"),tools:[...new Set([...pt,...yt,...ae])]}]},[s,f]);g.useEffect(()=>{if(y!=="manage")return;const Ke=E!==null?xe[E]:void 0;Ke&&l(Ke.name).then(C).catch(pt=>M(pt instanceof Error?pt.message:String(pt)))},[y,xe,E,l]),g.useEffect(()=>{v>=xe.length&&xe.length>0&&_(xe.length-1),E!==null&&E>=xe.length&&R(null)},[E,xe.length,v]);const Re=g.useCallback((Ke=v)=>{const pt=xe[Ke];if(!pt||!WO(pt))return;const yt=VO(pt.level);yt&&(N(!0),d(pt.name,yt).then(()=>{n(s("agent.deleted",{name:pt.name})),C(null),R(null),_(0),a()}).catch(ae=>M(ae instanceof Error?ae.message:String(ae))).finally(()=>N(!1)))},[xe,v,d,n,a,s]),ct=g.useCallback(()=>{if(!ee.trim()||!F.trim()||!A.trim()){M(s("agent.create.required"));return}N(!0),c({name:ee.trim(),description:F.trim(),systemPrompt:A.trim(),scope:J,tools:be}).then(Ke=>{n(s("agent.created",{name:Ke.agent.name})),Ve()}).catch(Ke=>M(Ke instanceof Error?Ke.message:String(Ke))).finally(()=>N(!1))},[ee,F,A,J,be,c,n,Ve,s]),Ct=g.useCallback(async()=>{const Ke=F.trim();if(!Ke||se)return;const pt=He.current+1;He.current=pt,re(!0),ke(!1),M(null);try{const yt=await u(Ke);if(He.current!==pt)return;L(yt.name),P(yt.description),ne(yt.systemPrompt),H(Y==="manual"?6:4),me(0)}catch(yt){if(He.current!==pt)return;M(s("agent.create.generateFailed",{error:yt instanceof Error?yt.message:String(yt)})),ke(!0)}finally{He.current===pt&&re(!1)}},[F,se,Y,u,s]),vt=g.useCallback(Ke=>{if(Ke==="name"&&ee.trim())H(4),ke(!0);else if(Ke==="prompt"&&A.trim())H(5),ke(!0);else if(Ke==="desc"&&F.trim()){if(Y==="qwen"){Ct();return}H(Y==="manual"?6:4),me(0),ke(!1)}},[ee,F,A,Y,Ct]);if(m)return h.jsx("div",{className:`${_e.panel} ${t?_e.embedded:""} ${_e.closed}`,children:h.jsx("div",{className:_e.closedText,children:s("agents.closed")})});if(o&&i.length===0)return h.jsxs("div",{className:`${_e.panel} ${t?_e.embedded:""}`,children:[h.jsxs("div",{className:_e.titleLine,children:[h.jsx("span",{className:_e.icon,children:"?"}),h.jsx("span",{className:_e.title,children:s("agents.title")})]}),h.jsx("div",{className:_e.loading,children:s("common.loading")})]});const Rt=s("agents.title");return h.jsxs("div",{className:`${_e.panel} ${t?_e.embedded:""}`,children:[!t&&y!=="create"&&h.jsxs("div",{className:_e.titleLine,children:[h.jsx("span",{className:_e.icon,children:"?"}),h.jsx("span",{className:_e.title,children:Rt}),h.jsx("span",{className:_e.subtitle,children:s("agent.count",{count:i.length})})]}),B&&h.jsx("div",{className:_e.error,children:B}),y==="menu"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:s("agent.selectAction")}),h.jsxs("div",{className:_e.options,children:[h.jsx(Qc,{idx:0,active:b===0,label:s("agent.manage"),desc:s("agent.manage.desc"),onClick:()=>{w(0),x("manage")},onHover:()=>w(0)}),h.jsx(Qc,{idx:1,active:b===1,label:s("agent.create"),desc:s("agent.create.desc"),onClick:()=>{w(1),x("create")},onHover:()=>w(1)})]}),h.jsx("div",{className:_e.footer,children:s("agent.footer.nav")})]}),y==="manage"&&h.jsx(u3e,{agents:xe,expandedAgentIdx:E,selectedAgent:S,busy:j,onToggleAgent:Ke=>{_(Ke),R(pt=>pt===Ke?null:Ke),C(null)},onDelete:Ke=>{j||Re(Ke)},t:s}),y==="create"&&h.jsx(d3e,{step:$,method:Y,scope:J,name:ee,desc:F,prompt:A,tools:be,toolCategories:Me,selIdx:ye,busy:j,generating:se,inputFocused:oe,onSetName:L,onSetDesc:P,onSetPrompt:ne,onInputNext:vt,onInputFocus:()=>ke(!0),onInputBlur:()=>ke(!1),onSetStep:H,onSetSelectedIndex:me,onSelectLocation:Ke=>{me(Ke),O(Ke===0?"workspace":"global")},onSelectMethod:Ke=>{me(Ke),G(Ke===0?"qwen":"manual")},onSelectTools:Ke=>{var pt;me(Ke),he(((pt=Me[Ke])==null?void 0:pt.tools)??[])},onSave:()=>{j||ct()},t:s})]})}function Qc({idx:e,active:t,label:n,desc:r,badge:s,numbered:i=!1,onClick:o,onHover:a}){return h.jsxs("div",{className:`${_e.option} ${t?_e.optionActive:""}`,onClick:o,onMouseEnter:a,children:[h.jsx("span",{className:_e.optionIcon,"aria-hidden":"true"}),h.jsxs("span",{className:_e.optionContent,children:[h.jsxs("span",{className:_e.optionLabel,children:[i?`${e+1}. `:"",n,s&&h.jsx("span",{className:_e.badge,children:s})]}),r&&h.jsx("span",{className:_e.optionDesc,children:r})]})]})}function u3e({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:r,onToggleAgent:s,onDelete:i,t:o}){const[a,l]=g.useState(null),c=g.useMemo(()=>new Set(e.filter(u=>u.level==="project").map(u=>u.name)),[e]);return e.length===0?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:o("agent.empty")}),h.jsx("div",{className:_e.text,children:o("agent.createFirstHint")})]}):h.jsx("div",{className:_e.manageList,children:e.map((u,d)=>{const f=t===d,m=f&&(n==null?void 0:n.name)===u.name?n:null,p=WO(u),y=(m==null?void 0:m.tools)??[],x=y.length===0||y.includes("*")?o("agent.create.tools.all"):y.join(", ");return h.jsxs("div",{className:`${_e.manageItem} ${f?_e.manageItemExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${_e.manageRow} ${f?_e.manageRowActive:""}`,onClick:()=>{l(null),s(d)},children:[h.jsx("span",{className:_e.manageIcon,"aria-hidden":"true"}),h.jsx("span",{className:_e.manageName,children:u.name}),h.jsx("span",{className:_e.levelTag,children:o3e(u.level,o)}),u.level==="user"&&c.has(u.name)?h.jsx("span",{className:_e.levelTag,children:o("agent.overriddenBadge")}):null,h.jsx("span",{className:`${_e.manageChevron} ${f?_e.manageChevronExpanded:""}`})]}),f?h.jsx("div",{className:_e.manageDetail,children:m?h.jsxs("div",{className:_e.manageDetailInner,children:[h.jsx("div",{className:_e.manageDetailHeader,children:p?h.jsx("div",{className:_e.manageActions,children:a===d?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:_e.deleteText,children:r?o("agent.delete.loading"):o("agent.delete.confirm",{name:u.name})}),h.jsx("button",{type:"button",className:_e.manageButton,onClick:()=>l(null),disabled:r,children:o("common.cancel")}),h.jsx("button",{type:"button",className:`${_e.manageButton} ${_e.dangerButton}`,onClick:()=>i(d),disabled:r,children:o("agent.action.delete")})]}):h.jsx("button",{type:"button",className:`${_e.manageButton} ${_e.dangerButton}`,onClick:()=>l(d),disabled:r,children:o("agent.action.delete")})}):null}),h.jsxs("div",{className:_e.viewerField,children:[h.jsx("div",{className:_e.viewerSectionTitle,children:zo(o("agent.toolsLabel"))}),h.jsx("div",{className:_e.viewerBlock,children:x})]}),h.jsxs("div",{className:_e.viewerField,children:[h.jsx("div",{className:_e.viewerSectionTitle,children:zo(o("agent.filePathLabel"))}),h.jsx("div",{className:_e.viewerBlock,children:m.filePath||"—"})]}),m.model?h.jsxs("div",{className:_e.viewerRow,children:[h.jsx("span",{className:_e.viewerLabel,children:zo(o("agent.modelLabel"))}),h.jsx("span",{children:m.model})]}):null,h.jsxs("div",{className:_e.viewerField,children:[h.jsx("div",{className:_e.viewerSectionTitle,children:zo(o("agent.descriptionLabel"))}),h.jsx("div",{className:_e.viewerBlock,children:m.description||"—"})]}),h.jsxs("div",{className:_e.viewerField,children:[h.jsx("div",{className:_e.viewerSectionTitle,children:zo(o("agent.systemPromptLabel"))}),h.jsx("div",{className:_e.viewerBlock,children:m.systemPrompt||"—"})]})]}):h.jsx("div",{className:_e.loading,children:o("common.loading")})}):null]},`${u.level}:${u.name}`)})})}function d3e({step:e,method:t,scope:n,name:r,desc:s,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:c,generating:u,inputFocused:d,onSetName:f,onSetDesc:m,onSetPrompt:p,onInputNext:y,onInputFocus:x,onInputBlur:b,onSetStep:w,onSetSelectedIndex:v,onSelectLocation:_,onSelectMethod:S,onSelectTools:C,onSave:E,t:R}){const j=g.useRef(null),N=g.useRef(null),B=g.useRef(null);g.useEffect(()=>{var F,P,A,ne;d&&(t==="manual"?e===3?(F=j.current)==null||F.focus():e===4?(P=B.current)==null||P.focus():e===5&&((A=N.current)==null||A.focus()):e===3&&((ne=N.current)==null||ne.focus()))},[e,t,d]);const M=t==="manual"?6:4,$=M+1,H=t==="manual"?[R("agent.create.location"),R("agent.create.method"),R("agent.create.name"),R("agent.create.prompt"),R("agent.create.description"),R("agent.create.toolsSelection")]:[R("agent.create.location"),R("agent.create.method"),R("agent.create.describeAgent"),R("agent.create.toolsSelection")],J=F=>F===1?n==="workspace"?0:1:F===2?t==="qwen"?0:1:F===M?l3e(a,o):0,O=F=>{w(F),v(J(F)),t==="manual"&&(F===3||F===4||F===5)||t==="qwen"&&F===3?x():b()},Y=()=>{e<=1||u||O(e-1)},G=()=>{if(!u){if(e===1){O(2);return}if(e===2){O(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===M&&(C(l),O($))}},ee=u||t==="manual"&&e===3&&!r.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!s.trim()||t==="qwen"&&e===3&&!s.trim();let L=null;if(e===1&&(L=h.jsx(h.Fragment,{children:h.jsxs("div",{className:_e.options,children:[h.jsx(Qc,{idx:0,active:l===0,label:R("agent.create.project.cli"),numbered:!0,onClick:()=>_(0)}),h.jsx(Qc,{idx:1,active:l===1,label:R("agent.create.user.cli"),numbered:!0,onClick:()=>_(1)})]})})),e===2&&(L=h.jsx(h.Fragment,{children:h.jsxs("div",{className:_e.options,children:[h.jsx(Qc,{idx:0,active:l===0,label:R("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>S(0)}),h.jsx(Qc,{idx:1,active:l===1,label:R("agent.create.method.manual"),numbered:!0,onClick:()=>S(1)})]})})),t==="manual"&&e===3&&(L=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:R("agent.create.nameHelp")}),h.jsx("input",{ref:j,className:_e.textInput,value:r,onChange:F=>f(F.target.value),onFocus:x,onBlur:b,placeholder:R("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(L=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:R("agent.create.promptHelp")}),h.jsx("textarea",{ref:B,className:_e.textArea,value:i,onChange:F=>p(F.target.value),onFocus:x,onBlur:b,placeholder:R("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(L=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:R("agent.create.manualDescHelp")}),h.jsx("textarea",{ref:N,className:_e.textArea,value:s,onChange:F=>m(F.target.value),onFocus:x,onBlur:b,placeholder:R("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(L=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:R("agent.create.qwenHint")}),u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.text,children:R("agent.create.generatingConfig")}),h.jsx("div",{className:_e.footer,children:R("agent.footer.generating")})]}):h.jsx(h.Fragment,{children:h.jsx("textarea",{ref:N,className:_e.textArea,value:s,onChange:F=>m(F.target.value),onFocus:x,onBlur:b,placeholder:R("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===M){const F=a[l]??a[0],P=(F==null?void 0:F.tools)??[],A=(F==null?void 0:F.id)==="all"?R("agent.create.tools.allInfo"):P.length>0?P.join(", "):R("agent.create.tools.none"),ne=P.filter(GO),be=P.filter(KO),he=P.filter(YO);L=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.options,children:a.map((ye,me)=>h.jsx(Qc,{idx:me,active:l===me,label:ye.label,numbered:!0,onClick:()=>C(me)},ye.id))}),h.jsx("div",{className:_e.toolDetail,children:(F==null?void 0:F.id)==="all"?h.jsx("div",{className:_e.toolDetailBody,children:A}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:_e.toolDetailTitle,children:R("agent.create.tools.selected")}),h.jsx("div",{className:_e.toolList,children:P.length===0?A:h.jsxs(h.Fragment,{children:[ne.length>0&&h.jsxs("div",{children:[R("agent.create.tools.readOnlyLabel")," ",ne.join(", ")]}),be.length>0&&h.jsxs("div",{children:[R("agent.create.tools.editLabel")," ",be.join(", ")]}),he.length>0&&h.jsxs("div",{children:[R("agent.create.tools.executionLabel")," ",he.join(", ")]})]})})]})})]})}if(e===$){const F=o.length===0?"*":o.join(", ");L=h.jsx(h.Fragment,{children:h.jsxs("div",{className:_e.summary,children:[h.jsxs("div",{className:_e.summaryRow,children:[h.jsx("span",{className:_e.summaryLabel,children:zo(R("agent.create.name"))}),h.jsx("span",{className:_e.summaryValue,children:r||"—"})]}),h.jsxs("div",{className:_e.summaryRow,children:[h.jsx("span",{className:_e.summaryLabel,children:zo(R("agent.location"))}),h.jsx("span",{className:_e.summaryValue,children:R(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),h.jsxs("div",{className:_e.summaryRow,children:[h.jsx("span",{className:_e.summaryLabel,children:zo(R("agent.toolsLabel"))}),h.jsx("span",{className:_e.summaryValue,children:F})]}),h.jsx("div",{className:_e.summaryBlockTitle,children:zo(R("agent.descriptionLabel"))}),h.jsx("div",{className:_e.summaryBlock,children:s||"—"}),h.jsx("div",{className:_e.summaryBlockTitle,children:zo(R("agent.systemPromptLabel"))}),h.jsx("div",{className:_e.summaryBlock,children:i||"—"})]})})}return h.jsxs("div",{className:_e.createWizard,children:[h.jsx("div",{className:_e.createSteps,children:H.map((F,P)=>{const A=P+1;return h.jsxs("div",{className:`${_e.createStepPill} ${A===Math.min(e,M)?_e.createStepPillActive:""} ${A<Math.min(e,M)?_e.createStepPillDone:""}`,children:[h.jsx("span",{className:_e.createStepNumber,children:A}),h.jsx("span",{className:_e.createStepLabel,children:F})]},`${A}:${F}`)})}),h.jsx("div",{className:_e.createBody,children:L}),h.jsxs("div",{className:_e.createActions,children:[h.jsx("button",{type:"button",className:_e.manageButton,onClick:Y,disabled:e<=1||u||c,children:R("common.previous")}),e===$?h.jsx("button",{type:"button",className:_e.manageButton,onClick:E,disabled:c,children:R(c?"agent.create.loading":"agent.create.save")}):h.jsx("button",{type:"button",className:_e.manageButton,onClick:G,disabled:ee,children:R("common.next")})]})]})}const h3e="_page_1np31_1",f3e="_tabs_1np31_11",m3e="_memoryCard_1np31_19",p3e="_memoryCardActive_1np31_35",g3e="_memoryTitle_1np31_44",y3e="_detailPath_1np31_48",b3e="_status_1np31_49",w3e="_actionButton_1np31_54",v3e="_primaryButton_1np31_55",x3e="_secondaryButton_1np31_56",_3e="_detail_1np31_48",k3e="_detailHeader_1np31_79",S3e="_detailTitleWrap_1np31_87",T3e="_actions_1np31_91",C3e="_content_1np31_105",A3e="_editor_1np31_106",E3e="_editorFooter_1np31_127",ts={page:h3e,tabs:f3e,memoryCard:m3e,memoryCardActive:p3e,memoryTitle:g3e,detailPath:y3e,status:b3e,actionButton:w3e,primaryButton:v3e,secondaryButton:x3e,detail:_3e,detailHeader:k3e,detailTitleWrap:S3e,actions:T3e,content:C3e,editor:A3e,editorFooter:E3e};function NC(e,t){return e.find(n=>n.scope===t)}function IC(e,t){return t(e==="global"?"memory.global":"memory.project")}function M3e({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var L,F;const{t:s}=at(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:u}=sH({autoLoad:!0}),d=g.useRef(null),f=g.useRef(0),[m,p]=g.useState("workspace"),[y,x]=g.useState("view"),[b,w]=g.useState(""),[v,_]=g.useState(""),[S,C]=g.useState(!1),[E,R]=g.useState(!1),[j,N]=g.useState(null),B=g.useRef(0),M=g.useMemo(()=>{const P=NC(i,"global"),A=NC(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:A},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:P}]},[i,s]),$=M.find(P=>P.scope===m)??M[0],H=g.useCallback((P,A)=>{const ne=++f.current;if(x(A),N(null),w(""),_(""),!(P!=null&&P.file)){A==="edit"&&requestAnimationFrame(()=>{var be;return(be=d.current)==null?void 0:be.focus()});return}C(!0),l(P.file.path).then(be=>{ne===f.current&&(w(be.content),_(be.content),be.truncated&&N(s("memory.fileTruncated")),requestAnimationFrame(()=>{var he;return(he=d.current)==null?void 0:he.focus()}))}).catch(be=>{if(ne!==f.current)return;const he=be instanceof Error?be.message:String(be);N(he),P.scope!=="global"&&(r==null||r(he,"error"))}).finally(()=>{ne===f.current&&C(!1)})},[r,l,s]);g.useEffect(()=>{$&&H($,y)},[(L=$==null?void 0:$.file)==null?void 0:L.path,$==null?void 0:$.scope]),g.useEffect(()=>{a&&N(a.message)},[a]),g.useEffect(()=>{e<=0||c().then(()=>N(s("memory.refreshed"))).catch(P=>{const A=P instanceof Error?P.message:String(P);N(A),r==null||r(A,"error")})},[r,e,c,s]),g.useEffect(()=>{if(t<=0||B.current===t)return;B.current=t;const P=n==="global"?"global":"workspace";p(P);const A=M.find(ne=>ne.scope===P);H(A,"edit")},[n,t,M,H]);const J=P=>{p(P.scope),H(P,"view")},O=()=>{$&&H($,"edit")},Y=()=>{if($){if(!v.trim()){N(s("memory.contentEmpty"));return}R(!0),N(null),u({scope:$.scope,mode:"replace",content:v}).then(P=>{const A=s("memory.saved",{scope:IC($.scope,s),bytes:P.bytesWritten,path:P.filePath});w(v),x("view"),N(A),r==null||r(A,"status"),c().catch(()=>{})}).catch(P=>{const A=P instanceof Error?P.message:String(P);N(A),r==null||r(A,"error")}).finally(()=>R(!1))}},G=((F=$==null?void 0:$.file)==null?void 0:F.path)??($==null?void 0:$.fallbackPath)??"",ee=j??(o?s("memory.loading"):null);return h.jsxs("div",{className:ts.page,children:[h.jsx("nav",{className:ts.tabs,"aria-label":s("memory.menu"),children:M.map(P=>{const A=P.scope===m;return h.jsx("button",{type:"button",className:`${ts.memoryCard} ${A?ts.memoryCardActive:""}`,onClick:()=>J(P),children:h.jsx("span",{className:ts.memoryTitle,children:P.title})},P.scope)})}),h.jsxs("section",{className:ts.detail,children:[h.jsxs("header",{className:ts.detailHeader,children:[h.jsx("div",{className:ts.detailTitleWrap,children:h.jsx("div",{className:ts.detailPath,children:G})}),h.jsx("div",{className:ts.actions,children:h.jsx("button",{type:"button",className:ts.actionButton,onClick:O,children:s("settings.action.edit")})})]}),ee&&h.jsx("div",{className:ts.status,children:ee}),y==="edit"?h.jsxs(h.Fragment,{children:[h.jsx("textarea",{ref:d,className:ts.editor,value:v,disabled:E||S,onChange:P=>_(P.target.value),placeholder:s("memory.placeholder",{scope:$?IC($.scope,s):""})}),h.jsxs("div",{className:ts.editorFooter,children:[h.jsx("button",{type:"button",className:ts.secondaryButton,disabled:E,onClick:()=>{_(b),x("view")},children:s("common.cancel")}),h.jsx("button",{type:"button",className:ts.primaryButton,disabled:E||S,onClick:Y,children:s(E?"memory.saving":"memory.save")})]})]}):h.jsx("pre",{className:ts.content,children:S?s("memory.loadingFile"):b||s("memory.noFiles")})]})]})}const N3e="_panel_cxp6w_1",I3e="_steps_cxp6w_10",R3e="_stepPill_cxp6w_18",j3e="_stepPillActive_cxp6w_29",L3e="_stepPillDone_cxp6w_34",D3e="_stepNumber_cxp6w_38",O3e="_stepLabel_cxp6w_49",B3e="_body_cxp6w_55",P3e="_text_cxp6w_59",z3e="_muted_cxp6w_64",$3e="_options_cxp6w_68",q3e="_option_cxp6w_68",F3e="_optionActive_cxp6w_90",U3e="_label_cxp6w_94",H3e="_optionText_cxp6w_98",V3e="_description_cxp6w_112",W3e="_input_cxp6w_119",G3e="_preview_cxp6w_135",K3e="_error_cxp6w_146",Y3e="_link_cxp6w_150",X3e="_terms_cxp6w_161",Q3e="_actions_cxp6w_169",J3e="_actionButton_cxp6w_177",mn={panel:N3e,steps:I3e,stepPill:R3e,stepPillActive:j3e,stepPillDone:L3e,stepNumber:D3e,stepLabel:O3e,body:B3e,text:P3e,muted:z3e,options:$3e,option:q3e,optionActive:F3e,label:U3e,optionText:H3e,description:V3e,input:W3e,preview:G3e,error:K3e,link:Y3e,terms:X3e,actions:Q3e,actionButton:J3e},Z3e=[{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 ff(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function RC(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function e_e(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 t_e(e){const t=e.trim();return t?t.length<=6?"***":`${t.slice(0,3)}...${t.slice(-4)}`:"(not set)"}function V4(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function n_e({onMessage:e,onClose:t}){const{t:n}=at(),r=yc(),[s,i]=g.useState("groups"),[o,a]=g.useState(0),[l,c]=g.useState(0),[u,d]=g.useState("providers"),[f,m]=g.useState(0),[p,y]=g.useState(),[x,b]=g.useState("alibaba"),[w,v]=g.useState(null),[_,S]=g.useState("openai"),[C,E]=g.useState(""),[R,j]=g.useState(""),[N,B]=g.useState(""),[M,$]=g.useState(!1),[H,J]=g.useState(!1),[O,Y]=g.useState(!0),[G,ee]=g.useState(!0),[L,F]=g.useState(!1),[P,A]=g.useState(!1),[ne,be]=g.useState(""),[he,ye]=g.useState(!0),[me,se]=g.useState(!1),[re,oe]=g.useState(null);g.useEffect(()=>{r.getAuthProviders().then(K=>{y(K),ye(!1)}).catch(K=>{oe(K instanceof Error?K.message:String(K)),ye(!1)})},[r]);const ke=g.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),He=g.useMemo(()=>{var ie;return(((ie=ke.find(fe=>fe.id===x))==null?void 0:ie.providerIds)??[]).map(fe=>p==null?void 0:p.providers.find(We=>We.id===fe)).filter(fe=>!!fe)},[p,x,ke]),Ve=g.useMemo(()=>(w==null?void 0:w.steps)??[],[w==null?void 0:w.steps]),ce=Ve[f],xe=(w==null?void 0:w.showAdvancedConfig)===!0,Me=g.useMemo(()=>H?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[H]),Re=Me.indexOf("context"),ct=ce==="apiKey"||ce==="models"||ce==="baseUrl"&&!Array.isArray(w==null?void 0:w.baseUrl),[Ct,vt]=g.useState(0),Rt=g.useCallback((K,ie="providers")=>{var We,Mt;v(K),d(ie);const fe=((We=K.protocolOptions)==null?void 0:We[0])??K.protocol;S(fe),typeof K.baseUrl=="string"?E(K.baseUrl):Array.isArray(K.baseUrl)?E(((Mt=K.baseUrl[0])==null?void 0:Mt.url)??""):E(ff(fe)),j(""),B(RC(K)),$(!1),J(!1),Y(!0),ee(!0),F(!1),A(!1),be(""),m(0),vt(0),oe(null),i(K.steps.length>0?"step":"review")},[]),Ke=g.useCallback(()=>{if(oe(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(Ve.length===0){i(u);return}i("step"),m(Math.max(0,Ve.length-1));return}if(f>0){m(K=>K-1),vt(0);return}i(u)},[t,u,f,Ve.length,s]),pt=g.useCallback(()=>{if(!w||me)return;se(!0),oe(null);const K=Number(ne);r.installAuthProvider({providerId:w.id,protocol:_,baseUrl:C,apiKey:R,modelIds:V4(N),advancedConfig:M||H||Number.isFinite(K)&&K>0?{...M?{enableThinking:!0}:{},...H?{multimodal:{...O?{image:!0}:{},...G?{video:!0}:{},...L?{audio:!0}:{},...P?{pdf:!0}:{}}}:{},...Number.isFinite(K)&&K>0?{contextWindowSize:K}:{}}:void 0}).then(ie=>{e(ie.message),t()}).catch(ie=>{const fe=ie instanceof Error?ie.message:String(ie);oe(fe),e(fe,"error")}).finally(()=>se(!1))},[R,C,ne,H,L,O,P,G,N,t,e,_,w,me,M,r]),yt=g.useCallback(()=>{if(w){if(ce==="baseUrl"){const K=C.trim()||ff(_);if(!K){oe(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(K)){oe(n("auth.baseUrlInvalid"));return}C.trim()||E(K)}if(ce==="apiKey"&&R.trim().length===0){oe(n("auth.apiKeyRequired"));return}if(ce==="models"&&V4(N).length===0){oe(n("auth.modelsRequired"));return}oe(null),f>=Ve.length-1?xe?i("review"):pt():(m(K=>K+1),vt(0))}},[R,C,ce,N,_,w,pt,xe,f,Ve.length,n]),ae=g.useCallback(K=>{switch(K){case"thinking":$(ie=>!ie);return;case"modality":J(ie=>!ie);return;case"image":Y(ie=>!ie);return;case"video":ee(ie=>!ie);return;case"audio":F(ie=>!ie);return;case"pdf":A(ie=>!ie);return;case"context":yt();return;default:return}},[yt]),V=g.useCallback(()=>{if(s==="groups"){const K=ke[o];if(!K)return;if(K.id==="custom"){const ie=K.providerIds.map(fe=>p==null?void 0:p.providers.find(We=>We.id===fe)).find(fe=>!!fe);ie&&Rt(ie,"groups");return}b(K.id),c(0),i("providers");return}if(s==="providers"){const K=He[l];K&&Rt(K,"providers");return}if(s==="review"){pt();return}if(!(!w||!ce)){if(ce==="protocol"){const K=(w.protocolOptions??[w.protocol])[Ct];K&&(S(K),w.baseUrl||E(ff(K))),yt();return}if(ce==="baseUrl"&&Array.isArray(w.baseUrl)){const K=w.baseUrl[Ct];K&&E(K.url),yt();return}if(ce==="advancedConfig"){ae(Me[Ct]);return}yt()}},[ce,p,yt,o,ke,Ct,w,l,He,pt,Rt,s,ae,Me]),ue=g.useCallback(K=>{if(s==="groups"){const ie=ke[K];if(!ie)return;if(ie.id==="custom"){const fe=ie.providerIds.map(We=>p==null?void 0:p.providers.find(Mt=>Mt.id===We)).find(We=>!!We);fe&&Rt(fe,"groups");return}b(ie.id),c(0),i("providers");return}if(s==="providers"){const ie=He[K];ie&&Rt(ie,"providers");return}if(!w||!ce){s==="review"&&pt();return}if(ce==="protocol"){const ie=(w.protocolOptions??[w.protocol])[K];ie&&(S(ie),w.baseUrl||E(ff(ie))),yt();return}if(ce==="baseUrl"&&Array.isArray(w.baseUrl)){const ie=w.baseUrl[K];ie&&E(ie.url),yt();return}ce==="advancedConfig"&&ae(Me[K])},[ce,p,yt,ke,ae,Me,w,He,pt,Rt,s]),Ne=(K,ie,fe)=>h.jsx("div",{className:mn.options,children:K.map((We,Mt)=>h.jsx("button",{type:"button",className:`${mn.option} ${ie===Mt?mn.optionActive:""}`,onClick:()=>{fe(Mt),ue(Mt)},children:h.jsxs("div",{className:mn.optionText,children:[h.jsx("div",{className:mn.label,children:We.label}),We.description&&h.jsx("div",{className:mn.description,children:We.description})]})},We.value))}),ut=()=>{if(!w||!ce)return null;if(ce==="protocol"){const fe=w.protocolOptions??[w.protocol];return Ne(Z3e.filter(We=>fe.includes(We.value)),Ct,vt)}if(ce==="baseUrl")return Array.isArray(w.baseUrl)?Ne(w.baseUrl.map(fe=>({value:fe.url,label:fe.label,description:fe.url})),Ct,vt):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:mn.text,children:n("auth.baseUrlPrompt")}),h.jsx("input",{className:mn.input,value:C,placeholder:ff(_),onChange:fe=>{E(fe.target.value),oe(null)},onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.stopPropagation(),yt())},autoFocus:!0}),w.documentationUrl&&h.jsx("a",{className:mn.link,href:w.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(ce==="apiKey")return h.jsxs(h.Fragment,{children:[w.documentationUrl&&h.jsxs("a",{className:mn.link,href:w.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",w.documentationUrl]}),h.jsx("input",{className:mn.input,type:"password",value:R,placeholder:w.apiKeyPlaceholder??"sk-...",onChange:fe=>{j(fe.target.value),oe(null)},onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.stopPropagation(),yt())},autoFocus:!0})]});if(ce==="models"){const fe=RC(w);return h.jsxs(h.Fragment,{children:[fe&&h.jsx("div",{className:mn.muted,children:n("auth.modelsPrompt",{modelIds:fe})}),h.jsx("input",{className:mn.input,value:N,placeholder:fe||"model-id-1, model-id-2",onChange:We=>{B(We.target.value),oe(null)},onKeyDown:We=>{We.key==="Enter"&&(We.preventDefault(),We.stopPropagation(),yt())},autoFocus:!0})]})}const K=fe=>fe?"◉":"○",ie=[{value:"thinking",label:`${K(M)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${K(H)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return H&&ie.push({value:"image",label:`${K(O)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${K(G)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${K(L)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${K(P)} ${n("auth.advanced.modalityPdf")}`}),ie.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ne||"auto"}`,description:n("auth.advanced.contextDesc")}),h.jsxs(h.Fragment,{children:[h.jsx("div",{className:mn.text,children:n("auth.advanced.prompt")}),Ne(ie,Ct,vt),h.jsx("input",{className:mn.input,value:ne,placeholder:"auto",onChange:fe=>be(fe.target.value.replace(/[^0-9]/g,"")),onFocus:()=>vt(Re),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.stopPropagation(),yt())}})]})},ht=g.useMemo(()=>{if(!w)return"";const K=w.envKey??`${_.toUpperCase()}_API_KEY`,ie=V4(N),fe={};if(M&&(fe.extra_body={enable_thinking:!0}),H){const _t={};O&&(_t.image=!0),G&&(_t.video=!0),L&&(_t.audio=!0),P&&(_t.pdf=!0),Object.keys(_t).length>0&&(fe.modalities=_t)}const We=Number(ne);Number.isFinite(We)&&We>0&&(fe.contextWindowSize=We);const Mt=Object.keys(fe).length>0;return JSON.stringify({env:{[K]:t_e(R)},modelProviders:{[_]:ie.map(_t=>({id:_t,name:_t,baseUrl:C.trim(),envKey:K,...Mt?{generationConfig:fe}:{}}))},security:{auth:{selectedType:_}},model:{name:ie[0]}},null,2)},[R,C,ne,H,L,O,P,G,N,_,w,M]),ft=g.useMemo(()=>{const K=[n("auth.step.group"),n("auth.step.provider")];return w&&(K.push(...Ve.map(ie=>e_e(ie,w,n))),xe&&K.push(n("auth.review"))),K},[w,xe,Ve,n]),pe=g.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+f,ft.length):ft.length,[f,ft.length,s]),Ae=he?h.jsx("div",{className:mn.muted,children:n("common.loading")}):s==="groups"?h.jsxs(h.Fragment,{children:[Ne(ke.map(K=>({value:K.id,label:n(K.label),description:n(K.description)})),o,a),h.jsxs("div",{className:mn.terms,children:[h.jsxs("div",{children:[n("auth.termsTitle"),":"]}),h.jsx("a",{className:mn.link,href:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/",target:"_blank",rel:"noreferrer",children:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/"})]})]}):s==="providers"?Ne(He.map(K=>({value:K.id,label:n(K.label),description:n(K.description)})),l,c):s==="step"?ut():h.jsxs(h.Fragment,{children:[h.jsx("div",{className:mn.text,children:n("auth.reviewText")}),h.jsx("div",{className:mn.preview,children:ht})]}),te=()=>{if(s==="review"){pt();return}if(ct||ce==="advancedConfig"){yt();return}V()};return h.jsxs("div",{className:mn.panel,children:[h.jsx("div",{className:mn.steps,children:ft.map((K,ie)=>{const fe=ie+1;return h.jsxs("div",{className:`${mn.stepPill} ${fe===pe?mn.stepPillActive:""} ${fe<pe?mn.stepPillDone:""}`,children:[h.jsx("span",{className:mn.stepNumber,children:fe}),h.jsx("span",{className:mn.stepLabel,children:K})]},`${fe}:${K}`)})}),h.jsx("div",{className:mn.body,children:Ae}),re&&h.jsx("div",{className:mn.error,children:re}),h.jsxs("div",{className:mn.actions,children:[h.jsx("button",{type:"button",className:mn.actionButton,onClick:Ke,disabled:s==="groups"||he||me,children:n("common.previous")}),h.jsx("button",{type:"button",className:mn.actionButton,onClick:te,disabled:he||me,children:n(s==="review"?me?"auth.saving":"auth.save":"common.next")})]})]})}function r_e(e){return e.displayName||e.name}function s_e(){const{t:e}=at(),{status:t,tools:n,loading:r,error:s}=zN({autoLoad:!0}),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState(()=>new Set),d=g.useRef(null);g.useEffect(()=>{var 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=g.useCallback(p=>{u(y=>y.has(p.name)?new Set:new Set([p.name]))},[]);g.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),g.useEffect(()=>{var y;const p=(y=d.current)==null?void 0:y.children[i];p==null||p.scrollIntoView({block:"nearest"})},[i]);const m=g.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:ve("resume-picker","resume-picker-in-shell"),children:[m&&h.jsx("div",{className:ve("resume-picker-search"),children:h.jsx("span",{className:ve("resume-picker-search-hint"),children:m})}),(a||r)&&h.jsx("div",{className:ve("resume-picker-search"),children:h.jsx("span",{className:ve("resume-picker-search-hint"),children:a||e("tools.loading")})}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("resume-picker-list"),ref:d,children:[!r&&n.length===0&&h.jsx("div",{className:ve("resume-picker-empty"),children:e("tools.empty")}),n.map((p,y)=>{const x=c.has(p.name),b=p.description??"";return h.jsxs("div",{className:ve("resume-picker-item","resume-picker-session-item","tools-picker-item",x?"selected":void 0,x?"tools-picker-item-expanded":void 0),onClick:()=>{o(y),p.description&&f(p)},children:[h.jsxs("div",{className:ve("resume-picker-item-row"),children:[h.jsx("span",{className:ve("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:ve("resume-picker-item-title"),children:r_e(p)}),h.jsx("span",{className:ve("tools-status-badge",p.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:p.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),b?h.jsx("svg",{className:ve("tools-item-chevron",x?"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]}),x&&b&&h.jsx("div",{className:ve("tools-desc-expanded"),children:h.jsx("div",{className:ve("tools-desc-body"),children:b})})]},p.name)})]})]})}const XO="update available";function i_e(e){return e.displayName||e.name}function QO(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function o_e(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 ed(e){return e&&e.length>0?e.join(", "):"-"}const a_e=a6;function l_e(){const{t:e}=at(),t=Xa(),n=yc(),r=ju(),[s,i]=g.useState([]),[o,a]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState({}),[f,m]=g.useState(!1),[p,y]=g.useState(!1),[x,b]=g.useState(null),[w,v]=g.useState(null),_=g.useCallback(()=>(m(!0),n.loadExtensionsStatus().then(j=>{var B,M;const N=j.extensions??[];i(N),v(((M=(B=j.errors)==null?void 0:B[0])==null?void 0:M.error)??null),a($=>$&&N.some(H=>H.name===$)?$:null)}).catch(j=>{v(j instanceof Error?j.message:String(j))}).finally(()=>m(!1))),[n]),S=g.useCallback(()=>{const j=t.clientId;return j?(y(!0),n.checkExtensionUpdates(j).then(N=>d(N.states)).catch(N=>{v(N instanceof Error?N.message:String(N))}).finally(()=>y(!1))):(v(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),C=g.useCallback(()=>{const j=t.clientId;if(!j){v(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(j).then(async N=>{v(e("extensions.manage.refreshed",{refreshed:N.refreshed,failed:N.failed})),await _(),await S()}).catch(N=>{v(N instanceof Error?N.message:String(N))}).finally(()=>y(!1))},[n,S,t.clientId,_,e]);g.useEffect(()=>{_()},[_]),g.useEffect(()=>{s.length>0&&S()},[S,s.length]),g.useEffect(()=>{((r==null?void 0:r.extensionsVersion)??0)>0&&(d({}),_())},[_,r==null?void 0:r.extensionsVersion]);const E=g.useCallback((j,N)=>{const B=t.clientId;if(!B){v(e("extensions.install.waitForSession"));return}b(j),v(null),N(B).then(()=>v(e("extensions.manage.queued",{name:j}))).catch(M=>{v(M instanceof Error?M.message:String(M))}).finally(()=>b(null))},[t.clientId,e]),R=g.useMemo(()=>f?e("extensions.manage.loading"):p?e("extensions.manage.checkingUpdates"):e("extensions.manage.count",{count:s.length}),[p,s.length,f,e]);return h.jsxs("div",{className:ve("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ve("resume-picker-search","extensions-toolbar"),children:[h.jsx("span",{className:ve("resume-picker-search-hint"),children:w||R}),h.jsx("button",{type:"button",className:ve("dialog-inline-button"),disabled:f||p,onClick:C,children:e("common.refresh")})]}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("resume-picker-list"),children:[!f&&s.length===0&&h.jsx("div",{className:ve("resume-picker-empty"),children:e("extensions.manage.empty")}),s.map(j=>{const N=u[j.name]??j.updateState,B=o===j.name,M=x===j.name;return h.jsxs("div",{className:ve("resume-picker-item","resume-picker-session-item","tools-picker-item",B?"selected":void 0,B?"tools-picker-item-expanded":void 0),children:[h.jsxs("button",{type:"button",className:ve("extensions-row-button"),onClick:()=>{a(B?null:j.name),c(null)},children:[h.jsx("span",{className:ve("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:ve("resume-picker-item-title"),children:i_e(j)}),h.jsxs("span",{className:ve("resume-picker-item-badge"),children:["v",j.version]}),h.jsx("span",{className:ve("tools-status-badge",j.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:QO(j,e)}),h.jsx("span",{className:ve("tools-status-badge",N===XO?"tools-status-badge-busy":void 0),children:o_e(N,e)}),h.jsx("svg",{className:ve("tools-item-chevron",B?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),B&&h.jsx(c_e,{extension:j,updateState:N,busy:M,confirmingUninstall:l===j.name,onUpdate:()=>E(j.name,$=>n.updateExtension(j.name,$)),onToggleScope:($,H)=>E(j.name,J=>$==="enable"?n.enableExtension(j.name,{scope:H},J):n.disableExtension(j.name,{scope:H},J)),onRequestUninstall:()=>c(j.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{E(j.name,$=>n.uninstallExtension(j.name,$)),c(null),a(null)}})]},j.id||j.name)})]})]})}function c_e({extension:e,updateState:t,busy:n,confirmingUninstall:r,onUpdate:s,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=at(),u=e.details,d=e.isActive?"disable":"enable";return h.jsxs("div",{className:ve("extensions-detail"),children:[h.jsxs("div",{className:ve("extensions-detail-actions"),children:[h.jsx("button",{type:"button",className:ve("dialog-inline-button"),disabled:n||t!==XO,onClick:s,children:c("extensions.manage.update")}),h.jsxs("button",{type:"button",className:ve("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:ve("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:ve("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),r&&h.jsxs("div",{className:ve("extensions-confirm"),children:[h.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),h.jsxs("div",{className:ve("dialog-inline-actions"),children:[h.jsx("button",{type:"button",className:ve("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),h.jsx("button",{type:"button",className:ve("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),h.jsxs("div",{className:ve("extensions-detail-grid"),children:[h.jsx(ho,{label:c("extensions.manage.name"),value:e.name}),h.jsx(ho,{label:c("extensions.manage.version"),value:e.version}),h.jsx(ho,{label:c("extensions.manage.status"),value:QO(e,c)}),h.jsx(ho,{label:c("extensions.manage.path"),value:e.path}),h.jsx(ho,{label:c("extensions.manage.source"),value:e.source??"-"}),h.jsx(ho,{label:c("extensions.manage.commands"),value:ed(u==null?void 0:u.commands)}),h.jsx(ho,{label:c("extensions.manage.skills"),value:ed(u==null?void 0:u.skills)}),h.jsx(ho,{label:c("extensions.manage.agents"),value:ed(u==null?void 0:u.agents)}),h.jsx(ho,{label:c("extensions.manage.mcpServers"),value:ed(u==null?void 0:u.mcpServers)}),h.jsx(ho,{label:c("extensions.manage.contextFiles"),value:ed(u==null?void 0:u.contextFiles)}),h.jsx(ho,{label:c("extensions.manage.settings"),value:ed(u==null?void 0:u.settings)})]})]})}function ho({label:e,value:t}){return h.jsxs("div",{className:ve("extensions-detail-field"),children:[h.jsx("span",{className:ve("extensions-detail-label"),children:a_e(e)}),h.jsx("span",{className:ve("extensions-detail-value"),children:t})]})}const u_e="_panel_1nmt9_1",d_e="_embeddedPanel_1nmt9_16",h_e="_header_1nmt9_26",f_e="_title_1nmt9_32",m_e="_secondary_1nmt9_36",p_e="_hint_1nmt9_37",g_e="_empty_1nmt9_38",y_e="_busy_1nmt9_39",b_e="_scopeTabs_1nmt9_49",w_e="_scopeTab_1nmt9_49",v_e="_scopeTabActive_1nmt9_71",x_e="_settingsPage_1nmt9_76",__e="_sidebar_1nmt9_83",k_e="_categoryButton_1nmt9_92",S_e="_categoryButtonActive_1nmt9_110",T_e="_categoryCount_1nmt9_115",C_e="_content_1nmt9_121",A_e="_card_1nmt9_128",E_e="_cardBody_1nmt9_142",M_e="_cardTitle_1nmt9_146",N_e="_cardDescription_1nmt9_155",I_e="_scopeHint_1nmt9_156",R_e="_scopeBadge_1nmt9_164",j_e="_cardControl_1nmt9_174",L_e="_select_1nmt9_180",D_e="_actionButton_1nmt9_181",O_e="_editInput_1nmt9_182",B_e="_editor_1nmt9_219",P_e="_switchOn_1nmt9_241",z_e="_switchKnob_1nmt9_246",$_e="_footer_1nmt9_261",Ht={panel:u_e,embeddedPanel:d_e,header:h_e,title:f_e,secondary:m_e,hint:p_e,empty:g_e,busy:y_e,scopeTabs:b_e,scopeTab:w_e,scopeTabActive:v_e,settingsPage:x_e,sidebar:__e,categoryButton:k_e,categoryButtonActive:S_e,categoryCount:T_e,content:C_e,card:A_e,cardBody:E_e,cardTitle:M_e,cardDescription:N_e,scopeHint:I_e,scopeBadge:R_e,cardControl:j_e,select:L_e,actionButton:D_e,editInput:O_e,editor:B_e,switch:"_switch_1nmt9_231",switchOn:P_e,switchKnob:z_e,footer:$_e},q_e=new Set(["fastModel"]),F_e=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function lb(e,t,n){const r=e(t);return r===t?n:r}function U_e(e,t){return lb(t,`settings.category.${e}`,e)}function H_e(e,t){return lb(t,`settings.label.${e.key}`,e.label)}function V_e(e,t){if(e.description)return lb(t,`settings.description.${e.key}`,e.description)}function JO(e,t,n,r){return lb(r,`settings.option.${e.key}.${String(t)}`,n)}function W4(e,t,n){const r=eB(e,t);if(r==null)return"";if(e.key===Wc){const i=C_(r,bs.Dark);return n(`theme.${i}`)}if(e.key===Kf){const i=k_(r);return i?S_(i):String(r)}if(e.type==="boolean")return n(r===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===r);return i?JO(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?s.slice(0,21)+"...":s}function ZO(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function W_e(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return ZO(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function eB(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function G_e(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:U_e(r,t),items:s}))}function K_e({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,embedded:o=!1}){const{t:a}=at(),{status:l,settings:c,loading:u,error:d,reload:f,setValue:m}=e,[p,y]=g.useState("workspace"),[x,b]=g.useState(""),[w,v]=g.useState(null),[_,S]=g.useState(null),[C,E]=g.useState(null),R=g.useRef(null),[j,N]=g.useState(!1),B=u&&!l,M=c.find(P=>P.key===Wc),$=C_(M==null?void 0:M.values.effective),H=c.find(P=>P.key===Kf),J=k_(H==null?void 0:H.values.effective),O=g.useMemo(()=>{const P=c.filter(he=>!F_e.has(he.key)),A=G_e(P,a).map(he=>({id:he.category,label:he.category,items:he.items.map(ye=>({type:"setting",setting:ye}))})),ne={type:"local",localKey:"chatWidth"},be=A.find(he=>he.items.some(ye=>ye.type==="setting"&&ye.setting.key===Wc));if(be){const he=be.items.findIndex(ye=>ye.type==="setting"&&ye.setting.key===Wc);be.items.splice(he+1,0,ne)}else A.push({id:a("settings.category.UI"),label:a("settings.category.UI"),items:[ne]});return A},[c,a]);g.useEffect(()=>{O.length!==0&&(O.some(P=>P.id===x)||b(O[0].id))},[x,O]),g.useEffect(()=>{var P;d?S(d.message):(P=l==null?void 0:l.warnings)!=null&&P.length?S(l.warnings.map(A=>a("settings.corrupted",{recovered:A.recovered?"true":"false"})).join("; ")):c.length>0&&!j&&S(null)},[d,c,l,a,j]),g.useEffect(()=>{C&&setTimeout(()=>{var P;return(P=R.current)==null?void 0:P.focus()},0)},[C]);const Y=g.useCallback((P,A)=>{j||S(null),v(P),m("workspace",P,A).then(async ne=>{try{await f()}catch{}ne!=null&&ne.requiresRestart&&P!==Kf&&(N(!0),S(a("settings.requiresRestart")))}).catch(ne=>{S(ne instanceof Error?ne.message:String(ne))}).finally(()=>v(null))},[f,j,m,a]),G=g.useCallback(()=>{if(!C)return;const P=c.find(ne=>ne.key===C.key);if(!P){E(null);return}let A=C.draft;if(P.type==="number"){const ne=C.draft.trim();if(ne===""||!Number.isFinite(Number(ne))){S(a("settings.invalidNumber"));return}A=Number(ne)}E(null),Y(P.key,A)},[C,c,Y,a]),ee=O.find(P=>P.id===x)??O[0],L=(P,A,ne,be=!1)=>h.jsx("select",{className:Ht.select,value:P,disabled:be,onChange:he=>A(he.target.value),children:ne.map(he=>h.jsx("option",{value:he.value,children:he.label},he.value))}),F=P=>{var ye;const A=eB(P,p),ne=w===P.key,be=(C==null?void 0:C.key)===P.key;if(p!=="workspace")return h.jsx("button",{type:"button",className:Ht.actionButton,disabled:!0,title:a("settings.readOnly"),children:W4(P,p,a)||a("settings.readOnly")});if(P.key===Wc)return L($??bs.Dark,me=>{const se=me;r(se),Y(Wc,XH(se))},GN.map(me=>({value:me,label:a(`theme.${me}`)})),ne);if(P.key===Kf)return L(J??"zh-CN",me=>t(me),jH.map(me=>({value:me,label:S_(me)})),ne);if(q_e.has(P.key))return h.jsx("button",{type:"button",className:Ht.actionButton,onClick:()=>n(P.key),children:W4(P,p,a)||a("settings.action.edit")});if(P.type==="boolean"){const me=A===!0;return h.jsx("button",{type:"button",className:`${Ht.switch} ${me?Ht.switchOn:""}`,disabled:ne,onClick:()=>Y(P.key,!me),"aria-pressed":me,children:h.jsx("span",{className:Ht.switchKnob})})}if(P.type==="enum"&&((ye=P.options)!=null&&ye.length)){const me=P.options.findIndex(se=>se.value===A);return L(me>=0?String(me):"",se=>{var oe;const re=(oe=P.options)==null?void 0:oe[Number(se)];re&&Y(P.key,re.value)},P.options.map((se,re)=>({value:String(re),label:JO(P,se.value,se.label,a)})),ne)}return be?h.jsxs("div",{className:Ht.editor,children:[h.jsx("input",{ref:R,className:Ht.editInput,type:P.type==="number"?"number":"text",value:C.draft,onChange:me=>E({key:C.key,draft:me.target.value}),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),G()),me.key==="Escape"&&(me.preventDefault(),E(null))}}),h.jsx("button",{type:"button",className:Ht.actionButton,onClick:G,children:a("settings.action.save")})]}):h.jsx("button",{type:"button",className:Ht.actionButton,disabled:ne,onClick:()=>E({key:P.key,draft:String(A??"")}),children:W4(P,p,a)||a("settings.action.edit")})};return h.jsxs("div",{className:`${Ht.panel} ${o?Ht.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!o&&h.jsxs("div",{className:Ht.header,children:[h.jsx("span",{className:Ht.title,children:a("settings.title")}),h.jsx("span",{className:Ht.secondary,children:a("settings.scope.workspace")})]}),(_||B)&&h.jsx("div",{className:Ht.hint,children:_||a("settings.loading")}),h.jsxs("div",{className:Ht.scopeTabs,role:"tablist",children:[h.jsx("button",{type:"button",role:"tab","aria-selected":p==="workspace",className:`${Ht.scopeTab} ${p==="workspace"?Ht.scopeTabActive:""}`,onClick:()=>y("workspace"),children:a("settings.scope.workspace")}),h.jsx("button",{type:"button",role:"tab","aria-selected":p==="user",className:`${Ht.scopeTab} ${p==="user"?Ht.scopeTabActive:""}`,onClick:()=>{E(null),y("user")},children:a("settings.scope.user")})]}),h.jsxs("div",{className:Ht.settingsPage,children:[h.jsx("nav",{className:Ht.sidebar,"aria-label":a("settings.title"),children:O.map(P=>h.jsxs("button",{type:"button",className:`${Ht.categoryButton} ${P.id===x?Ht.categoryButtonActive:""}`,onClick:()=>b(P.id),children:[h.jsx("span",{children:P.label}),h.jsx("span",{className:Ht.categoryCount,children:P.items.length})]},P.id))}),h.jsxs("section",{className:Ht.content,children:[!u&&!ee&&h.jsx("div",{className:Ht.empty,children:a("settings.empty")}),ee==null?void 0:ee.items.map(P=>{if(P.type==="local")return h.jsxs("div",{className:Ht.card,children:[h.jsxs("div",{className:Ht.cardBody,children:[h.jsx("div",{className:Ht.cardTitle,children:a("settings.label.ui.chatWidth")}),h.jsx("div",{className:Ht.cardDescription,children:a("settings.description.ui.chatWidth")})]}),h.jsx("div",{className:Ht.cardControl,children:L(s,ye=>i(ye),[{value:"1000",label:a("settings.option.ui.chatWidth.1000")},{value:"wide",label:a("settings.option.ui.chatWidth.wide")}])})]},P.localKey);const A=P.setting,ne=V_e(A,a),be=W_e(A,p),he=ZO(A,p);return h.jsxs("div",{className:Ht.card,children:[h.jsxs("div",{className:Ht.cardBody,children:[h.jsxs("div",{className:Ht.cardTitle,children:[H_e(A,a),he&&h.jsx("span",{className:Ht.scopeBadge,children:a(p==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),ne&&h.jsx("div",{className:Ht.cardDescription,children:ne}),be&&h.jsx("div",{className:Ht.scopeHint,children:a(be,{scope:a(p==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),h.jsx("div",{className:Ht.cardControl,children:w===A.key?h.jsx("span",{className:Ht.busy,children:"..."}):F(A)})]},A.key)})]})]}),!o&&h.jsx("div",{className:Ht.footer,children:a(C?"settings.footer.edit":"settings.footer")})]})}const Y_e="_approval_j86la_1",X_e="_floating_j86la_18",Q_e="_header_j86la_31",J_e="_icon_j86la_41",Z_e="_name_j86la_56",e5e="_desc_j86la_67",t5e="_content_j86la_87",n5e="_code_j86la_105",r5e="_codeBlock_j86la_113",s5e="_question_j86la_133",i5e="_options_j86la_139",o5e="_option_j86la_139",a5e="_optionPlain_j86la_167",l5e="_optionSecondary_j86la_177",c5e="_optionPrimary_j86la_184",u5e="_optionActive_j86la_195",d5e="_pointer_j86la_199",h5e="_num_j86la_203",f5e="_label_j86la_207",hr={approval:Y_e,floating:X_e,header:Q_e,icon:J_e,name:Z_e,desc:e5e,content:t5e,code:n5e,codeBlock:r5e,question:s5e,options:i5e,option:o5e,optionPlain:a5e,optionSecondary:l5e,optionPrimary:c5e,optionActive:u5e,pointer:d5e,num:h5e,label:f5e};function m5e(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 p5e(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function g5e(e){var n;const t=(n=e.toolName)==null?void 0:n.toLowerCase();return e.kind==="bash"||e.kind==="exec"||e.kind==="execute"||e.kind==="shell"||t==="run_shell_command"}function y5e(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 b5e(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function jC(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 LC(e){return e.kind==="reject_once"||e.kind==="reject_always"?0:e.kind==="allow_always"&&e.id==="proceed_always_user"?1:e.kind==="allow_always"&&e.id==="proceed_always_project"?2:e.kind==="allow_always"&&(e.id==="proceed_always_server"||e.id==="proceed_always_tool")||e.kind==="allow_always"?3:e.kind==="allow_once"?4:5}function zp(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=LC(t.option)-LC(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function w5e(e){if(e.kind==="allow_once")return"approval.option.allowOnce";if(e.kind==="reject_once")return"approval.option.rejectOnce";if(e.kind==="allow_always"){if(e.id==="proceed_always_project")return"approval.option.allowAlwaysProject";if(e.id==="proceed_always_user")return"approval.option.allowAlwaysUser";if(e.id==="proceed_always_server")return"approval.option.allowAlwaysServer";if(e.id==="proceed_always_tool")return"approval.option.allowAlwaysTool";if(e.id==="proceed_always")return"approval.option.allowAllEdits"}}function v5e(e){return e.kind==="allow_once"?hr.optionPrimary:e.kind==="allow_always"?hr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?hr.optionPlain:hr.optionSecondary}function x5e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=at(),s=g.useMemo(()=>zp(e.options),[e.options]),[i,o]=g.useState(()=>jC(zp(e.options))),a=g.useRef(e);a.current=e;const l=g.useRef(i),c=g.useRef(!1),u=g.useRef(!1);g.useEffect(()=>{const S=jC(zp(a.current.options));c.current=!1,u.current=!1,l.current=S,o(S)},[e.id]);const d=m5e(e.title),f=e.toolName||d.toolName||e.kind||"Tool",m=tl(f,r),p=b5e(e),y=p5e(e),x=g.useCallback(S=>{c.current||(c.current=!0,t(a.current.id,S))},[t]),b=g.useCallback(S=>{if(S.defaultPrevented||j0(S.target))return;const C=a.current,E=zp(C.options),R=E.length;if(S.key==="ArrowUp"||S.key==="k")S.preventDefault(),u.current=!0,o(j=>{const N=(j-1+R)%R;return l.current=N,N});else if(S.key==="ArrowDown"||S.key==="j")S.preventDefault(),u.current=!0,o(j=>{const N=(j+1)%R;return l.current=N,N});else if(S.key==="Enter"){if(S.preventDefault(),!u.current){u.current=!0;return}const j=E[l.current];j&&x(j.id)}else if(S.key==="Escape"){S.preventDefault();const j=C.options.find(N=>N.kind==="reject_once"||N.kind==="reject_always");j&&x(j.id)}else if(S.key>="1"&&S.key<="9"){const j=parseInt(S.key)-1;j<R&&(S.preventDefault(),u.current=!0,x(E[j].id))}},[x]);g.useEffect(()=>{const S=setTimeout(()=>{window.addEventListener("keydown",b)},250);return()=>{clearTimeout(S),window.removeEventListener("keydown",b)}},[b]);const w=g5e(e),v=rq(e.toolName),_=y5e(e);return h.jsxs("div",{className:n==="floating"?`${hr.approval} ${hr.floating}`:hr.approval,children:[h.jsxs("div",{className:hr.header,children:[h.jsx("span",{className:hr.icon,children:"?"}),h.jsx("span",{className:hr.name,children:m})]}),p&&h.jsx("div",{className:hr.desc,title:p,children:p}),w&&_?h.jsx("div",{className:hr.code,children:h.jsx("pre",{className:hr.codeBlock,title:_,children:_})}):y&&y!==e.title?h.jsx("pre",{className:hr.content,title:y,children:y}):null,h.jsx("div",{className:hr.question,children:v?r("approval.launchAgentQuestion"):w?r("approval.execQuestion",{tool:m}):r("approval.changeQuestion")}),h.jsx("div",{className:hr.options,children:s.map((S,C)=>{const E=C===i,R=w5e(S),j=R?r(R):S.label;return h.jsxs("div",{className:`${hr.option} ${v5e(S)} ${E?hr.optionActive:""}`,onClick:()=>x(S.id),children:[h.jsx("span",{className:hr.pointer,children:E?"›":" "}),h.jsxs("span",{className:hr.num,children:[C+1,"."]}),h.jsx("span",{className:hr.label,children:j})]},S.id)})})]})}const _5e="_question_1e2wi_1",k5e="_floating_1e2wi_18",S5e="_titleLine_1e2wi_30",T5e="_icon_1e2wi_39",C5e="_toolName_1e2wi_43",A5e="_toolDesc_1e2wi_47",E5e="_tabs_1e2wi_54",M5e="_tab_1e2wi_54",N5e="_tabActive_1e2wi_78",I5e="_text_1e2wi_95",R5e="_description_1e2wi_104",j5e="_multiHint_1e2wi_112",L5e="_options_1e2wi_118",D5e="_option_1e2wi_118",O5e="_optionActive_1e2wi_140",B5e="_optionSelected_1e2wi_141",P5e="_optionLabel_1e2wi_146",z5e="_pointer_1e2wi_151",$5e="_optionNum_1e2wi_155",q5e="_editIcon_1e2wi_172",F5e="_optionContent_1e2wi_204",U5e="_optionPlaceholder_1e2wi_220",H5e="_optionDesc_1e2wi_225",V5e="_customInput_1e2wi_232",W5e="_actions_1e2wi_249",G5e="_button_1e2wi_257",K5e="_submitButton_1e2wi_283",Y5e="_ignoreButton_1e2wi_289",an={question:_5e,floating:k5e,titleLine:S5e,icon:T5e,toolName:C5e,toolDesc:A5e,tabs:E5e,tab:M5e,tabActive:N5e,text:I5e,description:R5e,multiHint:j5e,options:L5e,option:D5e,optionActive:O5e,optionSelected:B5e,optionLabel:P5e,pointer:z5e,optionNum:$5e,editIcon:q5e,optionContent:F5e,optionPlaceholder:U5e,optionDesc:H5e,customInput:V5e,actions:W5e,button:G5e,submitButton:K5e,ignoreButton:Y5e};function X5e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=at(),s=g.useMemo(()=>{var O;return Array.isArray((O=e.rawInput)==null?void 0:O.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState({}),[d,f]=g.useState({}),[m,p]=g.useState({}),[y,x]=g.useState(!1),b=g.useRef(!1);g.useEffect(()=>{const O=s[0];b.current=!1,o(0),l(O!=null&&O.options.length?0:null),u(O&&!O.multiSelect&&O.options[0]?{0:O.options[0].label}:{}),f({}),p(O!=null&&O.multiSelect&&O.options[0]?{0:[O.options[0].label]}:{}),x(!1)},[s,e.id]);const w=s[i],v=(w==null?void 0:w.multiSelect)??!1,_=g.useCallback(()=>{const O={};for(let Y=0;Y<s.length;Y++){const G=s[Y];if(G)if(G.multiSelect){const ee=m[Y]||[],L=d[Y],F=L?[...ee,L]:ee;O[String(Y)]=F.join(", ")}else O[String(Y)]=c[Y]||d[Y]||""}return O},[s,m,d,c]),S=g.useCallback(()=>{if(b.current)return;const O=e.options.find(Y=>Y.kind==="allow_once");O&&(b.current=!0,t(e.id,O.id,_()))},[_,e,t]),C=g.useCallback(()=>{if(b.current)return;const O=e.options.find(Y=>Y.kind==="reject_once"||Y.kind==="reject_always");O&&(b.current=!0,t(e.id,O.id,void 0))},[e,t]),E=g.useCallback(O=>{O!==void 0&&f(Y=>({...Y,[i]:O})),v||u(Y=>{if(!(i in Y))return Y;const G={...Y};return delete G[i],G}),x(!0)},[i,v]),R=g.useCallback(O=>{if(!w)return;if(O===w.options.length){E();return}const G=w.options[O].label;if(v){const ee=m[i]||[],L=ee.includes(G)?ee.filter(F=>F!==G):[...ee,G];p({...m,[i]:L})}else{const ee={...c,[i]:G};u(ee),f(L=>{if(!(i in L))return L;const F={...L};return delete F[i],F})}},[w,i,v,m,c,E]),j=g.useCallback(O=>{if(!w||!v)return;if(O===w.options.length){E();return}const Y=w.options[O].label,G=m[i]||[],ee=G.includes(Y)?G.filter(L=>L!==Y):[...G,Y];p({...m,[i]:ee})},[w,v,m,i,E]);if(s.length===0)return null;const N=O=>{const Y=s[O];return Y?Y.multiSelect?(m[O]||[]).length>0||!!d[O]:!!c[O]||!!d[O]:!1},B=s.every((O,Y)=>N(Y)),M=Math.min(i,s.length-1),$=O=>{const Y=s[O];if(o(O),x(!1),!(Y!=null&&Y.options.length)){l(null);return}if(l(0),Y.multiSelect){p(G=>(G[O]||[]).length>0||d[O]?G:{...G,[O]:[Y.options[0].label]});return}u(G=>G[O]||d[O]?G:{...G,[O]:Y.options[0].label})},H=()=>{i<=0||$(i-1)},J=()=>{i>=s.length-1||$(i+1)};return h.jsxs("div",{className:`${an.question} ${n==="floating"?an.floating:""}`,children:[h.jsxs("div",{className:an.titleLine,children:[h.jsx("span",{className:an.icon,children:"?"}),h.jsx("span",{className:an.toolName,children:tl("ask_user_question",r)}),h.jsx("span",{className:an.toolDesc,children:r("askUser.progress",{current:M+1,total:s.length})})]}),h.jsx("div",{className:an.tabs,children:s.map((O,Y)=>h.jsx("span",{className:`${an.tab} ${Y===i?an.tabActive:""}`,"aria-hidden":"true"},Y))}),w?h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:an.text,children:[w.question,v&&h.jsxs("span",{className:an.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),h.jsx("p",{className:an.description,children:r("askUser.selectAnswer")}),h.jsxs("div",{className:an.options,onMouseLeave:()=>l(null),children:[w.options.map((O,Y)=>{const G=Y===a,ee=v?(m[i]||[]).includes(O.label):c[i]===O.label;return h.jsxs("div",{className:`${an.option} ${G?an.optionActive:""} ${ee?an.optionSelected:""}`,onClick:()=>{l(Y),v?j(Y):R(Y)},onMouseEnter:()=>l(Y),children:[h.jsx("span",{className:an.pointer,children:G?"›":" "}),h.jsx("span",{className:an.optionNum,children:Y+1}),h.jsxs("span",{className:an.optionContent,children:[h.jsx("span",{className:an.optionLabel,children:O.label}),O.description&&h.jsx("span",{className:an.optionDesc,children:O.description})]})]},O.label)}),(()=>{const O=a===w.options.length,Y=!!d[i];return h.jsxs("div",{className:`${an.option} ${O?an.optionActive:""} ${Y?an.optionSelected:""}`,onClick:()=>{l(w.options.length),E()},onMouseEnter:()=>l(w.options.length),children:[h.jsx("span",{className:an.pointer,children:O?"›":" "}),h.jsx("span",{className:an.editIcon,"aria-hidden":"true",children:h.jsx("svg",{viewBox:"0 0 16 16",children:h.jsx("path",{d:"M3.2 10.9 4 7.8 10.8 1l3.2 3.2-6.8 6.8-3 .8zM10 1.8l3.2 3.2M3 14h10",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}),y?h.jsx("input",{type:"text",className:an.customInput,placeholder:r("askUser.typePlaceholder"),value:d[i]||"",onChange:G=>f({...d,[i]:G.target.value}),onBlur:()=>x(!1),autoFocus:!0}):h.jsx("span",{className:`${an.optionLabel} ${d[i]?"":an.optionPlaceholder}`,children:d[i]||r("askUser.typePlaceholder")})]})})()]})]}):null,h.jsxs("div",{className:an.actions,children:[h.jsx("button",{type:"button",className:an.ignoreButton,onClick:C,children:r("askUser.ignore")}),s.length>1&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:an.button,disabled:i<=0,onClick:H,children:r("common.previous")}),h.jsx("button",{type:"button",className:an.button,disabled:i>=s.length-1,onClick:J,children:r("common.next")})]}),h.jsx("button",{type:"button",className:`${an.button} ${an.submitButton}`,disabled:!B,onClick:S,children:r("askUser.submit")})]})]})}const Q5e="_dialog_1ymqd_1",J5e="_toolbar_1ymqd_12",Z5e="_tabs_1ymqd_21",e6e="_tab_1ymqd_21",t6e="_tabActive_1ymqd_39",n6e="_search_1ymqd_48",r6e="_general_1ymqd_60",s6e="_shortcuts_1ymqd_67",i6e="_shortcut_1ymqd_67",o6e="_shortcutKey_1ymqd_87",a6e="_shortcutDesc_1ymqd_95",l6e="_commandList_1ymqd_101",c6e="_commandCard_1ymqd_108",u6e="_commandCardExpanded_1ymqd_115",d6e="_commandRow_1ymqd_119",h6e="_commandName_1ymqd_135",f6e="_commandTag_1ymqd_142",m6e="_chevron_1ymqd_152",p6e="_chevronExpanded_1ymqd_160",g6e="_commandDetail_1ymqd_164",y6e="_commandDescription_1ymqd_174",b6e="_commandSubcommands_1ymqd_175",w6e="_empty_1ymqd_182",rr={dialog:Q5e,toolbar:J5e,tabs:Z5e,tab:e6e,tabActive:t6e,search:n6e,general:r6e,shortcuts:s6e,shortcut:i6e,shortcutKey:o6e,shortcutDesc:a6e,commandList:l6e,commandCard:c6e,commandCardExpanded:u6e,commandRow:d6e,commandName:h6e,commandTag:f6e,chevron:m6e,chevronExpanded:p6e,commandDetail:g6e,commandDescription:y6e,commandSubcommands:b6e,empty:w6e},v6e=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],x6e=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"]),_6e=[["@","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 k6e(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function n3(e){return!x6e.has(e.name)}function S6e(e,t){return n3(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function T6e(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!n3(s):t==="custom-commands"?n3(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 C6e(){const{t:e}=at();return h.jsx("div",{className:rr.general,children:h.jsx("div",{className:rr.shortcuts,children:_6e.map(([t,n])=>h.jsxs("div",{className:rr.shortcut,children:[h.jsx("span",{className:rr.shortcutDesc,children:e(n)}),h.jsx("span",{className:rr.shortcutKey,children:t})]},t))})})}function A6e({commands:e,tab:t,query:n}){const{t:r}=at(),[s,i]=g.useState(null),o=g.useMemo(()=>T6e(e,t,n),[e,n,t]);return o.length===0?h.jsx("div",{className:rr.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):h.jsx("div",{className:rr.commandList,children:o.map(a=>{var c;const l=s===a.name;return h.jsxs("article",{className:`${rr.commandCard} ${l?rr.commandCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:rr.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[h.jsx("span",{className:rr.commandName,children:k6e(a)}),h.jsx("span",{className:rr.commandTag,children:S6e(a,r)}),h.jsx("svg",{className:`${rr.chevron} ${l?rr.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:rr.commandDetail,children:[a.description&&h.jsx("div",{className:rr.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&h.jsxs("div",{className:rr.commandSubcommands,children:[r("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function E6e({commands:e}){const{t}=at(),[n,r]=g.useState("general"),[s,i]=g.useState(""),o=n!=="general";return h.jsxs("div",{className:rr.dialog,children:[h.jsxs("div",{className:rr.toolbar,children:[h.jsx("div",{className:rr.tabs,children:v6e.map(a=>h.jsx("button",{type:"button",className:`${rr.tab} ${a.id===n?rr.tabActive:""}`,onClick:()=>r(a.id),children:t(a.labelKey)},a.id))}),o&&h.jsx("input",{className:rr.search,value:s,onChange:a=>i(a.target.value),placeholder:t("help.search")})]}),n==="general"?h.jsx(C6e,{}):h.jsx(A6e,{commands:e,tab:n,query:s})]})}function M6e({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=at(),s=GN.map(l=>({id:l,label:r(`theme.${l}`),description:r(`theme.${l}.desc`)})),[i,o]=g.useState(()=>{const l=s.findIndex(c=>c.id===e);return l>=0?l:0}),a=g.useRef(null);return g.useEffect(()=>{var c;const l=(c=a.current)==null?void 0:c.children[i];l==null||l.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:ve("resume-picker-list","resume-picker-list-compact"),ref:a,role:"listbox",children:s.map((l,c)=>{const u=l.id===e;return h.jsxs("button",{type:"button",role:"option","aria-selected":u,className:ve("resume-picker-item","resume-picker-session-item",c===i||u?"selected":void 0),onClick:()=>{t(l.id),n()},onMouseEnter:()=>o(c),children:[h.jsxs("div",{className:ve("resume-picker-item-row"),children:[h.jsx("span",{className:ve("resume-picker-item-title"),children:l.label}),u&&h.jsx("span",{className:ve("resume-picker-item-check"),children:" ✓"})]}),h.jsx("div",{className:ve("resume-picker-item-meta"),children:l.description})]},l.id)})})}function N6e({onDeleted:e,onError:t,onClose:n}){const{t:r}=at(),s=Xa(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=wy({autoLoad:!0}),u=s.sessionId,[d,f]=g.useState(!1),[m,p]=g.useState(0),[y,x]=g.useState(new Set),[b,w]=g.useState(""),[v,_]=g.useState(null),S=g.useRef(null),C=g.useRef(null);g.useEffect(()=>{a&&_(a.message)},[a]);const E=g.useMemo(()=>b?i.filter(M=>{const $=b.toLowerCase();return(M.displayName||"").toLowerCase().includes($)||M.sessionId.toLowerCase().includes($)}):i,[i,b]);g.useEffect(()=>{if(b&&y.size>0){const M=new Set(E.map($=>$.sessionId));x($=>{const H=new Set([...$].filter(J=>M.has(J)));return H.size===$.size?$:H})}},[b,E,y.size]),g.useEffect(()=>{m>=E.length&&E.length>0&&p(E.length-1)},[E.length,m]),g.useEffect(()=>{var $;const M=($=S.current)==null?void 0:$.children[m];M==null||M.scrollIntoView({block:"nearest"})},[m]),g.useEffect(()=>{var M;(M=C.current)==null||M.focus()},[]);const R=g.useCallback(M=>{M!==u&&x($=>{const H=new Set($);return H.has(M)?H.delete(M):H.add(M),H})},[u]),j=g.useCallback(()=>{if(d)return;if(y.size>0){const $=new Set(E.map(J=>J.sessionId)),H=Array.from(y).filter(J=>$.has(J));if(H.length===0)return;f(!0),c(H).then(J=>{const O=J.removed.length+J.notFound.length,Y=J.errors.length;if(Y>0&&O>0){t(new Error(r("delete.partialFail",{removed:O,failed:Y,detail:J.errors[0].error}))),n();return}if(Y>0){_(r("delete.allFailed",{count:Y,reason:J.errors[0].error})),f(!1),x(new Set);return}if(O===0){_(r("delete.nonRemoved")),f(!1),x(new Set);return}e([...J.removed,...J.notFound]),n()}).catch(J=>{t(J),f(!1)});return}const M=E[m];if(M){if(M.sessionId===u){_(r("delete.cannotCurrent"));return}f(!0),l(M.sessionId).then($=>{if(!$){_(r("delete.notFound")),f(!1);return}e([M.sessionId]),n()}).catch($=>{t($),f(!1)})}},[u,l,c,d,E,n,e,t,m,y,r]),N=y.size>0,B=!d&&!o&&N;return h.jsxs("div",{className:ve("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ve("resume-picker-search"),children:[h.jsxs("span",{className:ve("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:C,className:ve("resume-picker-search-input"),value:b,onChange:M=>{w(M.target.value),p(0),x(new Set)},placeholder:""}),h.jsx("span",{className:ve("resume-picker-search-hint"),children:v||(d?r("delete.deleting"):o?r("common.loading"):N?r("delete.selected",{count:y.size}):b?r("delete.matches",{count:E.length}):"")})]}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("resume-picker-list"),ref:S,children:[o&&h.jsx("div",{className:ve("resume-picker-empty"),children:r("common.loading")}),!o&&a&&h.jsx("div",{className:ve("resume-picker-empty"),children:a.message}),!o&&!a&&E.length===0&&h.jsx("div",{className:ve("resume-picker-empty"),children:b?r("delete.noMatch",{query:b}):r("delete.none")}),!o&&E.map((M,$)=>{const H=M.sessionId===u,J=y.has(M.sessionId),O=J?"[x] ":"[ ] ";return h.jsxs("div",{className:ve("resume-picker-item","resume-picker-session-item",J?"selected":void 0,H?"resume-picker-item-current":void 0,H?"disabled":void 0),onClick:()=>{p($),H||R(M.sessionId)},children:[h.jsxs("div",{className:ve("resume-picker-item-row"),children:[h.jsx("span",{className:ve("resume-picker-item-checkbox"),children:O}),h.jsx("span",{className:ve("resume-picker-item-title"),children:M.displayName||M.sessionId.slice(0,8)}),H&&h.jsx("span",{className:ve("resume-picker-item-badge"),children:r("resume.current")})]}),h.jsxs("div",{className:ve("resume-picker-item-meta"),children:[h.jsx("span",{children:(M.updatedAt||M.createdAt)&&ab(M.updatedAt||M.createdAt||"",r)}),h.jsx("span",{className:ve("resume-picker-item-detail"),children:r("common.clients",{count:M.clientCount??0})}),M.hasActivePrompt&&h.jsx("span",{className:ve("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},M.sessionId)})]}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:ve("dialog-inline-button"),onClick:n,disabled:d,children:r("common.cancel")}),h.jsx("button",{type:"button",className:ve("dialog-danger-button"),onClick:j,disabled:!B,children:r(d?"delete.deleting":"delete.action")})]})]})}function I6e({onReleased:e,onError:t,onClose:n}){const{t:r}=at(),s=Xa(),{sessions:i,loading:o,error:a,releaseSession:l}=wy({autoLoad:!0}),c=s.sessionId,[u,d]=g.useState(!1),[f,m]=g.useState(0),[p,y]=g.useState(!1),[x,b]=g.useState(""),[w,v]=g.useState(null),_=g.useRef(null),S=g.useRef(null);g.useEffect(()=>{a&&v(a.message)},[a]);const C=x?i.filter(B=>{const M=x.toLowerCase();return(B.displayName||"").toLowerCase().includes(M)||B.sessionId.toLowerCase().includes(M)}):i;g.useEffect(()=>{f>=C.length&&C.length>0&&m(C.length-1)},[C.length,f]),g.useEffect(()=>{var M;const B=(M=_.current)==null?void 0:M.children[f];B==null||B.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var B;(B=S.current)==null||B.focus()},[]);const E=g.useCallback(B=>{const M=B??C[f];if(!M||u)return;if(!((M.clientCount??0)>0||M.hasActivePrompt===!0)){v(r("release.inactive"));return}if(M.sessionId===c){v(r("release.cannotCurrent"));return}l&&(d(!0),l(M.sessionId).then(()=>{e(M.sessionId),n()}).catch(H=>{t(H),d(!1)}))},[c,u,C,n,t,e,l,f,r]),R=C[f],j=R&&((R.clientCount??0)>0||R.hasActivePrompt===!0),N=!u&&!o&&p&&!!R&&R.sessionId!==c&&!!j;return h.jsxs("div",{className:ve("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ve("resume-picker-search"),children:[h.jsxs("span",{className:ve("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:S,className:ve("resume-picker-search-input"),value:x,onChange:B=>{b(B.target.value),m(0),y(!1)},placeholder:""}),h.jsx("span",{className:ve("resume-picker-search-hint"),children:w||(u?r("release.releasing"):o?r("common.loading"):x?r("release.matches",{count:C.length}):"")})]}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("resume-picker-list"),ref:_,children:[o&&h.jsx("div",{className:ve("resume-picker-empty"),children:r("common.loading")}),!o&&C.length===0&&h.jsx("div",{className:ve("resume-picker-empty"),children:x?r("release.noMatch",{query:x}):r("release.none")}),!o&&C.map((B,M)=>{const $=B.sessionId===c,H=(B.clientCount??0)>0||B.hasActivePrompt===!0,J=$||!H;return h.jsxs("div",{className:ve("resume-picker-item","resume-picker-session-item",p&&M===f?"selected":void 0,$?"resume-picker-item-current":void 0,J?"disabled":void 0),onClick:()=>{m(M),y(!0)},children:[h.jsxs("div",{className:ve("resume-picker-item-row"),children:[h.jsx("span",{className:ve("resume-picker-item-title"),children:B.displayName||B.sessionId.slice(0,8)}),$&&h.jsx("span",{className:ve("resume-picker-item-badge"),children:r("resume.current")}),!$&&!H&&h.jsx("span",{className:ve("resume-picker-item-badge"),children:r("release.inactiveBadge")})]}),h.jsxs("div",{className:ve("resume-picker-item-meta"),children:[h.jsx("span",{children:(B.updatedAt||B.createdAt)&&ab(B.updatedAt||B.createdAt||"",r)}),h.jsx("span",{className:ve("resume-picker-item-detail"),children:r("common.clients",{count:B.clientCount??0})}),B.hasActivePrompt&&h.jsx("span",{className:ve("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},B.sessionId)})]}),h.jsx("div",{className:ve("resume-picker-sep")}),h.jsxs("div",{className:ve("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:ve("dialog-inline-button"),onClick:n,disabled:u,children:r("common.cancel")}),h.jsx("button",{type:"button",className:ve("dialog-danger-button"),onClick:()=>E(),disabled:!N,children:r(u?"release.releasing":"release.action")})]})]})}const R6e="_root_kygee_1",j6e="_list_kygee_8",L6e="_item_kygee_15",D6e="_itemSelected_kygee_33",O6e="_prompt_kygee_42",B6e="_turn_kygee_51",P6e="_time_kygee_56",z6e="_footer_kygee_62",$6e="_dangerButton_kygee_69",va={root:R6e,list:j6e,item:L6e,itemSelected:D6e,prompt:O6e,turn:B6e,time:P6e,footer:z6e,dangerButton:$6e};function q6e(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 F6e(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function U6e({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=at(),[o,a]=g.useState([]),[l,c]=g.useState(!0),[u,d]=g.useState(null),[f,m]=g.useState(null);g.useEffect(()=>{let x=!0;return c(!0),t().then(b=>{x&&a(b.snapshots)}).catch(b=>{x&&r(b)}).finally(()=>{x&&c(!1)}),()=>{x=!1}},[t,r]);const p=g.useMemo(()=>o.map(x=>({snapshot:x,promptText:q6e(e,x.turnIndex)})).sort((x,b)=>x.snapshot.turnIndex-b.snapshot.turnIndex),[e,o]);g.useEffect(()=>{p.length>0&&!f&&m(p[0].snapshot.promptId)},[p,f]);const y=()=>{const x=f;x&&(u||(d(x),n(x).then(()=>{s()}).catch(b=>{r(b),d(null)})))};return l?h.jsx("div",{className:ve("resume-picker-empty"),children:i("rewind.loading")}):p.length===0?h.jsx("div",{className:ve("resume-picker-empty"),children:i("rewind.empty")}):h.jsxs("div",{className:va.root,children:[h.jsx("div",{className:va.list,role:"list",children:p.map(({snapshot:x,promptText:b})=>{const w=f===x.promptId,v=u!==null,_=b||i("rewind.promptFallback",{id:x.promptId.slice(-8)});return h.jsxs("button",{type:"button",className:`${va.item} ${w?va.itemSelected:""}`,disabled:v,onClick:()=>m(x.promptId),children:[h.jsxs("div",{className:va.prompt,title:_,children:[h.jsxs("span",{className:va.turn,children:["#",x.turnIndex+1]})," ",_]}),h.jsx("div",{className:va.time,children:F6e(x.timestamp)})]},x.promptId)})}),h.jsxs("div",{className:va.footer,children:[h.jsx("button",{type:"button",className:ve("dialog-inline-button"),onClick:s,disabled:u!==null,children:i("common.cancel")}),h.jsx("button",{type:"button",className:`${ve("dialog-danger-button")} ${va.dangerButton}`,onClick:y,disabled:!f||u!==null,children:i(u?"rewind.rewinding":"rewind.confirm")})]})]})}const H6e="_sidebar_khplw_1",V6e="_resizing_khplw_21",W6e="_collapsed_khplw_25",G6e="_newChatButton_khplw_31",K6e="_footerButton_khplw_32",Y6e="_collapseButton_khplw_33",X6e="_projectRow_khplw_34",Q6e="_sessionRow_khplw_35",J6e="_retry_khplw_36",Z6e="_projectIconButton_khplw_38",eke="_sessionActionButton_khplw_39",tke="_secondaryButton_khplw_40",nke="_dangerButton_khplw_41",rke="_navIcon_khplw_96",ske="_settingsIcon_khplw_119",ike="_projectFolderIcon_khplw_125",oke="_body_khplw_129",ake="_sectionTitle_khplw_138",lke="_projectName_khplw_176",cke="_sessionText_khplw_177",uke="_sessionList_khplw_192",dke="_currentSession_khplw_214",hke="_busySession_khplw_219",fke="_floatingTooltip_khplw_224",mke="_tooltipContent_khplw_254",pke="_tooltipTitle_khplw_260",gke="_tooltipTags_khplw_267",yke="_tooltipTag_khplw_267",bke="_tooltipTagRunning_khplw_287",wke="_tooltipTagNew_khplw_292",vke="_tooltipMeta_khplw_297",xke="_sessionStatusSlot_khplw_312",_ke="_sessionStatusDot_khplw_322",kke="_sessionMetaSlot_khplw_332",Ske="_sessionTime_khplw_343",Tke="_sessionLoading_khplw_350",Cke="_runningSession_khplw_360",Ake="_sessionActions_khplw_369",Eke="_searchInput_khplw_461",Mke="_renameInput_khplw_475",Nke="_renameForm_khplw_486",Ike="_notice_khplw_502",Rke="_confirmContent_khplw_517",jke="_confirmDescription_khplw_523",Lke="_confirmActions_khplw_530",Dke="_footer_khplw_32",Oke="_resizeHandle_khplw_603",Bke="_mobileOpen_khplw_636",bt={sidebar:H6e,resizing:V6e,collapsed:W6e,newChatButton:G6e,footerButton:K6e,collapseButton:Y6e,projectRow:X6e,sessionRow:Q6e,retry:J6e,projectIconButton:Z6e,sessionActionButton:eke,secondaryButton:tke,dangerButton:nke,navIcon:rke,settingsIcon:ske,projectFolderIcon:ike,body:oke,sectionTitle:ake,projectName:lke,sessionText:cke,sessionList:uke,currentSession:dke,busySession:hke,floatingTooltip:fke,tooltipContent:mke,tooltipTitle:pke,tooltipTags:gke,tooltipTag:yke,tooltipTagRunning:bke,tooltipTagNew:wke,tooltipMeta:vke,sessionStatusSlot:xke,sessionStatusDot:_ke,sessionMetaSlot:kke,sessionTime:Ske,sessionLoading:Tke,runningSession:Cke,sessionActions:Ake,searchInput:Eke,renameInput:Mke,renameForm:Nke,notice:Ike,confirmContent:Rke,confirmDescription:jke,confirmActions:Lke,footer:Dke,resizeHandle:Oke,mobileOpen:Bke},tB="qwen-code-web-shell-sidebar-width",$p=260,Pke=220,zke=420,$ke=1e3,qke=2e3,Fke=3e4;function qp(...e){return e.filter(Boolean).join(" ")}function DC(e){return e instanceof DOMException&&e.name==="AbortError"}function Uke(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function mf(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function Hke(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function W1(e){return Math.min(zke,Math.max(Pke,e))}function Vke(){if(typeof window>"u")return $p;try{const e=window.localStorage.getItem(tB),t=e?Number(e):$p;return Number.isFinite(t)?W1(t):$p}catch{return $p}}function Wke(e){try{window.localStorage.setItem(tB,String(W1(e)))}catch{}}function Gke(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v14M5 12h14"})})}function Kke({expanded:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M3.25 8.6V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v1.1"}),h.jsx("path",{d:"M4.3 10.6h14.9a1.75 1.75 0 0 1 1.68 2.24l-1.32 4.5A2.4 2.4 0 0 1 17.25 19H5.05a2.4 2.4 0 0 1-2.34-2.94l.86-3.75A2.2 2.2 0 0 1 5.72 10.6"})]}):h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M3.25 8.2V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v.7"}),h.jsx("path",{d:"M3.25 8.2h17.5v7.9a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V8.2Z"})]})})}function Yke(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"m16.5 16.5 4 4"})]})}function Xke(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1A2 2 0 1 1 4.2 17l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.9L4.2 7A2 2 0 1 1 7 4.2l.1.1a1.7 1.7 0 0 0 1.9.3h.1a1.7 1.7 0 0 0 .9-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1A2 2 0 1 1 19.8 7l-.1.1a1.7 1.7 0 0 0-.3 1.9v.1a1.7 1.7 0 0 0 1.5.9h.1a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z"})]})}function Qke(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("path",{d:"M4 20h5l10-10a3 3 0 0 0-5-5L4 15v5Z"}),h.jsx("path",{d:"M13.5 5.5 18.5 10.5"})]})}function Jke(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"})})}function Zke({collapsed:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsx("path",{d:"M9 6l6 6-6 6"}):h.jsx("path",{d:"M15 6l-6 6 6 6"})})}function e8e({expanded:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsx("path",{d:"m6 9 6 6 6-6"}):h.jsx("path",{d:"m9 6 6 6-6 6"})})}function t8e({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onNewSession:r,onLoadSession:s,onError:i,mobileOpen:o}){const{t:a}=at(),l=Xa(),c=by(),{sessions:u,loading:d,error:f,reload:m,deleteSession:p}=wy({autoLoad:!0,pageSize:$ke}),[y,x]=g.useState(null),[b,w]=g.useState(""),[v,_]=g.useState(null),S=g.useRef(null),C=g.useRef(!1),[E,R]=g.useState(null),[j,N]=g.useState(Vke),[B,M]=g.useState(!0),[$,H]=g.useState(!1),[J,O]=g.useState(""),[Y,G]=g.useState(!1),[ee,L]=g.useState(null),[F,P]=g.useState(()=>new Set),A=g.useRef(null),ne=g.useRef(null),be=g.useRef(!1),he=g.useRef(null),ye=l.sessionId,me=Uke(l.workspaceCwd)||a("sidebar.projectFallback"),se={"--web-shell-sidebar-width":`${j}px`},re=g.useCallback(()=>{A.current!==null&&(window.clearTimeout(A.current),A.current=null)},[]),oe=g.useCallback(()=>{re(),A.current=window.setTimeout(()=>{L(null),A.current=null},240)},[re]);g.useEffect(()=>()=>{var V;re(),(V=he.current)==null||V.call(he,!1)},[re]),g.useEffect(()=>{M(!e),e&&(H(!1),O(""),L(null))},[e]);const ke=g.useMemo(()=>u.some(V=>V.hasActivePrompt),[u]);g.useEffect(()=>{if(!B&&!ke)return;const V=ke&&!f?qke:Fke,ue=window.setInterval(()=>{document.hidden||be.current||(be.current=!0,m().finally(()=>{be.current=!1}))},V);return()=>window.clearInterval(ue)},[f,ke,B,m]),g.useEffect(()=>{const V=new Map(u.map(Ne=>[Ne.sessionId,!!Ne.hasActivePrompt])),ue=ne.current;ne.current=V,ue!==null&&P(Ne=>{const ut=new Set(Ne);let ht=!1;for(const[ft,pe]of ue){const Ae=V.get(ft);pe&&Ae===!1&&ft!==ye&&!ut.has(ft)&&(ut.add(ft),ht=!0)}for(const ft of ut)(ft===ye||!V.has(ft)||V.get(ft))&&(ut.delete(ft),ht=!0);return ht?ut:Ne})},[ye,u]);const He=g.useCallback((V,ue)=>{re();const Ne=V.currentTarget.getBoundingClientRect();L({content:ue,top:Ne.top+Ne.height/2,left:Ne.right+8})},[re]),Ve=g.useCallback(V=>{const ue=mf(V),Ne=V.sessionId!==ye&&F.has(V.sessionId);return h.jsxs("div",{className:bt.tooltipContent,children:[h.jsx("div",{className:bt.tooltipTitle,children:ue}),h.jsxs("div",{className:bt.tooltipTags,children:[V.hasActivePrompt&&h.jsx("span",{className:qp(bt.tooltipTag,bt.tooltipTagRunning),children:a("sidebar.running")}),Ne&&h.jsx("span",{className:qp(bt.tooltipTag,bt.tooltipTagNew),children:a("sidebar.completedUnread")}),h.jsx("span",{className:bt.tooltipTag,children:a("sidebar.clients",{count:V.clientCount??0})})]}),h.jsx("div",{className:bt.tooltipMeta,children:V.sessionId})]})},[F,ye,a]),ce=g.useCallback(()=>{S.current!==null||C.current||(C.current=!0,(async()=>{try{await r()&&m()}catch(V){DC(V)||i(V,a("sidebar.newSessionFailed"))}finally{C.current=!1}})())},[i,r,m,a]),xe=g.useCallback(V=>{V===ye||V===S.current||(P(ue=>{if(!ue.has(V))return ue;const Ne=new Set(ue);return Ne.delete(V),Ne}),S.current=V,_(V),(async()=>{try{await s(V)}catch(ue){DC(ue)||i(ue,a("sidebar.switchFailed"))}finally{S.current===V&&(S.current=null),_(ue=>ue===V?null:ue)}})())},[ye,i,s,a]),Me=g.useCallback(V=>{x(V.sessionId),w(mf(V))},[]),Re=g.useCallback(()=>{x(null),w("")},[]),ct=g.useCallback(()=>{const V=b.trim();if(!V||y!==ye){Re();return}const ue=y;S.current=ue,_(ue),c.renameSession(V).then(()=>{Re(),m()}).catch(Ne=>{i(Ne,a("sidebar.renameFailed")),Re()}).finally(()=>{S.current===ue&&(S.current=null),_(Ne=>Ne===ue?null:Ne)})},[c,Re,ye,b,y,i,m,a]),Ct=g.useCallback(V=>{V.sessionId!==ye&&R(V)},[ye]),vt=g.useCallback(()=>{if(!E)return;const V=E.sessionId;if(V===ye){R(null);return}R(null),S.current=V,_(V),p(V).then(ue=>{ue||m()}).catch(ue=>i(ue,a("sidebar.deleteFailed"))).finally(()=>{S.current===V&&(S.current=null),_(ue=>ue===V?null:ue)})},[ye,E,p,i,m,a]),Rt=g.useCallback(V=>{V.sessionId===ye&&Me(V)},[ye,Me]),Ke=g.useMemo(()=>{const V=J.trim().toLowerCase(),ue=V?u.filter(ut=>mf(ut).toLowerCase().includes(V)||ut.sessionId.toLowerCase().includes(V)):u.slice(),Ne=new Map(ue.map(ut=>[ut.sessionId,Hke(ut)]));return ue.sort((ut,ht)=>(Ne.get(ht.sessionId)??0)-(Ne.get(ut.sessionId)??0))},[J,u]),pt=g.useCallback(V=>{var K;if(e)return;V.preventDefault(),(K=he.current)==null||K.call(he,!0),G(!0);const ue=V.clientX,Ne=j,ut=document.body.style.cursor,ht=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}const ft=ie=>{const fe=W1(Ne+ie.clientX-ue);N(fe)},pe=ie=>{document.body.style.cursor=ut,document.body.style.userSelect=ht,window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",Ae),window.removeEventListener("pointercancel",te),he.current=null,ie&&G(!1)},Ae=ie=>{const fe=W1(Ne+ie.clientX-ue);N(fe),Wke(fe),pe(!0)},te=()=>{pe(!0)};he.current=pe,window.addEventListener("pointermove",ft),window.addEventListener("pointerup",Ae,{once:!0}),window.addEventListener("pointercancel",te,{once:!0})},[e,j]),yt=E?mf(E):"",ae=g.useMemo(()=>B?d&&u.length===0?h.jsx("div",{className:bt.notice,children:a("sidebar.loadingSessions")}):f&&u.length===0?h.jsx("button",{className:bt.retry,type:"button",onClick:m,children:a("sidebar.loadFailed")}):Ke.length===0?h.jsx("div",{className:bt.notice,children:a("sidebar.searchEmpty")}):Ke.map(V=>{const ue=V.sessionId===ye,Ne=y===V.sessionId,ut=mf(V),ht=V.updatedAt||V.createdAt,ft=ht?ab(ht,a):"",pe=v===V.sessionId,Ae=!ue&&F.has(V.sessionId);return h.jsx("div",{className:qp(bt.sessionRow,ue&&bt.currentSession,V.hasActivePrompt&&bt.runningSession,pe&&bt.busySession),role:"button",tabIndex:0,"aria-current":ue?"page":void 0,onMouseEnter:te=>He(te,Ve(V)),onMouseLeave:oe,onFocus:te=>He(te,Ve(V)),onBlur:oe,onClick:()=>xe(V.sessionId),onDoubleClick:()=>{ue&&!e&&Me(V)},onKeyDown:te=>{te.key==="Enter"&&xe(V.sessionId)},children:!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:bt.sessionStatusSlot,"aria-hidden":"true",children:Ae&&h.jsx("span",{className:bt.sessionStatusDot})}),Ne?h.jsx("form",{className:bt.renameForm,onClick:te=>te.stopPropagation(),onSubmit:te=>{te.preventDefault(),ct()},children:h.jsx("input",{autoFocus:!0,className:bt.renameInput,value:b,onChange:te=>w(te.target.value),onBlur:Re,onKeyDown:te=>{te.key==="Escape"&&(te.preventDefault(),Re())}})}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:bt.sessionText,children:ut}),h.jsxs("div",{className:bt.sessionMetaSlot,children:[V.hasActivePrompt?h.jsx("span",{className:bt.sessionLoading,"aria-label":a("sidebar.running")}):h.jsx("span",{className:bt.sessionTime,children:ft}),h.jsxs("div",{className:bt.sessionActions,onClick:te=>te.stopPropagation(),onKeyDown:te=>te.stopPropagation(),onMouseEnter:te=>{te.stopPropagation(),L(null)},children:[h.jsx("button",{className:bt.sessionActionButton,type:"button",disabled:!ue,title:a(ue?"sidebar.rename":"sidebar.renameCurrentOnly"),"aria-label":a("sidebar.rename"),onClick:()=>Rt(V),children:h.jsx(Qke,{})}),h.jsx("button",{className:bt.sessionActionButton,type:"button",disabled:ue,title:a(ue?"sidebar.currentDeleteDisabled":"sidebar.delete"),"aria-label":a("sidebar.delete"),onClick:()=>Ct(V),children:h.jsx(Jke,{})})]})]})]})]})},V.sessionId)}):null,[v,Re,e,F,ye,b,y,f,Ke,Ct,xe,Rt,oe,d,B,m,ct,Ve,u.length,He,Me,a]);return h.jsxs("aside",{className:qp(bt.sidebar,e&&bt.collapsed,Y&&bt.resizing,o&&bt.mobileOpen),"aria-label":a("sidebar.label"),style:se,children:[ee&&h.jsx("div",{className:bt.floatingTooltip,role:"tooltip",style:{top:ee.top,left:ee.left},onMouseEnter:re,onMouseLeave:oe,children:ee.content}),E&&h.jsx(ns,{title:a("delete.title"),size:"sm",onClose:()=>R(null),children:h.jsxs("div",{className:bt.confirmContent,children:[h.jsx("p",{className:bt.confirmDescription,children:a("sidebar.deleteConfirmDescription",{name:yt})}),h.jsxs("div",{className:bt.confirmActions,children:[h.jsx("button",{className:bt.secondaryButton,type:"button",onClick:()=>R(null),children:a("common.cancel")}),h.jsx("button",{className:bt.dangerButton,type:"button",onClick:vt,children:a("sidebar.delete")})]})]})}),h.jsxs("button",{className:bt.newChatButton,type:"button",title:a("sidebar.newChat"),"aria-label":a("sidebar.newChat"),onClick:ce,children:[h.jsx("span",{className:bt.navIcon,children:h.jsx(Gke,{})}),!e&&h.jsx("span",{children:a("sidebar.newChat")})]}),h.jsxs("div",{className:bt.body,children:[!e&&h.jsx("div",{className:bt.sectionTitle,children:a("sidebar.project")}),h.jsxs("div",{className:bt.projectRow,role:"button",tabIndex:0,"aria-expanded":B,onClick:()=>{e||M(V=>!V)},onKeyDown:V=>{e||(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),M(ue=>!ue))},onMouseEnter:V=>He(V,h.jsxs("div",{className:bt.tooltipContent,children:[h.jsx("div",{className:bt.tooltipTitle,children:me}),h.jsx("div",{className:bt.tooltipMeta,children:l.workspaceCwd||me})]})),onMouseLeave:oe,onFocus:V=>He(V,h.jsxs("div",{className:bt.tooltipContent,children:[h.jsx("div",{className:bt.tooltipTitle,children:me}),h.jsx("div",{className:bt.tooltipMeta,children:l.workspaceCwd||me})]})),onBlur:oe,children:[h.jsx("span",{className:`${bt.navIcon} ${bt.projectFolderIcon}`,children:h.jsx(Kke,{expanded:B})}),!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:bt.projectName,children:me}),h.jsx("button",{className:bt.projectIconButton,type:"button","aria-label":a("sidebar.search"),onKeyDown:V=>V.stopPropagation(),onClick:V=>{V.stopPropagation(),H(ue=>(ue&&O(""),!ue)),M(!0)},children:h.jsx(Yke,{})}),h.jsx("button",{className:bt.projectIconButton,type:"button","aria-label":a(B?"sidebar.collapseProject":"sidebar.expandProject"),onKeyDown:V=>V.stopPropagation(),onClick:V=>{V.stopPropagation(),M(ue=>!ue)},children:h.jsx(e8e,{expanded:B})})]})]}),$&&!e&&B&&h.jsx("input",{className:bt.searchInput,value:J,placeholder:a("sidebar.searchPlaceholder"),"aria-label":a("sidebar.search"),autoFocus:!0,onChange:V=>O(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(O(""),H(!1))}}),h.jsx("div",{className:bt.sessionList,children:ae})]}),h.jsxs("div",{className:bt.footer,children:[h.jsxs("button",{className:bt.footerButton,type:"button",title:a("sidebar.settings"),"aria-label":a("sidebar.settings"),onClick:n,children:[h.jsx("span",{className:`${bt.navIcon} ${bt.settingsIcon}`,children:h.jsx(Xke,{})}),!e&&h.jsx("span",{children:a("sidebar.settings")})]}),!o&&h.jsx("button",{className:bt.collapseButton,type:"button",title:a(e?"sidebar.expand":"sidebar.collapse"),"aria-label":a(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:h.jsx(Zke,{collapsed:e})})]}),h.jsx("div",{className:bt.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:pt})]})}function n8e(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 r8e(...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 s8e(e){const[t,n]=g.useState(e);return g.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(r)},[e]),t}const i8e=3e3,o8e=2;function OC(e){return e.some(t=>t.status==="running"||t.status==="paused")}function a8e(e,t,n=0){const r=by(),[s,i]=g.useState([]),[o,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useRef(0),d=g.useRef(!1);g.useEffect(()=>{if(!t){i([]),a(!1),u.current=0;return}},[t]),g.useEffect(()=>{!t||!e||(u.current=0,a(!0))},[t,e]),g.useEffect(()=>{!t||n===0||(u.current=0,a(!0))},[t,n]),g.useEffect(()=>{if(l||!t||!o)return;let m=!1;const p=()=>{d.current||(d.current=!0,r.getTasks().then(x=>{if(!m){if(i(x.tasks),x.tasks.length===0){u.current+=1,u.current>=o8e&&a(!1);return}u.current=0,OC(x.tasks)||a(!1)}}).catch(x=>{m||console.warn("[web-shell] failed to refresh tasks:",x)}).finally(()=>{d.current=!1}))};p();const y=setInterval(p,i8e);return()=>{m=!0,clearInterval(y)}},[r,t,o,l]);const f=g.useRef(s);return f.current=s,g.useEffect(()=>{const m=p=>{const y=p.detail,x=(y==null?void 0:y.active)===!0;c(x),!x&&OC(f.current)&&a(!0)};return window.addEventListener(L0,m),()=>window.removeEventListener(L0,m)},[]),s}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function l8e(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function c8e(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 u8e(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 d8e(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function h8e(e){return d8e(e)||!e.text&&!e.usage?null:e}function BC(e){return e.text.length===0}function f8e(e){const t=e.flatMap((n,r)=>{const s=ri(n),i=Zs(s,"content");return i?[{id:Zs(s,"id")??`plan-${r}`,content:i,status:w8e(Zs(s,"status")),...(()=>{const a=v8e(Zs(s,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function PC(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 m8e(e,t={}){var c,u,d;const n=[],r=((c=t.labels)==null?void 0:c.promptCancelled)??"Request cancelled.",s=new Map,i=new Map;let o=null,a=null,l=!1;for(let f=0;f<e.length;f++){const m=e[f],p=m.serverTimestamp??m.clientReceivedAt;switch(m.kind){case"user":{o=null,a=null,l=!1;const y=m,x={id:m.id,role:"user",content:y.text,timestamp:p};y.images&&y.images.length>0&&(x.images=y.images.map(b=>({data:b.data,mimeType:b.mimeType||"image/*"}))),n.push(x);break}case"assistant":{const y=h8e(m);if(!y)break;const x=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(x){zC(x,y.text);break}const b=j8e(y.text);if(b){let v=null,_=!1,S=0,C=0;for(const E of b)E.kind==="insight"?E.data.type==="insight_progress"?v=E.data:E.data.type==="insight_ready"?(_=!0,n.push({id:`${m.id}-ir-${S++}`,role:"insight_ready",path:E.data.path,timestamp:p})):E.data.type==="insight_error"&&(_=!0,n.push({id:`${m.id}-ie-${C++}`,role:"insight_error",error:E.data.error,timestamp:p})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:E.text,timestamp:p}),o=n.length-1,a=null);v&&!_&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:v.stage,progress:v.progress,detail:v.detail,timestamp:p}),l=!0;break}const w=o!==null?n[o]:void 0;if(w&&w.role==="assistant"&&!l&&!BC(y)){const v=PC(w.usage,y.usage);n[o]={...w,content:w.content+y.text,isStreaming:y.streaming,...v?{usage:v}:{}},l=!1,a=null}else if(!BC(y))n.push({id:m.id,role:"assistant",content:y.text,isStreaming:y.streaming,timestamp:p,...y.usage?{usage:y.usage}:{}}),o=n.length-1,a=null,l=!1;else if(y.usage&&w&&w.role==="assistant"){const v=PC(w.usage,y.usage);n[o]={...w,...v?{usage:v}:{}}}break}case"thought":{const y=m,x=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(x){zC(x,y.text);break}const b=a!==null?n[a]:void 0;b&&b.role==="thinking"&&!l?(n[a]={...b,content:b.content+y.text,isStreaming:y.streaming},l=!1):(n.push({id:m.id,role:"thinking",content:y.text,isStreaming:y.streaming,timestamp:p}),a=n.length-1,l=!1),o=null;break}case"tool":{const x=x8e(m),b=i.get(x.callId);b!=null&&b.title&&(x.title=b.title),!x.args&&(b!=null&&b.args)&&(x.args=b.args);const w=x.parentToolCallId?s.get(x.parentToolCallId):void 0,v=s.get(x.callId);if(v){$C(v,x);break}if(w){p8e(w,x),s.set(x.callId,x);break}G4(n,m.id,x,p),s.set(x.callId,x),o=null,a=null,l=!0;break}case"shell":{const y=m,x=n[n.length-1];if(x&&x.role==="tool_group"){const b=g8e(x.tools),w=x.tools[b];if(w){const v=typeof w.rawOutput=="string"?w.rawOutput:"",_={...w,rawOutput:v+y.text};n[n.length-1]={...x,tools:[...x.tools.slice(0,b),_,...x.tools.slice(b+1)]},s.get(w.callId)===w&&s.set(w.callId,_)}}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;k8e(y,i);const x=_8e(y);if(!x)break;const b=nB(x);if(!y.resolved)break;const w=s.get(x.callId);if(w){const v=w.status;x.toolName=w.toolName,y.resolved&&(K4(y.resolved)?x.status=b?x.status:"in_progress":(x.status="failed",x.endTime=y.updatedAt)),$C(w,x),y.resolved&&b&&K4(y.resolved)&&(w.status=v);break}if(y.resolved){K4(y.resolved)?(b||(x.status="in_progress"),G4(n,m.id,x,p),s.set(x.callId,x),l=!0):(x.status="failed",x.endTime=y.updatedAt,G4(n,m.id,x,p),s.set(x.callId,x),l=!0);break}break}case"status":case"debug":{const y=m,x=y.source==="session_branched"?c8e(y.data):null,b=y.source==="mid_turn_message_injected"?u8e(y.data):null,w=x&&((u=t.labels)!=null&&u.branchSuccess)?t.labels.branchSuccess(x):b&&((d=t.labels)!=null&&d.midTurnInserted)?t.labels.midTurnInserted(b):y.text;if(l8e(w))break;const v=b8e(w);if(v){n.push({id:m.id,role:"plan",todos:v,timestamp:p}),l=!0;break}n.push({id:m.id,role:"system",content:w,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 p8e(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function zC(e,t){e.subContent=(e.subContent||"")+t}function G4(e,t,n,r){const s=o=>nB(o)||jh(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!s(n)&&!i.tools.some(s)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:r})}function g8e(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 $C(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 nB(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||y8e(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function y8e(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function b8e(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=ri(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:f8e(r.entries)}catch{return}}function ri(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Zs(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function w8e(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function v8e(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function x8e(e){const t=T8e(e),n=S8e(e,t),r=C8e(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:sB(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 _8e(e){const t=ri(e.toolCall);if(!t)return;const n=rB(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=ri(t._meta),s=Zs(t,"kind"),i=Zs(r,"toolName")??Zs(t,"toolName")??Zs(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),o=Zs(t,"toolCallId")??Zs(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Zs(t,"title")??e.title,status:"pending",kind:sB(i,s),args:n,startTime:e.createdAt}}function k8e(e,t){const n=ri(e.toolCall),r=Zs(n,"toolCallId")??Zs(n,"id");if(!r)return;const s=Zs(n,"title")??e.title,i=n?rB(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function K4(e){const[t="",n=""]=e.toLowerCase().split(":",2);return qC(t)?!0:t!=="selected"?!1:qC(n.trim())}function qC(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 rB(e){return ri(e.rawInput)??ri(e.input)??ri(e.args)}function S8e(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=ri(t);return(r==null?void 0:r.status)==="background"}function T8e(e){return A8e(e)&&e.status==="failed"?E8e(e)??e.details??e.rawOutput:!M8e(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 C8e(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=ri(n);if(!r)return[];const s=r.type;if(s==="content"){const i=ri(r.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(s==="diff"){const i=r.newText;if(typeof i!="string")return[];const o=r.path,a=r.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(s==="terminal"){const i=r.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function A8e(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function E8e(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 M8e(e){return e==="cancelled"||e==="canceled"}const N8e=['"insight_progress":','"insight_ready":','"insight_error":'];function I8e(e){try{const t=JSON.parse(e),n=ri(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=ri(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=ri(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function R8e(e,t){if(e[t]!=="{")return null;let n=0,r=!1,s=!1;for(let i=t;i<e.length;i++){const o=e[i];if(s){s=!1;continue}if(o==="\\"&&r){s=!0;continue}if(o==='"'){r=!r;continue}if(!r){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function j8e(e){const t=[];let n=0,r=0,s=!1;for(;r<e.length;){const o=e.indexOf("{",r);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!N8e.some(f=>a.startsWith(f))){r=o+1;continue}const c=R8e(e,o);if(!c){r=o+1;continue}const u=I8e(c);if(!u){r=o+1;continue}s=!0;const d=e.slice(n,o).trim();d&&t.push({kind:"text",text:d}),t.push({kind:"insight",data:u}),n=o+c.length,r=n}if(!s)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function sB(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 L8e(e){const t=yy();return g.useMemo(()=>m8e(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n})}}),[t,e])}function D8e(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>i===t[o]);const n=Object.keys(e),r=t,s=e;return n.length!==Object.keys(r).length?!1:n.every(i=>{const o=s[i],a=r[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((l,c)=>l===a[c]):!1})}function O8e(e){const t=g.useRef(e);return D8e(t.current,e)||(t.current=e),t.current}function B8e(e,t){const n=g.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((s,i)=>t(s)!==t(n.current[i]))&&(n.current=e),n.current)}const Dr={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"},FC=1024,P8e=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${FC}}\S\$)([^$\n]{1,${FC}})\$(?![\w$])`,"g");function z8e(e){var c,u,d;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=new Map;let i=null,o=null,a=null,l=[];for(const f of n){const m=f.match(r);if(!i){if(m){if(i=m[1]??null,o=((u=(c=m[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:u.toLowerCase())||null,o){const p=(s.get(o)??0)+1;s.set(o,p),a=p}else a=null;l=[]}continue}if(m&&((d=m[1])!=null&&d.startsWith(i[0]??""))&&m[1].length>=i.length){t.push({lang:o,content:l.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,l=[];continue}l.push(f)}return t}function $8e(e){var l;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const c of n){const u=c.match(r);if(i){u&&((l=u[1])!=null&&l.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(!o){if(u){i=u[1]??null;continue}s.test(c)&&(o=!0,a=[]);continue}if(s.test(c)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(c)}return t}function q8e(e){var a;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1;for(const l of n){const c=l.match(r);if(i){c&&((a=c[1])!=null&&a.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(o){s.test(l)&&(o=!1);continue}if(c){i=c[1]??null;continue}if(s.test(l)){o=!0;continue}for(const u of l.matchAll(P8e)){const d=u[1];d&&t.push({content:d,index:t.length+1})}}return t}function UC(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function F8e(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=z8e(e);if(s.length===0)return null;let i=null,o=null;const a=r==="code"?n.slice(1):n.map(d=>d);r!=="code"&&(i=r);for(const d of a)/^\d+$/.test(d)?o=Number(d):d.toLowerCase()!=="code"&&(i=d.toLowerCase());const l=i?s.filter(d=>d.lang===i):s;if(l.length===0)return null;if(o!==null){const d=i?l.find(f=>f.langIndex===o):s.find(f=>f.index===o);return d?{content:d.content,label:UC(d,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:UC(c,i)}:null}function HC(e,t){const n=q8e(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 U8e(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 HC(e,n.slice(1));const s=n.slice(1),i=s.findIndex(u=>u.toLowerCase()==="inline");if(i!==-1)return HC(e,s.filter((u,d)=>d!==i));const o=$8e(e);if(o.length===0)return null;let a=null;for(const u of s)/^\d+$/.test(u)&&(a=Number(u));const l=a!==null?o.find(u=>u.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function H8e(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 V8e(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 W8e(e,t,n=V8e){const r=H8e(e);if(r===null)return{status:"info",message:Dr.NO_OUTPUT};if(!r)return{status:"info",message:Dr.NO_TEXT};try{const s=U8e(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Dr.INLINE_LATEX_MISSING:Dr.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${Dr.COPIED_SUFFIX}`};const i=F8e(r,t);if(i===null)return{status:"info",message:Dr.CODE_MISSING};const o=(i==null?void 0:i.content)??r;return await n(o),{status:"info",message:i?`${i.label}${Dr.COPIED_SUFFIX}`:Dr.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${Dr.CLIPBOARD_PREFIX}${i}`}}}function G8e(e){return typeof e=="object"&&e!==null}function iB(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function l6(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function K8e(e){if(!l6(e)||!G8e(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function Y8e(e){const t=new Set;for(const n of e){if(!l6(n))continue;const r=K8e(n);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=iB(n.content);return!r||!t.has(r)})}function X8e(e){return e.role!=="system"||e.variant!=="info"?!1:iB(e.content)!==null||l6(e)}function Q8e(e){const t=e.findIndex(n=>!X8e(n));return t<0?[]:e.slice(t)}function VC(e){return Q8e(Y8e(e))}function J8e(e){return e.blocked?{kind:"ignore"}:e.streaming?e.armed==="cancel"?{kind:"cancel"}:{kind:"arm",action:"cancel"}:e.hasInput?e.armed==="clear"?{kind:"clear"}:{kind:"arm",action:"clear"}:{kind:"ignore"}}function WC(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const r of e.cells){const s=r.detail;r.kind==="node_version"&&(s!=null&&s.version)?n.nodeVersion=s.version:r.kind==="npm"&&(s!=null&&s.version)?n.npmVersion=String(s.version).replace(/^npm\s*/i,""):r.kind==="auth"&&(s!=null&&s.source)&&(n.authSource=s.source)}if(t)for(const r of t.cells)r.kind==="platform"?(n.platform=r.name,r.value&&(n.arch=r.value)):r.kind==="sandbox"&&r.name==="SANDBOX"?n.sandbox=r.value||"":r.kind==="proxy"&&r.present&&r.value?n.proxy=`${r.name}: ${r.value}`:r.kind==="memory"&&r.value&&(n.memoryUsage=r.value);return n}function Z8e(e,t,n,r){return e?!0:(r.append(t),!1)}function oB(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}const eSe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='12.400195360183716'%20height='13.973437547683716'%20viewBox='0%200%2012.400195360183716%2013.973437547683716'%3e%3cpath%20d='M8.200192523841858,3.504687623841858L4.200002823841858,3.504687623841858L2.999997223841858,3.504690323841858L2.400195323841858,3.504687623841858L2.400195323841858,10.305688523841859L2.400198123841858,10.905691023841857L1.200192573841858,10.905691023841857L1.200195313841858,10.305688523841859L1.2001953738418578,3.504687623841858L0.6000000238418579,3.504687623841858L-0.0000027461581421084347,3.504690323841858L-0.0000027461581421084347,2.304684723841858L0.6000000238418579,2.304687523841858L2.999999923841858,2.304687523841858L2.999999923841858,3.8418579428878274e-9L9.400195723841858,3.8418579428878274e-9L9.400195723841858,2.304687523841858L11.800195023841859,2.304687523841858L12.400198023841858,2.304684723841858L12.400198023841858,3.504690323841858L11.800195023841859,3.5046874238418577L11.200000023841858,3.504687623841858L11.200000023841858,13.973437023841857L1.800195323841858,13.973437023841857L1.200192573841858,13.973440023841858L1.200192573841858,12.773435023841857L1.800195323841858,12.773437023841858L10.000000623841858,12.773437023841858L10.000000623841858,3.504687623841858L9.400197623841859,3.504687623841858L8.200192523841858,3.504690323841858L8.200192523841858,3.504687623841858ZM8.200195423841858,2.304687523841858L8.200195423841858,1.2000000438418579L4.199999923841858,1.2000000438418579L4.199999923841858,2.304687523841858L8.200195423841858,2.304687523841858ZM4.266598823841858,6.2031222238418575L4.266601723841858,6.803125023841858L4.266601723841858,9.482812523841858L4.266598823841858,10.082814823841858L5.466604323841858,10.082814823841858L5.466601523841858,9.482812523841858L5.466601523841858,6.803125023841858L5.466604323841858,6.2031222238418575L4.266598823841858,6.2031222238418575ZM6.933591023841858,6.2031222238418575L6.933593823841858,6.803125023841858L6.933593823841858,9.482812523841858L6.933591023841858,10.082814823841858L8.133596523841858,10.082814823841858L8.133593723841859,9.482812523841858L8.133593723841859,6.803125023841858L8.133596523841858,6.2031222238418575L6.933591023841858,6.2031222238418575Z'%20fill-rule='evenodd'%20fill='%23747476'%20fill-opacity='1'/%3e%3c/svg%3e",tSe="/assets/insert-DmRbh9Rv.svg",nSe="/assets/queue-DWpnpFgW.svg",rSe="_app_ma7ez_1",sSe="_appChat_ma7ez_24",iSe="_appChatEmpty_ma7ez_30",oSe="_appShell_ma7ez_35",aSe="_chatPane_ma7ez_43",lSe="_mobileDrawer_ma7ez_52",cSe="_mobileBackdrop_ma7ez_56",uSe="_hamburgerButton_ma7ez_60",dSe="_mobileDrawerOpen_ma7ez_99",hSe="_appWithSidebar_ma7ez_127",fSe="_themeDark_ma7ez_175",mSe="_themeLight_ma7ez_243",pSe="_content_ma7ez_311",gSe="_contentHasMessages_ma7ez_319",ySe="_footer_ma7ez_328",bSe="_bottomPanels_ma7ez_338",wSe="_approvalOverlay_ma7ez_353",vSe="_scrollToBottomLayer_ma7ez_362",xSe="_scrollToBottomLayerWithTodos_ma7ez_373",_Se="_scrollToBottomButton_ma7ez_377",kSe="_scrollToBottomIcon_ma7ez_406",SSe="_btwPanel_ma7ez_412",TSe="_composer_ma7ez_419",CSe="_escClearStatus_ma7ez_426",ASe="_emptyWelcomeFooter_ma7ez_433",ESe="_queuedPrompts_ma7ez_437",MSe="_queuedPrompt_ma7ez_437",NSe="_queuedPromptIcon_ma7ez_467",ISe="_queuedPromptMaskIcon_ma7ez_477",RSe="_queuedPromptActionIcon_ma7ez_478",jSe="_queuedPromptText_ma7ez_491",LSe="_queuedPromptState_ma7ez_499",DSe="_queuedPromptSpinner_ma7ez_507",OSe="_queuedPromptActions_ma7ez_522",BSe="_queuedPromptAction_ma7ez_478",PSe="_queuedHint_ma7ez_567",Ft={app:rSe,appChat:sSe,appChatEmpty:iSe,appShell:oSe,chatPane:aSe,mobileDrawer:lSe,mobileBackdrop:cSe,hamburgerButton:uSe,mobileDrawerOpen:dSe,appWithSidebar:hSe,themeDark:fSe,themeLight:mSe,content:pSe,contentHasMessages:gSe,footer:ySe,bottomPanels:bSe,approvalOverlay:wSe,scrollToBottomLayer:vSe,scrollToBottomLayerWithTodos:xSe,scrollToBottomButton:_Se,scrollToBottomIcon:kSe,btwPanel:SSe,composer:TSe,escClearStatus:CSe,emptyWelcomeFooter:ASe,queuedPrompts:ESe,queuedPrompt:MSe,queuedPromptIcon:NSe,queuedPromptMaskIcon:ISe,queuedPromptActionIcon:RSe,queuedPromptText:jSe,queuedPromptState:LSe,queuedPromptSpinner:DSe,queuedPromptActions:OSe,queuedPromptAction:BSe,queuedHint:PSe},GC=240;function zSe({prompts:e,t,onDelete:n,onInsert:r,onEdit:s}){return e.length===0?null:h.jsxs("div",{className:Ft.queuedPrompts,children:[e.map(i=>{var b;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>GC?`${o.slice(0,GC)}...`:o,l=((b=i.images)==null?void 0:b.length)??0,c=oB(i.text),u=i.serverState==="submitting",d=i.serverState==="running",f=i.isRemoving===!0,m=u||d||i.isEditing===!0||f;let p=t("queue.insertTip");m?p=t("queue.submittingDisabled"):c&&(p=t("queue.insertCommandDisabled"));let y=t("queue.editTip");m&&(y=t("queue.submittingDisabled"));const x=t(m?"queue.submittingDisabled":"queue.deleteTip");return h.jsxs("div",{className:Ft.queuedPrompt,children:[h.jsx("span",{className:Ft.queuedPromptIcon,"aria-hidden":"true",children:h.jsx("span",{className:Ft.queuedPromptMaskIcon,style:Ef("--queued-icon-url",nSe)})}),h.jsxs("span",{className:Ft.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",u||i.isEditing||f?h.jsxs("span",{className:Ft.queuedPromptState,children:[h.jsx("span",{className:Ft.queuedPromptSpinner}),f?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),h.jsxs("span",{className:Ft.queuedPromptActions,children:[l===0&&h.jsxs("button",{type:"button",className:Ft.queuedPromptAction,onClick:()=>r(i.id),disabled:c||m,title:p,children:[h.jsx("span",{className:Ft.queuedPromptActionIcon,style:Ef("--queued-icon-url",tSe),"aria-hidden":"true"}),t("queue.insert")]}),h.jsx("button",{type:"button",className:Ft.queuedPromptAction,onClick:()=>n(i.id),disabled:m,"aria-label":t("queue.delete"),title:x,children:h.jsx("span",{className:Ft.queuedPromptActionIcon,style:Ef("--queued-icon-url",eSe),"aria-hidden":"true"})}),h.jsx("button",{type:"button",className:Ft.queuedPromptAction,onClick:()=>s(i.id),disabled:m,"aria-label":t("queue.edit"),title:y,children:h.jsx("span",{className:Ft.queuedPromptActionIcon,style:Ef("--queued-icon-url",UO),"aria-hidden":"true"})})]})]},i.id)}),h.jsx("div",{className:Ft.queuedHint,children:t("queue.footer")})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $Se(e,t,n,r){const s=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==r))for(const a of o.messages){const l=s.findIndex(c=>c.text===a&&(!c.images||c.images.length===0));l>=0&&(s.splice(l,1),i=!0)}return i?s:null}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const qSe=100;function KC(e,t){return e.length!==t.length?!1:e.every((n,r)=>{var i,o;const s=t[r];return s!==void 0&&n.id===s.id&&n.sessionId===s.sessionId&&n.text===s.text&&n.serverPromptId===s.serverPromptId&&n.serverState===s.serverState&&n.isEditing===s.isEditing&&n.isRemoving===s.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=s.images)==null?void 0:o.length)??0)})}function YC(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function FSe({connected:e,sessionId:t,clientId:n,streamingState:r,sessionActions:s,store:i,editorRef:o,reportError:a,notifySuccess:l,t:c}){const[u,d]=g.useState([]),f=g.useRef([]),m=g.useRef(1),p=g.useRef(t),y=g.useRef(null),x=g.useRef(new Set),b=g.useRef(new Set),w=g.useRef(new Set),v=g.useRef(new Map),_=g.useRef(new Set),S=g.useRef([]),C=g.useRef(r),E=g.useRef(0);p.current=t,C.current=r;const R=g.useMemo(()=>u.map(se=>se.text),[u]);g.useEffect(()=>{f.current=u},[u]),g.useEffect(()=>{var se;f.current=[],d([]),v.current.clear(),_.current.clear(),S.current=[];for(const re of x.current)re.abort();x.current.clear(),b.current.clear(),w.current.clear(),J.current=void 0,(se=y.current)==null||se.abort(),y.current=null},[t]);const j=g.useCallback((se,re)=>{const oe=f.current.filter(ke=>ke.serverPromptId?se.some(He=>He.promptId===ke.serverPromptId):!0);for(const ke of se){if(b.current.has(ke.promptId))continue;const He=oe.findIndex(xe=>xe.serverPromptId===ke.promptId),Ve=w.current.has(ke.promptId);if(He!==-1){if(Ve){oe.splice(He,1);continue}oe[He]={...oe[He],text:ke.text,serverState:ke.state};continue}const ce=oe.filter(xe=>!xe.serverPromptId&&xe.serverState==="submitting"&&xe.text===ke.text);if(ce.length===1){const xe=oe.indexOf(ce[0]);if(Ve){oe.splice(xe,1);continue}oe[xe]={...ce[0],serverPromptId:ke.promptId,serverState:ke.state};continue}ke.state==="running"||Ve||oe.push({id:m.current++,sessionId:re,text:ke.text,serverPromptId:ke.promptId,serverState:ke.state})}KC(f.current,oe)||(f.current=oe,d(oe))},[]),N=g.useCallback(async(se=t)=>{if(!e||!se||p.current!==se)return!1;const re=++E.current;try{const oe=await s.getPendingPrompts({sessionId:se});return re!==E.current||p.current!==se?!1:(j(oe.pendingPrompts.filter(ke=>ke.state==="queued"||ke.state==="running"),se),!0)}catch(oe){return console.warn("Failed to refresh pending prompts",oe),!1}},[e,s,t,j]),B=g.useCallback(se=>{const re=p.current,oe=se.filter(ce=>ce.sessionId===void 0||ce.sessionId===re);if(oe.length===0)return;const ke=new Set(f.current.map(ce=>ce.id)),He=oe.filter(ce=>!ke.has(ce.id));if(He.length===0)return;const Ve=[...f.current,...He].sort((ce,xe)=>ce.id-xe.id);f.current=Ve,d(Ve)},[]),M=g.useCallback((se,re,oe)=>{var Ve,ce,xe,Me;if(oe!==void 0&&p.current!==oe)return;const ke=((Ve=o.current)==null?void 0:Ve.getText())??"",He=ke.trim()?`${se}
${ke}`:se;(ce=o.current)==null||ce.setText(He),re&&re.length>0&&((xe=o.current)==null||xe.restoreImages(re)),(Me=o.current)==null||Me.focus()},[o]),$=g.useSyncExternalStore(OU,DU),H=g.useRef($),J=g.useRef(void 0);g.useEffect(()=>{if(!e||!t)return;const se=H.current!==$;if(H.current=$,!se){if(f.current.length>0||r==="idle"||J.current===t)return;J.current=t}N()},[$,e,t,r,N]);const O=g.useSyncExternalStore(BU,H8,H8);g.useEffect(()=>{if(!t||O.length===0)return;const se=[];for(const re of O){if(re.data.sessionId!==t)continue;se.push(re);const oe=re.data.promptId;if(oe){if(re.type==="pending_prompt_started"){if(b.current.has(oe))continue;if((re.originatorClientId===void 0||re.originatorClientId===n)&&!w.current.has(oe)){const He=typeof re.data.text=="string"?re.data.text:"",Ve=f.current.find(xe=>xe.serverPromptId===oe)??f.current.find(xe=>!xe.serverPromptId&&xe.serverState==="submitting"&&xe.text===He),ce=(Ve==null?void 0:Ve.text)??"";ce&&(w.current.add(oe),i.appendLocalUserMessage(ce,YC(Ve==null?void 0:Ve.images)))}N()}else if(re.type==="turn_complete"){w.current.delete(oe);const ke=v.current.get(oe);if(v.current.delete(oe),ke)ke();else if(!_.current.has(oe))for(_.current.add(oe),S.current.push(oe);S.current.length>qSe;){const He=S.current.shift();He&&_.current.delete(He)}}else if(re.type==="turn_error"||re.type==="pending_prompt_completed"&&re.data.state==="removed"){w.current.delete(oe);const ke=v.current.get(oe);v.current.delete(oe),ke==null||ke(),_.current.delete(oe),S.current=S.current.filter(He=>He!==oe)}}}zU(se)},[O,t,n,i,N]);const Y=g.useCallback((se,re)=>{if(_.current.delete(se)){S.current=S.current.filter(oe=>oe!==se),re();return}v.current.set(se,re)},[]),G=g.useCallback((se,re,oe)=>{const ke=se.trim();if(!ke)return!0;const He=m.current++,Ve=p.current,ce=new AbortController;x.current.add(ce);const xe=re?[...re]:void 0,Me={id:He,sessionId:Ve,text:ke,images:xe,onComplete:oe,serverState:"submitting"};return f.current=[...f.current,Me],d(f.current),s.submitPrompt(ke,{images:re,optimisticUserMessage:!1,sessionId:Ve,signal:ce.signal}).then(Re=>{if(x.current.delete(ce),p.current!==Ve){s.removePendingPrompt(Re.promptId,{sessionId:Ve}).catch(Rt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:Ve,promptId:Re.promptId,error:Rt})});return}if(C.current==="idle"){w.current.has(Re.promptId)||(w.current.add(Re.promptId),i.appendLocalUserMessage(ke,YC(xe)));const Rt=f.current.filter(Ke=>Ke.id!==He);f.current=Rt,d(Rt),oe&&Y(Re.promptId,oe);return}const ct=f.current,Ct=ct.findIndex(Rt=>Rt.id===He);if(Ct===-1){s.removePendingPrompt(Re.promptId,{sessionId:Ve}).then(Rt=>{Rt.removed||N(Ve)},()=>{N(Ve)});return}const vt=[...ct];vt[Ct]={...vt[Ct],serverPromptId:Re.promptId,serverState:"queued"},f.current=vt,d(vt),oe&&Y(Re.promptId,oe)}).catch(Re=>{if(x.current.delete(ce),p.current!==Ve||!f.current.some(Ct=>Ct.id===He))return;const ct=f.current.filter(Ct=>Ct.id!==He);f.current=ct,d(ct),M(ke,xe,Ve),a(Re,c("queue.queueFailed"))}),!0},[N,a,M,s,Y,i,c]);g.useEffect(()=>{if(r!=="idle")return;const se=y.current;se&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),se.abort(),y.current=null)},[r]);const ee=g.useCallback(se=>{const re=f.current;if(re.length===0)return null;const oe=se===void 0?re.length-1:re.findIndex(Ve=>Ve.id===se);if(oe<0)return null;const ke=re[oe],He=re.filter((Ve,ce)=>ce!==oe);return f.current=He,d(He),(ke==null?void 0:ke.text)??null},[]),L=g.useCallback((se,re)=>{const oe=f.current.map(ke=>ke.id===se?{...ke,...re}:ke);KC(oe,f.current)||(f.current=oe,d(oe))},[]),F=g.useCallback(async(se,re,oe)=>{if(!se.serverPromptId)return!0;if(se.serverState!=="queued"||b.current.has(se.serverPromptId))return!1;const ke=se.sessionId;b.current.add(se.serverPromptId),L(se.id,re);try{const He=await s.removePendingPrompt(se.serverPromptId,{sessionId:ke});return b.current.delete(se.serverPromptId),He.removed?(v.current.delete(se.serverPromptId),await N(ke)||(L(se.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),oe)),!0):(L(se.id,{isEditing:!1,isRemoving:!1}),await N(ke),a(new Error("Prompt could not be removed from queue"),oe),!1)}catch(He){return b.current.delete(se.serverPromptId),L(se.id,{isEditing:!1,isRemoving:!1}),await N(ke)||B([se]),a(He,oe),!1}},[N,a,B,s,L]),P=g.useCallback(se=>{const re=f.current.find(oe=>oe.id===se);if((re==null?void 0:re.serverState)!=="submitting"&&re){if(!re.serverPromptId){const oe=f.current.filter(ke=>ke.id!==se);f.current=oe,d(oe);return}F(re,{isRemoving:!0},c("queue.deleteFailed"))}},[F,c]),A=g.useCallback(async se=>{var ce;const re=f.current.find(xe=>xe.id===se);if(!re||(((ce=re.images)==null?void 0:ce.length)??0)>0||re.serverState==="submitting"||re.isEditing||re.isRemoving||oB(re.text))return;const oe=re.serverPromptId?re.onComplete??v.current.get(re.serverPromptId):void 0,ke=()=>{re.serverPromptId&&v.current.delete(re.serverPromptId),oe==null||oe()};if(re.serverPromptId&&!await F(re,{isRemoving:!0},c("queue.insertFailed")))return;let He=y.current;He||(He=new AbortController,y.current=He);let Ve;try{Ve=await s.enqueueMidTurnMessage(re.text,{signal:He.signal})}catch(xe){re.serverPromptId&&(M(re.text,re.images,re.sessionId),ke()),a(xe,c("queue.insertFailed"));return}if(!Ve.accepted){re.serverPromptId&&(M(re.text,re.images,re.sessionId),ke()),a(new Error("Queued message was not accepted for insertion"),c("queue.insertFailed"));return}if(ke(),!re.serverPromptId){const xe=f.current.filter(Me=>Me.id!==se);f.current=xe,d(xe)}l(c("queue.inserted"))},[F,l,a,M,s,c]),ne=g.useCallback(async se=>{const re=f.current.find(ke=>ke.id===se);if(!re||re.serverState==="submitting"||re.isEditing||re.isRemoving)return;if(re.serverPromptId){if(!await F(re,{isEditing:!0},c("queue.editFailed")))return;M(re.text,re.images,re.sessionId);return}const oe=ee(se);oe&&M(oe,re.images,re.sessionId)},[ee,F,M,c]),be=g.useCallback(()=>{const se=f.current;if(se.length===0)return!1;const re=se[se.length-1];if(!re)return!1;if(re.serverState==="submitting"||re.isEditing||re.isRemoving)return!0;if(!re.serverPromptId){const oe=ee(re.id);return oe?(M(oe,re.images,re.sessionId),!0):!1}return re.serverState!=="queued"?!1:((async()=>{await F(re,{isEditing:!0},c("queue.editFailed"))&&M(re.text,re.images,re.sessionId)})().catch(oe=>{a(oe,c("queue.editFailed"))}),!0)},[ee,F,a,M,c]),he=g.useCallback(()=>{if(f.current.length===0)return!1;const se=p.current,re=f.current.filter(xe=>xe.serverState==="submitting"),oe=f.current.filter(xe=>xe.serverState!=="submitting");for(const xe of[...re].reverse())M(xe.text,xe.images,xe.sessionId);for(const xe of x.current)xe.abort();const ke=oe.filter(xe=>xe.serverPromptId);if(ke.length===0)return f.current=[],d([]),i.dispatch([{type:"status",text:c("queue.cleared")}]),!0;const He=new Set(f.current.map(xe=>xe.id)),Ve=new Set(ke.map(xe=>xe.serverPromptId).filter(xe=>!!xe));for(const xe of Ve)b.current.add(xe);const ce=f.current.filter(xe=>!He.has(xe.id)).concat(ke.map(xe=>({...xe,isRemoving:!0})));return f.current=ce,d(ce),(async()=>{var ct;const xe=[];if(await Promise.all(ke.map(async Ct=>{const vt=Ct.serverPromptId;try{if((await s.removePendingPrompt(vt,{sessionId:Ct.sessionId})).removed){v.current.delete(vt);return}xe.push(Ct)}catch{xe.push(Ct)}finally{b.current.delete(vt)}})),p.current!==se)return;const Me=xe.map(Ct=>({...Ct,isRemoving:!1})),Re=f.current.filter(Ct=>Ct.serverPromptId?!Ve.has(Ct.serverPromptId):!He.has(Ct.id)).concat(Me);if(f.current=Re,d(Re),xe.length>0){a(new Error("Some prompts could not be removed from queue"),c("queue.deleteFailed")),N((ct=xe[0])==null?void 0:ct.sessionId);return}i.dispatch([{type:"status",text:c("queue.cleared")}])})(),!0},[N,a,M,i,c,s]),{batches:ye,consume:me}=uH();return g.useEffect(()=>{if(!t||ye.length===0)return;n===void 0&&ye.some(re=>re.sessionId===t&&re.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const se=$Se(f.current,ye,t,n);se&&(f.current=se,d(se)),me(ye.filter(re=>re.sessionId===t))},[ye,t,n,me]),{queuedPrompts:u,queuedTexts:R,enqueuePrompt:G,removeQueuedPrompt:P,insertQueuedPrompt:A,editQueuedPrompt:ne,editLastQueuedPrompt:be,clearQueuedPrompts:he}}const USe="_layout_ghraz_1",HSe="_muted_ghraz_8",VSe="_notice_ghraz_13",WSe="_list_ghraz_20",GSe="_group_ghraz_26",KSe="_groupTitle_ghraz_33",YSe="_server_ghraz_39",XSe="_serverCard_ghraz_44",QSe="_serverCardExpanded_ghraz_50",JSe="_row_ghraz_55",ZSe="_expandedRow_ghraz_72",e7e="_serverRow_ghraz_76",t7e="_rowMain_ghraz_81",n7e="_rowIcon_ghraz_96",r7e="_chevronCell_ghraz_125",s7e="_toolRow_ghraz_135",i7e="_chevron_ghraz_125",o7e="_chevronExpanded_ghraz_150",a7e="_disabled_ghraz_154",l7e="_name_ghraz_158",c7e="_serverName_ghraz_166",u7e="_status_ghraz_170",d7e="_badge_ghraz_171",h7e="_toolCount_ghraz_185",f7e="_resourceCount_ghraz_190",m7e="_promptCount_ghraz_191",p7e="_success_ghraz_196",g7e="_warning_ghraz_200",y7e="_error_ghraz_204",b7e="_serverDetail_ghraz_208",w7e="_serverDetailHeader_ghraz_218",v7e="_serverActions_ghraz_223",x7e="_field_ghraz_230",_7e="_label_ghraz_238",k7e="_value_ghraz_244",S7e="_button_ghraz_249",T7e="_message_ghraz_269",C7e="_schema_ghraz_270",A7e="_tools_ghraz_281",E7e="_tool_ghraz_135",M7e="_resources_ghraz_292",N7e="_sectionTitle_ghraz_301",I7e="_resourceUri_ghraz_306",R7e="_resourceLabel_ghraz_314",j7e="_toolDetail_ghraz_324",L7e="_section_ghraz_301",D7e="_description_ghraz_347",O7e="_parameter_ghraz_353",B7e="_empty_ghraz_359",P7e="_emptyTools_ghraz_360",Xe={layout:USe,muted:HSe,notice:VSe,list:WSe,group:GSe,groupTitle:KSe,server:YSe,serverCard:XSe,serverCardExpanded:QSe,row:JSe,expandedRow:ZSe,serverRow:e7e,rowMain:t7e,rowIcon:n7e,chevronCell:r7e,toolRow:s7e,chevron:i7e,chevronExpanded:o7e,disabled:a7e,name:l7e,serverName:c7e,status:u7e,badge:d7e,toolCount:h7e,resourceCount:f7e,promptCount:m7e,success:p7e,warning:g7e,error:y7e,serverDetail:b7e,serverDetailHeader:w7e,serverActions:v7e,field:x7e,label:_7e,value:k7e,button:S7e,message:T7e,schema:C7e,tools:A7e,tool:E7e,resources:M7e,sectionTitle:N7e,resourceUri:I7e,resourceLabel:R7e,toolDetail:j7e,section:L7e,description:D7e,parameter:O7e,empty:B7e,emptyTools:P7e};function XC(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 z7e(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:Xe.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:Xe.success};case"connecting":return{text:t("mcp.status.starting"),className:Xe.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:Xe.error}}}function $7e(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Y4(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function q7e(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 F7e(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 QC(e,t){return`${e}:${t}`}function JC(e,t){return`${e}\0${t}`}const Ml=a6;function X4({expanded:e}){return h.jsx("svg",{className:`${Xe.chevron} ${e?Xe.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function U7e(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 H7e({tool:e,t}){const n=q7e(e);if(!n)return h.jsx("div",{className:Xe.muted,children:t("mcp.noSchema")});const r=n.properties,s=Array.isArray(n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object")return h.jsx("pre",{className:Xe.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:Xe.parameter,children:`- ${o}${s.has(o)?t("mcp.required"):""}: ${c}${u?` - ${u}`:""}`},o)})]})}function Nf({label:e,value:t}){return h.jsxs("div",{className:Xe.field,children:[h.jsx("span",{className:Xe.label,children:e}),h.jsx("span",{className:Xe.value,children:t})]})}function V7e({tool:e,t}){const n=F7e(e,t);return h.jsxs("div",{className:Xe.toolDetail,children:[e.isValid?null:h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:`${Xe.sectionTitle} ${Xe.error}`,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{className:Xe.muted,children:[Ml(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:Xe.muted,children:t("mcp.invalidToolHelp")})]}),e.description?h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:Xe.sectionTitle,children:Ml(t("mcp.description"))}),h.jsx("div",{className:Xe.description,children:e.description.trim()})]}):h.jsx("div",{className:Xe.muted,children:t("mcp.noDescription")}),n?h.jsx(Nf,{label:Ml(t("mcp.annotations")),value:n}):null,h.jsx(H7e,{tool:e,t})]})}function W7e({resource:e,t}){const n=e.title||e.name||"",r=n!==""&&n!==e.uri;return h.jsxs("div",{className:Xe.toolDetail,children:[h.jsx(Nf,{label:Ml(t("mcp.resource.uriLabel")),value:e.uri}),r?h.jsx(Nf,{label:Ml(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?h.jsx(Nf,{label:Ml(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?h.jsx(Nf,{label:Ml(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?h.jsxs("div",{className:Xe.section,children:[h.jsx("div",{className:Xe.sectionTitle,children:Ml(t("mcp.description"))}),h.jsx("div",{className:Xe.description,children:e.description.trim()})]}):null]})}function G7e({message:e}){const{t}=at(),n=PN({autoLoad:!1}),[r,s]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(e.resourcesByServer??{}),c=g.useMemo(()=>r.servers??[],[r.servers]),[u,d]=g.useState(new Set),[f,m]=g.useState(new Set),[p,y]=g.useState(new Set),[x,b]=g.useState(null),[w,v]=g.useState(null);g.useEffect(()=>{d(B=>{const M=new Set(c.map($=>$.name));return new Set([...B].filter($=>M.has($)))})},[c]);const _=c.filter(B=>!B.disabled&&B.mcpStatus==="connecting").length,S=g.useMemo(()=>{var M,$;const B=[];for(const H of c){const J=$7e(H,t),O={server:H,tools:((M=i[H.name])==null?void 0:M.tools)??[],resources:(($=a[H.name])==null?void 0:$.resources)??[]},Y=B.find(G=>G.label===J);Y?Y.items.push(O):B.push({label:J,items:[O]})}return B},[c,t,i,a]),C=g.useCallback(async B=>{var J;const M=await n.reload();if(!M)return;s(M);const $=(J=M.servers)==null?void 0:J.find(O=>O.name===B);if(!$)return;const H=await n.loadTools($.name);if(o(O=>({...O,[$.name]:H})),$.resourceCount)try{const O=await n.loadResources($.name);l(Y=>({...Y,[$.name]:O}))}catch{}else l(O=>{if(!($.name in O))return O;const Y={...O};return delete Y[$.name],Y})},[n]),E=g.useCallback(async(B,M)=>{if(!w){d(new Set([B.name])),v(B.name),b({serverName:B.name,text:M.id==="authenticate"?Y4(B.name,t):t("mcp.action.running",{action:M.label})});try{let $=null;if(M.id==="reconnect")await n.restartServer(B.name);else{const H=await n.manageServer(B.name,M.id),J=[...H.messages??[],...H.authUrl?[H.authUrl]:[]].join(`
`);J&&($=M.id==="authenticate"?Y4(B.name,t,J):J)}await C(B.name),b({serverName:B.name,text:$??t("mcp.action.done",{action:M.label})})}catch($){b({serverName:B.name,text:M.id==="authenticate"?Y4(B.name,t,XC($)):t("mcp.action.failed",{error:XC($)})})}finally{v(null)}}},[w,n,C,t]),R=g.useCallback(B=>{d(M=>M.has(B)?new Set:new Set([B])),m(new Set),y(new Set)},[]),j=g.useCallback((B,M)=>{const $=QC(B,M);m(H=>H.has($)?new Set:new Set([$]))},[]),N=g.useCallback((B,M)=>{const $=JC(B,M);y(H=>H.has($)?new Set:new Set([$]))},[]);return h.jsxs("div",{className:Xe.layout,"data-keyboard-scope":!0,children:[_>0?h.jsxs("div",{className:Xe.notice,children:[t("mcp.starting",{count:_}),h.jsx("div",{className:Xe.muted,children:t("mcp.startingNote")})]}):null,c.length===0?h.jsx("div",{className:Xe.empty,children:t("mcp.empty")}):h.jsx("div",{className:Xe.list,children:S.map(B=>h.jsxs("div",{className:Xe.group,children:[B.label!==t("mcp.extensionMcp")?h.jsx("div",{className:Xe.groupTitle,children:B.label}):null,B.items.map(({server:M,tools:$,resources:H})=>{var F;const J=z7e(M,t),O=u.has(M.name),Y=U7e(M,t),G=((F=i[M.name])==null?void 0:F.tools.length)??0,ee=M.resourceCount??0,L=M.promptCount??0;return h.jsx("div",{className:Xe.server,children:h.jsxs("div",{className:`${Xe.serverCard} ${O?Xe.serverCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${Xe.row} ${Xe.serverRow} ${O?Xe.expandedRow:""}`,onClick:()=>R(M.name),"aria-label":t(O?"mcp.collapse":"mcp.expand"),children:[h.jsxs("span",{className:Xe.rowMain,children:[h.jsx("span",{className:Xe.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Xe.name} ${Xe.serverName}`,children:M.name})]}),h.jsx("span",{className:`${Xe.status} ${J.className}`,children:J.text}),h.jsx("span",{className:`${Xe.badge} ${Xe.toolCount}`,children:t(G===1?"mcp.toolCount":"mcp.toolsCount",{count:G})}),ee>0?h.jsx("span",{className:`${Xe.badge} ${Xe.resourceCount}`,children:t("mcp.resourceCount",{count:ee})}):null,L>0?h.jsx("span",{className:`${Xe.badge} ${Xe.promptCount}`,children:t("mcp.promptCount",{count:L})}):null,h.jsx("span",{className:Xe.chevronCell,"aria-hidden":"true",children:h.jsx(X4,{expanded:O})})]}),O?h.jsxs("div",{className:Xe.serverDetail,children:[Y.length>0?h.jsx("div",{className:Xe.serverDetailHeader,children:h.jsx("div",{className:Xe.serverActions,children:Y.map(P=>h.jsx("button",{type:"button",className:Xe.button,onClick:()=>void E(M,P),disabled:w!==null,children:P.label},P.id))})}):null,(x==null?void 0:x.serverName)===M.name?h.jsx("pre",{className:Xe.message,children:x.text}):null,$.length===0?h.jsx("div",{className:Xe.emptyTools,children:t("mcp.emptyTools")}):h.jsx("div",{className:Xe.tools,children:$.map(P=>{const A=QC(M.name,P.name),ne=f.has(A);return h.jsxs("div",{className:Xe.tool,children:[h.jsxs("button",{type:"button",className:`${Xe.row} ${Xe.toolRow} ${ne?Xe.expandedRow:""} ${P.isValid?"":Xe.disabled}`,onClick:()=>j(M.name,P.name),children:[h.jsx("span",{className:Xe.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:Xe.name,children:P.name}),h.jsx(X4,{expanded:ne})]}),ne?h.jsx(V7e,{tool:P,t}):null]},P.name)})}),ee>0?h.jsxs("div",{className:Xe.resources,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.resources")}),H.length===0?h.jsx("div",{className:Xe.emptyTools,children:t("mcp.resourcesUnavailable")}):null,H.map(P=>{const A=JC(M.name,P.uri),ne=p.has(A),be=P.title||P.name||"";return h.jsxs("div",{className:Xe.tool,children:[h.jsxs("button",{type:"button",className:`${Xe.row} ${Xe.toolRow} ${ne?Xe.expandedRow:""}`,onClick:()=>N(M.name,P.uri),children:[h.jsx("span",{className:Xe.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Xe.name} ${Xe.resourceUri}`,children:P.uri}),be&&be!==P.uri?h.jsx("span",{className:Xe.resourceLabel,children:be}):null,h.jsx(X4,{expanded:ne})]}),ne?h.jsx(W7e,{resource:P,t}):null]},P.uri)})]}):null]}):null]})},M.name)})]},B.label))})]})}const Dh=g.createContext(!1),c6=g.createContext(new Map),aB=g.createContext(new Map);function K7e({timeline:e,details:t,children:n}){return h.jsx(c6.Provider,{value:e,children:h.jsx(aB.Provider,{value:t,children:n})})}const Fp=my,Y7e="ui.compactMode",X7e="ui.hideTips",Q7e=new Set(["coder-model(qwen-oauth)"]);function ZC(e){return!Q7e.has(e.id)}function Q4(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const lB=new Set(["clear","stop","off","reset","none","cancel"]);function J7e(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return lB.has(t)}function Z7e(e){const t=e;return t.source!=="goal"?null:T1(t.data)??T1(t.text)}function e9e(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=Z7e(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const eA={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},cB=1e3,uB="qwen-code-web-shell-chat-width",t9e=40,dB="qwen-code-web-shell-sidebar-collapsed";function n9e(e){return e===!0?{enabled:!0,defaultCollapsed:!1}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1}:{enabled:!1,defaultCollapsed:!1}}function r9e(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(dB);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function s9e(e){try{window.localStorage.setItem(dB,String(e))}catch{}}function _g(){return`${cB}`}function i9e(){if(typeof window>"u")return _g();try{return window.localStorage.getItem(uB)==="wide"?"wide":_g()}catch{return _g()}}function o9e(e){try{window.localStorage.setItem(uB,e)}catch{}}function hB(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:cB}function a9e(e,t){const n=`${hB(t)}px`,r=`calc(${n} + ${t9e}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 tA(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function l9e(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 c9e(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Yl(e.get("language")??e.get("lang")??navigator.language)}function u9e(e,t){return e instanceof Error?e.message:t}function J4(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function td(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function d9e(e){e.length>0&&console.info("[web-shell] useSessionNotices()",{notices:e})}function h9e(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function f9e(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function Z4(e){return typeof e=="object"&&e!==null}function m9e(e){if(!Z4(e))return null;const t=e._meta;if(!Z4(t))return null;const n=t.qwenModelSwitch;if(!Z4(n))return null;const r=n.authType,s=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof r!="string"||typeof s!="string"||typeof i!="string"||typeof o!="string"?null:{authType:r,modelId:s,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function p9e(e){return`Using ${e.isRuntime?"runtime ":""}model: ${e.modelId}`}function nA(e){return my.includes(e)}function g9e(e){return e.toolKind==="edit"}function rA(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Rh(e.toolName):!0}function y9e(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 b9e(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 w9e(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)(FN(r)||b9e(r))&&t.push(`${r.callId}:${r.status}`);return t.join("|")}function v9e(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 x9e(e,t){return e===Dr.NO_OUTPUT?t("copy.noOutput"):e===Dr.NO_TEXT?t("copy.noText"):e===Dr.CODE_MISSING?t("copy.codeMissing"):e===Dr.LATEX_MISSING?t("copy.latexMissing"):e===Dr.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Dr.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Dr.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Dr.CLIPBOARD_PREFIX.length)}`:e.endsWith(Dr.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Dr.COPIED_SUFFIX.length)}):e}function _9e({onSessionIdChange:e,theme:t,onThemeChange:n,language:r,onLanguageChange:s,className:i,style:o,onConnectionChange:a,onStreamingStateChange:l,onError:c,onBugReport:u,hiddenSlashCommands:d,slashCommandCategoryOrder:f,renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:x,renderComposerToolbarEnd:b,renderComposerToolbarRight:w,renderFooter:v,chatMaxWidth:_,sidebar:S,composerToolbarActions:C,compactThinking:E=!1,collapseCompletedTurns:R=!0,markdownTableMode:j="basic",virtualScrollThreshold:N,markdown:B,loadingPhrases:M,onTranscriptChange:$,onToast:H,composerRef:J,onComposerReady:O,composerInput:Y,composerInputVersion:G}={}){var P6;const[ee,L]=g.useState(i9e),[F,P]=g.useState(()=>r===void 0?c9e():Yl(r)),A=g.useMemo(()=>VN(F),[F]),ne=g.useMemo(()=>n9e(S),[S]),[be,he]=g.useState(()=>r9e(ne.defaultCollapsed)),[ye,me]=g.useState(null),[se,re]=g.useState(!1),oe=g.useCallback(()=>re(!1),[]);g.useEffect(()=>{const z=window.matchMedia("(max-width: 760px)"),X=ge=>{ge.matches||re(!1)};return z.addEventListener("change",X),()=>z.removeEventListener("change",X)},[]),g.useEffect(()=>{if(!se)return;const z=dt=>{if(dt.key!=="Escape"||on.current)return;const Je=dt.target;j0(Je)&&!(Je!=null&&Je.closest("[data-mobile-drawer]"))||(dt.stopPropagation(),dt.preventDefault(),oe())},X=document.body.style.overflow;document.body.style.overflow="hidden";const ge=dt=>{const Je=dt.target;Je!=null&&Je.closest("[data-mobile-drawer]")&&!Je.closest(`.${Ft.mobileBackdrop}`)||dt.preventDefault()};return document.addEventListener("touchmove",ge,{passive:!1}),window.addEventListener("keydown",z,!0),()=>{document.body.style.overflow=X,document.removeEventListener("touchmove",ge),window.removeEventListener("keydown",z,!0)}},[se,oe]);const ke=g.useCallback(z=>{he(z),s9e(z)},[]),He=g.useMemo(()=>({renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:x,renderComposerToolbarEnd:b,renderComposerToolbarRight:w,renderFooter:v,compactThinking:E,collapseCompletedTurns:R,markdownTableMode:j,markdown:B,loadingPhrases:M}),[m,p,y,x,b,w,v,E,R,j,B,M]),Ve=v,ce=v_(),xe=yy(),Me=Xa(),Re=by(),{notices:ct,dismissNotice:Ct}=QU(),vt=yc(),Rt=g.useRef(H);Rt.current=H;const Ke=g.useRef(0),[pt,yt]=g.useState([]),ae=g.useCallback(z=>{yt(X=>X.filter(ge=>ge.id!==z))},[]),V=g.useCallback((z,X)=>{if(Rt.current){Rt.current(z,X);return}const ge={id:`web-shell-toast-${Date.now()}-${++Ke.current}`,tone:z,message:X};yt(dt=>[...dt.filter(Qe=>Qe.tone!==z||Qe.message!==X),ge].slice(-4))},[]),ue=L8e(A),Ne=g.useRef(ue);Ne.current=ue;const[ut,ht]=g.useState(null),[ft,pe]=g.useState(null),Ae=g.useRef(1),te=g.useRef(1),K=g.useRef(null),ie=g.useRef(Me.sessionId),fe=g.useMemo(()=>{const z=[ut].filter(ge=>ge!==null);if(z.length===0)return VC(ue);const X=[...ue];for(const ge of z.sort((dt,Je)=>dt.anchorIndex-Je.anchorIndex)){const dt=ge.anchorAfterId?X.findIndex(Qe=>Qe.id===ge.anchorAfterId):-1,Je=dt>=0?dt+1:Math.min(ge.anchorIndex,X.length);X.splice(Je,0,ge.message)}return VC(X)},[ue,ut]),We=s8e(xe),Mt=g.useMemo(()=>dH(We),[We]),_t=O8e(Mt),jn=!(Me.catchingUp&&ye!==null),ur=rA(_t)&&jn?_t:null,Xr=_t&&!rA(_t)&&jn?_t:null,on=g.useRef(_t);on.current=jn?_t:null;const Be=g.useMemo(()=>ude(ue),[ue]),gt=g.useRef(null),dn=g.useMemo(()=>{const z=hde(ue),X=gt.current;if(X&&X.signature===z)return X.timeline;const ge=dde(ue);return gt.current={signature:z,timeline:ge},ge},[ue]),Ts=g.useRef(null),_o=g.useMemo(()=>{const z=fde(ue),X=Ts.current;if(X&&X.signature===z)return X.details;const ge=wde(ue);return Ts.current={signature:z,details:ge},ge},[ue]),rl=B8e(Be.todos,z=>`${z.id}:${z.status}:${z.content}`),_c=Be.allCompleted,[kc,xn]=g.useState("hidden"),Fn=Me.catchingUp||rl.length===0||_c?"hidden":"active";Fn!==kc&&xn(Fn);const Qr=Fn!=="hidden",ds=g.useMemo(()=>w9e(ue),[ue]),[ci,Xt]=g.useState(0),ui=a8e(ds,Me.status==="connected",ci),Jr=g.useMemo(()=>v?ui.map(v9e):[],[ui,v]),ia=g.useRef(null),Zr=g.useRef(null),hs=g.useRef(null),oa=g.useRef(null),ji=g.useRef(null),[aa,sl]=g.useState(!1),la=g.useRef(null),il=g.useRef(!1),Nr=g.useCallback((z="smooth")=>{sl(!1),requestAnimationFrame(()=>{var X;(X=Zr.current)==null||X.scrollToBottom(z),requestAnimationFrame(()=>{var ge;(ge=Zr.current)==null||ge.scrollToBottom(z)})})},[]),Fs=g.useCallback(z=>{hs.current=z,tA(J,z??eA),z&&oa.current!==z&&(oa.current=z,O==null||O(z))},[J,O]);g.useEffect(()=>{tA(J,hs.current??eA)},[J]);const[ca,Ir]=g.useState(null),di=g.useRef(null);di.current=ca;const{followupState:zu,onAcceptFollowup:Oh,onDismissFollowup:$u,clear:qu}=cH({onAccept:z=>{var X;(X=hs.current)==null||X.insertText(z)}}),Ln=g.useCallback((z,X,ge)=>{qu();const dt=!z.trimStart().startsWith("/");!(ge!=null&&ge.retry)&&dt&&(je.current=z,et.current=X,rt.current=null),tn(!1);const Je={images:X,optimisticUserMessage:ge==null?void 0:ge.optimisticUserMessage,retry:ge==null?void 0:ge.retry};return Re.sendPrompt(z,Je)},[qu,Re]),Sn=x_(),io=g.useRef(Sn),Sc=g.useRef(Date.now()),Q=g.useRef(Sn);Q.current==="idle"&&Sn!=="idle"&&(Sc.current=Date.now()),Q.current=Sn;const de=g.useMemo(()=>{if(Sn!=="idle"){for(let z=fe.length-1;z>=0;z--){const X=fe[z];if((X==null?void 0:X.role)==="user")return X.timestamp??Sc.current}return Sc.current}},[fe,Sn]),je=g.useRef(""),et=g.useRef(void 0),De=g.useRef(null),rt=g.useRef(null),[At,tn]=g.useState(!1),nn=g.useRef(At);nn.current=At;const Gt=Me.status==="connected",[fn,fs]=g.useState([]);g.useEffect(()=>{Gt&&vt.loadSkillsStatus().then(z=>{fs(((z==null?void 0:z.skills)??[]).map(X=>({name:X.name,description:X.description??""})).sort((X,ge)=>X.name.localeCompare(ge.name)))}).catch(()=>{})},[Gt,vt]);const[Rr,jr]=g.useState(null),[Dn,dr]=g.useState([]),[Tc,ol]=g.useState(!1),[Ee,St]=g.useState(!1),[Nt,Bt]=g.useState(!1),[$t,Kt]=g.useState(!1),[_n,yr]=g.useState(!1),[Cs,oo]=g.useState(!1),[al,ao]=g.useState(!1),[Fu,Cc]=g.useState(!1),[ua,km]=g.useState(!1),[Bh,cb]=g.useState(null),[u6,Ph]=g.useState(!1),[d6,h6]=g.useState(!1),[f6,ub]=g.useState(!1),[gB,yB]=g.useState(0),[bB,wB]=g.useState(0),As=ju(),m6=g.useRef((As==null?void 0:As.extensionsVersion)??0);g.useEffect(()=>{const z=(As==null?void 0:As.extensionsVersion)??0;if(z!==m6.current){m6.current=z;const X=As==null?void 0:As.lastExtensionChange;if((X==null?void 0:X.status)==="failed"){ce.dispatch([{type:"error",text:A("extensions.action.failed",{name:X.name??"",source:X.source??"",error:X.error??A("error.unknown")})}]);return}if((X==null?void 0:X.status)==="installed"){const ge=X.name??X.source??A("extensions.label");ce.dispatch([{type:"status",text:X.version?A("extensions.install.installedWithVersion",{name:ge,version:X.version}):A("extensions.install.installed",{name:ge})}])}else if(X!=null&&X.status){const ge=X.name??X.source??A("extensions.label"),dt=X.status==="updated"&&X.version?"extensions.manage.updatedWithVersion":`extensions.manage.${X.status}`;ce.dispatch([{type:"status",text:A(dt,{name:ge,version:X.version??""})}])}Re.refreshCommands().catch(()=>{ce.dispatch([{type:"error",text:A("extensions.commands.refreshFailed")}])})}},[As==null?void 0:As.extensionsVersion,As==null?void 0:As.lastExtensionChange,Re,ce,A]);const[vB,xB]=g.useState("workspace"),[zh,db]=g.useState(null),[_B,p6]=g.useState(!1),[kB,g6]=g.useState(!1),Sm=g.useRef(null),Uu=g.useRef(null),[hb,Tm]=g.useState(null),[fb,mb]=g.useState(t??bs.Dark),[Hu,pb]=g.useState(""),y6=g.useRef(Hu);y6.current=Hu;const Cm=g.useRef(Me);Cm.current=Me;const SB=Me.displayName,[ll,gb]=g.useState("default"),TB=g.useMemo(()=>(Me.models??[]).filter(ZC).map(z=>({id:z.id,label:V1(z.label||z.id)})),[Me.models]),da=Ee||Nt||$t||_n||Cs||al||Fu||ua||Rr!==null||Tc||hb!==null||Bh!==null||zh!==null||u6||d6||f6,xt=g.useCallback((z,X)=>{if(J4(z))return;if(lN(z)){console.debug("[web-shell] turn error rendered in transcript",z);return}if(td(z)){console.debug("[web-shell] error already handled by notice",z);return}const ge=u9e(z,X);console.error("[web-shell]",ge,z),V("error",ge)},[V]),CB=g.useCallback(z=>V("success",z),[V]),{queuedPrompts:AB,queuedTexts:EB,enqueuePrompt:yb,removeQueuedPrompt:MB,insertQueuedPrompt:NB,editQueuedPrompt:IB,editLastQueuedPrompt:RB,clearQueuedPrompts:jB}=FSe({connected:Gt,sessionId:Me.sessionId,clientId:Me.clientId,streamingState:Sn,sessionActions:Re,store:ce,editorRef:hs,reportError:xt,notifySuccess:CB,t:A});g.useEffect(()=>{d9e(ct);for(const z of ct)h9e(z)?V(f9e(z),z.message):z.category==="lifecycle"?console.debug("[web-shell] daemon notice",z):console.warn("[web-shell] daemon notice",z),Ct(z.id)},[Ct,ct,V]);const bb=g.useRef(u);bb.current=u,g.useEffect(()=>{var z;ie.current=Me.sessionId,(z=K.current)==null||z.abort(),K.current=null,ht(null),pe(null),Tm(null),Mm.current=0},[Me.sessionId]);const b6=g.useCallback(()=>{var Je;const z=`local-recap-${Ae.current++}`,X=ue.length,ge=(Je=ue.at(-1))==null?void 0:Je.id,dt=Me.sessionId;ht({anchorAfterId:ge,anchorIndex:X,message:{id:z,role:"system",content:`※ ${A("recap.label")}: ${A("recap.loading")}`,variant:"info",source:"recap"}}),Re.recapSession().then(Qe=>{ie.current===dt&&ht({anchorAfterId:ge,anchorIndex:X,message:{id:z,role:"system",content:Qe.recap?`※ ${A("recap.label")}: ${Qe.recap}`:A("recap.empty"),variant:"info",source:"recap"}})},Qe=>{ie.current===dt&&(ht(null),!J4(Qe)&&!td(Qe)&&console.warn("[web-shell] unhandled recap failure",Qe))})},[Me.sessionId,ue,Re,A]),w6=g.useCallback(z=>{var Qe;const X=z.trim();if(!X){V("error",A("btw.empty"));return}const ge=`local-btw-${te.current++}`,dt=Me.sessionId;(Qe=K.current)==null||Qe.abort();const Je=new AbortController;K.current=Je,pe({id:ge,role:"btw",question:X,answer:"",isPending:!0}),Re.btwSession(X,{signal:Je.signal}).then(Le=>{ie.current===dt&&K.current===Je&&(K.current=null,pe({id:ge,role:"btw",question:X,answer:Le.answer||A("btw.emptyAnswer"),isPending:!1}))},Le=>{ie.current===dt&&K.current===Je&&(K.current=null,pe(null),!J4(Le)&&!td(Le)&&console.warn("[web-shell] unhandled btw failure",Le))})},[Me.sessionId,V,Re,A]),v6=g.useCallback(()=>{var z;(z=K.current)==null||z.abort(),K.current=null,pe(null)},[]);g.useEffect(()=>{const z=X=>{var Le;if(da||_t)return;const ge=ft;if(!ge||ge.role!=="btw")return;const dt=X.key.toLowerCase(),Je=X.key==="Escape"&&!X.ctrlKey&&!X.metaKey&&!X.altKey&&!X.shiftKey,Qe=X.ctrlKey&&!X.metaKey&&!X.altKey&&!X.shiftKey&&(dt==="c"||dt==="d");if(ge.isPending){if(!Je&&!Qe)return}else{const Se=((Le=hs.current)==null?void 0:Le.hasInput())??!1;if(!(!X.ctrlKey&&!X.metaKey&&!X.altKey&&!X.shiftKey&&(X.key==="Escape"||!Se&&(X.key==="Enter"||X.key===" "))))return}X.preventDefault(),X.stopPropagation(),v6()};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[da,ft,v6,_t]);const ko=g.useCallback((z,X)=>Z8e(io.current!=="idle",z,X,{append:ge=>ce.appendLocalUserMessage(ge)}),[ce]),es=g.useCallback(()=>(V("error",A("queue.commandBlocked")),!1),[V,A]),Am=g.useCallback(z=>{mb(z),n==null||n(z)},[n]),Vu=g.useCallback(z=>{P(z),s==null||s(z)},[s]),x6=g.useCallback(()=>{oo(!0)},[]),_6=iH({autoLoad:!0}),{settings:$h,setValue:k6,reload:S6}=_6,Wu=$h.find(z=>z.key===Wc),Gu=$h.find(z=>z.key===X7e),Ku=$h.find(z=>z.key===Kf),LB=(()=>{var X;const z=(X=$h.find(ge=>ge.key==="voiceModel"))==null?void 0:X.values.effective;return typeof z=="string"&&z.trim()?z.trim():void 0})(),DB=Zde($h),[wb,T6]=g.useState(!1),vb=g.useRef(wb);vb.current=wb,g.useEffect(()=>{if(t){mb(t);return}const z=C_(Wu==null?void 0:Wu.values.effective);z&&mb(z)},[t,Wu==null?void 0:Wu.values.effective]),g.useEffect(()=>{if(r!==void 0){P(Yl(r));return}const z=k_(Ku==null?void 0:Ku.values.effective);z&&P(z)},[r,Ku==null?void 0:Ku.values.effective]);const OB=g.useCallback(z=>{const X=F,ge=`/language ui ${z}`;Vu(z);const dt=()=>Promise.all([Re.refreshCommands(),S6()]);if(io.current!=="idle"){Vu(X),es();return}Ln(ge).then(dt).catch(Je=>{Vu(X),xt(Je,"Failed to sync /language command")})},[es,Vu,S6,xt,Ln,F,Re]),C6=g.useCallback(()=>{if(io.current!=="idle"){ce.dispatch([{type:"status",text:A("clear.blocked")}]);return}ce.reset()},[ce,A]),A6=g.useCallback(()=>{const z=vb.current,X=!vb.current;T6(X),k6("workspace",Y7e,X).catch(ge=>{T6(z),xt(ge,A("compact.saveFailed"))})},[xt,k6,A]),Ac=g.useCallback(z=>{if(!nA(z)){xt(new Error(`Unsupported approval mode: ${z}`),A("local.approvalMode"));return}Re.setApprovalMode(z).then(X=>{const ge=X.mode||z;gb(ge);const dt=on.current;if(!dt)return;if(z==="yolo"||z==="auto-edit"&&g9e(dt)){const Qe=dt.options.find(Le=>Le.kind==="allow_once");if(Qe){const Le=dt.title||"";ce.dispatch([{type:"status",text:A("mode.autoApproved",{tool:Le})}]),Re.submitPermission(dt.id,Qe.id).catch(Se=>{xt(Se,"Failed to auto-approve tool call")})}}}).catch(X=>{xt(X,A("local.approvalMode"))})},[Re,xt,ce,A]);g.useEffect(()=>{io.current=Sn},[Sn]),g.useEffect(()=>{let z=null;for(let ge=xe.length-1;ge>=0;ge--){const dt=xe[ge];if((dt==null?void 0:dt.kind)==="user")break;if((dt==null?void 0:dt.kind)==="error"&&dt.source==="turn_error"){z=dt.id;break}if((dt==null?void 0:dt.kind)!=="debug")break}const X=Gt&&z!==null&&z!==rt.current&&je.current.length>0;De.current=X?z:null,tn(X)},[xe,Gt]),g.useEffect(()=>{l==null||l(Sn)},[Sn,l]),g.useEffect(()=>{a==null||a(Me.status)},[Me.status,a]),g.useEffect(()=>{$==null||$(xe)},[xe,$]),g.useEffect(()=>{if(Me.error){const z=new Error(Me.error);c==null||c(z)}},[Me.error,c]),g.useEffect(()=>{pb(Me.currentModel??"")},[Me.currentModel,Me.sessionId]),g.useEffect(()=>{gb(Me.currentMode??"default")},[Me.currentMode,Me.sessionId]),g.useEffect(()=>{Me.sessionId&&(Ir(null),e==null||e(Me.sessionId),e||l9e(Me.sessionId))},[Me.sessionId,e]),g.useEffect(()=>{const z=e9e(xe);Ir(X=>z?(X==null?void 0:X.condition)===z.condition&&X.setAt===z.setAt?X:z:X&&null)},[xe]),g.useEffect(()=>{const z=X=>{const ge=X.detail;if(!(ge!=null&&ge.active)){Ir(null);return}ge.condition&&Ir({condition:ge.condition,setAt:ge.setAt??Date.now()})};return window.addEventListener(ox,z),()=>window.removeEventListener(ox,z)},[]);const Em=g.useRef(null),Mm=g.useRef(0);g.useEffect(()=>{Mm.current=0},[Me.sessionId]),g.useEffect(()=>{function ge(){if(document.hidden){Em.current===null&&(Em.current=Date.now());return}const dt=Em.current;if(Em.current=null,dt===null||Date.now()-dt<18e4||io.current!=="idle"||!Me.sessionId)return;const Je=ce.getSnapshot().blocks.length;Je-Mm.current<4||(Mm.current=Je,Re.recapSession().then(Qe=>{Qe.recap&&ce.dispatch([{type:"status",text:`※ ${A("recap.label")}: ${Qe.recap}`,source:"recap"}])},Qe=>{console.error("[auto-recap] failed:",Qe)}))}return document.addEventListener("visibilitychange",ge),()=>document.removeEventListener("visibilitychange",ge)},[Me.sessionId,Re,ce,A]);const xb=g.useCallback(()=>{const z=nA(ll)?Fp.indexOf(ll):-1,X=Fp[(z+1)%Fp.length];Ac(X)},[ll,Ac]),qh=g.useCallback((z,X)=>{ko(z)||Re.getContextUsage({detail:X}).then(ge=>{ce.dispatch([{type:"status",text:xoe(ge)}]),Nr("smooth")}).catch(ge=>{xt(ge,"Failed to load context usage")})},[ko,ce,Re,xt,Nr]),BB=g.useCallback(()=>{qh("/context detail",!0)},[qh]),Nm=g.useCallback(z=>{Re.branchSession(z||void 0).then(X=>{ce.dispatch([{type:"status",text:A("branch.success",{name:X.displayName})}])}).catch(X=>{xt(X,A("branch.failed"))})},[xt,Re,ce,A]),PB=g.useCallback(()=>{Nm()},[Nm]),Im=g.useCallback(async()=>{oe();try{const z=await Re.createSession();return e?(e(z.sessionId),!0):(Re.loadSession(z.sessionId).catch(X=>xt(X,"Failed to switch session")),!0)}catch(z){return xt(z,"Failed to create a new session"),!1}},[oe,e,xt,Re]),zB=g.useCallback(async z=>{me(z),oe();try{await Re.loadSession(z,{deferTranscriptReset:!0})}catch(X){throw me(ge=>ge===z?null:ge),X}},[oe,Re]);g.useEffect(()=>{ye!==null&&Me.sessionId===ye&&!Me.catchingUp&&me(null)},[Me.catchingUp,Me.sessionId,ye]);const _b=g.useCallback(()=>{Re.getTasks().then(z=>{Tm({snapshot:z})}).catch(z=>{xt(z,"Failed to load tasks")})},[xt,Re]),E6=g.useCallback((z,X)=>{Ir({condition:z,setAt:X}),ce.dispatch([{type:"status",text:A9({kind:"set",condition:z,setAt:X})}])},[ce]),M6=g.useCallback(z=>{z&&(ce.dispatch([{type:"status",text:A9({kind:"cleared",condition:z.condition,durationMs:Date.now()-z.setAt})}]),Ir(null))},[ce]),Rm=g.useCallback(z=>(ce.appendLocalUserMessage(z),Re.clearGoal().catch(X=>{xt(X,"Failed to clear /goal")}),!0),[xt,Re,ce]),$B=g.useCallback(()=>Re.getRewindSnapshots(),[Re]),qB=g.useCallback(z=>Re.rewindSession(z,{rewindFiles:!1}).then(()=>{}),[Re]),FB=g.useCallback(z=>{if(td(z))return;const X=z instanceof Error?z.message:String(z);V("error",A("rewind.failed",{reason:X}))},[V,A]),N6=g.useCallback((z,X,ge)=>{const dt=z.replace(/^\/goal\b/i,"").trim(),Je=dt.toLowerCase(),Qe=(ge==null?void 0:ge.sendToDaemon)??!0;return dt&&lB.has(Je)?Qe?Rm(z):(ce.appendLocalUserMessage(z),M6(di.current),!0):dt?(ce.appendLocalUserMessage(z),Qe?(Ln(z,X,{optimisticUserMessage:!1}).catch(Le=>{xt(Le,"Failed to send /goal command")}),!0):(E6(dt,Date.now()),!0)):(ce.appendLocalUserMessage(z),Qe&&Ln(z,X,{optimisticUserMessage:!1}).catch(Le=>xt(Le,"Failed to send /goal command")),!0)},[M6,E6,Rm,xt,Ln,ce]),Fh=g.useMemo(()=>new Set((d??[]).map(Q4).filter(Boolean)),[d]),UB=Fh.has("settings"),I6=g.useCallback((z,X)=>{var dt;const ge=io.current!=="idle";if(z.startsWith("/")){const Je=z.match(/^\/([\w-]+)/);if(Je){const Qe=Je[1];if(Fh.has(Q4(Qe)))return ge?es():(Ln(z,X).catch(Le=>xt(Le,"Failed to send hidden slash command")),!0);if(Qe==="help")return oo(!0),!0;if(Qe==="tasks")return _b(),!0;if(Qe==="goal")return ge?J7e(z)?Rm(z):es():N6(z,X);if(Qe==="theme"){const Le=z.slice(Je[0].length).trim().toLowerCase();return Le==="dark"||Le==="light"?Am(Le):Le?V("error",A("error.unsupportedTheme")):ao(!0),!0}if(Qe==="language"){const Le=z.slice(Je[0].length).trim(),[Se,Qt]=Le.split(/\s+/);if(!Le)return ce.dispatch([{type:"status",text:[A("language.current",{language:S_(F)}),A("language.usage"),A("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Se==null?void 0:Se.toLowerCase())==="ui"){if(!Qt)return ce.dispatch([{type:"status",text:[A("language.set"),"",A("language.usage"),"",A("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const qt=Qt.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(qt))return V("error",A("language.invalid")),!0;const br=Yl(Qt);return Vu(br),ge||Ln(`/language ui ${br}`).then(()=>Re.refreshCommands()).catch(Li=>{xt(Li,"Failed to sync /language command")}),!0}}if(Qe==="copy"){const Le=z.slice(Je[0].length).trim();return W8e(Ne.current,Le).then(Se=>{ce.dispatch([{type:Se.status==="error"?"error":"status",text:x9e(Se.message,A)}])}).catch(Se=>{xt(Se,A("copy.failedFallback"))}),!0}if(Qe==="delete")return Bt(!0),!0;if(Qe==="release")return Kt(!0),!0;if(Qe==="rewind")return yr(!0),!0;if(Qe==="branch"){if(ge)return es();const Le=z.slice(Je[0].length).trim();return Nm(Le||void 0),!0}if(Qe==="fork"){if(ge)return es();const Le=z.slice(Je[0].length).trim();return Le?(Re.forkSession(Le).then(Se=>{if(!Se.launched){V("warning",A("fork.notStarted"));return}Xt(Qt=>Qt+1),V("success",A("fork.started",{name:Se.description}))}).catch(Se=>{const Qt=Se instanceof Error?Se.message:String(Se);xt(Se,A("fork.failed",{reason:Qt}))}),!0):(V("error",A("fork.empty")),!0)}if(Qe==="auth")return ub(!0),!0;if(Qe==="model"){const Le=z.slice(Je[0].length).trim();return Le==="--fast"?(jr("fast"),!0):Le.startsWith("--fast ")?ge?es():(Ln(z,X).catch(Se=>xt(Se,"Failed to send /model --fast")),!0):Le==="--voice"?(ko(z,X)||vt.loadProviders().then(Se=>{dr(y0e(Se)),jr("voice")}).catch(Se=>xt(Se,A("model.setVoice"))),!0):Le.startsWith("--voice ")?ge?es():(Ln(z,X).catch(Se=>xt(Se,"Failed to send /model --voice")),!0):(Le?Re.setModel(Le).then(()=>{pb(Le)}).catch(Se=>{xt(Se,A("model.switch"))}):jr("main"),!0)}if(Qe==="plan"){if(ge)return es();const Le=z.slice(Je[0].length).trim();return Re.setApprovalMode("plan").then(()=>{gb("plan"),Le&&Ln(Le,X).catch(Se=>xt(Se,"Failed to send plan prompt"))}).catch(Se=>{xt(Se,A("mode.plan"))}),!0}if(Qe==="approval-mode"){const Le=z.slice(Je[0].length).trim();return Le?Ac(Le):ol(!0),!0}if(Qe==="mcp"){const Le=z.slice(Je[0].length).trim().toLowerCase();return vt.loadMcpStatus().then(async Se=>{const Qt={},qt={};await Promise.all(((Se==null?void 0:Se.servers)??[]).map(async On=>{await Promise.all([(async()=>{try{Qt[On.name]=await vt.loadMcpTools(On.name)}catch{}})(),(async()=>{if(On.resourceCount)try{qt[On.name]=await vt.loadMcpResources(On.name)}catch{}})()])})),cb({status:Se,toolsByServer:Qt,resourcesByServer:qt,showDescriptions:Le==="desc",showSchema:Le==="schema",showTips:!Le})}).catch(Se=>{xt(Se,"Failed to load MCP status")}),!0}if(Qe==="skills"){if(z.slice(Je[0].length).trim()){if(ge)return es();Ln(z,X).catch(Se=>xt(Se,"Failed to send /skills command"))}else{if(ko(z,X))return!0;vt.loadSkillsStatus().then(Se=>{const Qt=((Se==null?void 0:Se.skills)??[]).map(qt=>({name:qt.name,description:qt.description??""})).sort((qt,On)=>qt.name.localeCompare(On.name));if(fs(Qt),Qt.length===0)ce.dispatch([{type:"status",text:A("skills.none")}]);else{const qt=Qt.map(On=>`- ${On.name}`).join(`
`);ce.dispatch([{type:"status",text:`${A("skills.available")}

${qt}`}])}Nr("smooth")}).catch(Se=>{xt(Se,"Failed to load skills")})}return!0}if(Qe==="tools"){const Le=z.slice(Je[0].length).trim().toLowerCase();if(Le==="desc"||Le==="descriptions")Cc(!0);else{if(ko(z,X))return!0;vt.loadToolsStatus().then(Se=>{const Qt=(Se==null?void 0:Se.tools)??[];if(Qt.length===0)ce.dispatch([{type:"status",text:A("tools.none")}]);else{const qt=Qt.map(On=>`- ${On.displayName||On.name}`).join(`
`);ce.dispatch([{type:"status",text:`${A("tools.available")}

${qt}`}])}Nr("smooth")}).catch(Se=>{xt(Se,"Failed to load tools")})}return!0}if(Qe==="settings")return Ph(!0),!0;if(Qe==="context"){const Le=z.slice(Je[0].length).trim().toLowerCase();if(Le===""||Le==="detail"||Le==="-d")return qh(z,Le==="detail"||Le==="-d"),!0}if(Qe==="memory"){const Le=z.slice(Je[0].length).trim().toLowerCase();if(Le==="refresh")yB(Se=>Se+1);else if(Le==="add"||Le.startsWith("add ")){const Se=Le.slice(3).trim();xB(Se==="user"||Se==="global"?"global":"workspace"),wB(Qt=>Qt+1)}return h6(!0),!0}if(Qe==="agents"){const Le=z.slice(Je[0].length).trim().toLowerCase();let Se="menu";return Le==="create"?Se="create":Le==="create user"||Le==="create global"?Se="create-user":Le==="create project"||Le==="create workspace"?Se="create-project":Le==="manage"&&(Se="manage"),db(Se),!0}if(Qe==="extensions"){const Le=z.slice(Je[0].length).trim(),Se=(dt=Le.split(/\s+/)[0])==null?void 0:dt.toLowerCase();if(!Se||Se==="manage")return km(!0),!0;if(Se==="install"){if(ge)return es();const Qt=Le.slice(7).trim().split(/\s+/);let qt="",On,br,Li,Ec,So=null;for(let Di=0;Di<Qt.length;Di++){const Es=Qt[Di];if(Es)if(Es==="--auto-update")Li=!0;else if(Es==="--pre-release"||Es==="--allow-pre-release")Ec=!0;else if(Es==="--ref"||Es==="--registry"){const Mc=Qt[Di+1];if(!Mc||Mc.startsWith("--")){So=A("extensions.install.missingOptionValue",{option:Es});break}Es==="--ref"?On=Mc:br=Mc,Di+=1}else if(Es.startsWith("--")){So=A("extensions.install.unknownOption",{option:Es});break}else if(!qt)qt=Es;else{So=A("extensions.install.usage");break}}if(So)return ce.appendLocalUserMessage(z),ce.dispatch([{type:"error",text:So}]),!0;if(!qt)return ce.appendLocalUserMessage(z),ce.dispatch([{type:"error",text:A("extensions.install.usage")}]),!0;const To=Cm.current.clientId;return To?(ce.appendLocalUserMessage(z),ce.dispatch([{type:"status",text:A("extensions.install.started",{source:qt})}]),vt.installExtension({source:qt,...On?{ref:On}:{},...br?{registry:br}:{},...Li!==void 0?{autoUpdate:Li}:{},...Ec!==void 0?{allowPreRelease:Ec}:{},consent:!0},To).then(()=>{}).catch(Di=>{xt(Di,A("extensions.install.requestFailed"))}),!0):(ce.appendLocalUserMessage(z),ce.dispatch([{type:"error",text:A("extensions.install.waitForSession")}]),!0)}return ko(z,X)||ce.dispatch([{type:"error",text:A("extensions.install.usage")}]),!0}if(Qe==="clear"||Qe==="new"||Qe==="reset")return Im(),!0;if(Qe==="rename"){const Le=y9e(z.slice(Je[0].length));if(Le.type==="auto"||Le.type==="delegate")return ge?es():(Ln(z,X).catch(Qt=>xt(Qt,"Failed to send /rename command")),!0);const Se=Le.displayName;return Se?(Re.renameSession(Se).then(()=>{ce.dispatch([{type:"status",text:A("rename.success",{name:Se})}])}).catch(Qt=>{xt(Qt,"Failed to rename session")}),!0):(V("error",A("rename.empty")),!0)}if(Qe==="resume"){const Le=z.slice(Je[0].length).trim();return Le?(oe(),Re.loadSession(Le).catch(Se=>{xt(Se,"Failed to load session")})):(oe(),St(!0)),!0}if(Qe==="recap")return b6(),!0;if(Qe==="btw")return w6(z.slice(Je[0].length)),!0;if(Qe==="stats"){const Le=z.slice(Je[0].length).trim().toLowerCase();let Se="overview";return Le==="model"?Se="model":Le==="tools"&&(Se="tools"),ko(z,X)||Re.getStats().then(Qt=>{ce.dispatch([{type:"status",text:oae(Qt,Se)}]),Nr("smooth")}).catch(()=>{}),!0}if(Qe==="status"||Qe==="about")return ko(z,X)||Promise.all([vt.loadPreflight().catch(()=>null),vt.loadProviders().catch(()=>null),vt.loadEnv().catch(()=>null)]).then(([Le,Se,Qt])=>{var Mc,z6,$6,q6,F6,U6;const qt=WC(Le,Qt);let On=qt.authSource;!On&&((Mc=Se==null?void 0:Se.current)!=null&&Mc.authType)&&(On=Se.current.authType);const br=[];qt.nodeVersion&&br.push(`Node.js v${qt.nodeVersion}`),qt.npmVersion&&br.push(`npm ${qt.npmVersion}`);let Li="";On&&(On.startsWith("oauth")||On==="qwen-oauth"?Li="Qwen OAuth":Li=`API Key - ${On}`);const Ec=`${qt.platform} ${qt.arch}`.trim(),So=y6.current,To=Cm.current,Es={cliVersion:((z6=To.capabilities)==null?void 0:z6.qwenCodeVersion)||"",runtime:br.join(" / "),platform:Ec,auth:Li,baseUrl:(($6=Se==null?void 0:Se.current)==null?void 0:$6.baseUrl)||"",model:So||To.currentModel||((q6=Se==null?void 0:Se.current)==null?void 0:q6.modelId)||"",fastModel:((F6=Se==null?void 0:Se.current)==null?void 0:F6.fastModelId)||So||To.currentModel||((U6=Se==null?void 0:Se.current)==null?void 0:U6.modelId)||"",sessionId:To.sessionId||"",sandbox:qt.sandbox,proxy:qt.proxy,memoryUsage:qt.memoryUsage};ce.dispatch([{type:"status",text:kae(Es)}]),Nr("smooth")}),!0;if(Qe==="bug"){const Le=z.slice(Je[0].length).trim();return ko(z,X)||Promise.all([vt.loadPreflight().catch(()=>null),vt.loadEnv().catch(()=>null)]).then(([Se,Qt])=>{var Li;const qt=WC(Se,Qt),On=((Li=Cm.current.capabilities)==null?void 0:Li.qwenCodeVersion)||"",br={};if(On&&(br.cliVersion=On),qt.nodeVersion&&(br.nodeVersion=qt.nodeVersion),qt.npmVersion&&(br.npmVersion=qt.npmVersion),qt.platform&&(br.platform=qt.platform),qt.arch&&(br.arch=qt.arch),qt.sandbox&&(br.sandbox=qt.sandbox),qt.memoryUsage&&(br.memoryUsage=qt.memoryUsage),bb.current)bb.current({title:Le,systemInfo:br}),ce.dispatch([{type:"status",text:A("bug.submitted")}]);else{const Ec=Object.entries(br).filter(([,Di])=>Di).map(([Di,Es])=>`${Di}: ${Es}`).join(`
`),So=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(Le)}&info=${encodeURIComponent(`
`+Ec+`
`)}`,To=window.open(So,"_blank");To?(To.opener=null,ce.dispatch([{type:"status",text:A("bug.submitted")}])):V("error",A("bug.popupBlocked"))}}).catch(Se=>{xt(Se,A("bug.failed"))}),!0}}return ge?yb(z,X):(Ln(z,X).catch(Qe=>xt(Qe,"Failed to send command")),!0)}else if(z.startsWith("!")){if(ge)return V("error",A("queue.shellBlocked")),!1;const Je=z.slice(1).trim();return Je?(Re.sendShellCommand(Je).catch(Qe=>{xt(Qe,"Failed to execute shell command")}),!0):!1}else return ge?yb(z,X):(Ln(z,X).catch(Je=>xt(Je,"Failed to send message")),!0)},[Ln,Re,ce,yb,ko,Nm,oe,Im,Rm,N6,Am,Ac,Vu,es,_b,Fh,V,xt,b6,w6,Nr,F,qh,A,vt]),HB=g.useCallback((z,X)=>{const ge=I6(z,X);return ge!==!1&&Nr("smooth"),ge},[I6,Nr]),R6=g.useCallback((z,X,ge)=>{Re.submitPermission(z,X,ge).catch(dt=>{xt(dt,"Failed to submit permission choice")})},[Re,xt]),kb=g.useCallback(()=>{Re.cancel().catch(z=>{xt(z,"Failed to cancel request")})},[Re,xt]),VB=g.useCallback(()=>{var z;return da?!1:((z=ia.current)==null?void 0:z.focusTaskPill())??!1},[da]),WB=g.useCallback(z=>{var X,ge;if(z){(X=hs.current)==null||X.insertText(z);return}(ge=hs.current)==null||ge.focus()},[]),GB=g.useCallback(z=>{sl(!z)},[]),Sb=g.useCallback(()=>{nn.current&&Gt&&io.current==="idle"&&De.current&&je.current?(rt.current=De.current,tn(!1),Ln(je.current,et.current,{optimisticUserMessage:!1,retry:!0}).catch(z=>xt(z,"Failed to retry prompt"))):ce.dispatch([{type:"status",text:A("retry.none")}])},[Gt,Ln,xt,ce,A]);g.useEffect(()=>{const z=X=>{if(!da&&X.ctrlKey&&!X.metaKey&&!X.altKey&&!X.shiftKey){if(X.key==="l"){X.preventDefault(),C6();return}if(X.key==="o"){X.preventDefault(),A6();return}if(X.key==="y"){X.preventDefault(),Sb();return}}};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[da,C6,A6,Sb,ce,A]);const cl=g.useCallback(()=>{Sm.current=null,p6(!1),g6(!1),Uu.current&&(clearTimeout(Uu.current),Uu.current=null)},[]),j6=g.useRef({streamingState:Sn,pendingApproval:_t,interactionBlocked:da,handleCancel:kb,handleCycleMode:xb});j6.current={streamingState:Sn,pendingApproval:_t,interactionBlocked:da,handleCancel:kb,handleCycleMode:xb};const KB=Sn!=="idle";g.useEffect(()=>{cl()},[KB,cl]),g.useEffect(()=>{const ge=(Je,Qe)=>{Sm.current=Je,Je==="cancel"?g6(!0):p6(!0),Uu.current&&clearTimeout(Uu.current),Uu.current=setTimeout(cl,Qe)},dt=Je=>{var Se,Qt;if(Je.defaultPrevented||Je.isComposing)return;const Qe=j6.current;if(Je.key!=="Escape"){Sm.current!==null&&cl(),Je.key==="Tab"&&Je.shiftKey&&!Qe.interactionBlocked&&(Je.preventDefault(),Qe.handleCycleMode());return}const Le=J8e({blocked:!!Qe.pendingApproval||Qe.interactionBlocked,streaming:Qe.streamingState!=="idle",hasInput:!!((Se=hs.current)!=null&&Se.hasInput()),armed:Sm.current});if(Le.kind!=="ignore")switch(Je.preventDefault(),Le.kind){case"cancel":Qe.handleCancel(),cl();break;case"clear":(Qt=hs.current)==null||Qt.clear(),cl();break;case"arm":ge(Le.action,Le.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",dt),()=>{window.removeEventListener("keydown",dt),cl()}},[cl]);const YB=!Gt||Me.catchingUp,Tb=g.useCallback(z=>{Re.setModel(z).then(X=>{const ge=m9e(X);pb((ge==null?void 0:ge.modelId)??z),ge&&ce.dispatch({type:"debug",text:p9e(ge),source:"model_switch_summary",data:ge})}).catch(X=>{xt(X,A("model.switch"))})},[Re,ce,xt,A]),XB=g.useCallback(z=>{if(Sn!=="idle"){es();return}Ln(`/model --fast ${z}`).catch(X=>{xt(X,"Failed to switch fast model")})},[es,Ln,Sn,xt]),QB=g.useCallback(z=>{if(Sn!=="idle"){es();return}Ln(`/model --voice ${z}`).catch(X=>{xt(X,A("model.setVoice"))})},[es,Ln,Sn,xt,A]),L6=g.useMemo(()=>{const z=new Set(Me.skills??[]);return r8e(Me.commands??[],n8e(A)).filter(X=>!Fh.has(Q4(X.name))).map(X=>z.has(X.name)?{...X,displayCategory:"skill",description:X.description||A("skills.run")}:X)},[Me.commands,Me.skills,Fh,A]),Uh=g.useMemo(()=>{var z;return{version:((z=Me.capabilities)==null?void 0:z.qwenCodeVersion)||"",cwd:Me.workspaceCwd||"",currentModel:Hu,currentMode:ll,hideTips:(Gu==null?void 0:Gu.values.effective)===!0}},[(P6=Me.capabilities)==null?void 0:P6.qwenCodeVersion,Me.workspaceCwd,Hu,ll,Gu==null?void 0:Gu.values.effective]),JB=g.useMemo(()=>p?p(Uh):h.jsx(rve,{...Uh}),[p,Uh]),D6=g.useMemo(()=>y==null?void 0:y(Uh),[y,Uh]),ul=fe.length===0&&!Qr&&!_t&&!ft,O6=ul?_g():ee,ZB=hB(_),eP=[Ft.app,Ft.appChat,ul?Ft.appChatEmpty:void 0,ne.enabled?Ft.appWithSidebar:void 0,fb===bs.Light?Ft.themeLight:Ft.themeDark,i].filter(Boolean).join(" "),tP=g.useMemo(()=>({...o,...a9e(O6,_)}),[_,O6,o]),B6=g.useCallback(z=>{L(z),o9e(z)},[]);return g.useLayoutEffect(()=>{const z=ji.current;if(!z)return;const X=la.current,ge=il.current,dt=z.getBoundingClientRect();if(ge&&!ul&&X){const Je=X.top-dt.top;Math.abs(Je)>1&&(z.style.transition="width 320ms ease",z.style.transform=`translateY(${Je}px)`,requestAnimationFrame(()=>{z.style.transition="width 320ms ease, transform 280ms ease",z.style.transform=""}),window.setTimeout(()=>{z.style.transition=""},320))}la.current=dt,il.current=ul},[ul]),h.jsx(YH,{value:fb,children:h.jsx(BH,{language:F,children:h.jsxs("div",{className:eP,style:tP,"data-web-shell-root":!0,children:[!H&&h.jsx(Owe,{toasts:pt,onDismiss:ae}),Ee&&h.jsx(ns,{title:A("resume.title"),size:"lg",onClose:()=>St(!1),children:h.jsx(pve,{onSelect:z=>{oe(),Re.loadSession(z).catch(X=>{xt(X,"Failed to load session")})},onClose:()=>St(!1)})}),Rr&&h.jsx(ns,{title:A(Rr==="fast"?"model.setFast":Rr==="voice"?"model.setVoice":"model.select"),size:"lg",onClose:()=>jr(null),children:h.jsx(Xve,{mode:Rr,models:Rr==="voice"?Dn:void 0,currentModelId:Rr==="voice"?LB:void 0,onSelect:z=>{Rr==="fast"?XB(z):Rr==="voice"?QB(z):Tb(z),jr(null)}})}),Tc&&h.jsx(ns,{title:A("mode.select"),size:"sm",onClose:()=>ol(!1),children:h.jsx(dve,{currentMode:ll,onSelect:z=>{Ac(z),ol(!1)}})}),Fu&&h.jsx(ns,{title:A("tools.title"),size:"lg",onClose:()=>Cc(!1),children:h.jsx(s_e,{})}),ua&&h.jsx(ns,{title:A("extensions.manage.title"),size:"lg",onClose:()=>km(!1),children:h.jsx(l_e,{})}),Bh&&h.jsx(ns,{title:A("mcp.manageServers"),size:"lg",onClose:()=>cb(null),children:h.jsx(G7e,{message:Bh,onClose:()=>cb(null)})}),hb&&h.jsx(ns,{title:A("tasks.title"),size:"lg",onClose:()=>Tm(null),children:h.jsx(cL,{message:hb,embedded:!0,manageActiveEvent:!1,onClose:()=>Tm(null)})}),zh&&h.jsx(ns,{title:A(zh==="manage"?"agent.manage":zh==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>db(null),children:h.jsx(c3e,{mode:zh,embedded:!0,onMessage:z=>ce.dispatch([{type:"status",text:z}]),onClose:()=>db(null)})}),u6&&h.jsx(ns,{title:A("settings.title"),size:"lg",onClose:()=>Ph(!1),children:h.jsx(K_e,{settingsState:_6,embedded:!0,onLanguageChange:OB,onThemeChange:Am,chatWidthMode:ee,onChatWidthModeChange:B6,onSubDialog:z=>{Ph(!1),z==="fastModel"?jr("fast"):z==="tools.approvalMode"&&ol(!0)}})}),d6&&h.jsx(ns,{title:A("memory.menu"),size:"lg",onClose:()=>h6(!1),children:h.jsx(M3e,{refreshSignal:gB,addSignal:bB,addScope:vB,onMessage:(z,X="status")=>{ce.dispatch([{type:X,text:z}])}})}),Cs&&h.jsx(ns,{title:A("help.title"),size:"md",onClose:()=>oo(!1),children:h.jsx(E6e,{commands:L6})}),al&&h.jsx(ns,{title:A("theme.title"),size:"sm",onClose:()=>ao(!1),children:h.jsx(M6e,{currentTheme:fb,onSelect:Am,onClose:()=>ao(!1)})}),f6&&h.jsx(ns,{title:A("auth.title"),size:"lg",onClose:()=>ub(!1),children:h.jsx(n_e,{onMessage:(z,X="status")=>{ce.dispatch([X==="error"?{type:"error",text:z}:{type:"status",text:z}])},onClose:()=>ub(!1)})}),Nt&&h.jsx(ns,{title:A("delete.title"),size:"lg",onClose:()=>Bt(!1),children:h.jsx(N6e,{onDeleted:z=>{ce.dispatch([{type:"status",text:z.length===1?`${A("delete.deleted")} (${z[0].slice(0,8)})`:A("delete.deletedCount",{count:z.length})}])},onError:z=>{if(td(z))return;const X=z instanceof Error?z.message:String(z);V("error",A("delete.failed",{reason:X}))},onClose:()=>Bt(!1)})}),$t&&h.jsx(ns,{title:A("release.title"),size:"lg",onClose:()=>Kt(!1),children:h.jsx(I6e,{onReleased:z=>{ce.dispatch([{type:"status",text:`${A("release.released")} (${z.slice(0,8)})`}])},onError:z=>{if(td(z))return;const X=z instanceof Error?z.message:String(z);V("error",A("release.failed",{reason:X}))},onClose:()=>Kt(!1)})}),_n&&h.jsx(ns,{title:A("rewind.title"),subtitle:A("rewind.subtitle"),size:"lg",onClose:()=>yr(!1),children:h.jsx(U6e,{blocks:xe,loadSnapshots:$B,rewind:qB,onError:FB,onClose:()=>yr(!1)})}),h.jsxs("div",{className:Ft.appShell,children:[ne.enabled&&h.jsxs("div",{"data-mobile-drawer":"",...se?{role:"dialog","aria-modal":"true"}:{},"aria-label":A("sidebar.label"),className:[Ft.mobileDrawer,se?Ft.mobileDrawerOpen:void 0].filter(Boolean).join(" "),children:[h.jsx("div",{className:Ft.mobileBackdrop,onClick:oe,"aria-hidden":"true"}),h.jsx(t8e,{collapsed:be&&!se,onCollapsedChange:ke,onOpenSettings:()=>{oe(),Ph(!0)},onNewSession:Im,onLoadSession:zB,onError:xt,mobileOpen:se})]}),h.jsxs("div",{className:Ft.chatPane,children:[ne.enabled&&h.jsx("button",{type:"button",className:Ft.hamburgerButton,onClick:()=>re(z=>!z),"aria-label":A("sidebar.toggleMenu"),"aria-expanded":se,children:h.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),h.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),h.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),h.jsxs(RH,{value:He,children:[h.jsx(Dh.Provider,{value:wb,children:h.jsx(K7e,{timeline:dn,details:_o,children:h.jsxs("div",{className:[Ft.content,Qr||fe.length>0||_t?Ft.contentHasMessages:void 0].filter(Boolean).join(" "),children:[h.jsx(p0e,{ref:Zr,messages:fe,pendingApproval:Xr,onShowContextDetail:BB,catchingUp:Me.catchingUp,isResponding:Sn!=="idle",activeTurnStartedAt:de,workspaceCwd:Me.workspaceCwd||"",shellOutputMaxLines:DB,showRetryHint:At,onRetryClick:Sb,onBranchSession:PB,welcomeHeader:ul?JB:void 0,tailContent:void 0,tailKey:void 0,onFollowStateChange:GB,virtualScrollThreshold:N}),(ft==null?void 0:ft.role)==="btw"&&h.jsx("div",{className:Ft.btwPanel,children:h.jsx(xL,{question:ft.question,answer:ft.answer,isPending:ft.isPending})})]})})}),h.jsxs("div",{ref:ji,className:Ft.footer,children:[aa&&h.jsx("div",{className:Qr?`${Ft.scrollToBottomLayer} ${Ft.scrollToBottomLayerWithTodos}`:Ft.scrollToBottomLayer,children:h.jsx("button",{type:"button",className:Ft.scrollToBottomButton,"aria-label":A("chat.scrollToBottom"),onClick:()=>Nr("smooth"),children:h.jsx("svg",{className:Ft.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"})})})}),Qr&&h.jsx("div",{className:Ft.bottomPanels,children:h.jsx(Jwe,{todos:rl})}),Xr&&h.jsx("div",{className:Ft.approvalOverlay,children:h.jsx(x5e,{request:Xr,onConfirm:R6,variant:"floating"})}),ur&&h.jsx("div",{className:Ft.approvalOverlay,children:h.jsx(X5e,{request:ur,onConfirm:R6,variant:"floating"})}),h.jsxs("div",{className:Ft.composer,children:[h.jsx(Cwe,{startedAt:de}),_B&&Sn==="idle"&&h.jsx("div",{className:Ft.escClearStatus,role:"status",children:A("editor.escClearHint")}),h.jsx(zSe,{prompts:AB,t:A,onDelete:MB,onInsert:NB,onEdit:IB}),h.jsx(U4e,{ref:Fs,onSubmit:HB,onCycleMode:xb,onToggleShortcuts:x6,onCancel:kb,isRunning:Sn!=="idle",cancelArmed:kB,disabled:YB||_t!==null,commands:L6,skills:fn,slashCommandCategoryOrder:f,queuedMessages:EB,onFocusFooter:VB,onPopQueuedMessages:RB,onClearQueuedMessages:jB,currentMode:ll,currentModel:Hu,chatWidthMode:ee,showChatWidthToggle:!ul,chatWidthToggleMin:ZB,visibleToolbarActions:C,availableModels:TB,onSelectMode:Ac,onSelectModel:Tb,onChatWidthModeChange:B6,sessionName:SB,dialogOpen:da,followupState:zu,onAcceptFollowup:Oh,onDismissFollowup:$u,composerInput:Y,composerInputVersion:G,placeholderText:!Gt||Me.catchingUp?A("common.loading"):A(Sn!=="idle"?"editor.processing":"editor.placeholder")})]}),Ve?h.jsx(Ve,{connected:Gt,mode:ll,model:Hu,streamingState:Sn,contextUsageRatio:(Me.contextWindow??0)>0?(Me.tokenCount??0)/(Me.contextWindow??0):0,activeGoal:ca,tasks:Jr,availableModes:Fp,availableModels:(Me.models??[]).filter(ZC).map(z=>({id:z.id,label:V1(z.label||z.id),contextWindow:z.contextWindow})),skills:fn,onSelectMode:Ac,onSelectModel:Tb}):h.jsx(pwe,{onSelectMode:()=>ol(z=>!z),onSelectModel:()=>jr(z=>z?null:"main"),onShowContext:()=>qh("/context",!1),onOpenSettings:()=>Ph(!0),ref:ia,onOpenTasks:()=>_b(),onReturnToInput:WB,tasks:ui,activeGoal:ca,hideSettings:UB,onToggleShortcuts:x6,compact:!0}),ul&&D6&&h.jsx("div",{className:Ft.emptyWelcomeFooter,children:D6})]})]})]})]})]})})})}const sA={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again"},"zh-CN":{title:"出了点问题",body:"发生意外错误，无法显示此内容。",retry:"重试"}},k9e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},S9e={margin:0,fontSize:"1rem",fontWeight:600},T9e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},C9e={appearance:"none",cursor:"pointer",padding:"0.4rem 1rem",fontSize:"0.85rem",borderRadius:"6px",border:"1px solid rgba(128, 128, 128, 0.4)",background:"transparent",color:"inherit"};function A9e({error:e,onRetry:t,language:n="en"}){const r=sA[n]??sA.en;return h.jsxs("div",{role:"alert",style:k9e,"data-web-shell-error":!0,children:[h.jsx("p",{style:S9e,children:r.title}),h.jsx("p",{style:T9e,children:r.body}),!1,h.jsx("button",{type:"button",style:C9e,onClick:t,children:r.retry})]})}function E9e(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?L9e(e):""}let If;const M9e="qwen-daemon-auth",N9e=2500;function I9e(){return If||(typeof window>"u"?void 0:(If=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,If))}function R9e(e=N9e){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const r=o=>{n||(n=!0,window.removeEventListener("message",s),clearTimeout(i),If=o,t(o))},s=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const a=o.data;if((a==null?void 0:a.type)!==M9e)return;const l=typeof a.token=="string"?a.token:"";r(l.trim()||void 0)},i=setTimeout(()=>r(void 0),e);window.addEventListener("message",s)})}function j9e(){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 L9e(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 D9e=E9e(),fB="qwen-code-web-shell-language",mB="qwen-code-web-shell-theme";function pB(e){if(e===bs.Dark||e===bs.Light)return e}function O9e(){const e=new URLSearchParams(window.location.search).get("theme");return pB(e)}function B9e(){try{return pB(window.localStorage.getItem(mB))}catch{return}}function P9e(e){try{window.localStorage.setItem(mB,e)}catch{}}function z9e(){return O9e()??B9e()??bs.Dark}function $9e(){try{const e=window.localStorage.getItem(fB);return e?Yl(e):void 0}catch{return}}function q9e(e){try{window.localStorage.setItem(fB,e)}catch{}}function F9e(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Yl(t||($9e()??navigator.language))}function U9e(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function H9e({daemonToken:e}){const[t,n]=g.useState(()=>z9e()),[r,s]=g.useState(()=>F9e()),[i]=g.useState(()=>U9e()),o=D9e||window.location.origin,a=g.useCallback(c=>{n(c),P9e(c)},[]),l=g.useCallback(c=>{s(c),q9e(c)},[]);return h.jsx(WN,{label:"web-shell-root",fallback:(c,u)=>h.jsx(A9e,{error:c,onRetry:u,language:r}),children:h.jsx(TU,{baseUrl:o,token:e,children:h.jsx(WU,{initialSessionId:i,suppressOwnUserEcho:!0,children:h.jsx(_9e,{theme:t,onThemeChange:a,language:r,onLanguageChange:l,sidebar:!0,compactThinking:!0})},i??"new")})})}async function V9e(){const e=I9e()??await R9e();j9e(),tq.createRoot(document.getElementById("root")).render(h.jsx(_P.StrictMode,{children:h.jsx(H9e,{daemonToken:e})}))}V9e();export{q as _,kg as c,G1 as g,X9e as k};
