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 Tj=Object.defineProperty;var Cj=(t,e,n)=>e in t?Tj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ie=(t,e,n)=>Cj(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var zp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var m9={exports:{}},c1={};/**
 * @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 Ej=Symbol.for("react.transitional.element"),Aj=Symbol.for("react.fragment");function p9(t,e,n){var r=null;if(n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),"key"in e){n={};for(var i in e)i!=="key"&&(n[i]=e[i])}else n=e;return e=n.ref,{$$typeof:Ej,type:t,key:r,ref:e!==void 0?e:null,props:n}}c1.Fragment=Aj;c1.jsx=p9;c1.jsxs=p9;m9.exports=c1;var f=m9.exports,g9={exports:{}},jt={};/**
 * @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 ow=Symbol.for("react.transitional.element"),Mj=Symbol.for("react.portal"),Nj=Symbol.for("react.fragment"),Dj=Symbol.for("react.strict_mode"),Ij=Symbol.for("react.profiler"),Rj=Symbol.for("react.consumer"),Oj=Symbol.for("react.context"),jj=Symbol.for("react.forward_ref"),Lj=Symbol.for("react.suspense"),Bj=Symbol.for("react.memo"),y9=Symbol.for("react.lazy"),zj=Symbol.for("react.activity"),D5=Symbol.iterator;function Pj(t){return t===null||typeof t!="object"?null:(t=D5&&t[D5]||t["@@iterator"],typeof t=="function"?t:null)}var b9={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v9=Object.assign,x9={};function Vd(t,e,n){this.props=t,this.context=e,this.refs=x9,this.updater=n||b9}Vd.prototype.isReactComponent={};Vd.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Vd.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function w9(){}w9.prototype=Vd.prototype;function lw(t,e,n){this.props=t,this.context=e,this.refs=x9,this.updater=n||b9}var cw=lw.prototype=new w9;cw.constructor=lw;v9(cw,Vd.prototype);cw.isPureReactComponent=!0;var I5=Array.isArray;function f4(){}var jn={H:null,A:null,T:null,S:null},k9=Object.prototype.hasOwnProperty;function uw(t,e,n){var r=n.ref;return{$$typeof:ow,type:t,key:e,ref:r!==void 0?r:null,props:n}}function $j(t,e){return uw(t.type,e,t.props)}function dw(t){return typeof t=="object"&&t!==null&&t.$$typeof===ow}function Uj(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var R5=/\/+/g;function $y(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Uj(""+t.key):e.toString(36)}function Hj(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(f4,f4):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function Du(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case ow:case Mj:a=!0;break;case y9:return a=t._init,Du(a(t._payload),e,n,r,i)}}if(a)return i=i(t),a=r===""?"."+$y(t,0):r,I5(i)?(n="",a!=null&&(n=a.replace(R5,"$&/")+"/"),Du(i,e,n,"",function(c){return c})):i!=null&&(dw(i)&&(i=$j(i,n+(i.key==null||t&&t.key===i.key?"":(""+i.key).replace(R5,"$&/")+"/")+a)),e.push(i)),1;a=0;var o=r===""?".":r+":";if(I5(t))for(var l=0;l<t.length;l++)r=t[l],s=o+$y(r,l),a+=Du(r,e,n,s,i);else if(l=Pj(t),typeof l=="function")for(t=l.call(t),l=0;!(r=t.next()).done;)r=r.value,s=o+$y(r,l++),a+=Du(r,e,n,s,i);else if(s==="object"){if(typeof t.then=="function")return Du(Hj(t),e,n,r,i);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return a}function J0(t,e,n){if(t==null)return t;var r=[],i=0;return Du(t,r,"","",function(s){return e.call(n,s,i++)}),r}function qj(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var O5=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Fj={map:J0,forEach:function(t,e,n){J0(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return J0(t,function(){e++}),e},toArray:function(t){return J0(t,function(e){return e})||[]},only:function(t){if(!dw(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};jt.Activity=zj;jt.Children=Fj;jt.Component=Vd;jt.Fragment=Nj;jt.Profiler=Ij;jt.PureComponent=lw;jt.StrictMode=Dj;jt.Suspense=Lj;jt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=jn;jt.__COMPILER_RUNTIME={__proto__:null,c:function(t){return jn.H.useMemoCache(t)}};jt.cache=function(t){return function(){return t.apply(null,arguments)}};jt.cacheSignal=function(){return null};jt.cloneElement=function(t,e,n){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var r=v9({},t.props),i=t.key;if(e!=null)for(s in e.key!==void 0&&(i=""+e.key),e)!k9.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(r[s]=e[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var a=Array(s),o=0;o<s;o++)a[o]=arguments[o+2];r.children=a}return uw(t.type,i,r)};jt.createContext=function(t){return t={$$typeof:Oj,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:Rj,_context:t},t};jt.createElement=function(t,e,n){var r,i={},s=null;if(e!=null)for(r in e.key!==void 0&&(s=""+e.key),e)k9.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var o=Array(a),l=0;l<a;l++)o[l]=arguments[l+2];i.children=o}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return uw(t,s,i)};jt.createRef=function(){return{current:null}};jt.forwardRef=function(t){return{$$typeof:jj,render:t}};jt.isValidElement=dw;jt.lazy=function(t){return{$$typeof:y9,_payload:{_status:-1,_result:t},_init:qj}};jt.memo=function(t,e){return{$$typeof:Bj,type:t,compare:e===void 0?null:e}};jt.startTransition=function(t){var e=jn.T,n={};jn.T=n;try{var r=t(),i=jn.S;i!==null&&i(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(f4,O5)}catch(s){O5(s)}finally{e!==null&&n.types!==null&&(e.types=n.types),jn.T=e}};jt.unstable_useCacheRefresh=function(){return jn.H.useCacheRefresh()};jt.use=function(t){return jn.H.use(t)};jt.useActionState=function(t,e,n){return jn.H.useActionState(t,e,n)};jt.useCallback=function(t,e){return jn.H.useCallback(t,e)};jt.useContext=function(t){return jn.H.useContext(t)};jt.useDebugValue=function(){};jt.useDeferredValue=function(t,e){return jn.H.useDeferredValue(t,e)};jt.useEffect=function(t,e){return jn.H.useEffect(t,e)};jt.useEffectEvent=function(t){return jn.H.useEffectEvent(t)};jt.useId=function(){return jn.H.useId()};jt.useImperativeHandle=function(t,e,n){return jn.H.useImperativeHandle(t,e,n)};jt.useInsertionEffect=function(t,e){return jn.H.useInsertionEffect(t,e)};jt.useLayoutEffect=function(t,e){return jn.H.useLayoutEffect(t,e)};jt.useMemo=function(t,e){return jn.H.useMemo(t,e)};jt.useOptimistic=function(t,e){return jn.H.useOptimistic(t,e)};jt.useReducer=function(t,e,n){return jn.H.useReducer(t,e,n)};jt.useRef=function(t){return jn.H.useRef(t)};jt.useState=function(t){return jn.H.useState(t)};jt.useSyncExternalStore=function(t,e,n){return jn.H.useSyncExternalStore(t,e,n)};jt.useTransition=function(){return jn.H.useTransition()};jt.version="19.2.4";g9.exports=jt;var v=g9.exports;const Vj=l1(v);var _9={exports:{}},u1={},S9={exports:{}},T9={};/**
 * @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(t){function e(q,Y){var $=q.length;q.push(Y);e:for(;0<$;){var Z=$-1>>>1,M=q[Z];if(0<i(M,Y))q[Z]=Y,q[$]=M,$=Z;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var Y=q[0],$=q.pop();if($!==Y){q[0]=$;e:for(var Z=0,M=q.length,X=M>>>1;Z<X;){var H=2*(Z+1)-1,R=q[H],ae=H+1,xe=q[ae];if(0>i(R,$))ae<M&&0>i(xe,R)?(q[Z]=xe,q[ae]=$,Z=ae):(q[Z]=R,q[H]=$,Z=H);else if(ae<M&&0>i(xe,$))q[Z]=xe,q[ae]=$,Z=ae;else break e}}return Y}function i(q,Y){var $=q.sortIndex-Y.sortIndex;return $!==0?$:q.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,d=null,h=3,m=!1,p=!1,b=!1,x=!1,g=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function C(q){for(var Y=n(c);Y!==null;){if(Y.callback===null)r(c);else if(Y.startTime<=q)r(c),Y.sortIndex=Y.expirationTime,e(l,Y);else break;Y=n(c)}}function E(q){if(b=!1,C(q),!p)if(n(l)!==null)p=!0,S||(S=!0,N());else{var Y=n(c);Y!==null&&J(E,Y.startTime-q)}}var S=!1,T=-1,O=5,z=-1;function I(){return x?!0:!(t.unstable_now()-z<O)}function j(){if(x=!1,S){var q=t.unstable_now();z=q;var Y=!0;try{e:{p=!1,b&&(b=!1,y(T),T=-1),m=!0;var $=h;try{t:{for(C(q),d=n(l);d!==null&&!(d.expirationTime>q&&I());){var Z=d.callback;if(typeof Z=="function"){d.callback=null,h=d.priorityLevel;var M=Z(d.expirationTime<=q);if(q=t.unstable_now(),typeof M=="function"){d.callback=M,C(q),Y=!0;break t}d===n(l)&&r(l),C(q)}else r(l);d=n(l)}if(d!==null)Y=!0;else{var X=n(c);X!==null&&J(E,X.startTime-q),Y=!1}}break e}finally{d=null,h=$,m=!1}Y=void 0}}finally{Y?N():S=!1}}}var N;if(typeof w=="function")N=function(){w(j)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,P=B.port2;B.port1.onmessage=j,N=function(){P.postMessage(null)}}else N=function(){g(j,0)};function J(q,Y){T=g(function(){q(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_next=function(q){switch(h){case 1:case 2:case 3:var Y=3;break;default:Y=h}var $=h;h=Y;try{return q()}finally{h=$}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var $=h;h=q;try{return Y()}finally{h=$}},t.unstable_scheduleCallback=function(q,Y,$){var Z=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?Z+$:Z):$=Z,q){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=$+M,q={id:u++,callback:Y,priorityLevel:q,startTime:$,expirationTime:M,sortIndex:-1},$>Z?(q.sortIndex=$,e(c,q),n(l)===null&&q===n(c)&&(b?(y(T),T=-1):b=!0,J(E,$-Z))):(q.sortIndex=M,e(l,q),p||m||(p=!0,S||(S=!0,N()))),q},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(q){var Y=h;return function(){var $=h;h=Y;try{return q.apply(this,arguments)}finally{h=$}}}})(T9);S9.exports=T9;var Gj=S9.exports,C9={exports:{}},_i={};/**
 * @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 Wj=v;function E9(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Xo(){}var vi={d:{f:Xo,r:function(){throw Error(E9(522))},D:Xo,C:Xo,L:Xo,m:Xo,X:Xo,S:Xo,M:Xo},p:0,findDOMNode:null},Kj=Symbol.for("react.portal");function Yj(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Kj,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}var tf=Wj.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d1(t,e){if(t==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}_i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=vi;_i.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(E9(299));return Yj(t,e,null,n)};_i.flushSync=function(t){var e=tf.T,n=vi.p;try{if(tf.T=null,vi.p=2,t)return t()}finally{tf.T=e,vi.p=n,vi.d.f()}};_i.preconnect=function(t,e){typeof t=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,vi.d.C(t,e))};_i.prefetchDNS=function(t){typeof t=="string"&&vi.d.D(t)};_i.preinit=function(t,e){if(typeof t=="string"&&e&&typeof e.as=="string"){var n=e.as,r=d1(n,e.crossOrigin),i=typeof e.integrity=="string"?e.integrity:void 0,s=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;n==="style"?vi.d.S(t,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:s}):n==="script"&&vi.d.X(t,{crossOrigin:r,integrity:i,fetchPriority:s,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};_i.preinitModule=function(t,e){if(typeof t=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var n=d1(e.as,e.crossOrigin);vi.d.M(t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&vi.d.M(t)};_i.preload=function(t,e){if(typeof t=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var n=e.as,r=d1(n,e.crossOrigin);vi.d.L(t,n,{crossOrigin:r,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};_i.preloadModule=function(t,e){if(typeof t=="string")if(e){var n=d1(e.as,e.crossOrigin);vi.d.m(t,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else vi.d.m(t)};_i.requestFormReset=function(t){vi.d.r(t)};_i.unstable_batchedUpdates=function(t,e){return t(e)};_i.useFormState=function(t,e,n){return tf.H.useFormState(t,e,n)};_i.useFormStatus=function(){return tf.H.useHostTransitionStatus()};_i.version="19.2.4";function A9(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A9)}catch(t){console.error(t)}}A9(),C9.exports=_i;var hw=C9.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 Nr=Gj,M9=v,Xj=hw;function he(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function N9(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function m0(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function D9(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function I9(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function j5(t){if(m0(t)!==t)throw Error(he(188))}function Qj(t){var e=t.alternate;if(!e){if(e=m0(t),e===null)throw Error(he(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return j5(i),t;if(s===r)return j5(i),e;s=s.sibling}throw Error(he(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,o=i.child;o;){if(o===n){a=!0,n=i,r=s;break}if(o===r){a=!0,r=i,n=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===n){a=!0,n=s,r=i;break}if(o===r){a=!0,r=s,n=i;break}o=o.sibling}if(!a)throw Error(he(189))}}if(n.alternate!==r)throw Error(he(190))}if(n.tag!==3)throw Error(he(188));return n.stateNode.current===n?t:e}function R9(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=R9(t),e!==null)return e;t=t.sibling}return null}var Bn=Object.assign,Jj=Symbol.for("react.element"),Z0=Symbol.for("react.transitional.element"),Uh=Symbol.for("react.portal"),zu=Symbol.for("react.fragment"),O9=Symbol.for("react.strict_mode"),m4=Symbol.for("react.profiler"),j9=Symbol.for("react.consumer"),vo=Symbol.for("react.context"),fw=Symbol.for("react.forward_ref"),p4=Symbol.for("react.suspense"),g4=Symbol.for("react.suspense_list"),mw=Symbol.for("react.memo"),rl=Symbol.for("react.lazy"),y4=Symbol.for("react.activity"),Zj=Symbol.for("react.memo_cache_sentinel"),L5=Symbol.iterator;function bh(t){return t===null||typeof t!="object"?null:(t=L5&&t[L5]||t["@@iterator"],typeof t=="function"?t:null)}var eL=Symbol.for("react.client.reference");function b4(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===eL?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case zu:return"Fragment";case m4:return"Profiler";case O9:return"StrictMode";case p4:return"Suspense";case g4:return"SuspenseList";case y4:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case Uh:return"Portal";case vo:return t.displayName||"Context";case j9:return(t._context.displayName||"Context")+".Consumer";case fw:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case mw:return e=t.displayName||null,e!==null?e:b4(t.type)||"Memo";case rl:e=t._payload,t=t._init;try{return b4(t(e))}catch{}}return null}var Hh=Array.isArray,_t=M9.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,un=Xj.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Lc={pending:!1,data:null,method:null,action:null},v4=[],Pu=-1;function Ua(t){return{current:t}}function qr(t){0>Pu||(t.current=v4[Pu],v4[Pu]=null,Pu--)}function Nn(t,e){Pu++,v4[Pu]=t.current,t.current=e}var Ba=Ua(null),Nf=Ua(null),Sl=Ua(null),Pp=Ua(null);function $p(t,e){switch(Nn(Sl,e),Nn(Nf,t),Nn(Ba,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?H6(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=H6(e),t=tA(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}qr(Ba),Nn(Ba,t)}function bd(){qr(Ba),qr(Nf),qr(Sl)}function x4(t){t.memoizedState!==null&&Nn(Pp,t);var e=Ba.current,n=tA(e,t.type);e!==n&&(Nn(Nf,t),Nn(Ba,n))}function Up(t){Nf.current===t&&(qr(Ba),qr(Nf)),Pp.current===t&&(qr(Pp),Uf._currentValue=Lc)}var Uy,B5;function yc(t){if(Uy===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Uy=e&&e[1]||"",B5=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Uy+t+B5}var Hy=!1;function qy(t,e){if(!t||Hy)return"";Hy=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(e){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 h=m}Reflect.construct(t,[],d)}else{try{d.call()}catch(m){h=m}t.call(d.prototype)}}else{try{throw Error()}catch(m){h=m}(d=t())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&h&&typeof m.stack=="string")return[m.stack,h.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var s=r.DetermineComponentFrameRoot(),a=s[0],o=s[1];if(a&&o){var l=a.split(`
`),c=o.split(`
`);for(i=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;if(r===l.length||i===c.length)for(r=l.length-1,i=c.length-1;1<=r&&0<=i&&l[r]!==c[i];)i--;for(;1<=r&&0<=i;r--,i--)if(l[r]!==c[i]){if(r!==1||i!==1)do if(r--,i--,0>i||l[r]!==c[i]){var u=`
`+l[r].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=r&&0<=i);break}}}finally{Hy=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?yc(n):""}function tL(t,e){switch(t.tag){case 26:case 27:case 5:return yc(t.type);case 16:return yc("Lazy");case 13:return t.child!==e&&e!==null?yc("Suspense Fallback"):yc("Suspense");case 19:return yc("SuspenseList");case 0:case 15:return qy(t.type,!1);case 11:return qy(t.type.render,!1);case 1:return qy(t.type,!0);case 31:return yc("Activity");default:return""}}function z5(t){try{var e="",n=null;do e+=tL(t,n),n=t,t=t.return;while(t);return e}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var w4=Object.prototype.hasOwnProperty,pw=Nr.unstable_scheduleCallback,Fy=Nr.unstable_cancelCallback,nL=Nr.unstable_shouldYield,rL=Nr.unstable_requestPaint,rs=Nr.unstable_now,iL=Nr.unstable_getCurrentPriorityLevel,L9=Nr.unstable_ImmediatePriority,B9=Nr.unstable_UserBlockingPriority,Hp=Nr.unstable_NormalPriority,sL=Nr.unstable_LowPriority,z9=Nr.unstable_IdlePriority,aL=Nr.log,oL=Nr.unstable_setDisableYieldValue,p0=null,is=null;function fl(t){if(typeof aL=="function"&&oL(t),is&&typeof is.setStrictMode=="function")try{is.setStrictMode(p0,t)}catch{}}var ss=Math.clz32?Math.clz32:uL,lL=Math.log,cL=Math.LN2;function uL(t){return t>>>=0,t===0?32:31-(lL(t)/cL|0)|0}var em=256,tm=262144,nm=4194304;function bc(t){var e=t&42;if(e!==0)return e;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function h1(t,e,n){var r=t.pendingLanes;if(r===0)return 0;var i=0,s=t.suspendedLanes,a=t.pingedLanes;t=t.warmLanes;var o=r&134217727;return o!==0?(r=o&~s,r!==0?i=bc(r):(a&=o,a!==0?i=bc(a):n||(n=o&~t,n!==0&&(i=bc(n))))):(o=r&~s,o!==0?i=bc(o):a!==0?i=bc(a):n||(n=r&~t,n!==0&&(i=bc(n)))),i===0?0:e!==0&&e!==i&&!(e&s)&&(s=i&-i,n=e&-e,s>=n||s===32&&(n&4194048)!==0)?e:i}function g0(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function dL(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+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 e+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 P9(){var t=nm;return nm<<=1,!(nm&62914560)&&(nm=4194304),t}function Vy(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function y0(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function hL(t,e,n,r,i,s){var a=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var o=t.entanglements,l=t.expirationTimes,c=t.hiddenUpdates;for(n=a&~n;0<n;){var u=31-ss(n),d=1<<u;o[u]=0,l[u]=-1;var h=c[u];if(h!==null)for(c[u]=null,u=0;u<h.length;u++){var m=h[u];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&$9(t,r,0),s!==0&&i===0&&t.tag!==0&&(t.suspendedLanes|=s&~(a&~e))}function $9(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var r=31-ss(e);t.entangledLanes|=e,t.entanglements[r]=t.entanglements[r]|1073741824|n&261930}function U9(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-ss(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}function H9(t,e){var n=e&-e;return n=n&42?1:gw(n),n&(t.suspendedLanes|e)?0:n}function gw(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function yw(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function q9(){var t=un.p;return t!==0?t:(t=window.event,t===void 0?32:hA(t.type))}function P5(t,e){var n=un.p;try{return un.p=t,e()}finally{un.p=n}}var Xl=Math.random().toString(36).slice(2),Kr="__reactFiber$"+Xl,zi="__reactProps$"+Xl,Gd="__reactContainer$"+Xl,k4="__reactEvents$"+Xl,fL="__reactListeners$"+Xl,mL="__reactHandles$"+Xl,$5="__reactResources$"+Xl,b0="__reactMarker$"+Xl;function bw(t){delete t[Kr],delete t[zi],delete t[k4],delete t[fL],delete t[mL]}function $u(t){var e=t[Kr];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Gd]||n[Kr]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=W6(t);t!==null;){if(n=t[Kr])return n;t=W6(t)}return e}t=n,n=t.parentNode}return null}function Wd(t){if(t=t[Kr]||t[Gd]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function qh(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(he(33))}function rd(t){var e=t[$5];return e||(e=t[$5]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function $r(t){t[b0]=!0}var F9=new Set,V9={};function ru(t,e){vd(t,e),vd(t+"Capture",e)}function vd(t,e){for(V9[t]=e,t=0;t<e.length;t++)F9.add(e[t])}var pL=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]*$"),U5={},H5={};function gL(t){return w4.call(H5,t)?!0:w4.call(U5,t)?!1:pL.test(t)?H5[t]=!0:(U5[t]=!0,!1)}function ap(t,e,n){if(gL(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var r=e.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,""+n)}}function rm(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,""+n)}}function no(t,e,n,r){if(r===null)t.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,""+r)}}function _s(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function G9(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function yL(t,e,n){var r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function _4(t){if(!t._valueTracker){var e=G9(t)?"checked":"value";t._valueTracker=yL(t,e,""+t[e])}}function W9(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=G9(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function qp(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var bL=/[\n"\\]/g;function Ms(t){return t.replace(bL,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function S4(t,e,n,r,i,s,a,o){t.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?t.type=a:t.removeAttribute("type"),e!=null?a==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+_s(e)):t.value!==""+_s(e)&&(t.value=""+_s(e)):a!=="submit"&&a!=="reset"||t.removeAttribute("value"),e!=null?T4(t,a,_s(e)):n!=null?T4(t,a,_s(n)):r!=null&&t.removeAttribute("value"),i==null&&s!=null&&(t.defaultChecked=!!s),i!=null&&(t.checked=i&&typeof i!="function"&&typeof i!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?t.name=""+_s(o):t.removeAttribute("name")}function K9(t,e,n,r,i,s,a,o){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.type=s),e!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||e!=null)){_4(t);return}n=n!=null?""+_s(n):"",e=e!=null?""+_s(e):n,o||e===t.value||(t.value=e),t.defaultValue=e}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,t.checked=o?t.checked:!!r,t.defaultChecked=!!r,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(t.name=a),_4(t)}function T4(t,e,n){e==="number"&&qp(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function id(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+_s(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Y9(t,e,n){if(e!=null&&(e=""+_s(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+_s(n):""}function X9(t,e,n,r){if(e==null){if(r!=null){if(n!=null)throw Error(he(92));if(Hh(r)){if(1<r.length)throw Error(he(93));r=r[0]}n=r}n==null&&(n=""),e=n}n=_s(e),t.defaultValue=n,r=t.textContent,r===n&&r!==""&&r!==null&&(t.value=r),_4(t)}function xd(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var vL=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 q5(t,e,n){var r=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":r?t.setProperty(e,n):typeof n!="number"||n===0||vL.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function Q9(t,e,n){if(e!=null&&typeof e!="object")throw Error(he(62));if(t=t.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||e!=null&&e.hasOwnProperty(r)||(r.indexOf("--")===0?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="");for(var i in e)r=e[i],e.hasOwnProperty(i)&&n[i]!==r&&q5(t,i,r)}else for(var s in e)e.hasOwnProperty(s)&&q5(t,s,e[s])}function vw(t){if(t.indexOf("-")===-1)return!1;switch(t){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 xL=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"]]),wL=/^[\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 op(t){return wL.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function xo(){}var C4=null;function xw(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Uu=null,sd=null;function F5(t){var e=Wd(t);if(e&&(t=e.stateNode)){var n=t[zi]||null;e:switch(t=e.stateNode,e.type){case"input":if(S4(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ms(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=r[zi]||null;if(!i)throw Error(he(90));S4(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(e=0;e<n.length;e++)r=n[e],r.form===t.form&&W9(r)}break e;case"textarea":Y9(t,n.value,n.defaultValue);break e;case"select":e=n.value,e!=null&&id(t,!!n.multiple,e,!1)}}}var Gy=!1;function J9(t,e,n){if(Gy)return t(e,n);Gy=!0;try{var r=t(e);return r}finally{if(Gy=!1,(Uu!==null||sd!==null)&&(S1(),Uu&&(e=Uu,t=sd,sd=Uu=null,F5(e),t)))for(e=0;e<t.length;e++)F5(t[e])}}function Df(t,e){var n=t.stateNode;if(n===null)return null;var r=n[zi]||null;if(r===null)return null;n=r[e];e:switch(e){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)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(he(231,e,typeof n));return n}var Do=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),E4=!1;if(Do)try{var vh={};Object.defineProperty(vh,"passive",{get:function(){E4=!0}}),window.addEventListener("test",vh,vh),window.removeEventListener("test",vh,vh)}catch{E4=!1}var ml=null,ww=null,lp=null;function Z9(){if(lp)return lp;var t,e=ww,n=e.length,r,i="value"in ml?ml.value:ml.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var a=n-t;for(r=1;r<=a&&e[n-r]===i[s-r];r++);return lp=i.slice(t,1<r?1-r:void 0)}function cp(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function im(){return!0}function V5(){return!1}function $i(t){function e(n,r,i,s,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(n=t[o],this[o]=n?n(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?im:V5,this.isPropagationStopped=V5,this}return Bn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=im)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=im)},persist:function(){},isPersistent:im}),e}var iu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},f1=$i(iu),v0=Bn({},iu,{view:0,detail:0}),kL=$i(v0),Wy,Ky,xh,m1=Bn({},v0,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kw,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==xh&&(xh&&t.type==="mousemove"?(Wy=t.screenX-xh.screenX,Ky=t.screenY-xh.screenY):Ky=Wy=0,xh=t),Wy)},movementY:function(t){return"movementY"in t?t.movementY:Ky}}),G5=$i(m1),_L=Bn({},m1,{dataTransfer:0}),SL=$i(_L),TL=Bn({},v0,{relatedTarget:0}),Yy=$i(TL),CL=Bn({},iu,{animationName:0,elapsedTime:0,pseudoElement:0}),EL=$i(CL),AL=Bn({},iu,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),ML=$i(AL),NL=Bn({},iu,{data:0}),W5=$i(NL),DL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IL={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"},RL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OL(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=RL[t])?!!e[t]:!1}function kw(){return OL}var jL=Bn({},v0,{key:function(t){if(t.key){var e=DL[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=cp(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?IL[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kw,charCode:function(t){return t.type==="keypress"?cp(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?cp(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),LL=$i(jL),BL=Bn({},m1,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),K5=$i(BL),zL=Bn({},v0,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kw}),PL=$i(zL),$L=Bn({},iu,{propertyName:0,elapsedTime:0,pseudoElement:0}),UL=$i($L),HL=Bn({},m1,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),qL=$i(HL),FL=Bn({},iu,{newState:0,oldState:0}),VL=$i(FL),GL=[9,13,27,32],_w=Do&&"CompositionEvent"in window,nf=null;Do&&"documentMode"in document&&(nf=document.documentMode);var WL=Do&&"TextEvent"in window&&!nf,eC=Do&&(!_w||nf&&8<nf&&11>=nf),Y5=" ",X5=!1;function tC(t,e){switch(t){case"keyup":return GL.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Hu=!1;function KL(t,e){switch(t){case"compositionend":return nC(e);case"keypress":return e.which!==32?null:(X5=!0,Y5);case"textInput":return t=e.data,t===Y5&&X5?null:t;default:return null}}function YL(t,e){if(Hu)return t==="compositionend"||!_w&&tC(t,e)?(t=Z9(),lp=ww=ml=null,Hu=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return eC&&e.locale!=="ko"?null:e.data;default:return null}}var XL={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 Q5(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!XL[t.type]:e==="textarea"}function rC(t,e,n,r){Uu?sd?sd.push(r):sd=[r]:Uu=r,e=og(e,"onChange"),0<e.length&&(n=new f1("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var rf=null,If=null;function QL(t){JE(t,0)}function p1(t){var e=qh(t);if(W9(e))return t}function J5(t,e){if(t==="change")return e}var iC=!1;if(Do){var Xy;if(Do){var Qy="oninput"in document;if(!Qy){var Z5=document.createElement("div");Z5.setAttribute("oninput","return;"),Qy=typeof Z5.oninput=="function"}Xy=Qy}else Xy=!1;iC=Xy&&(!document.documentMode||9<document.documentMode)}function e6(){rf&&(rf.detachEvent("onpropertychange",sC),If=rf=null)}function sC(t){if(t.propertyName==="value"&&p1(If)){var e=[];rC(e,If,t,xw(t)),J9(QL,e)}}function JL(t,e,n){t==="focusin"?(e6(),rf=e,If=n,rf.attachEvent("onpropertychange",sC)):t==="focusout"&&e6()}function ZL(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return p1(If)}function eB(t,e){if(t==="click")return p1(e)}function tB(t,e){if(t==="input"||t==="change")return p1(e)}function nB(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var cs=typeof Object.is=="function"?Object.is:nB;function Rf(t,e){if(cs(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!w4.call(e,i)||!cs(t[i],e[i]))return!1}return!0}function t6(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function n6(t,e){var n=t6(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=t6(n)}}function aC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?aC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function oC(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=qp(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=qp(t.document)}return e}function Sw(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var rB=Do&&"documentMode"in document&&11>=document.documentMode,qu=null,A4=null,sf=null,M4=!1;function r6(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;M4||qu==null||qu!==qp(r)||(r=qu,"selectionStart"in r&&Sw(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}),sf&&Rf(sf,r)||(sf=r,r=og(A4,"onSelect"),0<r.length&&(e=new f1("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=qu)))}function cc(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Fu={animationend:cc("Animation","AnimationEnd"),animationiteration:cc("Animation","AnimationIteration"),animationstart:cc("Animation","AnimationStart"),transitionrun:cc("Transition","TransitionRun"),transitionstart:cc("Transition","TransitionStart"),transitioncancel:cc("Transition","TransitionCancel"),transitionend:cc("Transition","TransitionEnd")},Jy={},lC={};Do&&(lC=document.createElement("div").style,"AnimationEvent"in window||(delete Fu.animationend.animation,delete Fu.animationiteration.animation,delete Fu.animationstart.animation),"TransitionEvent"in window||delete Fu.transitionend.transition);function su(t){if(Jy[t])return Jy[t];if(!Fu[t])return t;var e=Fu[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in lC)return Jy[t]=e[n];return t}var cC=su("animationend"),uC=su("animationiteration"),dC=su("animationstart"),iB=su("transitionrun"),sB=su("transitionstart"),aB=su("transitioncancel"),hC=su("transitionend"),fC=new Map,N4="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(" ");N4.push("scrollEnd");function oa(t,e){fC.set(t,e),ru(e,[t])}var Fp=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ks=[],Vu=0,Tw=0;function g1(){for(var t=Vu,e=Tw=Vu=0;e<t;){var n=ks[e];ks[e++]=null;var r=ks[e];ks[e++]=null;var i=ks[e];ks[e++]=null;var s=ks[e];if(ks[e++]=null,r!==null&&i!==null){var a=r.pending;a===null?i.next=i:(i.next=a.next,a.next=i),r.pending=i}s!==0&&mC(n,i,s)}}function y1(t,e,n,r){ks[Vu++]=t,ks[Vu++]=e,ks[Vu++]=n,ks[Vu++]=r,Tw|=r,t.lanes|=r,t=t.alternate,t!==null&&(t.lanes|=r)}function Cw(t,e,n,r){return y1(t,e,n,r),Vp(t)}function au(t,e){return y1(t,null,null,e),Vp(t)}function mC(t,e,n){t.lanes|=n;var r=t.alternate;r!==null&&(r.lanes|=n);for(var i=!1,s=t.return;s!==null;)s.childLanes|=n,r=s.alternate,r!==null&&(r.childLanes|=n),s.tag===22&&(t=s.stateNode,t===null||t._visibility&1||(i=!0)),t=s,s=s.return;return t.tag===3?(s=t.stateNode,i&&e!==null&&(i=31-ss(n),t=s.hiddenUpdates,r=t[i],r===null?t[i]=[e]:r.push(e),e.lane=n|536870912),s):null}function Vp(t){if(50<mf)throw mf=0,Q4=null,Error(he(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var Gu={};function oB(t,e,n,r){this.tag=t,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=e,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 Ji(t,e,n,r){return new oB(t,e,n,r)}function Ew(t){return t=t.prototype,!(!t||!t.isReactComponent)}function To(t,e){var n=t.alternate;return n===null?(n=Ji(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function pC(t,e){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function up(t,e,n,r,i,s){var a=0;if(r=t,typeof t=="function")Ew(t)&&(a=1);else if(typeof t=="string")a=hz(t,n,Ba.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case y4:return t=Ji(31,n,e,i),t.elementType=y4,t.lanes=s,t;case zu:return Bc(n.children,i,s,e);case O9:a=8,i|=24;break;case m4:return t=Ji(12,n,e,i|2),t.elementType=m4,t.lanes=s,t;case p4:return t=Ji(13,n,e,i),t.elementType=p4,t.lanes=s,t;case g4:return t=Ji(19,n,e,i),t.elementType=g4,t.lanes=s,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case vo:a=10;break e;case j9:a=9;break e;case fw:a=11;break e;case mw:a=14;break e;case rl:a=16,r=null;break e}a=29,n=Error(he(130,t===null?"null":typeof t,"")),r=null}return e=Ji(a,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Bc(t,e,n,r){return t=Ji(7,t,r,e),t.lanes=n,t}function Zy(t,e,n){return t=Ji(6,t,null,e),t.lanes=n,t}function gC(t){var e=Ji(18,null,null,0);return e.stateNode=t,e}function eb(t,e,n){return e=Ji(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var i6=new WeakMap;function Ns(t,e){if(typeof t=="object"&&t!==null){var n=i6.get(t);return n!==void 0?n:(e={value:t,source:e,stack:z5(e)},i6.set(t,e),e)}return{value:t,source:e,stack:z5(e)}}var Wu=[],Ku=0,Gp=null,Of=0,Ss=[],Ts=0,jl=null,Na=1,Da="";function ho(t,e){Wu[Ku++]=Of,Wu[Ku++]=Gp,Gp=t,Of=e}function yC(t,e,n){Ss[Ts++]=Na,Ss[Ts++]=Da,Ss[Ts++]=jl,jl=t;var r=Na;t=Da;var i=32-ss(r)-1;r&=~(1<<i),n+=1;var s=32-ss(e)+i;if(30<s){var a=i-i%5;s=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Na=1<<32-ss(e)+i|n<<i|r,Da=s+t}else Na=1<<s|n<<i|r,Da=t}function Aw(t){t.return!==null&&(ho(t,1),yC(t,1,0))}function Mw(t){for(;t===Gp;)Gp=Wu[--Ku],Wu[Ku]=null,Of=Wu[--Ku],Wu[Ku]=null;for(;t===jl;)jl=Ss[--Ts],Ss[Ts]=null,Da=Ss[--Ts],Ss[Ts]=null,Na=Ss[--Ts],Ss[Ts]=null}function bC(t,e){Ss[Ts++]=Na,Ss[Ts++]=Da,Ss[Ts++]=jl,Na=e.id,Da=e.overflow,jl=t}var Yr=null,On=null,Yt=!1,Tl=null,Ds=!1,D4=Error(he(519));function Ll(t){var e=Error(he(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw jf(Ns(e,t)),D4}function s6(t){var e=t.stateNode,n=t.type,r=t.memoizedProps;switch(e[Kr]=t,e[zi]=r,n){case"dialog":qt("cancel",e),qt("close",e);break;case"iframe":case"object":case"embed":qt("load",e);break;case"video":case"audio":for(n=0;n<Pf.length;n++)qt(Pf[n],e);break;case"source":qt("error",e);break;case"img":case"image":case"link":qt("error",e),qt("load",e);break;case"details":qt("toggle",e);break;case"input":qt("invalid",e),K9(e,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":qt("invalid",e);break;case"textarea":qt("invalid",e),X9(e,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||r.suppressHydrationWarning===!0||eA(e.textContent,n)?(r.popover!=null&&(qt("beforetoggle",e),qt("toggle",e)),r.onScroll!=null&&qt("scroll",e),r.onScrollEnd!=null&&qt("scrollend",e),r.onClick!=null&&(e.onclick=xo),e=!0):e=!1,e||Ll(t,!0)}function a6(t){for(Yr=t.return;Yr;)switch(Yr.tag){case 5:case 31:case 13:Ds=!1;return;case 27:case 3:Ds=!0;return;default:Yr=Yr.return}}function Tu(t){if(t!==Yr)return!1;if(!Yt)return a6(t),Yt=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||nx(t.type,t.memoizedProps)),n=!n),n&&On&&Ll(t),a6(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(he(317));On=G6(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(he(317));On=G6(t)}else e===27?(e=On,Ql(t.type)?(t=ax,ax=null,On=t):On=e):On=Yr?zs(t.stateNode.nextSibling):null;return!0}function Wc(){On=Yr=null,Yt=!1}function tb(){var t=Tl;return t!==null&&(Ni===null?Ni=t:Ni.push.apply(Ni,t),Tl=null),t}function jf(t){Tl===null?Tl=[t]:Tl.push(t)}var I4=Ua(null),ou=null,wo=null;function ll(t,e,n){Nn(I4,e._currentValue),e._currentValue=n}function Co(t){t._currentValue=I4.current,qr(I4)}function R4(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function O4(t,e,n,r){var i=t.child;for(i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){var a=i.child;s=s.firstContext;e:for(;s!==null;){var o=s;s=i;for(var l=0;l<e.length;l++)if(o.context===e[l]){s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),R4(s.return,n,t),r||(a=null);break e}s=o.next}}else if(i.tag===18){if(a=i.return,a===null)throw Error(he(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),R4(a,n,t),a=null}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}}function Kd(t,e,n,r){t=null;for(var i=e,s=!1;i!==null;){if(!s){if(i.flags&524288)s=!0;else if(i.flags&262144)break}if(i.tag===10){var a=i.alternate;if(a===null)throw Error(he(387));if(a=a.memoizedProps,a!==null){var o=i.type;cs(i.pendingProps.value,a.value)||(t!==null?t.push(o):t=[o])}}else if(i===Pp.current){if(a=i.alternate,a===null)throw Error(he(387));a.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(t!==null?t.push(Uf):t=[Uf])}i=i.return}t!==null&&O4(e,t,n,r),e.flags|=262144}function Wp(t){for(t=t.firstContext;t!==null;){if(!cs(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Kc(t){ou=t,wo=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Xr(t){return vC(ou,t)}function sm(t,e){return ou===null&&Kc(t),vC(t,e)}function vC(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},wo===null){if(t===null)throw Error(he(308));wo=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else wo=wo.next=e;return n}var lB=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,r){t.push(r)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},cB=Nr.unstable_scheduleCallback,uB=Nr.unstable_NormalPriority,gr={$$typeof:vo,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nw(){return{controller:new lB,data:new Map,refCount:0}}function x0(t){t.refCount--,t.refCount===0&&cB(uB,function(){t.controller.abort()})}var af=null,j4=0,wd=0,ad=null;function dB(t,e){if(af===null){var n=af=[];j4=0,wd=t3(),ad={status:"pending",value:void 0,then:function(r){n.push(r)}}}return j4++,e.then(o6,o6),e}function o6(){if(--j4===0&&af!==null){ad!==null&&(ad.status="fulfilled");var t=af;af=null,wd=0,ad=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function hB(t,e){var n=[],r={status:"pending",value:null,reason:null,then:function(i){n.push(i)}};return t.then(function(){r.status="fulfilled",r.value=e;for(var i=0;i<n.length;i++)(0,n[i])(e)},function(i){for(r.status="rejected",r.reason=i,i=0;i<n.length;i++)(0,n[i])(void 0)}),r}var l6=_t.S;_t.S=function(t,e){RE=rs(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&dB(t,e),l6!==null&&l6(t,e)};var zc=Ua(null);function Dw(){var t=zc.current;return t!==null?t:Sn.pooledCache}function dp(t,e){e===null?Nn(zc,zc.current):Nn(zc,e.pool)}function xC(){var t=Dw();return t===null?null:{parent:gr._currentValue,pool:t}}var Yd=Error(he(460)),Iw=Error(he(474)),b1=Error(he(542)),Kp={then:function(){}};function c6(t){return t=t.status,t==="fulfilled"||t==="rejected"}function wC(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(xo,xo),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,d6(t),t;default:if(typeof e.status=="string")e.then(xo,xo);else{if(t=Sn,t!==null&&100<t.shellSuspendCounter)throw Error(he(482));t=e,t.status="pending",t.then(function(r){if(e.status==="pending"){var i=e;i.status="fulfilled",i.value=r}},function(r){if(e.status==="pending"){var i=e;i.status="rejected",i.reason=r}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,d6(t),t}throw Pc=e,Yd}}function vc(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Pc=n,Yd):n}}var Pc=null;function u6(){if(Pc===null)throw Error(he(459));var t=Pc;return Pc=null,t}function d6(t){if(t===Yd||t===b1)throw Error(he(483))}var od=null,Lf=0;function am(t){var e=Lf;return Lf+=1,od===null&&(od=[]),wC(od,t,e)}function wh(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function om(t,e){throw e.$$typeof===Jj?Error(he(525)):(t=Object.prototype.toString.call(e),Error(he(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function kC(t){function e(g,y){if(t){var w=g.deletions;w===null?(g.deletions=[y],g.flags|=16):w.push(y)}}function n(g,y){if(!t)return null;for(;y!==null;)e(g,y),y=y.sibling;return null}function r(g){for(var y=new Map;g!==null;)g.key!==null?y.set(g.key,g):y.set(g.index,g),g=g.sibling;return y}function i(g,y){return g=To(g,y),g.index=0,g.sibling=null,g}function s(g,y,w){return g.index=w,t?(w=g.alternate,w!==null?(w=w.index,w<y?(g.flags|=67108866,y):w):(g.flags|=67108866,y)):(g.flags|=1048576,y)}function a(g){return t&&g.alternate===null&&(g.flags|=67108866),g}function o(g,y,w,C){return y===null||y.tag!==6?(y=Zy(w,g.mode,C),y.return=g,y):(y=i(y,w),y.return=g,y)}function l(g,y,w,C){var E=w.type;return E===zu?u(g,y,w.props.children,C,w.key):y!==null&&(y.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===rl&&vc(E)===y.type)?(y=i(y,w.props),wh(y,w),y.return=g,y):(y=up(w.type,w.key,w.props,null,g.mode,C),wh(y,w),y.return=g,y)}function c(g,y,w,C){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=eb(w,g.mode,C),y.return=g,y):(y=i(y,w.children||[]),y.return=g,y)}function u(g,y,w,C,E){return y===null||y.tag!==7?(y=Bc(w,g.mode,C,E),y.return=g,y):(y=i(y,w),y.return=g,y)}function d(g,y,w){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=Zy(""+y,g.mode,w),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Z0:return w=up(y.type,y.key,y.props,null,g.mode,w),wh(w,y),w.return=g,w;case Uh:return y=eb(y,g.mode,w),y.return=g,y;case rl:return y=vc(y),d(g,y,w)}if(Hh(y)||bh(y))return y=Bc(y,g.mode,w,null),y.return=g,y;if(typeof y.then=="function")return d(g,am(y),w);if(y.$$typeof===vo)return d(g,sm(g,y),w);om(g,y)}return null}function h(g,y,w,C){var E=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return E!==null?null:o(g,y,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Z0:return w.key===E?l(g,y,w,C):null;case Uh:return w.key===E?c(g,y,w,C):null;case rl:return w=vc(w),h(g,y,w,C)}if(Hh(w)||bh(w))return E!==null?null:u(g,y,w,C,null);if(typeof w.then=="function")return h(g,y,am(w),C);if(w.$$typeof===vo)return h(g,y,sm(g,w),C);om(g,w)}return null}function m(g,y,w,C,E){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return g=g.get(w)||null,o(y,g,""+C,E);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Z0:return g=g.get(C.key===null?w:C.key)||null,l(y,g,C,E);case Uh:return g=g.get(C.key===null?w:C.key)||null,c(y,g,C,E);case rl:return C=vc(C),m(g,y,w,C,E)}if(Hh(C)||bh(C))return g=g.get(w)||null,u(y,g,C,E,null);if(typeof C.then=="function")return m(g,y,w,am(C),E);if(C.$$typeof===vo)return m(g,y,w,sm(y,C),E);om(y,C)}return null}function p(g,y,w,C){for(var E=null,S=null,T=y,O=y=0,z=null;T!==null&&O<w.length;O++){T.index>O?(z=T,T=null):z=T.sibling;var I=h(g,T,w[O],C);if(I===null){T===null&&(T=z);break}t&&T&&I.alternate===null&&e(g,T),y=s(I,y,O),S===null?E=I:S.sibling=I,S=I,T=z}if(O===w.length)return n(g,T),Yt&&ho(g,O),E;if(T===null){for(;O<w.length;O++)T=d(g,w[O],C),T!==null&&(y=s(T,y,O),S===null?E=T:S.sibling=T,S=T);return Yt&&ho(g,O),E}for(T=r(T);O<w.length;O++)z=m(T,g,O,w[O],C),z!==null&&(t&&z.alternate!==null&&T.delete(z.key===null?O:z.key),y=s(z,y,O),S===null?E=z:S.sibling=z,S=z);return t&&T.forEach(function(j){return e(g,j)}),Yt&&ho(g,O),E}function b(g,y,w,C){if(w==null)throw Error(he(151));for(var E=null,S=null,T=y,O=y=0,z=null,I=w.next();T!==null&&!I.done;O++,I=w.next()){T.index>O?(z=T,T=null):z=T.sibling;var j=h(g,T,I.value,C);if(j===null){T===null&&(T=z);break}t&&T&&j.alternate===null&&e(g,T),y=s(j,y,O),S===null?E=j:S.sibling=j,S=j,T=z}if(I.done)return n(g,T),Yt&&ho(g,O),E;if(T===null){for(;!I.done;O++,I=w.next())I=d(g,I.value,C),I!==null&&(y=s(I,y,O),S===null?E=I:S.sibling=I,S=I);return Yt&&ho(g,O),E}for(T=r(T);!I.done;O++,I=w.next())I=m(T,g,O,I.value,C),I!==null&&(t&&I.alternate!==null&&T.delete(I.key===null?O:I.key),y=s(I,y,O),S===null?E=I:S.sibling=I,S=I);return t&&T.forEach(function(N){return e(g,N)}),Yt&&ho(g,O),E}function x(g,y,w,C){if(typeof w=="object"&&w!==null&&w.type===zu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Z0:e:{for(var E=w.key;y!==null;){if(y.key===E){if(E=w.type,E===zu){if(y.tag===7){n(g,y.sibling),C=i(y,w.props.children),C.return=g,g=C;break e}}else if(y.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===rl&&vc(E)===y.type){n(g,y.sibling),C=i(y,w.props),wh(C,w),C.return=g,g=C;break e}n(g,y);break}else e(g,y);y=y.sibling}w.type===zu?(C=Bc(w.props.children,g.mode,C,w.key),C.return=g,g=C):(C=up(w.type,w.key,w.props,null,g.mode,C),wh(C,w),C.return=g,g=C)}return a(g);case Uh:e:{for(E=w.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(g,y.sibling),C=i(y,w.children||[]),C.return=g,g=C;break e}else{n(g,y);break}else e(g,y);y=y.sibling}C=eb(w,g.mode,C),C.return=g,g=C}return a(g);case rl:return w=vc(w),x(g,y,w,C)}if(Hh(w))return p(g,y,w,C);if(bh(w)){if(E=bh(w),typeof E!="function")throw Error(he(150));return w=E.call(w),b(g,y,w,C)}if(typeof w.then=="function")return x(g,y,am(w),C);if(w.$$typeof===vo)return x(g,y,sm(g,w),C);om(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,y!==null&&y.tag===6?(n(g,y.sibling),C=i(y,w),C.return=g,g=C):(n(g,y),C=Zy(w,g.mode,C),C.return=g,g=C),a(g)):n(g,y)}return function(g,y,w,C){try{Lf=0;var E=x(g,y,w,C);return od=null,E}catch(T){if(T===Yd||T===b1)throw T;var S=Ji(29,T,null,g.mode);return S.lanes=C,S.return=g,S}finally{}}}var Yc=kC(!0),_C=kC(!1),il=!1;function Rw(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function L4(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Cl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function El(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ln&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,e=Vp(t),mC(t,null,n),e}return y1(t,r,e,n),Vp(t)}function of(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,U9(t,n)}}function nb(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,callbacks:r.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var B4=!1;function lf(){if(B4){var t=ad;if(t!==null)throw t}}function cf(t,e,n,r){B4=!1;var i=t.updateQueue;il=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=t.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,u=c=l=null,o=s;do{var h=o.lane&-536870913,m=h!==o.lane;if(m?(Kt&h)===h:(r&h)===h){h!==0&&h===wd&&(B4=!0),u!==null&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var p=t,b=o;h=e;var x=n;switch(b.tag){case 1:if(p=b.payload,typeof p=="function"){d=p.call(x,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=b.payload,h=typeof p=="function"?p.call(x,d,h):p,h==null)break e;d=Bn({},d,h);break e;case 2:il=!0}}h=o.callback,h!==null&&(t.flags|=64,m&&(t.flags|=8192),m=i.callbacks,m===null?i.callbacks=[h]:m.push(h))}else m={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=m,l=d):u=u.next=m,a|=h;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;m=o,o=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,s===null&&(i.shared.lanes=0),zl|=a,t.lanes=a,t.memoizedState=d}}function SC(t,e){if(typeof t!="function")throw Error(he(191,t));t.call(e)}function TC(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)SC(n[t],e)}var kd=Ua(null),Yp=Ua(0);function h6(t,e){t=jo,Nn(Yp,t),Nn(kd,e),jo=t|e.baseLanes}function z4(){Nn(Yp,jo),Nn(kd,kd.current)}function Ow(){jo=Yp.current,qr(kd),qr(Yp)}var us=Ua(null),Bs=null;function cl(t){var e=t.alternate;Nn(ar,ar.current&1),Nn(us,t),Bs===null&&(e===null||kd.current!==null||e.memoizedState!==null)&&(Bs=t)}function P4(t){Nn(ar,ar.current),Nn(us,t),Bs===null&&(Bs=t)}function CC(t){t.tag===22?(Nn(ar,ar.current),Nn(us,t),Bs===null&&(Bs=t)):ul()}function ul(){Nn(ar,ar.current),Nn(us,us.current)}function Xi(t){qr(us),Bs===t&&(Bs=null),qr(ar)}var ar=Ua(0);function Xp(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ix(n)||sx(n)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Io=0,Lt=null,vn=null,mr=null,Qp=!1,ld=!1,Xc=!1,Jp=0,Bf=0,cd=null,fB=0;function Jn(){throw Error(he(321))}function jw(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!cs(t[n],e[n]))return!1;return!0}function Lw(t,e,n,r,i,s){return Io=s,Lt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,_t.H=t===null||t.memoizedState===null?rE:Ww,Xc=!1,s=n(r,i),Xc=!1,ld&&(s=AC(e,n,r,i)),EC(t),s}function EC(t){_t.H=zf;var e=vn!==null&&vn.next!==null;if(Io=0,mr=vn=Lt=null,Qp=!1,Bf=0,cd=null,e)throw Error(he(300));t===null||yr||(t=t.dependencies,t!==null&&Wp(t)&&(yr=!0))}function AC(t,e,n,r){Lt=t;var i=0;do{if(ld&&(cd=null),Bf=0,ld=!1,25<=i)throw Error(he(301));if(i+=1,mr=vn=null,t.updateQueue!=null){var s=t.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}_t.H=iE,s=e(n,r)}while(ld);return s}function mB(){var t=_t.H,e=t.useState()[0];return e=typeof e.then=="function"?w0(e):e,t=t.useState()[0],(vn!==null?vn.memoizedState:null)!==t&&(Lt.flags|=1024),e}function Bw(){var t=Jp!==0;return Jp=0,t}function zw(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function Pw(t){if(Qp){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}Qp=!1}Io=0,mr=vn=Lt=null,ld=!1,Bf=Jp=0,cd=null}function hi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mr===null?Lt.memoizedState=mr=t:mr=mr.next=t,mr}function or(){if(vn===null){var t=Lt.alternate;t=t!==null?t.memoizedState:null}else t=vn.next;var e=mr===null?Lt.memoizedState:mr.next;if(e!==null)mr=e,vn=t;else{if(t===null)throw Lt.alternate===null?Error(he(467)):Error(he(310));vn=t,t={memoizedState:vn.memoizedState,baseState:vn.baseState,baseQueue:vn.baseQueue,queue:vn.queue,next:null},mr===null?Lt.memoizedState=mr=t:mr=mr.next=t}return mr}function v1(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function w0(t){var e=Bf;return Bf+=1,cd===null&&(cd=[]),t=wC(cd,t,e),e=Lt,(mr===null?e.memoizedState:mr.next)===null&&(e=e.alternate,_t.H=e===null||e.memoizedState===null?rE:Ww),t}function x1(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return w0(t);if(t.$$typeof===vo)return Xr(t)}throw Error(he(438,String(t)))}function $w(t){var e=null,n=Lt.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var r=Lt.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(e={data:r.data.map(function(i){return i.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=v1(),Lt.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),r=0;r<t;r++)n[r]=Zj;return e.index++,n}function Ro(t,e){return typeof e=="function"?e(t):e}function hp(t){var e=or();return Uw(e,vn,t)}function Uw(t,e,n){var r=t.queue;if(r===null)throw Error(he(311));r.lastRenderedReducer=n;var i=t.baseQueue,s=r.pending;if(s!==null){if(i!==null){var a=i.next;i.next=s.next,s.next=a}e.baseQueue=i=s,r.pending=null}if(s=t.baseState,i===null)t.memoizedState=s;else{e=i.next;var o=a=null,l=null,c=e,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(Kt&d)===d:(Io&d)===d){var h=c.revertLane;if(h===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((Io&h)===h){c=c.next,h===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?(o=l=d,a=s):l=l.next=d,Lt.lanes|=h,zl|=h;d=c.action,Xc&&n(s,d),s=c.hasEagerState?c.eagerState:n(s,d)}else h={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(o=l=h,a=s):l=l.next=h,Lt.lanes|=d,zl|=d;c=c.next}while(c!==null&&c!==e);if(l===null?a=s:l.next=o,!cs(s,t.memoizedState)&&(yr=!0,u&&(n=ad,n!==null)))throw n;t.memoizedState=s,t.baseState=a,t.baseQueue=l,r.lastRenderedState=s}return i===null&&(r.lanes=0),[t.memoizedState,r.dispatch]}function rb(t){var e=or(),n=e.queue;if(n===null)throw Error(he(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do s=t(s,a.action),a=a.next;while(a!==i);cs(s,e.memoizedState)||(yr=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function MC(t,e,n){var r=Lt,i=or(),s=Yt;if(s){if(n===void 0)throw Error(he(407));n=n()}else n=e();var a=!cs((vn||i).memoizedState,n);if(a&&(i.memoizedState=n,yr=!0),i=i.queue,Hw(IC.bind(null,r,i,t),[t]),i.getSnapshot!==e||a||mr!==null&&mr.memoizedState.tag&1){if(r.flags|=2048,_d(9,{destroy:void 0},DC.bind(null,r,i,n,e),null),Sn===null)throw Error(he(349));s||Io&127||NC(r,e,n)}return n}function NC(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Lt.updateQueue,e===null?(e=v1(),Lt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function DC(t,e,n,r){e.value=n,e.getSnapshot=r,RC(e)&&OC(t)}function IC(t,e,n){return n(function(){RC(e)&&OC(t)})}function RC(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!cs(t,n)}catch{return!0}}function OC(t){var e=au(t,2);e!==null&&Li(e,t,2)}function $4(t){var e=hi();if(typeof t=="function"){var n=t;if(t=n(),Xc){fl(!0);try{n()}finally{fl(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:t},e}function jC(t,e,n,r){return t.baseState=n,Uw(t,vn,typeof r=="function"?r:Ro)}function pB(t,e,n,r,i){if(k1(t))throw Error(he(485));if(t=e.action,t!==null){var s={payload:i,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(a){s.listeners.push(a)}};_t.T!==null?n(!0):s.isTransition=!1,r(s),n=e.pending,n===null?(s.next=e.pending=s,LC(e,s)):(s.next=n.next,e.pending=n.next=s)}}function LC(t,e){var n=e.action,r=e.payload,i=t.state;if(e.isTransition){var s=_t.T,a={};_t.T=a;try{var o=n(i,r),l=_t.S;l!==null&&l(a,o),f6(t,e,o)}catch(c){U4(t,e,c)}finally{s!==null&&a.types!==null&&(s.types=a.types),_t.T=s}}else try{s=n(i,r),f6(t,e,s)}catch(c){U4(t,e,c)}}function f6(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){m6(t,e,r)},function(r){return U4(t,e,r)}):m6(t,e,n)}function m6(t,e,n){e.status="fulfilled",e.value=n,BC(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,LC(t,n)))}function U4(t,e,n){var r=t.pending;if(t.pending=null,r!==null){r=r.next;do e.status="rejected",e.reason=n,BC(e),e=e.next;while(e!==r)}t.action=null}function BC(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function zC(t,e){return e}function p6(t,e){if(Yt){var n=Sn.formState;if(n!==null){e:{var r=Lt;if(Yt){if(On){t:{for(var i=On,s=Ds;i.nodeType!==8;){if(!s){i=null;break t}if(i=zs(i.nextSibling),i===null){i=null;break t}}s=i.data,i=s==="F!"||s==="F"?i:null}if(i){On=zs(i.nextSibling),r=i.data==="F!";break e}}Ll(r)}r=!1}r&&(e=n[0])}}return n=hi(),n.memoizedState=n.baseState=e,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zC,lastRenderedState:e},n.queue=r,n=eE.bind(null,Lt,r),r.dispatch=n,r=$4(!1),s=Gw.bind(null,Lt,!1,r.queue),r=hi(),i={state:e,dispatch:null,action:t,pending:null},r.queue=i,n=pB.bind(null,Lt,i,s,n),i.dispatch=n,r.memoizedState=t,[e,n,!1]}function g6(t){var e=or();return PC(e,vn,t)}function PC(t,e,n){if(e=Uw(t,e,zC)[0],t=hp(Ro)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var r=w0(e)}catch(a){throw a===Yd?b1:a}else r=e;e=or();var i=e.queue,s=i.dispatch;return n!==e.memoizedState&&(Lt.flags|=2048,_d(9,{destroy:void 0},gB.bind(null,i,n),null)),[r,s,t]}function gB(t,e){t.action=e}function y6(t){var e=or(),n=vn;if(n!==null)return PC(e,n,t);or(),e=e.memoizedState,n=or();var r=n.queue.dispatch;return n.memoizedState=t,[e,r,!1]}function _d(t,e,n,r){return t={tag:t,create:n,deps:r,inst:e,next:null},e=Lt.updateQueue,e===null&&(e=v1(),Lt.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t),t}function $C(){return or().memoizedState}function fp(t,e,n,r){var i=hi();Lt.flags|=t,i.memoizedState=_d(1|e,{destroy:void 0},n,r===void 0?null:r)}function w1(t,e,n,r){var i=or();r=r===void 0?null:r;var s=i.memoizedState.inst;vn!==null&&r!==null&&jw(r,vn.memoizedState.deps)?i.memoizedState=_d(e,s,n,r):(Lt.flags|=t,i.memoizedState=_d(1|e,s,n,r))}function b6(t,e){fp(8390656,8,t,e)}function Hw(t,e){w1(2048,8,t,e)}function yB(t){Lt.flags|=4;var e=Lt.updateQueue;if(e===null)e=v1(),Lt.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function UC(t){var e=or().memoizedState;return yB({ref:e,nextImpl:t}),function(){if(ln&2)throw Error(he(440));return e.impl.apply(void 0,arguments)}}function HC(t,e){return w1(4,2,t,e)}function qC(t,e){return w1(4,4,t,e)}function FC(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function VC(t,e,n){n=n!=null?n.concat([t]):null,w1(4,4,FC.bind(null,e,t),n)}function qw(){}function GC(t,e){var n=or();e=e===void 0?null:e;var r=n.memoizedState;return e!==null&&jw(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function WC(t,e){var n=or();e=e===void 0?null:e;var r=n.memoizedState;if(e!==null&&jw(e,r[1]))return r[0];if(r=t(),Xc){fl(!0);try{t()}finally{fl(!1)}}return n.memoizedState=[r,e],r}function Fw(t,e,n){return n===void 0||Io&1073741824&&!(Kt&261930)?t.memoizedState=e:(t.memoizedState=n,t=jE(),Lt.lanes|=t,zl|=t,n)}function KC(t,e,n,r){return cs(n,e)?n:kd.current!==null?(t=Fw(t,n,r),cs(t,e)||(yr=!0),t):!(Io&42)||Io&1073741824&&!(Kt&261930)?(yr=!0,t.memoizedState=n):(t=jE(),Lt.lanes|=t,zl|=t,e)}function YC(t,e,n,r,i){var s=un.p;un.p=s!==0&&8>s?s:8;var a=_t.T,o={};_t.T=o,Gw(t,!1,e,n);try{var l=i(),c=_t.S;if(c!==null&&c(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=hB(l,r);uf(t,e,u,as(t))}else uf(t,e,r,as(t))}catch(d){uf(t,e,{then:function(){},status:"rejected",reason:d},as())}finally{un.p=s,a!==null&&o.types!==null&&(a.types=o.types),_t.T=a}}function bB(){}function H4(t,e,n,r){if(t.tag!==5)throw Error(he(476));var i=XC(t).queue;YC(t,i,e,Lc,n===null?bB:function(){return QC(t),n(r)})}function XC(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:Lc,baseState:Lc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:Lc},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function QC(t){var e=XC(t);e.next===null&&(e=t.alternate.memoizedState),uf(t,e.next.queue,{},as())}function Vw(){return Xr(Uf)}function JC(){return or().memoizedState}function ZC(){return or().memoizedState}function vB(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=as();t=Cl(n);var r=El(e,t,n);r!==null&&(Li(r,e,n),of(r,e,n)),e={cache:Nw()},t.payload=e;return}e=e.return}}function xB(t,e,n){var r=as();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},k1(t)?tE(e,n):(n=Cw(t,e,n,r),n!==null&&(Li(n,t,r),nE(n,e,r)))}function eE(t,e,n){var r=as();uf(t,e,n,r)}function uf(t,e,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(k1(t))tE(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,n);if(i.hasEagerState=!0,i.eagerState=o,cs(o,a))return y1(t,e,i,0),Sn===null&&g1(),!1}catch{}finally{}if(n=Cw(t,e,i,r),n!==null)return Li(n,t,r),nE(n,e,r),!0}return!1}function Gw(t,e,n,r){if(r={lane:2,revertLane:t3(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},k1(t)){if(e)throw Error(he(479))}else e=Cw(t,n,r,2),e!==null&&Li(e,t,2)}function k1(t){var e=t.alternate;return t===Lt||e!==null&&e===Lt}function tE(t,e){ld=Qp=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function nE(t,e,n){if(n&4194048){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,U9(t,n)}}var zf={readContext:Xr,use:x1,useCallback:Jn,useContext:Jn,useEffect:Jn,useImperativeHandle:Jn,useLayoutEffect:Jn,useInsertionEffect:Jn,useMemo:Jn,useReducer:Jn,useRef:Jn,useState:Jn,useDebugValue:Jn,useDeferredValue:Jn,useTransition:Jn,useSyncExternalStore:Jn,useId:Jn,useHostTransitionStatus:Jn,useFormState:Jn,useActionState:Jn,useOptimistic:Jn,useMemoCache:Jn,useCacheRefresh:Jn};zf.useEffectEvent=Jn;var rE={readContext:Xr,use:x1,useCallback:function(t,e){return hi().memoizedState=[t,e===void 0?null:e],t},useContext:Xr,useEffect:b6,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,fp(4194308,4,FC.bind(null,e,t),n)},useLayoutEffect:function(t,e){return fp(4194308,4,t,e)},useInsertionEffect:function(t,e){fp(4,2,t,e)},useMemo:function(t,e){var n=hi();e=e===void 0?null:e;var r=t();if(Xc){fl(!0);try{t()}finally{fl(!1)}}return n.memoizedState=[r,e],r},useReducer:function(t,e,n){var r=hi();if(n!==void 0){var i=n(e);if(Xc){fl(!0);try{n(e)}finally{fl(!1)}}}else i=e;return r.memoizedState=r.baseState=i,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:i},r.queue=t,t=t.dispatch=xB.bind(null,Lt,t),[r.memoizedState,t]},useRef:function(t){var e=hi();return t={current:t},e.memoizedState=t},useState:function(t){t=$4(t);var e=t.queue,n=eE.bind(null,Lt,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:qw,useDeferredValue:function(t,e){var n=hi();return Fw(n,t,e)},useTransition:function(){var t=$4(!1);return t=YC.bind(null,Lt,t.queue,!0,!1),hi().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var r=Lt,i=hi();if(Yt){if(n===void 0)throw Error(he(407));n=n()}else{if(n=e(),Sn===null)throw Error(he(349));Kt&127||NC(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,b6(IC.bind(null,r,s,t),[t]),r.flags|=2048,_d(9,{destroy:void 0},DC.bind(null,r,s,n,e),null),n},useId:function(){var t=hi(),e=Sn.identifierPrefix;if(Yt){var n=Da,r=Na;n=(r&~(1<<32-ss(r)-1)).toString(32)+n,e="_"+e+"R_"+n,n=Jp++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=fB++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:Vw,useFormState:p6,useActionState:p6,useOptimistic:function(t){var e=hi();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=Gw.bind(null,Lt,!0,n),n.dispatch=e,[t,e]},useMemoCache:$w,useCacheRefresh:function(){return hi().memoizedState=vB.bind(null,Lt)},useEffectEvent:function(t){var e=hi(),n={impl:t};return e.memoizedState=n,function(){if(ln&2)throw Error(he(440));return n.impl.apply(void 0,arguments)}}},Ww={readContext:Xr,use:x1,useCallback:GC,useContext:Xr,useEffect:Hw,useImperativeHandle:VC,useInsertionEffect:HC,useLayoutEffect:qC,useMemo:WC,useReducer:hp,useRef:$C,useState:function(){return hp(Ro)},useDebugValue:qw,useDeferredValue:function(t,e){var n=or();return KC(n,vn.memoizedState,t,e)},useTransition:function(){var t=hp(Ro)[0],e=or().memoizedState;return[typeof t=="boolean"?t:w0(t),e]},useSyncExternalStore:MC,useId:JC,useHostTransitionStatus:Vw,useFormState:g6,useActionState:g6,useOptimistic:function(t,e){var n=or();return jC(n,vn,t,e)},useMemoCache:$w,useCacheRefresh:ZC};Ww.useEffectEvent=UC;var iE={readContext:Xr,use:x1,useCallback:GC,useContext:Xr,useEffect:Hw,useImperativeHandle:VC,useInsertionEffect:HC,useLayoutEffect:qC,useMemo:WC,useReducer:rb,useRef:$C,useState:function(){return rb(Ro)},useDebugValue:qw,useDeferredValue:function(t,e){var n=or();return vn===null?Fw(n,t,e):KC(n,vn.memoizedState,t,e)},useTransition:function(){var t=rb(Ro)[0],e=or().memoizedState;return[typeof t=="boolean"?t:w0(t),e]},useSyncExternalStore:MC,useId:JC,useHostTransitionStatus:Vw,useFormState:y6,useActionState:y6,useOptimistic:function(t,e){var n=or();return vn!==null?jC(n,vn,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:$w,useCacheRefresh:ZC};iE.useEffectEvent=UC;function ib(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Bn({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var q4={enqueueSetState:function(t,e,n){t=t._reactInternals;var r=as(),i=Cl(r);i.payload=e,n!=null&&(i.callback=n),e=El(t,i,r),e!==null&&(Li(e,t,r),of(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=as(),i=Cl(r);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=El(t,i,r),e!==null&&(Li(e,t,r),of(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=as(),r=Cl(n);r.tag=2,e!=null&&(r.callback=e),e=El(t,r,n),e!==null&&(Li(e,t,n),of(e,t,n))}};function v6(t,e,n,r,i,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,a):e.prototype&&e.prototype.isPureReactComponent?!Rf(n,r)||!Rf(i,s):!0}function x6(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&q4.enqueueReplaceState(e,e.state,null)}function Qc(t,e){var n=e;if("ref"in e){n={};for(var r in e)r!=="ref"&&(n[r]=e[r])}if(t=t.defaultProps){n===e&&(n=Bn({},n));for(var i in t)n[i]===void 0&&(n[i]=t[i])}return n}function sE(t){Fp(t)}function aE(t){console.error(t)}function oE(t){Fp(t)}function Zp(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(r){setTimeout(function(){throw r})}}function w6(t,e,n){try{var r=t.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function F4(t,e,n){return n=Cl(n),n.tag=3,n.payload={element:null},n.callback=function(){Zp(t,e)},n}function lE(t){return t=Cl(t),t.tag=3,t}function cE(t,e,n,r){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=r.value;t.payload=function(){return i(s)},t.callback=function(){w6(e,n,r)}}var a=n.stateNode;a!==null&&typeof a.componentDidCatch=="function"&&(t.callback=function(){w6(e,n,r),typeof i!="function"&&(Al===null?Al=new Set([this]):Al.add(this));var o=r.stack;this.componentDidCatch(r.value,{componentStack:o!==null?o:""})})}function wB(t,e,n,r,i){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(e=n.alternate,e!==null&&Kd(e,n,i,!0),n=us.current,n!==null){switch(n.tag){case 31:case 13:return Bs===null?ig():n.alternate===null&&er===0&&(er=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Kp?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([r]):e.add(r),pb(t,r,i)),!1;case 22:return n.flags|=65536,r===Kp?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([r]):n.add(r)),pb(t,r,i)),!1}throw Error(he(435,n.tag))}return pb(t,r,i),ig(),!1}if(Yt)return e=us.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=i,r!==D4&&(t=Error(he(422),{cause:r}),jf(Ns(t,n)))):(r!==D4&&(e=Error(he(423),{cause:r}),jf(Ns(e,n))),t=t.current.alternate,t.flags|=65536,i&=-i,t.lanes|=i,r=Ns(r,n),i=F4(t.stateNode,r,i),nb(t,i),er!==4&&(er=2)),!1;var s=Error(he(520),{cause:r});if(s=Ns(s,n),ff===null?ff=[s]:ff.push(s),er!==4&&(er=2),e===null)return!0;r=Ns(r,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=i&-i,n.lanes|=t,t=F4(n.stateNode,r,t),nb(n,t),!1;case 1:if(e=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(Al===null||!Al.has(s))))return n.flags|=65536,i&=-i,n.lanes|=i,i=lE(i),cE(i,t,n,r),nb(n,i),!1}n=n.return}while(n!==null);return!1}var Kw=Error(he(461)),yr=!1;function Vr(t,e,n,r){e.child=t===null?_C(e,null,n,r):Yc(e,t.child,n,r)}function k6(t,e,n,r,i){n=n.render;var s=e.ref;if("ref"in r){var a={};for(var o in r)o!=="ref"&&(a[o]=r[o])}else a=r;return Kc(e),r=Lw(t,e,n,a,s,i),o=Bw(),t!==null&&!yr?(zw(t,e,i),Oo(t,e,i)):(Yt&&o&&Aw(e),e.flags|=1,Vr(t,e,r,i),e.child)}function _6(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!Ew(s)&&s.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=s,uE(t,e,s,r,i)):(t=up(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!Yw(t,i)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:Rf,n(a,r)&&t.ref===e.ref)return Oo(t,e,i)}return e.flags|=1,t=To(s,r),t.ref=e.ref,t.return=e,e.child=t}function uE(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(Rf(s,r)&&t.ref===e.ref)if(yr=!1,e.pendingProps=r=s,Yw(t,i))t.flags&131072&&(yr=!0);else return e.lanes=t.lanes,Oo(t,e,i)}return V4(t,e,n,r,i)}function dE(t,e,n,r){var i=r.children,s=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(e.flags&128){if(s=s!==null?s.baseLanes|n:n,t!==null){for(r=e.child=t.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~s}else r=0,e.child=null;return S6(t,e,s,n,r)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&dp(e,s!==null?s.cachePool:null),s!==null?h6(e,s):z4(),CC(e);else return r=e.lanes=536870912,S6(t,e,s!==null?s.baseLanes|n:n,n,r)}else s!==null?(dp(e,s.cachePool),h6(e,s),ul(),e.memoizedState=null):(t!==null&&dp(e,null),z4(),ul());return Vr(t,e,i,n),e.child}function Fh(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function S6(t,e,n,r,i){var s=Dw();return s=s===null?null:{parent:gr._currentValue,pool:s},e.memoizedState={baseLanes:n,cachePool:s},t!==null&&dp(e,null),z4(),CC(e),t!==null&&Kd(t,e,r,!0),e.childLanes=i,null}function mp(t,e){return e=eg({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function T6(t,e,n){return Yc(e,t.child,null,n),t=mp(e,e.pendingProps),t.flags|=2,Xi(e),e.memoizedState=null,t}function kB(t,e,n){var r=e.pendingProps,i=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Yt){if(r.mode==="hidden")return t=mp(e,r),e.lanes=536870912,Fh(null,t);if(P4(e),(t=On)?(t=rA(t,Ds),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:jl!==null?{id:Na,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},n=gC(t),n.return=e,e.child=n,Yr=e,On=null)):t=null,t===null)throw Ll(e);return e.lanes=536870912,null}return mp(e,r)}var s=t.memoizedState;if(s!==null){var a=s.dehydrated;if(P4(e),i)if(e.flags&256)e.flags&=-257,e=T6(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(he(558));else if(yr||Kd(t,e,n,!1),i=(n&t.childLanes)!==0,yr||i){if(r=Sn,r!==null&&(a=H9(r,n),a!==0&&a!==s.retryLane))throw s.retryLane=a,au(t,a),Li(r,t,a),Kw;ig(),e=T6(t,e,n)}else t=s.treeContext,On=zs(a.nextSibling),Yr=e,Yt=!0,Tl=null,Ds=!1,t!==null&&bC(e,t),e=mp(e,r),e.flags|=4096;return e}return t=To(t.child,{mode:r.mode,children:r.children}),t.ref=e.ref,e.child=t,t.return=e,t}function pp(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(he(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function V4(t,e,n,r,i){return Kc(e),n=Lw(t,e,n,r,void 0,i),r=Bw(),t!==null&&!yr?(zw(t,e,i),Oo(t,e,i)):(Yt&&r&&Aw(e),e.flags|=1,Vr(t,e,n,i),e.child)}function C6(t,e,n,r,i,s){return Kc(e),e.updateQueue=null,n=AC(e,r,n,i),EC(t),r=Bw(),t!==null&&!yr?(zw(t,e,s),Oo(t,e,s)):(Yt&&r&&Aw(e),e.flags|=1,Vr(t,e,n,s),e.child)}function E6(t,e,n,r,i){if(Kc(e),e.stateNode===null){var s=Gu,a=n.contextType;typeof a=="object"&&a!==null&&(s=Xr(a)),s=new n(r,s),e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=q4,e.stateNode=s,s._reactInternals=e,s=e.stateNode,s.props=r,s.state=e.memoizedState,s.refs={},Rw(e),a=n.contextType,s.context=typeof a=="object"&&a!==null?Xr(a):Gu,s.state=e.memoizedState,a=n.getDerivedStateFromProps,typeof a=="function"&&(ib(e,n,a,r),s.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(a=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),a!==s.state&&q4.enqueueReplaceState(s,s.state,null),cf(e,r,s,i),lf(),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!0}else if(t===null){s=e.stateNode;var o=e.memoizedProps,l=Qc(n,o);s.props=l;var c=s.context,u=n.contextType;a=Gu,typeof u=="object"&&u!==null&&(a=Xr(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function",o=e.pendingProps!==o,u||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o||c!==a)&&x6(e,s,r,a),il=!1;var h=e.memoizedState;s.state=h,cf(e,r,s,i),lf(),c=e.memoizedState,o||h!==c||il?(typeof d=="function"&&(ib(e,n,d,r),c=e.memoizedState),(l=il||v6(e,n,l,r,h,c,a))?(u||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),s.props=r,s.state=c,s.context=a,r=l):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,L4(t,e),a=e.memoizedProps,u=Qc(n,a),s.props=u,d=e.pendingProps,h=s.context,c=n.contextType,l=Gu,typeof c=="object"&&c!==null&&(l=Xr(c)),o=n.getDerivedStateFromProps,(c=typeof o=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||h!==l)&&x6(e,s,r,l),il=!1,h=e.memoizedState,s.state=h,cf(e,r,s,i),lf();var m=e.memoizedState;a!==d||h!==m||il||t!==null&&t.dependencies!==null&&Wp(t.dependencies)?(typeof o=="function"&&(ib(e,n,o,r),m=e.memoizedState),(u=il||v6(e,n,u,r,h,m,l)||t!==null&&t.dependencies!==null&&Wp(t.dependencies))?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),s.props=r,s.state=m,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return s=r,pp(t,e),r=(e.flags&128)!==0,s||r?(s=e.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:s.render(),e.flags|=1,t!==null&&r?(e.child=Yc(e,t.child,null,i),e.child=Yc(e,null,n,i)):Vr(t,e,n,i),e.memoizedState=s.state,t=e.child):t=Oo(t,e,i),t}function A6(t,e,n,r){return Wc(),e.flags|=256,Vr(t,e,n,r),e.child}var sb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ab(t){return{baseLanes:t,cachePool:xC()}}function ob(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=ts),t}function hE(t,e,n){var r=e.pendingProps,i=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(ar.current&2)!==0),a&&(i=!0,e.flags&=-129),a=(e.flags&32)!==0,e.flags&=-33,t===null){if(Yt){if(i?cl(e):ul(),(t=On)?(t=rA(t,Ds),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:jl!==null?{id:Na,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},n=gC(t),n.return=e,e.child=n,Yr=e,On=null)):t=null,t===null)throw Ll(e);return sx(t)?e.lanes=32:e.lanes=536870912,null}var o=r.children;return r=r.fallback,i?(ul(),i=e.mode,o=eg({mode:"hidden",children:o},i),r=Bc(r,i,n,null),o.return=e,r.return=e,o.sibling=r,e.child=o,r=e.child,r.memoizedState=ab(n),r.childLanes=ob(t,a,n),e.memoizedState=sb,Fh(null,r)):(cl(e),G4(e,o))}var l=t.memoizedState;if(l!==null&&(o=l.dehydrated,o!==null)){if(s)e.flags&256?(cl(e),e.flags&=-257,e=lb(t,e,n)):e.memoizedState!==null?(ul(),e.child=t.child,e.flags|=128,e=null):(ul(),o=r.fallback,i=e.mode,r=eg({mode:"visible",children:r.children},i),o=Bc(o,i,n,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,Yc(e,t.child,null,n),r=e.child,r.memoizedState=ab(n),r.childLanes=ob(t,a,n),e.memoizedState=sb,e=Fh(null,r));else if(cl(e),sx(o)){if(a=o.nextSibling&&o.nextSibling.dataset,a)var c=a.dgst;a=c,r=Error(he(419)),r.stack="",r.digest=a,jf({value:r,source:null,stack:null}),e=lb(t,e,n)}else if(yr||Kd(t,e,n,!1),a=(n&t.childLanes)!==0,yr||a){if(a=Sn,a!==null&&(r=H9(a,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,au(t,r),Li(a,t,r),Kw;ix(o)||ig(),e=lb(t,e,n)}else ix(o)?(e.flags|=192,e.child=t.child,e=null):(t=l.treeContext,On=zs(o.nextSibling),Yr=e,Yt=!0,Tl=null,Ds=!1,t!==null&&bC(e,t),e=G4(e,r.children),e.flags|=4096);return e}return i?(ul(),o=r.fallback,i=e.mode,l=t.child,c=l.sibling,r=To(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?o=To(c,o):(o=Bc(o,i,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,Fh(null,r),r=e.child,o=t.child.memoizedState,o===null?o=ab(n):(i=o.cachePool,i!==null?(l=gr._currentValue,i=i.parent!==l?{parent:l,pool:l}:i):i=xC(),o={baseLanes:o.baseLanes|n,cachePool:i}),r.memoizedState=o,r.childLanes=ob(t,a,n),e.memoizedState=sb,Fh(t.child,r)):(cl(e),n=t.child,t=n.sibling,n=To(n,{mode:"visible",children:r.children}),n.return=e,n.sibling=null,t!==null&&(a=e.deletions,a===null?(e.deletions=[t],e.flags|=16):a.push(t)),e.child=n,e.memoizedState=null,n)}function G4(t,e){return e=eg({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function eg(t,e){return t=Ji(22,t,null,e),t.lanes=0,t}function lb(t,e,n){return Yc(e,t.child,null,n),t=G4(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function M6(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),R4(t.return,e,n)}function cb(t,e,n,r,i,s){var a=t.memoizedState;a===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:s}:(a.isBackwards=e,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i,a.treeForkCount=s)}function fE(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;r=r.children;var a=ar.current,o=(a&2)!==0;if(o?(a=a&1|2,e.flags|=128):a&=1,Nn(ar,a),Vr(t,e,r,n),r=Yt?Of:0,!o&&t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&M6(t,n,e);else if(t.tag===19)M6(t,n,e);else if(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;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Xp(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),cb(e,!1,i,n,s,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Xp(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}cb(e,!0,n,null,s,r);break;case"together":cb(e,!1,null,null,void 0,r);break;default:e.memoizedState=null}return e.child}function Oo(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),zl|=e.lanes,!(n&e.childLanes))if(t!==null){if(Kd(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(he(153));if(e.child!==null){for(t=e.child,n=To(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=To(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Yw(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&Wp(t)))}function _B(t,e,n){switch(e.tag){case 3:$p(e,e.stateNode.containerInfo),ll(e,gr,t.memoizedState.cache),Wc();break;case 27:case 5:x4(e);break;case 4:$p(e,e.stateNode.containerInfo);break;case 10:ll(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,P4(e),null;break;case 13:var r=e.memoizedState;if(r!==null)return r.dehydrated!==null?(cl(e),e.flags|=128,null):n&e.child.childLanes?hE(t,e,n):(cl(e),t=Oo(t,e,n),t!==null?t.sibling:null);cl(e);break;case 19:var i=(t.flags&128)!==0;if(r=(n&e.childLanes)!==0,r||(Kd(t,e,n,!1),r=(n&e.childLanes)!==0),i){if(r)return fE(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Nn(ar,ar.current),r)break;return null;case 22:return e.lanes=0,dE(t,e,n,e.pendingProps);case 24:ll(e,gr,t.memoizedState.cache)}return Oo(t,e,n)}function mE(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)yr=!0;else{if(!Yw(t,n)&&!(e.flags&128))return yr=!1,_B(t,e,n);yr=!!(t.flags&131072)}else yr=!1,Yt&&e.flags&1048576&&yC(e,Of,e.index);switch(e.lanes=0,e.tag){case 16:e:{var r=e.pendingProps;if(t=vc(e.elementType),e.type=t,typeof t=="function")Ew(t)?(r=Qc(t,r),e.tag=1,e=E6(null,e,t,r,n)):(e.tag=0,e=V4(null,e,t,r,n));else{if(t!=null){var i=t.$$typeof;if(i===fw){e.tag=11,e=k6(null,e,t,r,n);break e}else if(i===mw){e.tag=14,e=_6(null,e,t,r,n);break e}}throw e=b4(t)||t,Error(he(306,e,""))}}return e;case 0:return V4(t,e,e.type,e.pendingProps,n);case 1:return r=e.type,i=Qc(r,e.pendingProps),E6(t,e,r,i,n);case 3:e:{if($p(e,e.stateNode.containerInfo),t===null)throw Error(he(387));r=e.pendingProps;var s=e.memoizedState;i=s.element,L4(t,e),cf(e,r,null,n);var a=e.memoizedState;if(r=a.cache,ll(e,gr,r),r!==s.cache&&O4(e,[gr],n,!0),lf(),r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){e=A6(t,e,r,n);break e}else if(r!==i){i=Ns(Error(he(424)),e),jf(i),e=A6(t,e,r,n);break e}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(On=zs(t.firstChild),Yr=e,Yt=!0,Tl=null,Ds=!0,n=_C(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Wc(),r===i){e=Oo(t,e,n);break e}Vr(t,e,r,n)}e=e.child}return e;case 26:return pp(t,e),t===null?(n=Y6(e.type,null,e.pendingProps,null))?e.memoizedState=n:Yt||(n=e.type,t=e.pendingProps,r=lg(Sl.current).createElement(n),r[Kr]=e,r[zi]=t,Jr(r,n,t),$r(r),e.stateNode=r):e.memoizedState=Y6(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return x4(e),t===null&&Yt&&(r=e.stateNode=iA(e.type,e.pendingProps,Sl.current),Yr=e,Ds=!0,i=On,Ql(e.type)?(ax=i,On=zs(r.firstChild)):On=i),Vr(t,e,e.pendingProps.children,n),pp(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Yt&&((i=r=On)&&(r=ZB(r,e.type,e.pendingProps,Ds),r!==null?(e.stateNode=r,Yr=e,On=zs(r.firstChild),Ds=!1,i=!0):i=!1),i||Ll(e)),x4(e),i=e.type,s=e.pendingProps,a=t!==null?t.memoizedProps:null,r=s.children,nx(i,s)?r=null:a!==null&&nx(i,a)&&(e.flags|=32),e.memoizedState!==null&&(i=Lw(t,e,mB,null,null,n),Uf._currentValue=i),pp(t,e),Vr(t,e,r,n),e.child;case 6:return t===null&&Yt&&((t=n=On)&&(n=ez(n,e.pendingProps,Ds),n!==null?(e.stateNode=n,Yr=e,On=null,t=!0):t=!1),t||Ll(e)),null;case 13:return hE(t,e,n);case 4:return $p(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Yc(e,null,r,n):Vr(t,e,r,n),e.child;case 11:return k6(t,e,e.type,e.pendingProps,n);case 7:return Vr(t,e,e.pendingProps,n),e.child;case 8:return Vr(t,e,e.pendingProps.children,n),e.child;case 12:return Vr(t,e,e.pendingProps.children,n),e.child;case 10:return r=e.pendingProps,ll(e,e.type,r.value),Vr(t,e,r.children,n),e.child;case 9:return i=e.type._context,r=e.pendingProps.children,Kc(e),i=Xr(i),r=r(i),e.flags|=1,Vr(t,e,r,n),e.child;case 14:return _6(t,e,e.type,e.pendingProps,n);case 15:return uE(t,e,e.type,e.pendingProps,n);case 19:return fE(t,e,n);case 31:return kB(t,e,n);case 22:return dE(t,e,n,e.pendingProps);case 24:return Kc(e),r=Xr(gr),t===null?(i=Dw(),i===null&&(i=Sn,s=Nw(),i.pooledCache=s,s.refCount++,s!==null&&(i.pooledCacheLanes|=n),i=s),e.memoizedState={parent:r,cache:i},Rw(e),ll(e,gr,i)):(t.lanes&n&&(L4(t,e),cf(e,null,null,n),lf()),i=t.memoizedState,s=e.memoizedState,i.parent!==r?(i={parent:r,cache:r},e.memoizedState=i,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=i),ll(e,gr,r)):(r=s.cache,ll(e,gr,r),r!==i.cache&&O4(e,[gr],n,!0))),Vr(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(he(156,e.tag))}function ro(t){t.flags|=4}function ub(t,e,n,r,i){if((e=(t.mode&32)!==0)&&(e=!1),e){if(t.flags|=16777216,(i&335544128)===i)if(t.stateNode.complete)t.flags|=8192;else if(zE())t.flags|=8192;else throw Pc=Kp,Iw}else t.flags&=-16777217}function N6(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!oA(e))if(zE())t.flags|=8192;else throw Pc=Kp,Iw}function lm(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?P9():536870912,t.lanes|=e,Sd|=e)}function kh(t,e){if(!Yt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Rn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function SB(t,e,n){var r=e.pendingProps;switch(Mw(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rn(e),null;case 1:return Rn(e),null;case 3:return n=e.stateNode,r=null,t!==null&&(r=t.memoizedState.cache),e.memoizedState.cache!==r&&(e.flags|=2048),Co(gr),bd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Tu(e)?ro(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,tb())),Rn(e),null;case 26:var i=e.type,s=e.memoizedState;return t===null?(ro(e),s!==null?(Rn(e),N6(e,s)):(Rn(e),ub(e,i,null,r,n))):s?s!==t.memoizedState?(ro(e),Rn(e),N6(e,s)):(Rn(e),e.flags&=-16777217):(t=t.memoizedProps,t!==r&&ro(e),Rn(e),ub(e,i,t,r,n)),null;case 27:if(Up(e),n=Sl.current,i=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&ro(e);else{if(!r){if(e.stateNode===null)throw Error(he(166));return Rn(e),null}t=Ba.current,Tu(e)?s6(e):(t=iA(i,r,n),e.stateNode=t,ro(e))}return Rn(e),null;case 5:if(Up(e),i=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&ro(e);else{if(!r){if(e.stateNode===null)throw Error(he(166));return Rn(e),null}if(s=Ba.current,Tu(e))s6(e);else{var a=lg(Sl.current);switch(s){case 1:s=a.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:s=a.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":s=a.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":s=a.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":s=a.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof r.is=="string"?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?s.multiple=!0:r.size&&(s.size=r.size);break;default:s=typeof r.is=="string"?a.createElement(i,{is:r.is}):a.createElement(i)}}s[Kr]=e,s[zi]=r;e:for(a=e.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===e)break e;for(;a.sibling===null;){if(a.return===null||a.return===e)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}e.stateNode=s;e:switch(Jr(s,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ro(e)}}return Rn(e),ub(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==r&&ro(e);else{if(typeof r!="string"&&e.stateNode===null)throw Error(he(166));if(t=Sl.current,Tu(e)){if(t=e.stateNode,n=e.memoizedProps,r=null,i=Yr,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}t[Kr]=e,t=!!(t.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||eA(t.nodeValue,n)),t||Ll(e,!0)}else t=lg(t).createTextNode(r),t[Kr]=e,e.stateNode=t}return Rn(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(r=Tu(e),n!==null){if(t===null){if(!r)throw Error(he(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(he(557));t[Kr]=e}else Wc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Rn(e),t=!1}else n=tb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(Xi(e),e):(Xi(e),null);if(e.flags&128)throw Error(he(558))}return Rn(e),null;case 13:if(r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(i=Tu(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(he(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(he(317));i[Kr]=e}else Wc(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Rn(e),i=!1}else i=tb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),i=!0;if(!i)return e.flags&256?(Xi(e),e):(Xi(e),null)}return Xi(e),e.flags&128?(e.lanes=n,e):(n=r!==null,t=t!==null&&t.memoizedState!==null,n&&(r=e.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==i&&(r.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),lm(e,e.updateQueue),Rn(e),null);case 4:return bd(),t===null&&n3(e.stateNode.containerInfo),Rn(e),null;case 10:return Co(e.type),Rn(e),null;case 19:if(qr(ar),r=e.memoizedState,r===null)return Rn(e),null;if(i=(e.flags&128)!==0,s=r.rendering,s===null)if(i)kh(r,!1);else{if(er!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=Xp(t),s!==null){for(e.flags|=128,kh(r,!1),t=s.updateQueue,e.updateQueue=t,lm(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)pC(n,t),n=n.sibling;return Nn(ar,ar.current&1|2),Yt&&ho(e,r.treeForkCount),e.child}t=t.sibling}r.tail!==null&&rs()>ng&&(e.flags|=128,i=!0,kh(r,!1),e.lanes=4194304)}else{if(!i)if(t=Xp(s),t!==null){if(e.flags|=128,i=!0,t=t.updateQueue,e.updateQueue=t,lm(e,t),kh(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!Yt)return Rn(e),null}else 2*rs()-r.renderingStartTime>ng&&n!==536870912&&(e.flags|=128,i=!0,kh(r,!1),e.lanes=4194304);r.isBackwards?(s.sibling=e.child,e.child=s):(t=r.last,t!==null?t.sibling=s:e.child=s,r.last=s)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=rs(),t.sibling=null,n=ar.current,Nn(ar,i?n&1|2:n&1),Yt&&ho(e,r.treeForkCount),t):(Rn(e),null);case 22:case 23:return Xi(e),Ow(),r=e.memoizedState!==null,t!==null?t.memoizedState!==null!==r&&(e.flags|=8192):r&&(e.flags|=8192),r?n&536870912&&!(e.flags&128)&&(Rn(e),e.subtreeFlags&6&&(e.flags|=8192)):Rn(e),n=e.updateQueue,n!==null&&lm(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),r=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),r!==n&&(e.flags|=2048),t!==null&&qr(zc),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),Co(gr),Rn(e),null;case 25:return null;case 30:return null}throw Error(he(156,e.tag))}function TB(t,e){switch(Mw(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(gr),bd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return Up(e),null;case 31:if(e.memoizedState!==null){if(Xi(e),e.alternate===null)throw Error(he(340));Wc()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Xi(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(he(340));Wc()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return qr(ar),null;case 4:return bd(),null;case 10:return Co(e.type),null;case 22:case 23:return Xi(e),Ow(),t!==null&&qr(zc),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return Co(gr),null;case 25:return null;default:return null}}function pE(t,e){switch(Mw(e),e.tag){case 3:Co(gr),bd();break;case 26:case 27:case 5:Up(e);break;case 4:bd();break;case 31:e.memoizedState!==null&&Xi(e);break;case 13:Xi(e);break;case 19:qr(ar);break;case 10:Co(e.type);break;case 22:case 23:Xi(e),Ow(),t!==null&&qr(zc);break;case 24:Co(gr)}}function k0(t,e){try{var n=e.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&t)===t){r=void 0;var s=n.create,a=n.inst;r=s(),a.destroy=r}n=n.next}while(n!==i)}}catch(o){yn(e,e.return,o)}}function Bl(t,e,n){try{var r=e.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var s=i.next;r=s;do{if((r.tag&t)===t){var a=r.inst,o=a.destroy;if(o!==void 0){a.destroy=void 0,i=e;var l=n,c=o;try{c()}catch(u){yn(i,l,u)}}}r=r.next}while(r!==s)}}catch(u){yn(e,e.return,u)}}function gE(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{TC(e,n)}catch(r){yn(t,t.return,r)}}}function yE(t,e,n){n.props=Qc(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(r){yn(t,e,r)}}function df(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var r=t.stateNode;break;case 30:r=t.stateNode;break;default:r=t.stateNode}typeof n=="function"?t.refCleanup=n(r):n.current=r}}catch(i){yn(t,e,i)}}function Ia(t,e){var n=t.ref,r=t.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){yn(t,e,i)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){yn(t,e,i)}else n.current=null}function bE(t){var e=t.type,n=t.memoizedProps,r=t.stateNode;try{e:switch(e){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(i){yn(t,t.return,i)}}function db(t,e,n){try{var r=t.stateNode;WB(r,t.type,n,e),r[zi]=e}catch(i){yn(t,t.return,i)}}function vE(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ql(t.type)||t.tag===4}function hb(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||vE(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ql(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function W4(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(t),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=xo));else if(r!==4&&(r===27&&Ql(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(W4(t,e,n),t=t.sibling;t!==null;)W4(t,e,n),t=t.sibling}function tg(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(r===27&&Ql(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(tg(t,e,n),t=t.sibling;t!==null;)tg(t,e,n),t=t.sibling}function xE(t){var e=t.stateNode,n=t.memoizedProps;try{for(var r=t.type,i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Jr(e,r,n),e[Kr]=t,e[zi]=n}catch(s){yn(t,t.return,s)}}var po=!1,pr=!1,fb=!1,D6=typeof WeakSet=="function"?WeakSet:Set,Pr=null;function CB(t,e){if(t=t.containerInfo,ex=hg,t=oC(t),Sw(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,l=-1,c=0,u=0,d=t,h=null;t:for(;;){for(var m;d!==n||i!==0&&d.nodeType!==3||(o=a+i),d!==s||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(m=d.firstChild)!==null;)h=d,d=m;for(;;){if(d===t)break t;if(h===n&&++c===i&&(o=a),h===s&&++u===r&&(l=a),(m=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=m}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(tx={focusedElem:t,selectionRange:n},hg=!1,Pr=e;Pr!==null;)if(e=Pr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Pr=t;else for(;Pr!==null;){switch(e=Pr,s=e.alternate,t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(n=0;n<t.length;n++)i=t[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(t&1024&&s!==null){t=void 0,n=e,i=s.memoizedProps,s=s.memoizedState,r=n.stateNode;try{var p=Qc(n.type,i);t=r.getSnapshotBeforeUpdate(p,s),r.__reactInternalSnapshotBeforeUpdate=t}catch(b){yn(n,n.return,b)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,n=t.nodeType,n===9)rx(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":rx(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(he(163))}if(t=e.sibling,t!==null){t.return=e.return,Pr=t;break}Pr=e.return}}function wE(t,e,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:so(t,n),r&4&&k0(5,n);break;case 1:if(so(t,n),r&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(a){yn(n,n.return,a)}else{var i=Qc(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(i,e,t.__reactInternalSnapshotBeforeUpdate)}catch(a){yn(n,n.return,a)}}r&64&&gE(n),r&512&&df(n,n.return);break;case 3:if(so(t,n),r&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{TC(t,e)}catch(a){yn(n,n.return,a)}}break;case 27:e===null&&r&4&&xE(n);case 26:case 5:so(t,n),e===null&&r&4&&bE(n),r&512&&df(n,n.return);break;case 12:so(t,n);break;case 31:so(t,n),r&4&&SE(t,n);break;case 13:so(t,n),r&4&&TE(t,n),r&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=jB.bind(null,n),tz(t,n))));break;case 22:if(r=n.memoizedState!==null||po,!r){e=e!==null&&e.memoizedState!==null||pr,i=po;var s=pr;po=r,(pr=e)&&!s?uo(t,n,(n.subtreeFlags&8772)!==0):so(t,n),po=i,pr=s}break;case 30:break;default:so(t,n)}}function kE(t){var e=t.alternate;e!==null&&(t.alternate=null,kE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&bw(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var $n=null,Mi=!1;function io(t,e,n){for(n=n.child;n!==null;)_E(t,e,n),n=n.sibling}function _E(t,e,n){if(is&&typeof is.onCommitFiberUnmount=="function")try{is.onCommitFiberUnmount(p0,n)}catch{}switch(n.tag){case 26:pr||Ia(n,e),io(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:pr||Ia(n,e);var r=$n,i=Mi;Ql(n.type)&&($n=n.stateNode,Mi=!1),io(t,e,n),pf(n.stateNode),$n=r,Mi=i;break;case 5:pr||Ia(n,e);case 6:if(r=$n,i=Mi,$n=null,io(t,e,n),$n=r,Mi=i,$n!==null)if(Mi)try{($n.nodeType===9?$n.body:$n.nodeName==="HTML"?$n.ownerDocument.body:$n).removeChild(n.stateNode)}catch(s){yn(n,e,s)}else try{$n.removeChild(n.stateNode)}catch(s){yn(n,e,s)}break;case 18:$n!==null&&(Mi?(t=$n,F6(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),Ad(t)):F6($n,n.stateNode));break;case 4:r=$n,i=Mi,$n=n.stateNode.containerInfo,Mi=!0,io(t,e,n),$n=r,Mi=i;break;case 0:case 11:case 14:case 15:Bl(2,n,e),pr||Bl(4,n,e),io(t,e,n);break;case 1:pr||(Ia(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"&&yE(n,e,r)),io(t,e,n);break;case 21:io(t,e,n);break;case 22:pr=(r=pr)||n.memoizedState!==null,io(t,e,n),pr=r;break;default:io(t,e,n)}}function SE(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ad(t)}catch(n){yn(e,e.return,n)}}}function TE(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ad(t)}catch(n){yn(e,e.return,n)}}function EB(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new D6),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new D6),e;default:throw Error(he(435,t.tag))}}function cm(t,e){var n=EB(t);e.forEach(function(r){if(!n.has(r)){n.add(r);var i=LB.bind(null,t,r);r.then(i,i)}})}function Ti(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],s=t,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 27:if(Ql(o.type)){$n=o.stateNode,Mi=!1;break e}break;case 5:$n=o.stateNode,Mi=!1;break e;case 3:case 4:$n=o.stateNode.containerInfo,Mi=!0;break e}o=o.return}if($n===null)throw Error(he(160));_E(s,a,i),$n=null,Mi=!1,s=i.alternate,s!==null&&(s.return=null),i.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)CE(e,t),e=e.sibling}var ta=null;function CE(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ti(e,t),Ci(t),r&4&&(Bl(3,t,t.return),k0(3,t),Bl(5,t,t.return));break;case 1:Ti(e,t),Ci(t),r&512&&(pr||n===null||Ia(n,n.return)),r&64&&po&&(t=t.updateQueue,t!==null&&(r=t.callbacks,r!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=ta;if(Ti(e,t),Ci(t),r&512&&(pr||n===null||Ia(n,n.return)),r&4){var s=n!==null?n.memoizedState:null;if(r=t.memoizedState,n===null)if(r===null)if(t.stateNode===null){e:{r=t.type,n=t.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":s=i.getElementsByTagName("title")[0],(!s||s[b0]||s[Kr]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=i.createElement(r),i.head.insertBefore(s,i.querySelector("head > title"))),Jr(s,r,n),s[Kr]=t,$r(s),r=s;break e;case"link":var a=Q6("link","href",i).get(r+(n.href||""));if(a){for(var o=0;o<a.length;o++)if(s=a[o],s.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(o,1);break t}}s=i.createElement(r),Jr(s,r,n),i.head.appendChild(s);break;case"meta":if(a=Q6("meta","content",i).get(r+(n.content||""))){for(o=0;o<a.length;o++)if(s=a[o],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){a.splice(o,1);break t}}s=i.createElement(r),Jr(s,r,n),i.head.appendChild(s);break;default:throw Error(he(468,r))}s[Kr]=t,$r(s),r=s}t.stateNode=r}else J6(i,t.type,t.stateNode);else t.stateNode=X6(i,r,t.memoizedProps);else s!==r?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,r===null?J6(i,t.type,t.stateNode):X6(i,r,t.memoizedProps)):r===null&&t.stateNode!==null&&db(t,t.memoizedProps,n.memoizedProps)}break;case 27:Ti(e,t),Ci(t),r&512&&(pr||n===null||Ia(n,n.return)),n!==null&&r&4&&db(t,t.memoizedProps,n.memoizedProps);break;case 5:if(Ti(e,t),Ci(t),r&512&&(pr||n===null||Ia(n,n.return)),t.flags&32){i=t.stateNode;try{xd(i,"")}catch(p){yn(t,t.return,p)}}r&4&&t.stateNode!=null&&(i=t.memoizedProps,db(t,i,n!==null?n.memoizedProps:i)),r&1024&&(fb=!0);break;case 6:if(Ti(e,t),Ci(t),r&4){if(t.stateNode===null)throw Error(he(162));r=t.memoizedProps,n=t.stateNode;try{n.nodeValue=r}catch(p){yn(t,t.return,p)}}break;case 3:if(bp=null,i=ta,ta=cg(e.containerInfo),Ti(e,t),ta=i,Ci(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ad(e.containerInfo)}catch(p){yn(t,t.return,p)}fb&&(fb=!1,EE(t));break;case 4:r=ta,ta=cg(t.stateNode.containerInfo),Ti(e,t),Ci(t),ta=r;break;case 12:Ti(e,t),Ci(t);break;case 31:Ti(e,t),Ci(t),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,cm(t,r)));break;case 13:Ti(e,t),Ci(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(_1=rs()),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,cm(t,r)));break;case 22:i=t.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=po,u=pr;if(po=c||i,pr=u||l,Ti(e,t),pr=u,po=c,Ci(t),r&8192)e:for(e=t.stateNode,e._visibility=i?e._visibility&-2:e._visibility|1,i&&(n===null||l||po||pr||xc(t)),n=null,e=t;;){if(e.tag===5||e.tag===26){if(n===null){l=n=e;try{if(s=l.stateNode,i)a=s.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none";else{o=l.stateNode;var d=l.memoizedProps.style,h=d!=null&&d.hasOwnProperty("display")?d.display:null;o.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(p){yn(l,l.return,p)}}}else if(e.tag===6){if(n===null){l=e;try{l.stateNode.nodeValue=i?"":l.memoizedProps}catch(p){yn(l,l.return,p)}}}else if(e.tag===18){if(n===null){l=e;try{var m=l.stateNode;i?V6(m,!0):V6(l.stateNode,!1)}catch(p){yn(l,l.return,p)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&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;n===e&&(n=null),e=e.return}n===e&&(n=null),e.sibling.return=e.return,e=e.sibling}r&4&&(r=t.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,cm(t,n))));break;case 19:Ti(e,t),Ci(t),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,cm(t,r)));break;case 30:break;case 21:break;default:Ti(e,t),Ci(t)}}function Ci(t){var e=t.flags;if(e&2){try{for(var n,r=t.return;r!==null;){if(vE(r)){n=r;break}r=r.return}if(n==null)throw Error(he(160));switch(n.tag){case 27:var i=n.stateNode,s=hb(t);tg(t,s,i);break;case 5:var a=n.stateNode;n.flags&32&&(xd(a,""),n.flags&=-33);var o=hb(t);tg(t,o,a);break;case 3:case 4:var l=n.stateNode.containerInfo,c=hb(t);W4(t,c,l);break;default:throw Error(he(161))}}catch(u){yn(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function EE(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;EE(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function so(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)wE(t,e.alternate,e),e=e.sibling}function xc(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:Bl(4,e,e.return),xc(e);break;case 1:Ia(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&yE(e,e.return,n),xc(e);break;case 27:pf(e.stateNode);case 26:case 5:Ia(e,e.return),xc(e);break;case 22:e.memoizedState===null&&xc(e);break;case 30:xc(e);break;default:xc(e)}t=t.sibling}}function uo(t,e,n){for(n=n&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var r=e.alternate,i=t,s=e,a=s.flags;switch(s.tag){case 0:case 11:case 15:uo(i,s,n),k0(4,s);break;case 1:if(uo(i,s,n),r=s,i=r.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(c){yn(r,r.return,c)}if(r=s,i=r.updateQueue,i!==null){var o=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)SC(l[i],o)}catch(c){yn(r,r.return,c)}}n&&a&64&&gE(s),df(s,s.return);break;case 27:xE(s);case 26:case 5:uo(i,s,n),n&&r===null&&a&4&&bE(s),df(s,s.return);break;case 12:uo(i,s,n);break;case 31:uo(i,s,n),n&&a&4&&SE(i,s);break;case 13:uo(i,s,n),n&&a&4&&TE(i,s);break;case 22:s.memoizedState===null&&uo(i,s,n),df(s,s.return);break;case 30:break;default:uo(i,s,n)}e=e.sibling}}function Xw(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&x0(n))}function Qw(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&x0(t))}function Qs(t,e,n,r){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)AE(t,e,n,r),e=e.sibling}function AE(t,e,n,r){var i=e.flags;switch(e.tag){case 0:case 11:case 15:Qs(t,e,n,r),i&2048&&k0(9,e);break;case 1:Qs(t,e,n,r);break;case 3:Qs(t,e,n,r),i&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&x0(t)));break;case 12:if(i&2048){Qs(t,e,n,r),t=e.stateNode;try{var s=e.memoizedProps,a=s.id,o=s.onPostCommit;typeof o=="function"&&o(a,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(l){yn(e,e.return,l)}}else Qs(t,e,n,r);break;case 31:Qs(t,e,n,r);break;case 13:Qs(t,e,n,r);break;case 23:break;case 22:s=e.stateNode,a=e.alternate,e.memoizedState!==null?s._visibility&2?Qs(t,e,n,r):hf(t,e):s._visibility&2?Qs(t,e,n,r):(s._visibility|=2,Iu(t,e,n,r,(e.subtreeFlags&10256)!==0||!1)),i&2048&&Xw(a,e);break;case 24:Qs(t,e,n,r),i&2048&&Qw(e.alternate,e);break;default:Qs(t,e,n,r)}}function Iu(t,e,n,r,i){for(i=i&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var s=t,a=e,o=n,l=r,c=a.flags;switch(a.tag){case 0:case 11:case 15:Iu(s,a,o,l,i),k0(8,a);break;case 23:break;case 22:var u=a.stateNode;a.memoizedState!==null?u._visibility&2?Iu(s,a,o,l,i):hf(s,a):(u._visibility|=2,Iu(s,a,o,l,i)),i&&c&2048&&Xw(a.alternate,a);break;case 24:Iu(s,a,o,l,i),i&&c&2048&&Qw(a.alternate,a);break;default:Iu(s,a,o,l,i)}e=e.sibling}}function hf(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,r=e,i=r.flags;switch(r.tag){case 22:hf(n,r),i&2048&&Xw(r.alternate,r);break;case 24:hf(n,r),i&2048&&Qw(r.alternate,r);break;default:hf(n,r)}e=e.sibling}}var Vh=8192;function Cu(t,e,n){if(t.subtreeFlags&Vh)for(t=t.child;t!==null;)ME(t,e,n),t=t.sibling}function ME(t,e,n){switch(t.tag){case 26:Cu(t,e,n),t.flags&Vh&&t.memoizedState!==null&&fz(n,ta,t.memoizedState,t.memoizedProps);break;case 5:Cu(t,e,n);break;case 3:case 4:var r=ta;ta=cg(t.stateNode.containerInfo),Cu(t,e,n),ta=r;break;case 22:t.memoizedState===null&&(r=t.alternate,r!==null&&r.memoizedState!==null?(r=Vh,Vh=16777216,Cu(t,e,n),Vh=r):Cu(t,e,n));break;default:Cu(t,e,n)}}function NE(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function _h(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];Pr=r,IE(r,t)}NE(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)DE(t),t=t.sibling}function DE(t){switch(t.tag){case 0:case 11:case 15:_h(t),t.flags&2048&&Bl(9,t,t.return);break;case 3:_h(t);break;case 12:_h(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,gp(t)):_h(t);break;default:_h(t)}}function gp(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];Pr=r,IE(r,t)}NE(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:Bl(8,e,e.return),gp(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,gp(e));break;default:gp(e)}t=t.sibling}}function IE(t,e){for(;Pr!==null;){var n=Pr;switch(n.tag){case 0:case 11:case 15:Bl(8,n,e);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:x0(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Pr=r;else e:for(n=t;Pr!==null;){r=Pr;var i=r.sibling,s=r.return;if(kE(r),r===n){Pr=null;break e}if(i!==null){i.return=s,Pr=i;break e}Pr=s}}}var AB={getCacheForType:function(t){var e=Xr(gr),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return Xr(gr).controller.signal}},MB=typeof WeakMap=="function"?WeakMap:Map,ln=0,Sn=null,Ft=null,Kt=0,pn=0,Ki=null,pl=!1,Xd=!1,Jw=!1,jo=0,er=0,zl=0,$c=0,Zw=0,ts=0,Sd=0,ff=null,Ni=null,K4=!1,_1=0,RE=0,ng=1/0,rg=null,Al=null,Ar=0,Ml=null,Td=null,Eo=0,Y4=0,X4=null,OE=null,mf=0,Q4=null;function as(){return ln&2&&Kt!==0?Kt&-Kt:_t.T!==null?t3():q9()}function jE(){if(ts===0)if(!(Kt&536870912)||Yt){var t=tm;tm<<=1,!(tm&3932160)&&(tm=262144),ts=t}else ts=536870912;return t=us.current,t!==null&&(t.flags|=32),ts}function Li(t,e,n){(t===Sn&&(pn===2||pn===9)||t.cancelPendingCommit!==null)&&(Cd(t,0),gl(t,Kt,ts,!1)),y0(t,n),(!(ln&2)||t!==Sn)&&(t===Sn&&(!(ln&2)&&($c|=n),er===4&&gl(t,Kt,ts,!1)),Ha(t))}function LE(t,e,n){if(ln&6)throw Error(he(327));var r=!n&&(e&127)===0&&(e&t.expiredLanes)===0||g0(t,e),i=r?IB(t,e):mb(t,e,!0),s=r;do{if(i===0){Xd&&!r&&gl(t,e,0,!1);break}else{if(n=t.current.alternate,s&&!NB(n)){i=mb(t,e,!1),s=!1;continue}if(i===2){if(s=e,t.errorRecoveryDisabledLanes&s)var a=0;else a=t.pendingLanes&-536870913,a=a!==0?a:a&536870912?536870912:0;if(a!==0){e=a;e:{var o=t;i=ff;var l=o.current.memoizedState.isDehydrated;if(l&&(Cd(o,a).flags|=256),a=mb(o,a,!1),a!==2){if(Jw&&!l){o.errorRecoveryDisabledLanes|=s,$c|=s,i=4;break e}s=Ni,Ni=i,s!==null&&(Ni===null?Ni=s:Ni.push.apply(Ni,s))}i=a}if(s=!1,i!==2)continue}}if(i===1){Cd(t,0),gl(t,e,0,!0);break}e:{switch(r=t,s=i,s){case 0:case 1:throw Error(he(345));case 4:if((e&4194048)!==e)break;case 6:gl(r,e,ts,!pl);break e;case 2:Ni=null;break;case 3:case 5:break;default:throw Error(he(329))}if((e&62914560)===e&&(i=_1+300-rs(),10<i)){if(gl(r,e,ts,!pl),h1(r,0,!0)!==0)break e;Eo=e,r.timeoutHandle=nA(I6.bind(null,r,n,Ni,rg,K4,e,ts,$c,Sd,pl,s,"Throttled",-0,0),i);break e}I6(r,n,Ni,rg,K4,e,ts,$c,Sd,pl,s,null,-0,0)}}break}while(!0);Ha(t)}function I6(t,e,n,r,i,s,a,o,l,c,u,d,h,m){if(t.timeoutHandle=-1,d=e.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xo},ME(e,s,d);var p=(s&62914560)===s?_1-rs():(s&4194048)===s?RE-rs():0;if(p=mz(d,p),p!==null){Eo=s,t.cancelPendingCommit=p(O6.bind(null,t,e,s,n,r,i,a,o,l,u,d,null,h,m)),gl(t,s,a,!c);return}}O6(t,e,s,n,r,i,a,o,l)}function NB(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!cs(s(),i))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function gl(t,e,n,r){e&=~Zw,e&=~$c,t.suspendedLanes|=e,t.pingedLanes&=~e,r&&(t.warmLanes|=e),r=t.expirationTimes;for(var i=e;0<i;){var s=31-ss(i),a=1<<s;r[s]=-1,i&=~a}n!==0&&$9(t,n,e)}function S1(){return ln&6?!0:(_0(0),!1)}function e3(){if(Ft!==null){if(pn===0)var t=Ft.return;else t=Ft,wo=ou=null,Pw(t),od=null,Lf=0,t=Ft;for(;t!==null;)pE(t.alternate,t),t=t.return;Ft=null}}function Cd(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,XB(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Eo=0,e3(),Sn=t,Ft=n=To(t.current,null),Kt=e,pn=0,Ki=null,pl=!1,Xd=g0(t,e),Jw=!1,Sd=ts=Zw=$c=zl=er=0,Ni=ff=null,K4=!1,e&8&&(e|=e&32);var r=t.entangledLanes;if(r!==0)for(t=t.entanglements,r&=e;0<r;){var i=31-ss(r),s=1<<i;e|=t[i],r&=~s}return jo=e,g1(),n}function BE(t,e){Lt=null,_t.H=zf,e===Yd||e===b1?(e=u6(),pn=3):e===Iw?(e=u6(),pn=4):pn=e===Kw?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Ki=e,Ft===null&&(er=1,Zp(t,Ns(e,t.current)))}function zE(){var t=us.current;return t===null?!0:(Kt&4194048)===Kt?Bs===null:(Kt&62914560)===Kt||Kt&536870912?t===Bs:!1}function PE(){var t=_t.H;return _t.H=zf,t===null?zf:t}function $E(){var t=_t.A;return _t.A=AB,t}function ig(){er=4,pl||(Kt&4194048)!==Kt&&us.current!==null||(Xd=!0),!(zl&134217727)&&!($c&134217727)||Sn===null||gl(Sn,Kt,ts,!1)}function mb(t,e,n){var r=ln;ln|=2;var i=PE(),s=$E();(Sn!==t||Kt!==e)&&(rg=null,Cd(t,e)),e=!1;var a=er;e:do try{if(pn!==0&&Ft!==null){var o=Ft,l=Ki;switch(pn){case 8:e3(),a=6;break e;case 3:case 2:case 9:case 6:us.current===null&&(e=!0);var c=pn;if(pn=0,Ki=null,Yu(t,o,l,c),n&&Xd){a=0;break e}break;default:c=pn,pn=0,Ki=null,Yu(t,o,l,c)}}DB(),a=er;break}catch(u){BE(t,u)}while(!0);return e&&t.shellSuspendCounter++,wo=ou=null,ln=r,_t.H=i,_t.A=s,Ft===null&&(Sn=null,Kt=0,g1()),a}function DB(){for(;Ft!==null;)UE(Ft)}function IB(t,e){var n=ln;ln|=2;var r=PE(),i=$E();Sn!==t||Kt!==e?(rg=null,ng=rs()+500,Cd(t,e)):Xd=g0(t,e);e:do try{if(pn!==0&&Ft!==null){e=Ft;var s=Ki;t:switch(pn){case 1:pn=0,Ki=null,Yu(t,e,s,1);break;case 2:case 9:if(c6(s)){pn=0,Ki=null,R6(e);break}e=function(){pn!==2&&pn!==9||Sn!==t||(pn=7),Ha(t)},s.then(e,e);break e;case 3:pn=7;break e;case 4:pn=5;break e;case 7:c6(s)?(pn=0,Ki=null,R6(e)):(pn=0,Ki=null,Yu(t,e,s,7));break;case 5:var a=null;switch(Ft.tag){case 26:a=Ft.memoizedState;case 5:case 27:var o=Ft;if(a?oA(a):o.stateNode.complete){pn=0,Ki=null;var l=o.sibling;if(l!==null)Ft=l;else{var c=o.return;c!==null?(Ft=c,T1(c)):Ft=null}break t}}pn=0,Ki=null,Yu(t,e,s,5);break;case 6:pn=0,Ki=null,Yu(t,e,s,6);break;case 8:e3(),er=6;break e;default:throw Error(he(462))}}RB();break}catch(u){BE(t,u)}while(!0);return wo=ou=null,_t.H=r,_t.A=i,ln=n,Ft!==null?0:(Sn=null,Kt=0,g1(),er)}function RB(){for(;Ft!==null&&!nL();)UE(Ft)}function UE(t){var e=mE(t.alternate,t,jo);t.memoizedProps=t.pendingProps,e===null?T1(t):Ft=e}function R6(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=C6(n,e,e.pendingProps,e.type,void 0,Kt);break;case 11:e=C6(n,e,e.pendingProps,e.type.render,e.ref,Kt);break;case 5:Pw(e);default:pE(n,e),e=Ft=pC(e,jo),e=mE(n,e,jo)}t.memoizedProps=t.pendingProps,e===null?T1(t):Ft=e}function Yu(t,e,n,r){wo=ou=null,Pw(e),od=null,Lf=0;var i=e.return;try{if(wB(t,i,e,n,Kt)){er=1,Zp(t,Ns(n,t.current)),Ft=null;return}}catch(s){if(i!==null)throw Ft=i,s;er=1,Zp(t,Ns(n,t.current)),Ft=null;return}e.flags&32768?(Yt||r===1?t=!0:Xd||Kt&536870912?t=!1:(pl=t=!0,(r===2||r===9||r===3||r===6)&&(r=us.current,r!==null&&r.tag===13&&(r.flags|=16384))),HE(e,t)):T1(e)}function T1(t){var e=t;do{if(e.flags&32768){HE(e,pl);return}t=e.return;var n=SB(e.alternate,e,jo);if(n!==null){Ft=n;return}if(e=e.sibling,e!==null){Ft=e;return}Ft=e=t}while(e!==null);er===0&&(er=5)}function HE(t,e){do{var n=TB(t.alternate,t);if(n!==null){n.flags&=32767,Ft=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){Ft=t;return}Ft=t=n}while(t!==null);er=6,Ft=null}function O6(t,e,n,r,i,s,a,o,l){t.cancelPendingCommit=null;do C1();while(Ar!==0);if(ln&6)throw Error(he(327));if(e!==null){if(e===t.current)throw Error(he(177));if(s=e.lanes|e.childLanes,s|=Tw,hL(t,n,s,a,o,l),t===Sn&&(Ft=Sn=null,Kt=0),Td=e,Ml=t,Eo=n,Y4=s,X4=i,OE=r,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,BB(Hp,function(){return WE(),null})):(t.callbackNode=null,t.callbackPriority=0),r=(e.flags&13878)!==0,e.subtreeFlags&13878||r){r=_t.T,_t.T=null,i=un.p,un.p=2,a=ln,ln|=4;try{CB(t,e,n)}finally{ln=a,un.p=i,_t.T=r}}Ar=1,qE(),FE(),VE()}}function qE(){if(Ar===1){Ar=0;var t=Ml,e=Td,n=(e.flags&13878)!==0;if(e.subtreeFlags&13878||n){n=_t.T,_t.T=null;var r=un.p;un.p=2;var i=ln;ln|=4;try{CE(e,t);var s=tx,a=oC(t.containerInfo),o=s.focusedElem,l=s.selectionRange;if(a!==o&&o&&o.ownerDocument&&aC(o.ownerDocument.documentElement,o)){if(l!==null&&Sw(o)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in o)o.selectionStart=c,o.selectionEnd=Math.min(u,o.value.length);else{var d=o.ownerDocument||document,h=d&&d.defaultView||window;if(h.getSelection){var m=h.getSelection(),p=o.textContent.length,b=Math.min(l.start,p),x=l.end===void 0?b:Math.min(l.end,p);!m.extend&&b>x&&(a=x,x=b,b=a);var g=n6(o,b),y=n6(o,x);if(g&&y&&(m.rangeCount!==1||m.anchorNode!==g.node||m.anchorOffset!==g.offset||m.focusNode!==y.node||m.focusOffset!==y.offset)){var w=d.createRange();w.setStart(g.node,g.offset),m.removeAllRanges(),b>x?(m.addRange(w),m.extend(y.node,y.offset)):(w.setEnd(y.node,y.offset),m.addRange(w))}}}}for(d=[],m=o;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<d.length;o++){var C=d[o];C.element.scrollLeft=C.left,C.element.scrollTop=C.top}}hg=!!ex,tx=ex=null}finally{ln=i,un.p=r,_t.T=n}}t.current=e,Ar=2}}function FE(){if(Ar===2){Ar=0;var t=Ml,e=Td,n=(e.flags&8772)!==0;if(e.subtreeFlags&8772||n){n=_t.T,_t.T=null;var r=un.p;un.p=2;var i=ln;ln|=4;try{wE(t,e.alternate,e)}finally{ln=i,un.p=r,_t.T=n}}Ar=3}}function VE(){if(Ar===4||Ar===3){Ar=0,rL();var t=Ml,e=Td,n=Eo,r=OE;e.subtreeFlags&10256||e.flags&10256?Ar=5:(Ar=0,Td=Ml=null,GE(t,t.pendingLanes));var i=t.pendingLanes;if(i===0&&(Al=null),yw(n),e=e.stateNode,is&&typeof is.onCommitFiberRoot=="function")try{is.onCommitFiberRoot(p0,e,void 0,(e.current.flags&128)===128)}catch{}if(r!==null){e=_t.T,i=un.p,un.p=2,_t.T=null;try{for(var s=t.onRecoverableError,a=0;a<r.length;a++){var o=r[a];s(o.value,{componentStack:o.stack})}}finally{_t.T=e,un.p=i}}Eo&3&&C1(),Ha(t),i=t.pendingLanes,n&261930&&i&42?t===Q4?mf++:(mf=0,Q4=t):mf=0,_0(0)}}function GE(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,x0(e)))}function C1(){return qE(),FE(),VE(),WE()}function WE(){if(Ar!==5)return!1;var t=Ml,e=Y4;Y4=0;var n=yw(Eo),r=_t.T,i=un.p;try{un.p=32>n?32:n,_t.T=null,n=X4,X4=null;var s=Ml,a=Eo;if(Ar=0,Td=Ml=null,Eo=0,ln&6)throw Error(he(331));var o=ln;if(ln|=4,DE(s.current),AE(s,s.current,a,n),ln=o,_0(0,!1),is&&typeof is.onPostCommitFiberRoot=="function")try{is.onPostCommitFiberRoot(p0,s)}catch{}return!0}finally{un.p=i,_t.T=r,GE(t,e)}}function j6(t,e,n){e=Ns(n,e),e=F4(t.stateNode,e,2),t=El(t,e,2),t!==null&&(y0(t,2),Ha(t))}function yn(t,e,n){if(t.tag===3)j6(t,t,n);else for(;e!==null;){if(e.tag===3){j6(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Al===null||!Al.has(r))){t=Ns(n,t),n=lE(2),r=El(e,n,2),r!==null&&(cE(n,r,e,t),y0(r,2),Ha(r));break}}e=e.return}}function pb(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new MB;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(Jw=!0,i.add(n),t=OB.bind(null,t,e,n),e.then(t,t))}function OB(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Sn===t&&(Kt&n)===n&&(er===4||er===3&&(Kt&62914560)===Kt&&300>rs()-_1?!(ln&2)&&Cd(t,0):Zw|=n,Sd===Kt&&(Sd=0)),Ha(t)}function KE(t,e){e===0&&(e=P9()),t=au(t,e),t!==null&&(y0(t,e),Ha(t))}function jB(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),KE(t,n)}function LB(t,e){var n=0;switch(t.tag){case 31:case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;case 22:r=t.stateNode._retryCache;break;default:throw Error(he(314))}r!==null&&r.delete(e),KE(t,n)}function BB(t,e){return pw(t,e)}var sg=null,Ru=null,J4=!1,ag=!1,gb=!1,yl=0;function Ha(t){t!==Ru&&t.next===null&&(Ru===null?sg=Ru=t:Ru=Ru.next=t),ag=!0,J4||(J4=!0,PB())}function _0(t,e){if(!gb&&ag){gb=!0;do for(var n=!1,r=sg;r!==null;){if(t!==0){var i=r.pendingLanes;if(i===0)var s=0;else{var a=r.suspendedLanes,o=r.pingedLanes;s=(1<<31-ss(42|t)+1)-1,s&=i&~(a&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,L6(r,s))}else s=Kt,s=h1(r,r===Sn?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(s&3)||g0(r,s)||(n=!0,L6(r,s));r=r.next}while(n);gb=!1}}function zB(){YE()}function YE(){ag=J4=!1;var t=0;yl!==0&&YB()&&(t=yl);for(var e=rs(),n=null,r=sg;r!==null;){var i=r.next,s=XE(r,e);s===0?(r.next=null,n===null?sg=i:n.next=i,i===null&&(Ru=n)):(n=r,(t!==0||s&3)&&(ag=!0)),r=i}Ar!==0&&Ar!==5||_0(t),yl!==0&&(yl=0)}function XE(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes&-62914561;0<s;){var a=31-ss(s),o=1<<a,l=i[a];l===-1?(!(o&n)||o&r)&&(i[a]=dL(o,e)):l<=e&&(t.expiredLanes|=o),s&=~o}if(e=Sn,n=Kt,n=h1(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r=t.callbackNode,n===0||t===e&&(pn===2||pn===9)||t.cancelPendingCommit!==null)return r!==null&&r!==null&&Fy(r),t.callbackNode=null,t.callbackPriority=0;if(!(n&3)||g0(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(r!==null&&Fy(r),yw(n)){case 2:case 8:n=B9;break;case 32:n=Hp;break;case 268435456:n=z9;break;default:n=Hp}return r=QE.bind(null,t),n=pw(n,r),t.callbackPriority=e,t.callbackNode=n,e}return r!==null&&r!==null&&Fy(r),t.callbackPriority=2,t.callbackNode=null,2}function QE(t,e){if(Ar!==0&&Ar!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(C1()&&t.callbackNode!==n)return null;var r=Kt;return r=h1(t,t===Sn?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r===0?null:(LE(t,r,e),XE(t,rs()),t.callbackNode!=null&&t.callbackNode===n?QE.bind(null,t):null)}function L6(t,e){if(C1())return null;LE(t,e,!0)}function PB(){QB(function(){ln&6?pw(L9,zB):YE()})}function t3(){if(yl===0){var t=wd;t===0&&(t=em,em<<=1,!(em&261888)&&(em=256)),yl=t}return yl}function B6(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:op(""+t)}function z6(t,e){var n=e.ownerDocument.createElement("input");return n.name=e.name,n.value=e.value,t.id&&n.setAttribute("form",t.id),e.parentNode.insertBefore(n,e),t=new FormData(t),n.parentNode.removeChild(n),t}function $B(t,e,n,r,i){if(e==="submit"&&n&&n.stateNode===i){var s=B6((i[zi]||null).action),a=r.submitter;a&&(e=(e=a[zi]||null)?B6(e.formAction):a.getAttribute("formAction"),e!==null&&(s=e,a=null));var o=new f1("action","action",null,r,i);t.push({event:o,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(yl!==0){var l=a?z6(i,a):new FormData(i);H4(n,{pending:!0,data:l,method:i.method,action:s},null,l)}}else typeof s=="function"&&(o.preventDefault(),l=a?z6(i,a):new FormData(i),H4(n,{pending:!0,data:l,method:i.method,action:s},s,l))},currentTarget:i}]})}}for(var yb=0;yb<N4.length;yb++){var bb=N4[yb],UB=bb.toLowerCase(),HB=bb[0].toUpperCase()+bb.slice(1);oa(UB,"on"+HB)}oa(cC,"onAnimationEnd");oa(uC,"onAnimationIteration");oa(dC,"onAnimationStart");oa("dblclick","onDoubleClick");oa("focusin","onFocus");oa("focusout","onBlur");oa(iB,"onTransitionRun");oa(sB,"onTransitionStart");oa(aB,"onTransitionCancel");oa(hC,"onTransitionEnd");vd("onMouseEnter",["mouseout","mouseover"]);vd("onMouseLeave",["mouseout","mouseover"]);vd("onPointerEnter",["pointerout","pointerover"]);vd("onPointerLeave",["pointerout","pointerover"]);ru("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ru("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ru("onBeforeInput",["compositionend","keypress","textInput","paste"]);ru("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ru("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ru("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pf="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(" "),qB=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pf));function JE(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var a=r.length-1;0<=a;a--){var o=r[a],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==s&&i.isPropagationStopped())break e;s=o,i.currentTarget=c;try{s(i)}catch(u){Fp(u)}i.currentTarget=null,s=l}else for(a=0;a<r.length;a++){if(o=r[a],l=o.instance,c=o.currentTarget,o=o.listener,l!==s&&i.isPropagationStopped())break e;s=o,i.currentTarget=c;try{s(i)}catch(u){Fp(u)}i.currentTarget=null,s=l}}}}function qt(t,e){var n=e[k4];n===void 0&&(n=e[k4]=new Set);var r=t+"__bubble";n.has(r)||(ZE(e,t,2,!1),n.add(r))}function vb(t,e,n){var r=0;e&&(r|=4),ZE(n,t,r,e)}var um="_reactListening"+Math.random().toString(36).slice(2);function n3(t){if(!t[um]){t[um]=!0,F9.forEach(function(n){n!=="selectionchange"&&(qB.has(n)||vb(n,!1,t),vb(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[um]||(e[um]=!0,vb("selectionchange",!1,e))}}function ZE(t,e,n,r){switch(hA(e)){case 2:var i=yz;break;case 8:i=bz;break;default:i=a3}n=i.bind(null,e,n,t),i=void 0,!E4||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function xb(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===i)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&a.stateNode.containerInfo===i)return;a=a.return}for(;o!==null;){if(a=$u(o),a===null)return;if(l=a.tag,l===5||l===6||l===26||l===27){r=s=a;continue e}o=o.parentNode}}r=r.return}J9(function(){var c=s,u=xw(n),d=[];e:{var h=fC.get(t);if(h!==void 0){var m=f1,p=t;switch(t){case"keypress":if(cp(n)===0)break e;case"keydown":case"keyup":m=LL;break;case"focusin":p="focus",m=Yy;break;case"focusout":p="blur",m=Yy;break;case"beforeblur":case"afterblur":m=Yy;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=G5;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=SL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=PL;break;case cC:case uC:case dC:m=EL;break;case hC:m=UL;break;case"scroll":case"scrollend":m=kL;break;case"wheel":m=qL;break;case"copy":case"cut":case"paste":m=ML;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=K5;break;case"toggle":case"beforetoggle":m=VL}var b=(e&4)!==0,x=!b&&(t==="scroll"||t==="scrollend"),g=b?h!==null?h+"Capture":null:h;b=[];for(var y=c,w;y!==null;){var C=y;if(w=C.stateNode,C=C.tag,C!==5&&C!==26&&C!==27||w===null||g===null||(C=Df(y,g),C!=null&&b.push($f(y,C,w))),x)break;y=y.return}0<b.length&&(h=new m(h,p,null,n,u),d.push({event:h,listeners:b}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",m=t==="mouseout"||t==="pointerout",h&&n!==C4&&(p=n.relatedTarget||n.fromElement)&&($u(p)||p[Gd]))break e;if((m||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?$u(p):null,p!==null&&(x=m0(p),b=p.tag,p!==x||b!==5&&b!==27&&b!==6)&&(p=null)):(m=null,p=c),m!==p)){if(b=G5,C="onMouseLeave",g="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(b=K5,C="onPointerLeave",g="onPointerEnter",y="pointer"),x=m==null?h:qh(m),w=p==null?h:qh(p),h=new b(C,y+"leave",m,n,u),h.target=x,h.relatedTarget=w,C=null,$u(u)===c&&(b=new b(g,y+"enter",p,n,u),b.target=w,b.relatedTarget=x,C=b),x=C,m&&p)t:{for(b=FB,g=m,y=p,w=0,C=g;C;C=b(C))w++;C=0;for(var E=y;E;E=b(E))C++;for(;0<w-C;)g=b(g),w--;for(;0<C-w;)y=b(y),C--;for(;w--;){if(g===y||y!==null&&g===y.alternate){b=g;break t}g=b(g),y=b(y)}b=null}else b=null;m!==null&&P6(d,h,m,b,!1),p!==null&&x!==null&&P6(d,x,p,b,!0)}}e:{if(h=c?qh(c):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var S=J5;else if(Q5(h))if(iC)S=tB;else{S=ZL;var T=JL}else m=h.nodeName,!m||m.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?c&&vw(c.elementType)&&(S=J5):S=eB;if(S&&(S=S(t,c))){rC(d,S,n,u);break e}T&&T(t,h,c),t==="focusout"&&c&&h.type==="number"&&c.memoizedProps.value!=null&&T4(h,"number",h.value)}switch(T=c?qh(c):window,t){case"focusin":(Q5(T)||T.contentEditable==="true")&&(qu=T,A4=c,sf=null);break;case"focusout":sf=A4=qu=null;break;case"mousedown":M4=!0;break;case"contextmenu":case"mouseup":case"dragend":M4=!1,r6(d,n,u);break;case"selectionchange":if(rB)break;case"keydown":case"keyup":r6(d,n,u)}var O;if(_w)e:{switch(t){case"compositionstart":var z="onCompositionStart";break e;case"compositionend":z="onCompositionEnd";break e;case"compositionupdate":z="onCompositionUpdate";break e}z=void 0}else Hu?tC(t,n)&&(z="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(z="onCompositionStart");z&&(eC&&n.locale!=="ko"&&(Hu||z!=="onCompositionStart"?z==="onCompositionEnd"&&Hu&&(O=Z9()):(ml=u,ww="value"in ml?ml.value:ml.textContent,Hu=!0)),T=og(c,z),0<T.length&&(z=new W5(z,t,null,n,u),d.push({event:z,listeners:T}),O?z.data=O:(O=nC(n),O!==null&&(z.data=O)))),(O=WL?KL(t,n):YL(t,n))&&(z=og(c,"onBeforeInput"),0<z.length&&(T=new W5("onBeforeInput","beforeinput",null,n,u),d.push({event:T,listeners:z}),T.data=O)),$B(d,t,c,n,u)}JE(d,e)})}function $f(t,e,n){return{instance:t,listener:e,currentTarget:n}}function og(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||s===null||(i=Df(t,n),i!=null&&r.unshift($f(t,i,s)),i=Df(t,e),i!=null&&r.push($f(t,i,s))),t.tag===3)return r;t=t.return}return[]}function FB(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function P6(t,e,n,r,i){for(var s=e._reactName,a=[];n!==null&&n!==r;){var o=n,l=o.alternate,c=o.stateNode;if(o=o.tag,l!==null&&l===r)break;o!==5&&o!==26&&o!==27||c===null||(l=c,i?(c=Df(n,s),c!=null&&a.unshift($f(n,c,l))):i||(c=Df(n,s),c!=null&&a.push($f(n,c,l)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var VB=/\r\n?/g,GB=/\u0000|\uFFFD/g;function $6(t){return(typeof t=="string"?t:""+t).replace(VB,`
`).replace(GB,"")}function eA(t,e){return e=$6(e),$6(t)===e}function bn(t,e,n,r,i,s){switch(n){case"children":typeof r=="string"?e==="body"||e==="textarea"&&r===""||xd(t,r):(typeof r=="number"||typeof r=="bigint")&&e!=="body"&&xd(t,""+r);break;case"className":rm(t,"class",r);break;case"tabIndex":rm(t,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":rm(t,n,r);break;case"style":Q9(t,r,s);break;case"data":if(e!=="object"){rm(t,"data",r);break}case"src":case"href":if(r===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=op(""+r),t.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){t.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 s=="function"&&(n==="formAction"?(e!=="input"&&bn(t,e,"name",i.name,i,null),bn(t,e,"formEncType",i.formEncType,i,null),bn(t,e,"formMethod",i.formMethod,i,null),bn(t,e,"formTarget",i.formTarget,i,null)):(bn(t,e,"encType",i.encType,i,null),bn(t,e,"method",i.method,i,null),bn(t,e,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=op(""+r),t.setAttribute(n,r);break;case"onClick":r!=null&&(t.onclick=xo);break;case"onScroll":r!=null&&qt("scroll",t);break;case"onScrollEnd":r!=null&&qt("scrollend",t);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(he(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(he(60));t.innerHTML=n}}break;case"multiple":t.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":t.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"){t.removeAttribute("xlink:href");break}n=op(""+r),t.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"?t.setAttribute(n,""+r):t.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"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":r===!0?t.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,r):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?t.setAttribute(n,r):t.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?t.removeAttribute(n):t.setAttribute(n,r);break;case"popover":qt("beforetoggle",t),qt("toggle",t),ap(t,"popover",r);break;case"xlinkActuate":no(t,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":no(t,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":no(t,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":no(t,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":no(t,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":no(t,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":no(t,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":no(t,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":no(t,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":ap(t,"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=xL.get(n)||n,ap(t,n,r))}}function Z4(t,e,n,r,i,s){switch(n){case"style":Q9(t,r,s);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(he(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(he(60));t.innerHTML=n}}break;case"children":typeof r=="string"?xd(t,r):(typeof r=="number"||typeof r=="bigint")&&xd(t,""+r);break;case"onScroll":r!=null&&qt("scroll",t);break;case"onScrollEnd":r!=null&&qt("scrollend",t);break;case"onClick":r!=null&&(t.onclick=xo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!V9.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),e=n.slice(2,i?n.length-7:void 0),s=t[zi]||null,s=s!=null?s[n]:null,typeof s=="function"&&t.removeEventListener(e,s,i),typeof r=="function")){typeof s!="function"&&s!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,r,i);break e}n in t?t[n]=r:r===!0?t.setAttribute(n,""):ap(t,n,r)}}}function Jr(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qt("error",t),qt("load",t);var r=!1,i=!1,s;for(s in n)if(n.hasOwnProperty(s)){var a=n[s];if(a!=null)switch(s){case"src":r=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(he(137,e));default:bn(t,e,s,a,n,null)}}i&&bn(t,e,"srcSet",n.srcSet,n,null),r&&bn(t,e,"src",n.src,n,null);return;case"input":qt("invalid",t);var o=s=a=i=null,l=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":i=u;break;case"type":a=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":s=u;break;case"defaultValue":o=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(he(137,e));break;default:bn(t,e,r,u,n,null)}}K9(t,s,o,l,c,a,i,!1);return;case"select":qt("invalid",t),r=a=s=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":s=o;break;case"defaultValue":a=o;break;case"multiple":r=o;default:bn(t,e,i,o,n,null)}e=s,n=a,t.multiple=!!r,e!=null?id(t,!!r,e,!1):n!=null&&id(t,!!r,n,!0);return;case"textarea":qt("invalid",t),s=i=r=null;for(a in n)if(n.hasOwnProperty(a)&&(o=n[a],o!=null))switch(a){case"value":r=o;break;case"defaultValue":i=o;break;case"children":s=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(he(91));break;default:bn(t,e,a,o,n,null)}X9(t,r,i,s);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case"selected":t.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:bn(t,e,l,r,n,null)}return;case"dialog":qt("beforetoggle",t),qt("toggle",t),qt("cancel",t),qt("close",t);break;case"iframe":case"object":qt("load",t);break;case"video":case"audio":for(r=0;r<Pf.length;r++)qt(Pf[r],t);break;case"image":qt("error",t),qt("load",t);break;case"details":qt("toggle",t);break;case"embed":case"source":case"link":qt("error",t),qt("load",t);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(he(137,e));default:bn(t,e,c,r,n,null)}return;default:if(vw(e)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&Z4(t,e,u,r,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(r=n[o],r!=null&&bn(t,e,o,r,n,null))}function WB(t,e,n,r){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,s=null,a=null,o=null,l=null,c=null,u=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(m)||bn(t,e,m,null,r,d)}}for(var h in r){var m=r[h];if(d=n[h],r.hasOwnProperty(h)&&(m!=null||d!=null))switch(h){case"type":s=m;break;case"name":i=m;break;case"checked":c=m;break;case"defaultChecked":u=m;break;case"value":a=m;break;case"defaultValue":o=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(he(137,e));break;default:m!==d&&bn(t,e,h,m,r,d)}}S4(t,a,o,l,c,u,s,i);return;case"select":m=a=o=h=null;for(s in n)if(l=n[s],n.hasOwnProperty(s)&&l!=null)switch(s){case"value":break;case"multiple":m=l;default:r.hasOwnProperty(s)||bn(t,e,s,null,r,l)}for(i in r)if(s=r[i],l=n[i],r.hasOwnProperty(i)&&(s!=null||l!=null))switch(i){case"value":h=s;break;case"defaultValue":o=s;break;case"multiple":a=s;default:s!==l&&bn(t,e,i,s,r,l)}e=o,n=a,r=m,h!=null?id(t,!!n,h,!1):!!r!=!!n&&(e!=null?id(t,!!n,e,!0):id(t,!!n,n?[]:"",!1));return;case"textarea":m=h=null;for(o in n)if(i=n[o],n.hasOwnProperty(o)&&i!=null&&!r.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:bn(t,e,o,null,r,i)}for(a in r)if(i=r[a],s=n[a],r.hasOwnProperty(a)&&(i!=null||s!=null))switch(a){case"value":h=i;break;case"defaultValue":m=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(he(91));break;default:i!==s&&bn(t,e,a,i,r,s)}Y9(t,h,m);return;case"option":for(var p in n)if(h=n[p],n.hasOwnProperty(p)&&h!=null&&!r.hasOwnProperty(p))switch(p){case"selected":t.selected=!1;break;default:bn(t,e,p,null,r,h)}for(l in r)if(h=r[l],m=n[l],r.hasOwnProperty(l)&&h!==m&&(h!=null||m!=null))switch(l){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:bn(t,e,l,h,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 b in n)h=n[b],n.hasOwnProperty(b)&&h!=null&&!r.hasOwnProperty(b)&&bn(t,e,b,null,r,h);for(c in r)if(h=r[c],m=n[c],r.hasOwnProperty(c)&&h!==m&&(h!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(he(137,e));break;default:bn(t,e,c,h,r,m)}return;default:if(vw(e)){for(var x in n)h=n[x],n.hasOwnProperty(x)&&h!==void 0&&!r.hasOwnProperty(x)&&Z4(t,e,x,void 0,r,h);for(u in r)h=r[u],m=n[u],!r.hasOwnProperty(u)||h===m||h===void 0&&m===void 0||Z4(t,e,u,h,r,m);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!r.hasOwnProperty(g)&&bn(t,e,g,null,r,h);for(d in r)h=r[d],m=n[d],!r.hasOwnProperty(d)||h===m||h==null&&m==null||bn(t,e,d,h,r,m)}function U6(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function KB(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var i=n[r],s=i.transferSize,a=i.initiatorType,o=i.duration;if(s&&o&&U6(a)){for(a=0,o=i.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>o)break;var u=l.transferSize,d=l.initiatorType;u&&U6(d)&&(l=l.responseEnd,a+=u*(l<o?1:(o-c)/(l-c)))}if(--r,e+=8*(s+a)/(i.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var ex=null,tx=null;function lg(t){return t.nodeType===9?t:t.ownerDocument}function H6(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tA(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function nx(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var wb=null;function YB(){var t=window.event;return t&&t.type==="popstate"?t===wb?!1:(wb=t,!0):(wb=null,!1)}var nA=typeof setTimeout=="function"?setTimeout:void 0,XB=typeof clearTimeout=="function"?clearTimeout:void 0,q6=typeof Promise=="function"?Promise:void 0,QB=typeof queueMicrotask=="function"?queueMicrotask:typeof q6<"u"?function(t){return q6.resolve(null).then(t).catch(JB)}:nA;function JB(t){setTimeout(function(){throw t})}function Ql(t){return t==="head"}function F6(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"||n==="/&"){if(r===0){t.removeChild(i),Ad(e);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")pf(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,pf(n);for(var s=n.firstChild;s;){var a=s.nextSibling,o=s.nodeName;s[b0]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=a}}else n==="body"&&pf(t.ownerDocument.body);n=i}while(n);Ad(e)}function V6(t,e){var n=t;t=0;do{var r=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=r}while(n)}function rx(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":rx(n),bw(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function ZB(t,e,n,r){for(;t.nodeType===1;){var i=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!r&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(r){if(!t[b0])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(s=t.getAttribute("rel"),s==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(s!==i.rel||t.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||t.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||t.getAttribute("title")!==(i.title==null?null:i.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(s=t.getAttribute("src"),(s!==(i.src==null?null:i.src)||t.getAttribute("type")!==(i.type==null?null:i.type)||t.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&s&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var s=i.name==null?null:""+i.name;if(i.type==="hidden"&&t.getAttribute("name")===s)return t}else return t;if(t=zs(t.nextSibling),t===null)break}return null}function ez(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=zs(t.nextSibling),t===null))return null;return t}function rA(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=zs(t.nextSibling),t===null))return null;return t}function ix(t){return t.data==="$?"||t.data==="$~"}function sx(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function tz(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var r=function(){e(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),t._reactRetry=r}}function zs(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var ax=null;function G6(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return zs(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function W6(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function iA(t,e,n){switch(e=lg(n),t){case"html":if(t=e.documentElement,!t)throw Error(he(452));return t;case"head":if(t=e.head,!t)throw Error(he(453));return t;case"body":if(t=e.body,!t)throw Error(he(454));return t;default:throw Error(he(451))}}function pf(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);bw(t)}var $s=new Map,K6=new Set;function cg(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Po=un.d;un.d={f:nz,r:rz,D:iz,C:sz,L:az,m:oz,X:cz,S:lz,M:uz};function nz(){var t=Po.f(),e=S1();return t||e}function rz(t){var e=Wd(t);e!==null&&e.tag===5&&e.type==="form"?QC(e):Po.r(t)}var Qd=typeof document>"u"?null:document;function sA(t,e,n){var r=Qd;if(r&&typeof e=="string"&&e){var i=Ms(e);i='link[rel="'+t+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),K6.has(i)||(K6.add(i),t={rel:t,crossOrigin:n,href:e},r.querySelector(i)===null&&(e=r.createElement("link"),Jr(e,"link",t),$r(e),r.head.appendChild(e)))}}function iz(t){Po.D(t),sA("dns-prefetch",t,null)}function sz(t,e){Po.C(t,e),sA("preconnect",t,e)}function az(t,e,n){Po.L(t,e,n);var r=Qd;if(r&&t&&e){var i='link[rel="preload"][as="'+Ms(e)+'"]';e==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+Ms(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+Ms(n.imageSizes)+'"]')):i+='[href="'+Ms(t)+'"]';var s=i;switch(e){case"style":s=Ed(t);break;case"script":s=Jd(t)}$s.has(s)||(t=Bn({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),$s.set(s,t),r.querySelector(i)!==null||e==="style"&&r.querySelector(S0(s))||e==="script"&&r.querySelector(T0(s))||(e=r.createElement("link"),Jr(e,"link",t),$r(e),r.head.appendChild(e)))}}function oz(t,e){Po.m(t,e);var n=Qd;if(n&&t){var r=e&&typeof e.as=="string"?e.as:"script",i='link[rel="modulepreload"][as="'+Ms(r)+'"][href="'+Ms(t)+'"]',s=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Jd(t)}if(!$s.has(s)&&(t=Bn({rel:"modulepreload",href:t},e),$s.set(s,t),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(T0(s)))return}r=n.createElement("link"),Jr(r,"link",t),$r(r),n.head.appendChild(r)}}}function lz(t,e,n){Po.S(t,e,n);var r=Qd;if(r&&t){var i=rd(r).hoistableStyles,s=Ed(t);e=e||"default";var a=i.get(s);if(!a){var o={loading:0,preload:null};if(a=r.querySelector(S0(s)))o.loading=5;else{t=Bn({rel:"stylesheet",href:t,"data-precedence":e},n),(n=$s.get(s))&&r3(t,n);var l=a=r.createElement("link");$r(l),Jr(l,"link",t),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,yp(a,e,r)}a={type:"stylesheet",instance:a,count:1,state:o},i.set(s,a)}}}function cz(t,e){Po.X(t,e);var n=Qd;if(n&&t){var r=rd(n).hoistableScripts,i=Jd(t),s=r.get(i);s||(s=n.querySelector(T0(i)),s||(t=Bn({src:t,async:!0},e),(e=$s.get(i))&&i3(t,e),s=n.createElement("script"),$r(s),Jr(s,"link",t),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function uz(t,e){Po.M(t,e);var n=Qd;if(n&&t){var r=rd(n).hoistableScripts,i=Jd(t),s=r.get(i);s||(s=n.querySelector(T0(i)),s||(t=Bn({src:t,async:!0,type:"module"},e),(e=$s.get(i))&&i3(t,e),s=n.createElement("script"),$r(s),Jr(s,"link",t),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function Y6(t,e,n,r){var i=(i=Sl.current)?cg(i):null;if(!i)throw Error(he(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=Ed(n.href),n=rd(i).hoistableStyles,r=n.get(e),r||(r={type:"style",instance:null,count:0,state:null},n.set(e,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Ed(n.href);var s=rd(i).hoistableStyles,a=s.get(t);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(t,a),(s=i.querySelector(S0(t)))&&!s._p&&(a.instance=s,a.state.loading=5),$s.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},$s.set(t,n),s||dz(i,t,n,a.state))),e&&r===null)throw Error(he(528,""));return a}if(e&&r!==null)throw Error(he(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Jd(n),n=rd(i).hoistableScripts,r=n.get(e),r||(r={type:"script",instance:null,count:0,state:null},n.set(e,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(he(444,t))}}function Ed(t){return'href="'+Ms(t)+'"'}function S0(t){return'link[rel="stylesheet"]['+t+"]"}function aA(t){return Bn({},t,{"data-precedence":t.precedence,precedence:null})}function dz(t,e,n,r){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?r.loading=1:(e=t.createElement("link"),r.preload=e,e.addEventListener("load",function(){return r.loading|=1}),e.addEventListener("error",function(){return r.loading|=2}),Jr(e,"link",n),$r(e),t.head.appendChild(e))}function Jd(t){return'[src="'+Ms(t)+'"]'}function T0(t){return"script[async]"+t}function X6(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var r=t.querySelector('style[data-href~="'+Ms(n.href)+'"]');if(r)return e.instance=r,$r(r),r;var i=Bn({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(t.ownerDocument||t).createElement("style"),$r(r),Jr(r,"style",i),yp(r,n.precedence,t),e.instance=r;case"stylesheet":i=Ed(n.href);var s=t.querySelector(S0(i));if(s)return e.state.loading|=4,e.instance=s,$r(s),s;r=aA(n),(i=$s.get(i))&&r3(r,i),s=(t.ownerDocument||t).createElement("link"),$r(s);var a=s;return a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),Jr(s,"link",r),e.state.loading|=4,yp(s,n.precedence,t),e.instance=s;case"script":return s=Jd(n.src),(i=t.querySelector(T0(s)))?(e.instance=i,$r(i),i):(r=n,(i=$s.get(s))&&(r=Bn({},n),i3(r,i)),t=t.ownerDocument||t,i=t.createElement("script"),$r(i),Jr(i,"link",r),t.head.appendChild(i),e.instance=i);case"void":return null;default:throw Error(he(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(r=e.instance,e.state.loading|=4,yp(r,n.precedence,t));return e.instance}function yp(t,e,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,s=i,a=0;a<r.length;a++){var o=r[a];if(o.dataset.precedence===e)s=o;else if(s!==i)break}s?s.parentNode.insertBefore(t,s.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function r3(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function i3(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var bp=null;function Q6(t,e,n){if(bp===null){var r=new Map,i=bp=new Map;i.set(n,r)}else i=bp,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(t))return r;for(r.set(t,null),n=n.getElementsByTagName(t),i=0;i<n.length;i++){var s=n[i];if(!(s[b0]||s[Kr]||t==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var a=s.getAttribute(e)||"";a=t+a;var o=r.get(a);o?o.push(s):r.set(a,[s])}}return r}function J6(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function hz(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function oA(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function fz(t,e,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=Ed(r.href),s=e.querySelector(S0(i));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=ug.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=s,$r(s);return}s=e.ownerDocument||e,r=aA(r),(i=$s.get(i))&&r3(r,i),s=s.createElement("link"),$r(s);var a=s;a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),Jr(s,"link",r),n.instance=s}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&!(n.state.loading&3)&&(t.count++,n=ug.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var kb=0;function mz(t,e){return t.stylesheets&&t.count===0&&vp(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var r=setTimeout(function(){if(t.stylesheets&&vp(t,t.stylesheets),t.unsuspend){var s=t.unsuspend;t.unsuspend=null,s()}},6e4+e);0<t.imgBytes&&kb===0&&(kb=62500*KB());var i=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&vp(t,t.stylesheets),t.unsuspend)){var s=t.unsuspend;t.unsuspend=null,s()}},(t.imgBytes>kb?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ug(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vp(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var dg=null;function vp(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,dg=new Map,e.forEach(pz,t),dg=null,ug.call(t))}function pz(t,e){if(!(e.state.loading&4)){var n=dg.get(t);if(n)var r=n.get(null);else{n=new Map,dg.set(t,n);for(var i=t.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<i.length;s++){var a=i[s];(a.nodeName==="LINK"||a.getAttribute("media")!=="not all")&&(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}i=e.instance,a=i.getAttribute("data-precedence"),s=n.get(a)||r,s===r&&n.set(null,i),n.set(a,i),this.count++,r=ug.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),s?s.parentNode.insertBefore(i,s.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(i,t.firstChild)),e.state.loading|=4}}var Uf={$$typeof:vo,Provider:null,Consumer:null,_currentValue:Lc,_currentValue2:Lc,_threadCount:0};function gz(t,e,n,r,i,s,a,o,l){this.tag=1,this.containerInfo=t,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=Vy(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vy(0),this.hiddenUpdates=Vy(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=s,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function lA(t,e,n,r,i,s,a,o,l,c,u,d){return t=new gz(t,e,n,a,l,c,u,d,o),e=1,s===!0&&(e|=24),s=Ji(3,null,null,e),t.current=s,s.stateNode=t,e=Nw(),e.refCount++,t.pooledCache=e,e.refCount++,s.memoizedState={element:r,isDehydrated:n,cache:e},Rw(s),t}function cA(t){return t?(t=Gu,t):Gu}function uA(t,e,n,r,i,s){i=cA(i),r.context===null?r.context=i:r.pendingContext=i,r=Cl(e),r.payload={element:n},s=s===void 0?null:s,s!==null&&(r.callback=s),n=El(t,r,e),n!==null&&(Li(n,t,e),of(n,t,e))}function Z6(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function s3(t,e){Z6(t,e),(t=t.alternate)&&Z6(t,e)}function dA(t){if(t.tag===13||t.tag===31){var e=au(t,67108864);e!==null&&Li(e,t,67108864),s3(t,67108864)}}function e_(t){if(t.tag===13||t.tag===31){var e=as();e=gw(e);var n=au(t,e);n!==null&&Li(n,t,e),s3(t,e)}}var hg=!0;function yz(t,e,n,r){var i=_t.T;_t.T=null;var s=un.p;try{un.p=2,a3(t,e,n,r)}finally{un.p=s,_t.T=i}}function bz(t,e,n,r){var i=_t.T;_t.T=null;var s=un.p;try{un.p=8,a3(t,e,n,r)}finally{un.p=s,_t.T=i}}function a3(t,e,n,r){if(hg){var i=ox(r);if(i===null)xb(t,e,r,fg,n),t_(t,r);else if(xz(i,t,e,n,r))r.stopPropagation();else if(t_(t,r),e&4&&-1<vz.indexOf(t)){for(;i!==null;){var s=Wd(i);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var a=bc(s.pendingLanes);if(a!==0){var o=s;for(o.pendingLanes|=2,o.entangledLanes|=2;a;){var l=1<<31-ss(a);o.entanglements[1]|=l,a&=~l}Ha(s),!(ln&6)&&(ng=rs()+500,_0(0))}}break;case 31:case 13:o=au(s,2),o!==null&&Li(o,s,2),S1(),s3(s,2)}if(s=ox(r),s===null&&xb(t,e,r,fg,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else xb(t,e,r,null,n)}}function ox(t){return t=xw(t),o3(t)}var fg=null;function o3(t){if(fg=null,t=$u(t),t!==null){var e=m0(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=D9(e),t!==null)return t;t=null}else if(n===31){if(t=I9(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return fg=t,null}function hA(t){switch(t){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(iL()){case L9:return 2;case B9:return 8;case Hp:case sL:return 32;case z9:return 268435456;default:return 32}default:return 32}}var lx=!1,Nl=null,Dl=null,Il=null,Hf=new Map,qf=new Map,dl=[],vz="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 t_(t,e){switch(t){case"focusin":case"focusout":Nl=null;break;case"dragenter":case"dragleave":Dl=null;break;case"mouseover":case"mouseout":Il=null;break;case"pointerover":case"pointerout":Hf.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":qf.delete(e.pointerId)}}function Sh(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Wd(e),e!==null&&dA(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function xz(t,e,n,r,i){switch(e){case"focusin":return Nl=Sh(Nl,t,e,n,r,i),!0;case"dragenter":return Dl=Sh(Dl,t,e,n,r,i),!0;case"mouseover":return Il=Sh(Il,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return Hf.set(s,Sh(Hf.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,qf.set(s,Sh(qf.get(s)||null,t,e,n,r,i)),!0}return!1}function fA(t){var e=$u(t.target);if(e!==null){var n=m0(e);if(n!==null){if(e=n.tag,e===13){if(e=D9(n),e!==null){t.blockedOn=e,P5(t.priority,function(){e_(n)});return}}else if(e===31){if(e=I9(n),e!==null){t.blockedOn=e,P5(t.priority,function(){e_(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function xp(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=ox(t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);C4=r,n.target.dispatchEvent(r),C4=null}else return e=Wd(n),e!==null&&dA(e),t.blockedOn=n,!1;e.shift()}return!0}function n_(t,e,n){xp(t)&&n.delete(e)}function wz(){lx=!1,Nl!==null&&xp(Nl)&&(Nl=null),Dl!==null&&xp(Dl)&&(Dl=null),Il!==null&&xp(Il)&&(Il=null),Hf.forEach(n_),qf.forEach(n_)}function dm(t,e){t.blockedOn===e&&(t.blockedOn=null,lx||(lx=!0,Nr.unstable_scheduleCallback(Nr.unstable_NormalPriority,wz)))}var hm=null;function r_(t){hm!==t&&(hm=t,Nr.unstable_scheduleCallback(Nr.unstable_NormalPriority,function(){hm===t&&(hm=null);for(var e=0;e<t.length;e+=3){var n=t[e],r=t[e+1],i=t[e+2];if(typeof r!="function"){if(o3(r||n)===null)continue;break}var s=Wd(n);s!==null&&(t.splice(e,3),e-=3,H4(s,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ad(t){function e(l){return dm(l,t)}Nl!==null&&dm(Nl,t),Dl!==null&&dm(Dl,t),Il!==null&&dm(Il,t),Hf.forEach(e),qf.forEach(e);for(var n=0;n<dl.length;n++){var r=dl[n];r.blockedOn===t&&(r.blockedOn=null)}for(;0<dl.length&&(n=dl[0],n.blockedOn===null);)fA(n),n.blockedOn===null&&dl.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],s=n[r+1],a=i[zi]||null;if(typeof s=="function")a||r_(n);else if(a){var o=null;if(s&&s.hasAttribute("formAction")){if(i=s,a=s[zi]||null)o=a.formAction;else if(o3(i)!==null)continue}else o=a.action;typeof o=="function"?n[r+1]=o:(n.splice(r,3),r-=3),r_(n)}}}function mA(){function t(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(a){return i=a})},focusReset:"manual",scroll:"manual"})}function e(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,i=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),i!==null&&(i(),i=null)}}}function l3(t){this._internalRoot=t}E1.prototype.render=l3.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(he(409));var n=e.current,r=as();uA(n,r,t,e,null,null)};E1.prototype.unmount=l3.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;uA(t.current,2,null,t,null,null),S1(),e[Gd]=null}};function E1(t){this._internalRoot=t}E1.prototype.unstable_scheduleHydration=function(t){if(t){var e=q9();t={blockedOn:null,target:t,priority:e};for(var n=0;n<dl.length&&e!==0&&e<dl[n].priority;n++);dl.splice(n,0,t),n===0&&fA(t)}};var i_=M9.version;if(i_!=="19.2.4")throw Error(he(527,i_,"19.2.4"));un.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(he(188)):(t=Object.keys(t).join(","),Error(he(268,t)));return t=Qj(e),t=t!==null?R9(t):null,t=t===null?null:t.stateNode,t};var kz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:_t,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fm.isDisabled&&fm.supportsFiber)try{p0=fm.inject(kz),is=fm}catch{}}u1.createRoot=function(t,e){if(!N9(t))throw Error(he(299));var n=!1,r="",i=sE,s=aE,a=oE;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onUncaughtError!==void 0&&(i=e.onUncaughtError),e.onCaughtError!==void 0&&(s=e.onCaughtError),e.onRecoverableError!==void 0&&(a=e.onRecoverableError)),e=lA(t,1,!1,null,null,n,r,null,i,s,a,mA),t[Gd]=e.current,n3(t),new l3(e)};u1.hydrateRoot=function(t,e,n){if(!N9(t))throw Error(he(299));var r=!1,i="",s=sE,a=aE,o=oE,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(a=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),e=lA(t,1,!0,e,n??null,r,i,l,s,a,o,mA),e.context=cA(null),n=e.current,r=as(),r=gw(r),i=Cl(r),i.callback=null,El(n,i,r),n=r,e.current.lanes=n,y0(e,n),Ha(e),t[Gd]=e.current,n3(t),new E1(e)};u1.version="19.2.4";function pA(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pA)}catch(t){console.error(t)}}pA(),_9.exports=u1;var _z=_9.exports;const Sz=l1(_z);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Tz="agent";function Cz(t){return t===Tz}var Ez=3e4,Az=new Set(["authorized","expired","error","cancelled"]),Mz=class{constructor(t){this.client=t}async start(t){let e=await this.client.startDeviceFlow(t),n=this.client;return{deviceFlowId:e.deviceFlowId,providerId:e.providerId,userCode:e.userCode,verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,expiresAt:e.expiresAt,intervalMs:e.intervalMs,attached:e.attached,cancel:()=>n.cancelDeviceFlow(e.deviceFlowId,{clientId:t.clientId}),awaitCompletion:async(r={})=>await Nz(n,e,t.clientId,r)}}status(t,e){return this.client.getDeviceFlow(t,e)}cancel(t,e){return this.client.cancelDeviceFlow(t,e)}};async function Nz(t,e,n,r){return await Dz(t,e,n,r)}async function s_(t,e,n,r){try{return await t.getDeviceFlow(e.deviceFlowId,{clientId:n,signal:r})}catch(i){if(i instanceof Md&&i.status===404)return{deviceFlowId:e.deviceFlowId,providerId:e.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 i}}function a_(t,e={}){if(t!==void 0&&Number.isFinite(t)&&!(e.allowZero?t<0:t<=0))return t}async function Dz(t,e,n,r){var u;let i=r.signal,s=a_(r.timeoutMs,{allowZero:!0}),a=a_(r.pollOverrideMs),o=s!==void 0?Date.now()+s:e.expiresAt+Ez,l=Math.max(1e3,a??e.intervalMs??5e3),c=l;for(;;){if(i!=null&&i.aborted)throw cx(i);if(Date.now()>=o)return await s_(t,e,n,i);let d=await s_(t,e,n,i);if(d.intervalMs&&d.intervalMs!==c&&(c=d.intervalMs,l=d.intervalMs,(u=r.onThrottled)==null||u.call(r,d.intervalMs)),Az.has(d.status))return d;await Iz(l,i)}}async function Iz(t,e){if(e!=null&&e.aborted)throw cx(e);await new Promise((n,r)=>{let i=setTimeout(()=>{a(),n()},t),s=()=>{a(),r(cx(e))};function a(){clearTimeout(i),e==null||e.removeEventListener("abort",s)}e&&e.addEventListener("abort",s,{once:!0})})}function cx(t){let e=t==null?void 0:t.reason;return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("aborted")}var Md=class extends Error{constructor(e,n,r){super(r);ie(this,"status");ie(this,"body");this.name="DaemonHttpError",this.status=e,this.body=n}},o_=class extends Error{constructor(t){super(t??"Transport connection closed"),this.name="DaemonTransportClosedError"}},Rz=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},l_=16*1024*1024;async function*Oz(t,e){let n=t.getReader(),r=new TextDecoder,i="",s;e&&(s=()=>{n.cancel().catch(()=>{})},e.aborted?s():e.addEventListener("abort",s,{once:!0}));try{for(;;){if(e!=null&&e.aborted)return;let a,o;try{({value:a,done:o}=await n.read())}catch(c){if(e!=null&&e.aborted)return;throw c}if(o){if(i+=r.decode(),i.length>0){let c=c_(i);for(let u of c.frames){let d=_b(u);d&&(yield d)}if(c.tail.length>0){let u=_b(c.tail);u&&(yield u)}}return}if(i+=r.decode(a,{stream:!0}),i.length>l_)throw new Rz(`parseSseStream: unread buffer exceeded ${l_} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=c_(i);if(l.frames.length>0)for(let c of l.frames){let u=_b(c);u&&(yield u)}i=l.tail}}finally{e&&s&&e.removeEventListener("abort",s);try{await n.cancel()}catch{}}}function c_(t){let e=[],n=0;for(;n<t.length;){let r=t.indexOf(`

`,n);if(r===-1){let s=t.indexOf(`\r
\r
`,n);if(s===-1)break;e.push(t.slice(n,s)),n=s+4;continue}let i=t.slice(n,r).indexOf(`\r
\r
`);if(i!==-1){let s=n+i;e.push(t.slice(n,s)),n=s+4}else e.push(t.slice(n,r)),n=r+2}return{frames:e,tail:t.slice(n)}}function _b(t){if(!t)return;let e=[];for(let r of t.split(/\r?\n/)){if(!r.startsWith("data:"))continue;let i=r.slice(5);e.push(i.startsWith(" ")?i.slice(1):i)}if(e.length===0)return;let n=e.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 i=r.id;return i!==void 0&&(!Number.isSafeInteger(i)||i<1)?void 0:r}catch{return}}var jz=class{constructor(t,e,n){ie(this,"baseUrl");ie(this,"token");ie(this,"_fetch");ie(this,"_disposed",!1);ie(this,"type","rest");ie(this,"supportsReplay",!0);this.baseUrl=t,this.token=e,this._fetch=n}get connected(){return!this._disposed}async fetch(t,e,n){if(this._disposed)throw new o_;return this._fetch(t,e)}async*subscribeEvents(t,e={}){var u;if(this._disposed)throw new o_;let n={Accept:"text/event-stream"};this.token&&(n.Authorization=`Bearer ${this.token}`),e.lastEventId!==void 0&&(n["Last-Event-ID"]=String(e.lastEventId));let r=new AbortController,i,s=e.connectTimeoutMs;s&&Number.isFinite(s)&&(i=setTimeout(()=>r.abort(new DOMException("Initial connect timed out","TimeoutError")),s),typeof i=="object"&&i&&"unref"in i&&i.unref());let a=e.signal?Lz([e.signal,r.signal]):r.signal,o=`${this.baseUrl}/session/${encodeURIComponent(t)}/events`;e.maxQueued!==void 0&&(o+=`?maxQueued=${encodeURIComponent(String(e.maxQueued))}`);let l;try{l=await this._fetch(o,{headers:n,signal:a})}finally{i!==void 0&&clearTimeout(i)}if(!l.ok){let d;try{let m=await l.text();try{d=JSON.parse(m)}catch{d=m}}catch{}let h=d&&typeof d=="object"&&"error"in d?String(d.error):`HTTP ${l.status}`;throw new Md(l.status,d,`GET /session/:id/events: ${h}`)}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 Md(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*Oz(l.body,e.signal)}dispose(){this._disposed=!0}};function Lz(t){let e=AbortSignal.any;if(typeof e=="function")return e.call(AbortSignal,t);let n=new AbortController,r=[],i=()=>{for(;r.length>0;){let s=r.pop();try{s==null||s()}catch{}}};for(let s of t){if(s.aborted)return n.abort(s.reason),i(),n.signal;let a=()=>{n.abort(s.reason),i()};s.addEventListener("abort",a,{once:!0}),r.push(()=>s.removeEventListener("abort",a))}return n.signal.addEventListener("abort",i,{once:!0}),n.signal}var Bz=3e4,zz=5,Th=33e4,Pz="X-Qwen-Client-Id";function gA(t){if(t===void 0)return zz;if(t===null||t===0||t===1/0)return 1/0;if(!Number.isInteger(t)||t<0)throw new TypeError("bad maxPendingPromptsPerSession");return t}function $z(t){let e=t.length;for(;e>0&&t.charCodeAt(e-1)===47;)e--;return e===t.length?t:t.slice(0,e)}function Uz(){var t,e;try{let n=(e=(t=globalThis.process)==null?void 0:t.env)==null?void 0:e.QWEN_SERVER_TOKEN;if(typeof n!="string")return;let r=n.trim();return r.length===0?void 0:r}catch{return}}var u_=class extends Error{constructor(t,e,n){super(`Pending prompts full: "${t}" (${n}/${e})`),this.name="DaemonPendingPromptLimitError",this.sessionId=t,this.limit=e,this.pendingCount=n}};function yA(t){return typeof t=="object"&&t!==null&&t._daemonTurnError===!0}var bA=class{constructor(t){ie(this,"baseUrl");ie(this,"token");ie(this,"_fetch");ie(this,"fetchTimeoutMs");ie(this,"promptLimit");ie(this,"promptCounts",Object.create(null));ie(this,"transport");ie(this,"_authFlow");this.baseUrl=$z(t.baseUrl),this.token=t.token??Uz(),this._fetch=t.fetch??globalThis.fetch.bind(globalThis);let e=t.fetchTimeoutMs??Bz;this.fetchTimeoutMs=Number.isFinite(e)&&e>0?e:0,this.promptLimit=gA(t.maxPendingPromptsPerSession),this.transport=t.transport??new jz(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new Mz(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(t,e=this.promptLimit){if(e===1/0)return()=>{};let n=this.promptCounts,r=n[t]??0;if(r>=e)throw new u_(t,e,r);n[t]=r+1;let i;return()=>{i||(i=!0,(n[t]??0)<=1?delete n[t]:--n[t])}}async fetchWithTimeout(t,e={},n,r){let i=this.fetchTimeoutMs;if(r!==void 0&&Number.isFinite(r)&&r>=0&&(i=r),!i||!Number.isFinite(i)){let c=await this.transport.fetch(t,e);return n?n(c):c}let s=new AbortController,a=setTimeout(()=>{s.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let o=e.signal??void 0,l=o?d_([o,s.signal]):s.signal;try{let c=await this.transport.fetch(t,{...e,signal:l});return n?await n(c):c}finally{clearTimeout(a)}}headers(t={},e){let n={...t};return this.token&&(n.Authorization=`Bearer ${this.token}`),e&&(n[Pz]=e),n}async failOnError(t,e,n){let r;try{let s=await t.text();if(s.length>0)try{r=JSON.parse(s)}catch{r=s}}catch{}let i=r&&typeof r=="object"&&"error"in r?String(r.error):`HTTP ${t.status}`;if(n&&t.status===503&&r&&typeof r=="object"){let s=r;if(s.code==="prompt_queue_full")return new u_(typeof s.sessionId=="string"?s.sessionId:n,typeof s.limit=="number"?s.limit:0,typeof s.pendingCount=="number"?s.pendingCount:0)}return new Md(t.status,r,`${e}: ${i}`)}async jsonRequest(t,e,n={}){let r=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${t}`,{...n.method?{method:n.method}:{},headers:this.headers(r?{"Content-Type":"application/json"}:{},n.clientId),...r?{body:JSON.stringify(n.body)}:{}},async i=>{if(!i.ok)throw await this.failOnError(i,e);return await i.json()})}async health(){return await this.fetchWithTimeout(`${this.baseUrl}/health`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /health");return await t.json()})}async capabilities(){return await this.fetchWithTimeout(`${this.baseUrl}/capabilities`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /capabilities");return await t.json()})}async workspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp");return await t.json()})}async workspaceMcpTools(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(t)}/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/mcp/:server/tools");return await e.json()})}async workspaceSkills(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/skills");return await t.json()})}async workspaceProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/providers`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/providers");return await t.json()})}async workspaceHooks(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/hooks`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/hooks");return await t.json()})}async sessionHooks(t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/hooks`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /session/:id/hooks");return await e.json()})}async workspaceExtensions(){return await this.jsonRequest("/workspace/extensions","GET /workspace/extensions")}async installExtension(t,e){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:t,clientId:e})}async checkExtensionUpdates(t){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:t})}async refreshExtensions(t){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:t})}async enableExtension(t,e,n){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(t)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:e,clientId:n})}async disableExtension(t,e,n){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(t)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:e,clientId:n})}async updateExtension(t,e){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(t)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:e})}async uninstallExtension(t,e){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(t)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:e})}async readWorkspaceFile(t,e={},n){let r=new URL(`${this.baseUrl}/file`);return r.searchParams.set("path",t),e.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(e.maxBytes)),e.line!==void 0&&r.searchParams.set("line",String(e.line)),e.limit!==void 0&&r.searchParams.set("limit",String(e.limit)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /file");return await i.json()})}async readWorkspaceFileBytes(t,e={},n){let r=new URL(`${this.baseUrl}/file/bytes`);return r.searchParams.set("path",t),e.offset!==void 0&&r.searchParams.set("offset",String(e.offset)),e.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(e.maxBytes)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /file/bytes");return await i.json()})}async fileStat(t){let e=new URL(`${this.baseUrl}/stat`);return e.searchParams.set("path",t),await this.fetchWithTimeout(e.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(t){let e=new URL(`${this.baseUrl}/list`);return e.searchParams.set("path",t),await this.fetchWithTimeout(e.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async glob(t){let e=new URL(`${this.baseUrl}/glob`);return e.searchParams.set("pattern",t),await this.fetchWithTimeout(e.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /glob");return await n.json()})}async writeWorkspaceFile(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/file/write`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify(t)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/write");return await n.json()})}async editWorkspaceFile(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/file/edit`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify(t)},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 t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/memory");return await t.json()})}async writeWorkspaceMemory(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify(t)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/memory");return await n.json()})}async listWorkspaceAgents(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/agents");return await t.json()})}async createWorkspaceAgent(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify(t)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents");return await n.json()})}async generateWorkspaceAgent(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify({description:t})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents/generate");return await n.json()},Th)}async getWorkspaceAgent(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${encodeURIComponent(t)}`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/agents/:agentType");return await e.json()})}async updateWorkspaceAgent(t,e,n={},r){let i=n.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(t)}?scope=${encodeURIComponent(n.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(t)}`;return await this.fetchWithTimeout(i,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(e)},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/agents/:agentType");return await s.json()})}async deleteWorkspaceAgent(t,e={},n){let r=e.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(t)}?scope=${encodeURIComponent(e.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(t)}`;return await this.fetchWithTimeout(r,{method:"DELETE",headers:this.headers({},n)},async i=>{var s;if(i.status===204){try{await((s=i.body)==null?void 0:s.cancel())}catch{}return}if(i.status===404){let a=await this.failOnError(i,"DELETE /workspace/agents/:agentType"),o=a.body;if(o&&o.code==="agent_not_found")return;throw a}throw await this.failOnError(i,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/env");return await t.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/preflight");return await t.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/tools");return await t.json()})}async createOrAttachSession(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify({cwd:t.workspaceCwd,...t.modelServiceId?{modelServiceId:t.modelServiceId}:{},...t.sessionScope!==void 0?{sessionScope:t.sessionScope}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/${encodeURIComponent(t)}/sessions`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/:id/sessions");return(await e.json()).sessions})}async loadSession(t,e={},n){return this.restoreSession("load",t,e,n)}async resumeSession(t,e={},n){return this.restoreSession("resume",t,e,n)}async branchSession(t,e={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:e.name})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/branch");return await r.json()})}async sessionContext(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/context`,{headers:this.headers({},e)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/context");return await n.json()})}async sessionContextUsage(t,e={},n){let r=new URLSearchParams;e.detail===!0&&r.set("detail","true");let i=r.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/context-usage${i?`?${i}`:""}`,{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /session/:id/context-usage");return await s.json()})}async sessionSupportedCommands(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/supported-commands`,{headers:this.headers({},e)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/supported-commands");return await n.json()})}async sessionTasks(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/tasks`,{headers:this.headers({},e)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/tasks");return await n.json()})}async sessionTaskCancel(t,e,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({kind:n})},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /session/:id/tasks/:taskId/cancel");return await i.json()})}async sessionGoalClear(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/goal/clear`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify({})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/goal/clear");return await n.json()})}async sessionStats(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/stats`,{headers:this.headers({},e)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(t,e,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/${t}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({cwd:n.workspaceCwd})},async i=>{if(!i.ok)throw await this.failOnError(i,`POST /session/:id/${t}`);return await i.json()})}async setSessionApprovalMode(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:e,...(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(t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/rewind/snapshots`,{method:"GET",headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /session/:id/rewind/snapshots");return await e.json()})}async rewindSession(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:e})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/rewind");return await r.json()})}async recapSession(t,e){let n=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(t)}/recap`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}",signal:e==null?void 0:e.signal});if(!n.ok)throw await this.failOnError(n,"POST /session/:id/recap");return await n.json()}async btwSession(t,e,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(t)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:e}),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(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:e}),signal:n==null?void 0:n.signal},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/mid-turn-message");return await r.json()})}async shellCommand(t,e,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(t)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:e}),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(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${encodeURIComponent(t)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:e})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/tools/:name/enable");return await r.json()})}async workspaceSettings(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},t==null?void 0:t.clientId)},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/settings");return await e.json()})}async setWorkspaceSetting(t,e,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:t,key:e,value:n})},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/settings");return await i.json()})}async restartMcpServer(t,e){let n=(e==null?void 0:e.entryIndex)===void 0?"":`?entryIndex=${encodeURIComponent(String(e.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(t)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/restart");return await r.json()},(e==null?void 0:e.timeoutMs)??Th)}async reload(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/reload");return await e.json()},t==null?void 0:t.timeoutMs)}async manageMcpServer(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(t)}/${encodeURIComponent(e)}`,{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)??Th)}async addRuntimeMcpServer(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:JSON.stringify(t)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/mcp/servers");return await n.json()},(e==null?void 0:e.timeoutMs)??Th)}async removeRuntimeMcpServer(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.headers({},e==null?void 0:e.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"DELETE /workspace/mcp/servers/:name");return await n.json()},(e==null?void 0:e.timeoutMs)??Th)}async initWorkspace(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/init`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify((t==null?void 0:t.force)===!0?{force:!0}:{})},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/init");return await e.json()})}async setSessionModel(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:e})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/model");return await r.json()})}async setSessionLanguage(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:e,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(t,e,n,r){n==null||n.throwIfAborted();let i=this.reservePromptSlot(t),s=!0;try{let a=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(t)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(e),signal:n});if(a.status===202){let o=await a.json();s=!1;try{return await this._awaitTurnComplete(t,o.promptId,o.lastEventId,n,r)}finally{i()}}if(!a.ok)throw await this.failOnError(a,"POST /session/:id/prompt",t);return await a.json()}finally{s&&i()}}async promptNonBlocking(t,e,n,r){let i=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(t)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(e),signal:n});if(i.status===202)return await i.json();if(!i.ok)throw await this.failOnError(i,"POST /session/:id/prompt",t);return await i.json()}async _awaitTurnComplete(t,e,n,r,i){let s=new AbortController,a=r?d_([r,s.signal]):s.signal;try{let o=this.subscribeEvents(t,{lastEventId:n,signal:a});for await(let l of o){let c=c3(l,e);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(o){throw r!=null&&r.aborted&&o instanceof DOMException&&o.name==="AbortError"&&this.cancel(t,i).catch(()=>{}),o}finally{s.signal.aborted||s.abort()}}async heartbeat(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/heartbeat`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:"{}"},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/heartbeat");return await n.json()})}async cancel(t,e){await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),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(t,e={}){yield*this.transport.subscribeEvents(t,{lastEventId:e.lastEventId,maxQueued:e.maxQueued,signal:e.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${encodeURIComponent(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(e)},async r=>{var i,s;if(r.status===200){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!0}if(r.status===404){try{await((s=r.body)==null?void 0:s.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /permission/:requestId")})}async respondToSessionPermission(t,e,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/permission/${encodeURIComponent(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(n)},async i=>{var s,a;if(i.status===200){try{await((s=i.body)==null?void 0:s.cancel())}catch{}return!0}if(i.status===404){try{await((a=i.body)==null?void 0:a.cancel())}catch{}return!1}throw await this.failOnError(i,"POST /session/:id/permission/:requestId")})}async closeSession(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.headers({},e)},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(t,e){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e),body:JSON.stringify({sessionIds:t})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async startDeviceFlow(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t.clientId),body:JSON.stringify({providerId:t.providerId})},async e=>{if(e.status!==200&&e.status!==201)throw await this.failOnError(e,"POST /workspace/auth/device-flow");return await e.json()})}async getDeviceFlow(t,e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${encodeURIComponent(t)}`,{headers:this.headers({},e.clientId),signal:e.signal},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/auth/device-flow/:id");return await n.json()})}async cancelDeviceFlow(t,e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.headers({},e.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(t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},t.clientId)},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/status");return await e.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/providers");return await t.json()})}async installAuthProvider(t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(t)},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/auth/provider");return await e.json()})}dispose(){this.transport.dispose()}async updateSessionMetadata(t,e,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(e)},async r=>{if(r.status===200){let i=await r.json();return typeof i.displayName=="string"?{displayName:i.displayName}:{}}throw await this.failOnError(r,"PATCH /session/:id/metadata")})}};function d_(t){let e=AbortSignal.any;if(typeof e=="function")return e.call(AbortSignal,t);let n=new AbortController,r=[],i=()=>{for(;r.length>0;){let s=r.pop();try{s==null||s()}catch{}}};for(let s of t){if(s.aborted)return n.abort(s.reason),i(),n.signal;let a=()=>{n.abort(s.reason),i()};s.addEventListener("abort",a,{once:!0}),r.push(()=>s.removeEventListener("abort",a))}return n.signal.addEventListener("abort",i,{once:!0}),n.signal}function c3(t,e){if(t.type==="turn_complete"){let n=t.data;if(n.promptId===e)return{stopReason:n.stopReason??"end_turn"}}if(t.type==="turn_error"){let n=t.data;if(n.promptId===e)throw Object.assign(new Md(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function vA(t){return"promptId"in t&&"lastEventId"in t}var mm=class wp{constructor(e){ie(this,"client");ie(this,"session");ie(this,"state");ie(this,"replaySnapshot");ie(this,"lastSeenEventId");ie(this,"subscriptionActive",!1);ie(this,"promptLimit");ie(this,"_pendingPrompts",new Map);this.client=e.client,this.session={...e.session},this.state={...e.state??{}},this.replaySnapshot=e.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=pm(e.lastEventId),this.promptLimit=e.maxPendingPromptsPerSession===void 0?e.client.maxPendingPromptsPerSession:gA(e.maxPendingPromptsPerSession)}static async createOrAttach(e,n={},r){let i=await e.createOrAttachSession(n,r),s=!i.attached||n.modelServiceId?0:void 0;return new wp({client:e,session:i,lastEventId:s})}static async load(e,n,r={},i){let{state:s,compactedReplay:a,liveJournal:o,lastEventId:l,...c}=await e.loadSession(n,r,i);return new wp({client:e,session:c,state:s,lastEventId:l??0,replaySnapshot:{compactedReplay:a??[],liveJournal:o??[]}})}static async resume(e,n,r={},i){let{state:s,lastEventId:a,...o}=await e.resumeSession(n,r,i);return new wp({client:e,session:o,state:s,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(e){this.lastSeenEventId=pm(e)}async prompt(e,n){if(n==null||n.throwIfAborted(),!this.subscriptionActive)return await this.client.prompt(this.sessionId,e,n,this.clientId);let r=this.client.reservePromptSlot(this.sessionId,this.promptLimit),i;try{if(i=await this.client.promptNonBlocking(this.sessionId,e,n,this.clientId),!vA(i))return r(),i;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(s){throw r(),s}return new Promise((s,a)=>{let o=()=>{let c=this._pendingPrompts.get(i.promptId);c&&this._pendingPrompts.delete(i.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),c.reject(n.reason??new DOMException("Aborted","AbortError")))},l=()=>n==null?void 0:n.removeEventListener("abort",o);this._pendingPrompts.set(i.promptId,{resolve:c=>{l(),r(),s(c)},reject:c=>{l(),r(),a(c)}}),n!=null&&n.aborted?o():n==null||n.addEventListener("abort",o,{once:!0})})}async cancel(){await this.client.cancel(this.sessionId,this.clientId)}async heartbeat(){return await this.client.heartbeat(this.sessionId,this.clientId)}async setModel(e){return await this.client.setSessionModel(this.sessionId,e,this.clientId)}async getRewindSnapshots(){return await this.client.getRewindSnapshots(this.sessionId)}async rewind(e){return await this.client.rewindSession(this.sessionId,e,{clientId:this.clientId})}async recap(e){return await this.client.recapSession(this.sessionId,{...e!=null&&e.signal?{signal:e.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async btw(e,n){return await this.client.btwSession(this.sessionId,e,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async enqueueMidTurnMessage(e,n){return await this.client.enqueueMidTurnMessage(this.sessionId,e,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async shellCommand(e,n){return await this.client.shellCommand(this.sessionId,e,{...n?{signal:n}:{},...this.clientId?{clientId:this.clientId}:{}})}async context(){return await this.client.sessionContext(this.sessionId,this.clientId)}async contextUsage(e={}){return await this.client.sessionContextUsage(this.sessionId,e,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 cancelTask(e,n){return await this.client.sessionTaskCancel(this.sessionId,e,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(e,n){return await this.client.respondToPermission(e,n,this.clientId)}async respondToSessionPermission(e,n){return await this.client.respondToSessionPermission(this.sessionId,e,n,this.clientId)}async close(){return await this.client.closeSession(this.sessionId,this.clientId)}async updateMetadata(e){return await this.client.updateSessionMetadata(this.sessionId,e,this.clientId)}events(e={}){return this.openEventSubscription(e)}subscribeEvents(e={}){return this.openEventSubscription(e)}openEventSubscription(e){let n=pm(e.lastEventId),r=!1,i=!1,s=()=>{i||(i=!0,this.subscriptionActive=!1)},a=()=>{if(!r){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,r=!0}},o=this.iterateEvents({...e,lastEventId:n},s);return{next:async l=>(i||a(),await o.next(l)),return:async()=>{try{return await o.return(void 0)}finally{s()}},throw:async l=>{try{return await o.throw(l)}finally{s()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(e,n){try{let{resume:r=!0,...i}=e,s=i.lastEventId??(r?this.lastSeenEventId:void 0);for await(let a of this.client.subscribeEvents(this.sessionId,{...i,lastEventId:s}))this._dispatchTurnEvent(a),yield a,a.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,pm(a.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(e){var i;if(e.type!=="turn_complete"&&e.type!=="turn_error")return;let n=(i=e.data)==null?void 0:i.promptId;if(!n)return;let r=this._pendingPrompts.get(n);if(r){this._pendingPrompts.delete(n);try{let s=c3(e,n);s!==void 0&&r.resolve(s)}catch(s){r.reject(s)}}}_rejectAllPending(e){for(let[,n]of this._pendingPrompts)n.reject(e);this._pendingPrompts.clear()}};function pm(t){if(t!==void 0){if(!Number.isInteger(t)||t<0)throw new TypeError("invalid lastEventId");return t}}var xA="mid_turn_message_injected",Hz=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated",xA,"client_evicted","slow_client_warning","stream_error","state_resync_required","mcp_budget_warning","mcp_child_refused_batch","memory_changed","agent_changed","auth_device_flow_started","auth_device_flow_throttled","auth_device_flow_authorized","auth_device_flow_failed","auth_device_flow_cancelled","approval_mode_changed","tool_toggled","settings_changed","workspace_initialized","mcp_server_restarted","mcp_server_restart_refused","settings_reloaded","mcp_server_added","mcp_server_removed","extensions_changed","permission_partial_vote","permission_forbidden","prompt_cancelled","replay_complete","followup_suggestion","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot"];new Set(Hz);var qz=["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"],u3=["plan","default","auto-edit","auto","yolo"],ux="daemon-plan";function et(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ce(t,e){if(!et(t))return;let n=t[e];return typeof n=="string"?n:void 0}function nn(t,e){if(et(t))for(let n of e){let r=t[n];if(typeof r=="string"&&r.trim().length>0)return r}}function Pl(t){if(t===void 0)return"";if(typeof t=="string")return t;try{return JSON.stringify(t,null,2)??String(t)}catch{return String(t)}}function Lo(t){return Pl(ko(t))}function ko(t,e=0){return e>16?"[truncated]":Array.isArray(t)?t.map(n=>ko(n,e+1)):et(t)?Object.fromEntries(Object.entries(t).map(([n,r])=>[n,wA(n)?"[redacted]":ko(r,e+1)])):t}function wA(t){let e=t.toLowerCase().replace(/[^a-z0-9]/g,"");return e==="authorization"||e==="auth"||e==="cookie"||e==="setcookie"||e==="credential"||e==="credentials"||e==="passphrase"||e==="xauthkey"||e.endsWith("password")||e.endsWith("token")||e.endsWith("secret")||e.endsWith("secretkey")||e.endsWith("accesskey")||e.endsWith("apikey")||e.endsWith("privatekey")||e.includes("accesstoken")||e.includes("refreshtoken")||e.includes("bearertoken")||e.includes("personalaccesstoken")}function Sb(t){if(typeof t=="string")return t;if(!et(t))return"";let e=t.text;return typeof e=="string"?e:""}function Fz(t){if(typeof t=="string")return{kind:"text",text:t};if(!et(t))return;let e=t.type;if(e==="text"||e===void 0){let n=t.text;return typeof n=="string"?{kind:"text",text:n}:void 0}if(e==="image"){let n=et(t.source)?t.source:void 0,r,i;return n&&(r=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0),!r&&!i&&(i=typeof t.data=="string"?t.data:void 0,r=typeof t.url=="string"?t.url:void 0),!r&&!i?void 0:{kind:"image",mediaType:(typeof t.mediaType=="string"?t.mediaType:void 0)??(typeof t.mimeType=="string"?t.mimeType:void 0)??(typeof t.media_type=="string"?t.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...r?{url:r}:{},...i?{data:i}:{}}}}if(e==="audio"){let n=et(t.source)?t.source:void 0;if(!n)return;let r=(typeof t.mediaType=="string"?t.mediaType:void 0)??"audio/*",i=typeof n.url=="string"?n.url:void 0,s=typeof n.data=="string"?n.data:void 0;return!i&&!s?void 0:{kind:"audio",mediaType:r,source:{...i?{url:i}:{},...s?{data:s}:{}}}}if(e==="resource"||e==="resource_link"){let n=typeof t.uri=="string"?t.uri:void 0;if(!n)return;let r=typeof t.mediaType=="string"?t.mediaType:void 0,i=typeof t.description=="string"?t.description:void 0;return{kind:"resource",uri:n,...r?{mediaType:r}:{},...i?{description:i}:{}}}}var Vz=64;function mg(t,e=0){if(e>Vz)return"[output truncated]";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>mg(r,e+1)).filter(Boolean).join(`
`);if(!et(t))return t===void 0?"":Pl(t);for(let r of["text","output","stdout","stderr","rawOutput"]){let i=t[r];if(typeof i=="string")return i}let n=t.content;if(n!==void 0){let r=mg(n,e+1);if(r)return r}return Pl(t)}var Gz=new Set(qz),kA=new Set(["qwen","qwen-oauth"]),Wz=new Set(["in_flight","disabled","budget_would_exceed"]),h_=4096;function Kz(t,e={}){let n=Qz(t,e);switch(t.type){case"session_update":return Zz(t,n,e);case"shell_output":{let r=mg(t.data),i=hx(t.data),s=fx(t.data);return r?[{...n,type:s==="user-shell"?"user.shell.output":"shell.output",text:r,...i?{stream:i}:{}}]:[]}case"permission_request":return aP(t,n);case"permission_resolved":case"permission_already_resolved":return oP(t,n);case"model_switched":return[{...n,type:"model.changed",modelId:Ce(t.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Ce(t.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=m_(Ce(t.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:Ce(t.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Ce(t.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Ce(t.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=m_(Ce(t.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:Ce(t.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=Ce(t.data,"code"),i=Ce(t.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...i?{promptId:i}:{},text:Ce(t.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return Yz(t,n);case"prompt_cancelled":{let r=NP(t.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return Xz(t,n);case"user_shell_command":{let r=Ce(t.data,"command"),i=Ce(t.data,"cwd");return r?[{...n,type:"user.shell.command",command:r,...i?{cwd:i}:{}},{...n,type:"user.text.delta",text:`$ ${r}`}]:[]}case"user_shell_result":{let r=Kn(t.data,"exitCode"),i=et(t.data)&&t.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${r??"unknown"}`;return[{...n,type:"status",text:i}]}case"replay_complete":{let r=Kn(t.data,"replayedCount")??0,i=Kn(t.data,"lastReplayedEventId")??Kn(t.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...i!==void 0?{lastReplayedEventId:i}:{}}]}case"session_metadata_updated":return hP(t,n);case"approval_mode_changed":return fP(t,n);case"memory_changed":return mP(t,n);case"agent_changed":return pP(t,n);case"tool_toggled":return gP(t,n);case"settings_changed":return yP(t,n);case"workspace_initialized":return bP(t,n);case"mcp_budget_warning":return vP(t,n);case"mcp_child_refused_batch":return xP(t,n);case"mcp_server_restarted":return wP(t,n);case"mcp_server_restart_refused":return kP(t,n);case"extensions_changed":return _P(t,n);case"auth_device_flow_started":return SP(t,n);case"auth_device_flow_throttled":return TP(t,n);case"auth_device_flow_authorized":return CP(t,n);case"auth_device_flow_failed":return EP(t,n);case"auth_device_flow_cancelled":return MP(t,n);default:return[{...n,type:"debug",text:`${t.type} (unrecognized daemon event): ${Lo(t.data)}`}]}}function Yz(t,e){let n=Ce(t.data,"reason"),r=Kn(t.data,"lastDeliveredId"),i=Kn(t.data,"earliestAvailableId");return!n||r===void 0||i===void 0?lr(t,e,"malformed state_resync_required payload"):[{...e,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:i}]}function Xz(t,e){let n=Ce(t.data,"sessionId"),r=Ce(t.data,"suggestion"),i=Ce(t.data,"promptId");return!n||!r||!i?lr(t,e,"malformed followup_suggestion payload"):[{...e,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:i}]}function Qz(t,e){let n=Jz(t);return{...t.id!==void 0?{eventId:t.id}:{},...n!==void 0?{serverTimestamp:n}:{},...t.originatorClientId?{originatorClientId:t.originatorClientId}:{},...e.includeRawEvent?{rawEvent:{...t,data:ko(t.data)}}:{}}}function Jz(t){let e=t.serverTimestamp;if(typeof e=="number"&&Number.isFinite(e))return e;let n=t._meta;if(et(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(et(t.data)){let r=t.data._meta;if(et(r)){let s=r.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}let i=t.data.update;if(et(i)){let s=i._meta;if(et(s)){let a=s.serverTimestamp;if(typeof a=="number"&&Number.isFinite(a))return a;let o=s.timestamp;if(typeof o=="number"&&Number.isFinite(o))return o}}}}function Zz(t,e,n){let r=lP(t.data);if(!r)return[{...e,type:"debug",text:`session_update: ${Lo(t.data)}`}];let i=Ce(r,"sessionUpdate");switch(i){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&t.originatorClientId===n.clientId)return[];let s=r.content,a=Fz(s);if(a){if(a.kind==="image"){let l=a.source.data,c=a.mediaType||"image/*";if(c==="image/*"&&l){let u=(l.startsWith("data:")?l.split(",")[1]??"":l).slice(0,10);u.startsWith("iVBORw0KGg")?c="image/png":u.startsWith("/9j/")?c="image/jpeg":u.startsWith("R0lGOD")?c="image/gif":u.startsWith("UklGR")&&(c="image/webp")}return l?[{...e,type:"user.image.delta",data:l,mimeType:c}]:[]}return a.kind==="text"?a.text?[{...e,type:"user.text.delta",text:a.text}]:[]:[]}let o=Sb(s);return o?[{...e,type:"user.text.delta",text:o}]:[]}case"agent_message_chunk":{let s=Sb(r.content),a=f_(r),o=[];s&&o.push({...e,type:"assistant.text.delta",text:s,...a?{parentToolCallId:a}:{}});let l=eP(r);return l&&o.push({...e,type:"assistant.usage",usage:l,...a?{parentToolCallId:a}:{}}),o}case"agent_thought_chunk":{let s=Sb(r.content);if(!s)return[];let a=f_(r);return[{...e,type:"thought.text.delta",text:s,...a?{parentToolCallId:a}:{}}]}case"tool_call":case"tool_call_update":return[tP(r,e)];case"shell_output":case"tool_output":{let s=mg(r),a=hx(r)??hx(t.data),o=fx(r)??fx(t.data);return s?[{...e,type:o==="user-shell"?"user.shell.output":"shell.output",text:s,...a?{stream:a}:{}}]:[]}case"available_commands_update":{let s=(Array.isArray(r.availableCommands)?r.availableCommands:[]).filter(et);return[{...e,type:"session.available_commands",count:s.length,commands:s}]}case"plan":return[nP(r,e)];case"current_mode_update":return[];default:return[{...e,type:"debug",text:`${i??"session_update"}: ${Lo(r)}`}]}}function f_(t){let e=et(t._meta)?t._meta:void 0;return e?Ce(e,"parentToolCallId"):void 0}function eP(t){let e=et(t._meta)?t._meta:void 0,n=e&&et(e.usage)?e.usage:void 0;if(!n)return;let r=Kn(n,"inputTokens"),i=Kn(n,"outputTokens");if(r===void 0&&i===void 0)return;let s=Kn(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:i??0,...s!==void 0?{cachedTokens:s}:{}}}function tP(t,e){let n=et(t._meta)?t._meta:void 0,r=Ce(t,"toolName")??Ce(t,"name")??(n?Ce(n,"toolName"):void 0)??(n?Ce(n,"name"):void 0),i=Ce(t,"kind"),s=Ce(t,"title")??r??i,a=t.rawInput??t.input??t.args,o=t.rawOutput??t.output??t.result,l=a!==void 0?ko(a):void 0,c=o!==void 0?ko(o):void 0,u=t.content!==void 0?ko(t.content):void 0,d=t.locations!==void 0?ko(t.locations):void 0,h=Ce(t,"toolCallId"),m=Ce(t,"status");if(!h)return{...e,type:"error",code:"daemon.protocol.tool_update_missing_tool_call_id",recoverable:!0,text:`Tool update missing toolCallId${s?` (${s})`:""}`};let{provenance:p,serverId:b}=sP(t,r),x=Ce(t,"parentToolCallId")??(n?Ce(n,"parentToolCallId"):void 0),g=x&&x!==h?x:void 0,y=Ce(t,"subagentType")??(n?Ce(n,"subagentType"):void 0);return{...e,type:"tool.update",toolCallId:h,...m?{status:m}:{},...s?{title:s}:{},...r?{toolName:r}:{},...i?{toolKind:i}:{},...u!==void 0?{content:u}:{},...d!==void 0?{locations:d}:{},...p?{provenance:p}:{},...b?{serverId:b}:{},...g?{parentToolCallId:g}:{},...y?{subagentType:y}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:dx(Lo(l))}:c!==void 0?{details:dx(Lo(c))}:{}}}function nP(t,e){let n=Array.isArray(t.entries)?t.entries:[],r=dx(rP(n)),i=e.eventId!==void 0?`${ux}-${e.eventId}`:ux,s=et(t._meta)?t._meta:void 0,a=s&&et(s.stats)?s.stats:void 0;return{...e,type:"tool.update",toolCallId:i,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:r}}],rawOutput:a?{entries:n,stats:a}:{entries:n}}}function rP(t){return t.flatMap(e=>{if(!et(e))return[];let n=Ce(e,"content");return n?[`- [${iP(Ce(e,"status"))}] ${n}`]:[]}).join(`
`)}function iP(t){switch(t){case"completed":return"x";case"in_progress":return"-";default:return" "}}function sP(t,e){let n=Ce(t,"provenance"),r=Ce(t,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&r?{serverId:r}:{}};if(e&&e.startsWith("mcp__")){let i=e.slice(5),s=i.indexOf("__");if(s>0)return{provenance:"mcp",serverId:i.slice(0,s)}}return{}}function m_(t){if(t)return Gz.has(t)?t:void 0}function dx(t){return t.length<=h_?t:`${t.slice(0,h_)}... [truncated]`}function aP(t,e){if(!et(t.data))return[{...e,type:"debug",text:`permission_request: ${Lo(t.data)}`}];let n=Ce(t.data,"requestId");if(!n)return[{...e,type:"debug",text:`permission_request: ${Lo(t.data)}`}];let r=t.data.toolCall!==void 0?ko(t.data.toolCall):void 0;return[{...e,type:"permission.request",requestId:n,sessionId:Ce(t.data,"sessionId"),title:dP(r),options:cP(t.data.options),toolCall:r}]}function oP(t,e){let n=Ce(t.data,"requestId");if(!n)return[{...e,type:"debug",text:`${t.type}: ${Lo(t.data)}`}];let r=Ce(t.data,"voterClientId")??e.originatorClientId;return[{...e,type:"permission.resolved",requestId:n,outcome:uP(t.data),...r?{voterClientId:r}:{}}]}function lP(t){if(!et(t))return;let e=t.update;return et(e)?e:t}function cP(t){return Array.isArray(t)?t.flatMap(e=>{if(!et(e))return[];let n=Ce(e,"optionId");return n?[{optionId:n,label:Ce(e,"label")??Ce(e,"title")??Ce(e,"name")??n,...Ce(e,"description")?{description:Ce(e,"description")}:{},raw:e}]:[]}):[]}function uP(t){if(!et(t))return Pl(t);let e=t.outcome;if(typeof e=="string")return e;if(et(e)){let n=Ce(e,"outcome")??"selected",r=Ce(e,"optionId");return r?`${n}:${r}`:n}return nn(t,["status","reason"])??Pl(t)}function dP(t){return et(t)?Ce(t,"title")??Ce(t,"name")??Ce(t,"kind")??Ce(t,"toolName")??"Tool permission":"Tool permission"}function hx(t){let e=Ce(t,"stream");return e==="stdout"||e==="stderr"?e:void 0}function fx(t){if(!et(t))return;let e=Ce(t,"source");if(e)return e;let n=t._meta;return et(n)?Ce(n,"source"):void 0}function lr(t,e,n){return[{...e,type:"debug",text:`${t.type}: ${n}`}]}function hP(t,e){let n=Ce(t.data,"sessionId");if(!n)return lr(t,e,"missing sessionId");let r=Ce(t.data,"displayName");return[{...e,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function fP(t,e){let n=Ce(t.data,"sessionId"),r=Ce(t.data,"previous"),i=Ce(t.data,"next");if(!n||!r||!i)return lr(t,e,"missing sessionId / previous / next");let s=et(t.data)&&typeof t.data.persisted=="boolean"?t.data.persisted:!1;return[{...e,type:"session.approval_mode.changed",sessionId:n,previous:r,next:i,persisted:s}]}function mP(t,e){let n=Ce(t.data,"scope"),r=Ce(t.data,"filePath"),i=Ce(t.data,"mode"),s=Kn(et(t.data)?t.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||i!=="append"&&i!=="replace"||s===void 0?lr(t,e,"malformed memory_changed payload"):[{...e,type:"workspace.memory.changed",scope:n,filePath:r,mode:i,bytesWritten:s}]}function pP(t,e){let n=Ce(t.data,"change"),r=Ce(t.data,"name"),i=Ce(t.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||i!=="project"&&i!=="user"?lr(t,e,"malformed agent_changed payload"):[{...e,type:"workspace.agent.changed",change:n,name:r,level:i}]}function gP(t,e){let n=Ce(t.data,"toolName"),r=et(t.data)&&typeof t.data.enabled=="boolean"?t.data.enabled:void 0;return!n||r===void 0?lr(t,e,"malformed tool_toggled payload"):[{...e,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function yP(t,e){let n=Ce(t.data,"key"),r=Ce(t.data,"scope");return n?[{...e,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:et(t.data)?t.data.value:void 0}]:lr(t,e,"malformed settings_changed payload")}function bP(t,e){let n=Ce(t.data,"path"),r=Ce(t.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?lr(t,e,"malformed workspace_initialized payload"):[{...e,type:"workspace.initialized",path:n,action:r}]}function vP(t,e){if(!et(t.data))return lr(t,e,"non-object payload");let n=Kn(t.data,"liveCount"),r=Kn(t.data,"reservedCount"),i=Kn(t.data,"budget"),s=Kn(t.data,"thresholdRatio"),a=Ce(t.data,"mode");return n===void 0||r===void 0||i===void 0||s===void 0||a!=="warn"&&a!=="enforce"?lr(t,e,"malformed mcp_budget_warning payload"):[{...e,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:i,thresholdRatio:s,mode:a}]}function xP(t,e){if(!et(t.data))return lr(t,e,"non-object payload");let n=Array.isArray(t.data.refusedServers)?t.data.refusedServers.filter(et).map(a=>{let o=Ce(a,"name"),l=Ce(a,"transport"),c=Ce(a,"reason");return!o||!l||c!=="budget_exhausted"?null:{name:o,transport:l,reason:"budget_exhausted"}}).filter(a=>a!==null):[],r=Kn(t.data,"budget"),i=Kn(t.data,"liveCount"),s=Kn(t.data,"reservedCount");return n.length===0||r===void 0||i===void 0||s===void 0?lr(t,e,"malformed mcp_child_refused_batch payload"):[{...e,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:i,reservedCount:s}]}function wP(t,e){let n=Ce(t.data,"serverName"),r=Kn(t.data,"durationMs");return!n||r===void 0?lr(t,e,"malformed mcp_server_restarted payload"):[{...e,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function kP(t,e){let n=Ce(t.data,"serverName"),r=Ce(t.data,"reason");return!n||!r||!Wz.has(r)?lr(t,e,"malformed mcp_server_restart_refused payload"):[{...e,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function _P(t,e){let n=Kn(t.data,"refreshed"),r=Kn(t.data,"failed"),i=Ce(t.data,"status"),s=Ce(t.data,"source"),a=Ce(t.data,"name"),o=Ce(t.data,"version"),l=Ce(t.data,"error");return n===void 0||r===void 0||i!==void 0&&i!=="installed"&&i!=="enabled"&&i!=="disabled"&&i!=="updated"&&i!=="uninstalled"&&i!=="failed"?lr(t,e,"malformed extensions_changed payload"):[{...e,type:"workspace.extensions.changed",refreshed:n,failed:r,...i?{status:i}:{},...s?{source:s}:{},...a?{name:a}:{},...o?{version:o}:{},...l?{error:l}:{}}]}function SP(t,e){let n=Ce(t.data,"deviceFlowId"),r=Ce(t.data,"providerId"),i=Kn(t.data,"expiresAt");return!n||!r||!kA.has(r)||i===void 0?lr(t,e,"malformed auth_device_flow_started payload"):[{...e,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:i}]}function TP(t,e){let n=Ce(t.data,"deviceFlowId"),r=Kn(t.data,"intervalMs");return!n||r===void 0?lr(t,e,"malformed auth_device_flow_throttled payload"):[{...e,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function CP(t,e){let n=Ce(t.data,"deviceFlowId"),r=Ce(t.data,"providerId");if(!n||!r||!kA.has(r))return lr(t,e,"malformed auth_device_flow_authorized payload");let i=Kn(t.data,"expiresAt"),s=Ce(t.data,"accountAlias");return[{...e,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...i!==void 0?{expiresAt:i}:{},...s?{accountAlias:s}:{}}]}function EP(t,e){let n=Ce(t.data,"deviceFlowId"),r=Ce(t.data,"errorKind");if(!n||!AP(r))return lr(t,e,"malformed auth_device_flow_failed payload");let i=Ce(t.data,"hint");return[{...e,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...i?{hint:i}:{}}]}function AP(t){return typeof t=="string"&&t.trim().length>0}function MP(t,e){let n=Ce(t.data,"deviceFlowId");return n?[{...e,type:"auth.device_flow.cancelled",deviceFlowId:n}]:lr(t,e,"malformed auth_device_flow_cancelled payload")}function Kn(t,e){if(!et(t))return;let n=t[e];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function NP(t,e){if(!et(t))return;let n=t[e];return typeof n=="string"&&n.length>0?n:void 0}var DP=8;function pg(t,e={},n=0){if(n>DP){let p=e.title??e.toolName??e.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(et(t)){let p=t.rawInput??t.input??t.args;if(p!==void 0&&p!==t){let b=pg(p,{title:e.title??nn(t,["title"]),toolName:e.toolName??nn(t,["toolName","name"]),toolKind:e.toolKind??nn(t,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let r=LP(t);if(r.length>0)return{kind:"ask_user_question",questions:r};let i=jP(t,e);if(i)return i;let s=$P(t,e);if(s)return s;let a=UP(t,e);if(a)return a;let o=HP(t,e);if(o)return o;let l=IP(t,e);if(l)return l;let c=RP(t,e);if(c)return c;let u=OP(t);if(u)return u;let d=qP(t,e);if(d)return d;let h=FP(t);if(h)return h;if(et(t)){let p=nn(t,["command","cmd"]);if(p){let x=nn(t,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...x?{cwd:x}:{}}}let b=zP(t);if(b.length>0)return{kind:"key_value",rows:b}}let m=e.title??e.toolName??e.toolKind;return{kind:"generic",...m?{summary:m}:{}}}function IP(t,e={}){if(!et(t))return;let n=nn(t,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=nn(t,["oldText","old_text","old_str","oldString"]),i=nn(t,["newText","new_text","new_str","newString"]),s=(e.toolName??"").toLowerCase(),a=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(s)||!!r,o=i===void 0&&a?nn(t,["content"]):void 0,l=i??o,c=nn(t,["patch","diff","unified_diff"]);if(!(!r&&!l&&!c))return{kind:"file_diff",path:n,...r?{oldText:r}:{},...l?{newText:l}:{},...c?{patch:c}:{}}}function RP(t,e){if(!et(t))return;let n=nn(t,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=e.toolName??nn(t,["toolName","name"]),i=r!==void 0&&/read|view|cat/i.test(r),s=t.lineRange??t.line_range??t.range,a;if(Array.isArray(s)&&s.length===2&&typeof s[0]=="number"&&typeof s[1]=="number")a=[s[0],s[1]];else{let o=t.offset,l=t.limit;typeof o=="number"&&typeof l=="number"&&l>0&&(a=[o+1,o+l])}if(!(!i&&!a))return{kind:"file_read",path:n,...a?{range:a}:{}}}function OP(t){if(!et(t))return;let e=nn(t,["url","uri","href"]);if(!e||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))return;let n=nn(t,["method","httpMethod"]);return{kind:"web_fetch",url:e,...n?{method:n}:{}}}function jP(t,e){let n=e.toolName??(et(t)?nn(t,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let r=n.slice(5),i=r.indexOf("__");if(i<=0)return;let s=r.slice(0,i),a=r.slice(i+2),o;if(et(t)){let l=t.arguments??t.args??t;if(et(l)){let c=Object.entries(l).filter(([u])=>u!=="name"&&u!=="toolName").slice(0,1).map(([u,d])=>{let h=typeof d=="string"?d:JSON.stringify(d),m=h.length>60?`${h.slice(0,60)}…`:h;return`${u}=${m}`})[0];c&&(o=c)}}return{kind:"mcp_invocation",serverId:s,toolName:a,...o?{argsSummary:o}:{}}}function LP(t){return!et(t)||!Array.isArray(t.questions)?[]:t.questions.filter(et).map(e=>{let n=nn(e,["header","title","label"]),r=nn(e,["question","prompt","text"])??"Question",i=Array.isArray(e.options)?e.options.filter(et).map(BP):[];return{...n?{header:n}:{},question:r,options:i,raw:e}})}function BP(t){let e=nn(t,["label","title","value"])??"Option",n=nn(t,["description","detail","text"]);return{label:e,...n?{description:n}:{},raw:t}}function zP(t){let e=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[r,i]of n){let s=nn(t,i);s&&e.push({label:r,value:s})}if(e.length>0)return e;for(let[r,i]of Object.entries(t).slice(0,4))i==null||Array.isArray(i)||et(i)||e.push({label:r,value:wA(r)?"[redacted]":Lo(i)});return e}var p_=50,PP=5;function $P(t,e){let n=e.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(e.toolKind??""))||!et(t))return;let r=nn(t,["subagent_type","agent","agentName","agent_name","subagent"]),i=nn(t,["prompt","task","description","instruction","query"]);if(!r&&!i)return;let s=nn(t,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:i??"(no task description)",...s?{parentDelegationId:s}:{}}}function UP(t,e){if(!et(t))return;let n=nn(t,["query","pattern","search","q"]);if(!n)return;let r=e.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(r)||typeof t.resultCount=="number"||Array.isArray(t.results)||Array.isArray(t.matches)))return;let i=typeof t.resultCount=="number"?t.resultCount:typeof t.total=="number"?t.total:Array.isArray(t.results)?t.results.length:Array.isArray(t.matches)?t.matches.length:void 0,s,a=t.results??t.matches;return Array.isArray(a)&&(s=a.slice(0,PP).map(o=>typeof o=="string"?o:et(o)?nn(o,["path","file","name","title","text"])??Pl(o).slice(0,120):String(o)).filter(Boolean),s.length===0&&(s=void 0)),{kind:"search",query:n,...i!==void 0?{resultCount:i}:{},...s?{top:s}:{}}}function HP(t,e){let n=e.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!et(t))return;let r=nn(t,["prompt","description","query"]);if(!r)return;let i=nn(t,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),s=nn(t,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...i?{thumbnailUrl:i}:{},...s?{model:s}:{}}}function qP(t,e){if(!et(t))return;let n=nn(t,["code","snippet","source"]);if(!n)return;let r=nn(t,["language","lang","codeLanguage","syntax"]),i=e.toolName??"",s=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(i);if(!r&&!s)return;let a=nn(t,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...a?{origin:a}:{}}}function FP(t){if(!et(t))return;let e=t.columns,n=t.rows;if(Array.isArray(e)&&Array.isArray(n)){let i=e.filter(a=>typeof a=="string").slice(0,30);if(i.length===0)return;let s=n.slice(0,p_).map(a=>Array.isArray(a)?a.map(o=>typeof o=="string"?o:Pl(o).slice(0,80)):[]);return{kind:"tabular",columns:i,rows:s,...n.length>s.length?{totalRows:n.length}:{}}}let r=t.data??t.records;if(Array.isArray(r)&&r.length>0&&et(r[0])){let i=Object.keys(r[0]).slice(0,30);if(i.length===0)return;let s=r.slice(0,p_).map(a=>{let o=a;return i.map(l=>{let c=o[l];return typeof c=="string"?c:Pl(c).slice(0,80)})});return{kind:"tabular",columns:i,rows:s,...r.length>s.length?{totalRows:r.length}:{}}}}var VP=1e3,Uc="__trimmed_tool_block__",A1="__trimmed_permission_block__",mx=1e5,g_=`
[truncated]
`,GP=16;function WP(t={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:t.now??Date.now(),maxBlocks:t.maxBlocks??VP}}var d3=new Set(["pending","confirming","running","in_progress"]),KP=new Set(["completed","success","failed","error","canceled","cancelled"]),YP=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function XP(t,e,n={}){let r=EA(t,n);m3(r);let i=p3(r,"user",e);return n.images&&n.images.length>0&&(i.images=[...n.images]),qa(r,i),r.activeUserBlockId=i.id,AA(r)}function QP(t,e,n={}){if(e.length===0)return t;let r=EA(t,n);for(let s of e)JP(r,s);let i=AA(r);return Object.freeze(i.blocks),i}function _A(t){let e={};return t.forEach((n,r)=>{e[n.id]=r}),e}function JP(t,e){var n;if(e.eventId!==void 0&&(t.lastEventId=Math.max(t.lastEventId??0,e.eventId)),t.awaitingResync&&!YP.has(e.type)){typeof console<"u"&&((n=console.warn)==null||n.call(console,`[daemon-ui] dropping event \`${e.type}\` while awaitingResync; state may be stale until session reconnect (lastResyncRequired: ${t.lastResyncRequired?JSON.stringify(t.lastResyncRequired):"unknown"})`));return}switch(e.type){case"user.shell.command":t.pendingUserShellCommand={command:e.command,...e.cwd?{cwd:e.cwd}:{}};break;case"user.text.delta":t.activeUserBlockId||(t.lastFollowupSuggestion=void 0),Tb(t,"user","activeUserBlockId",e.text,e);break;case"user.image.delta":{if(t.activeUserBlockId){let r=Us(t,t.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:e.data,mimeType:e.mimeType}])}else{let r=p3(t,"user","");r.images=[{data:e.data,mimeType:e.mimeType}],qa(t,r),t.activeUserBlockId=r.id}break}case"assistant.text.delta":Tb(t,"assistant","activeAssistantBlockId",e.text,e);break;case"assistant.done":m3(t),(e.reason==="cancelled"||e.reason==="error")&&px(t);break;case"assistant.usage":t$(t,e);break;case"thought.text.delta":Tb(t,"thought","activeThoughtBlockId",e.text,e);break;case"tool.update":CA(t,e);break;case"shell.output":r$(t,e);break;case"user.shell.output":i$(t,e);break;case"permission.request":s$(t,e);break;case"permission.resolved":a$(t,e);break;case"model.changed":gg(t,"status",`Model switched: ${e.modelId}`,e);break;case"status":case"debug":case"error":gg(t,e.type,e.text,e);break;case"session.approval_mode.changed":t.approvalMode=e.next;break;case"session.metadata.changed":case"session.available_commands":break;case"session.state_resync_required":ZP(t,e);break;case"prompt.cancelled":px(t),e.reason!=="forward_failed"&&o$(t,e);break;case"followup.suggestion":t.lastFollowupSuggestion={suggestion:e.suggestion,promptId:e.promptId};break}}function ZP(t,e){t.awaitingResync=!0,t.resyncRequiredCount+=1,t.lastResyncRequired={reason:e.reason,lastDeliveredId:e.lastDeliveredId,earliestAvailableId:e.earliestAvailableId},px(t),gg(t,"error",`State resync required: ${e$(e.lastDeliveredId,e.earliestAvailableId)}.`,e)}function e$(t,e){let n=t+1,r=e-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 M1(t,e){let n=Us(t,e);((n==null?void 0:n.kind)==="assistant"||(n==null?void 0:n.kind)==="thought")&&(n.streaming=!1,n.updatedAt=t.now)}function SA(t){M1(t,t.activeAssistantBlockId),t.activeAssistantBlockId=void 0}function t$(t,e){let n=Us(t,t.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let r=n.usage;n.usage={inputTokens:((r==null?void 0:r.inputTokens)??0)+e.usage.inputTokens,outputTokens:((r==null?void 0:r.outputTokens)??0)+e.usage.outputTokens,cachedTokens:((r==null?void 0:r.cachedTokens)??0)+(e.usage.cachedTokens??0)},n.updatedAt=t.now}function TA(t){M1(t,t.activeThoughtBlockId),t.activeThoughtBlockId=void 0}function h3(t,e){M1(t,t.activeAssistantBlockByParent[e]),delete t.activeAssistantBlockByParent[e]}function f3(t,e){M1(t,t.activeThoughtBlockByParent[e]),delete t.activeThoughtBlockByParent[e]}function Tb(t,e,n,r,i){let s=e!=="user"&&"parentToolCallId"in i?i.parentToolCallId:void 0,a=s!=null?e==="assistant"?t.activeAssistantBlockByParent:e==="thought"?t.activeThoughtBlockByParent:void 0:void 0,o=a&&s!=null?a[s]:t[n],l=Us(t,o);if(l&&l.kind===e){l.text=g3(l.text,r),l.updatedAt=t.now,i.eventId!==void 0&&(l.eventId=i.eventId),i.serverTimestamp!==void 0&&(l.serverTimestamp=i.serverTimestamp),(e==="assistant"||e==="thought")&&(l.streaming=!0);return}let c=p3(t,e,r,i.eventId,i.serverTimestamp);(e==="assistant"||e==="thought")&&(c.streaming=!0),e==="thought"&&(c.collapsed=!0),s!=null&&(c.parentToolCallId=s),qa(t,c),a&&s!=null?a[s]=c.id:t[n]=c.id,s!=null?(e==="assistant"&&f3(t,s),e==="thought"&&h3(t,s)):(e!=="user"&&(t.activeUserBlockId=void 0),e!=="assistant"&&SA(t),e!=="thought"&&TA(t))}function m3(t){SA(t);for(let e of Object.keys(t.activeAssistantBlockByParent))h3(t,e);for(let e of Object.keys(t.activeThoughtBlockByParent))f3(t,e);TA(t)}function CA(t,e){let n=t.toolBlockByCallId[e.toolCallId];if(n===Uc){if(l$(e))return delete t.toolBlockByCallId[e.toolCallId],delete t.trimmedToolNotificationByCallId[e.toolCallId],CA(t,e);t.trimmedToolNotificationByCallId[e.toolCallId]||(t.trimmedToolNotificationByCallId[e.toolCallId]=!0,gg(t,"error",`Tool ${e.toolCallId} output trimmed (max blocks reached)`,e,{clearActiveText:!1}));return}let r=Us(t,n);if((r==null?void 0:r.kind)==="tool"){if(e.title!==void 0&&(r.title=e.title),e.status!==void 0&&(r.status=e.status),e.rawInput!==void 0&&(r.preview=pg(e.rawInput,{title:e.title,toolName:e.toolName,toolKind:e.toolKind})),r.updatedAt=t.now,e.eventId!==void 0&&(r.eventId=e.eventId),e.details&&(r.details=e.details),e.content!==void 0&&(r.content=e.content),e.locations!==void 0&&(r.locations=e.locations),e.rawInput!==void 0&&(r.rawInput=e.rawInput),e.rawOutput!==void 0&&(r.rawOutput=e.rawOutput),e.toolName&&(r.toolName=e.toolName),e.toolKind&&(r.toolKind=e.toolKind),e.parentToolCallId&&!r.parentToolCallId&&(r.parentToolCallId=e.parentToolCallId),r.parentToolCallId&&!r.parentBlockId){let a=t.toolBlockByCallId[r.parentToolCallId];a&&a!==Uc&&(r.parentBlockId=a)}e.subagentType&&!r.subagentType&&(r.subagentType=e.subagentType),y_(t,e.toolCallId,e.status);return}let i=e.parentToolCallId&&t.toolBlockByCallId[e.parentToolCallId]!==Uc?t.toolBlockByCallId[e.parentToolCallId]:void 0,s={id:Jl(t,"tool"),kind:"tool",toolCallId:e.toolCallId,title:e.title??e.toolName??e.toolKind??"Tool",status:e.status??"pending",preview:pg(e.rawInput,{title:e.title,toolName:e.toolName,toolKind:e.toolKind}),clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...e.eventId!==void 0?{eventId:e.eventId}:{},...e.serverTimestamp!==void 0?{serverTimestamp:e.serverTimestamp}:{},...e.details?{details:e.details}:{},...e.content!==void 0?{content:e.content}:{},...e.locations!==void 0?{locations:e.locations}:{},...e.rawInput!==void 0?{rawInput:e.rawInput}:{},...e.rawOutput!==void 0?{rawOutput:e.rawOutput}:{},...e.toolName?{toolName:e.toolName}:{},...e.toolKind?{toolKind:e.toolKind}:{},...e.parentToolCallId?{parentToolCallId:e.parentToolCallId}:{},...e.subagentType?{subagentType:e.subagentType}:{},...i?{parentBlockId:i}:{}};qa(t,s),t.toolBlockByCallId[e.toolCallId]=s.id;for(let a of t.blocks)if(a.kind==="tool"&&a.parentToolCallId===e.toolCallId&&!a.parentBlockId){let o=Us(t,a.id);(o==null?void 0:o.kind)==="tool"&&(o.parentBlockId=s.id)}y_(t,e.toolCallId,e.status??"pending"),lu(t,e.parentToolCallId)}function y_(t,e,n){if(n!==void 0){if(d3.has(n)){t.currentToolCallId=e;return}if(KP.has(n)){t.currentToolCallId===e&&(t.currentToolCallId=n$(t));return}}}function n$(t){for(let e=t.blocks.length-1;e>=0;e-=1){let n=t.blocks[e];if((n==null?void 0:n.kind)==="tool"&&d3.has(n.status))return n.toolCallId}}function px(t){for(let e of Object.values(t.toolBlockByCallId)){if(e===Uc)continue;let n=Us(t,e);!n||n.kind!=="tool"||d3.has(n.status)&&(n.status="cancelled",n.updatedAt=t.now)}t.currentToolCallId=void 0}function r$(t,e){if(!e.text)return;let n=t.blocks[t.blocks.length-1];if((n==null?void 0:n.kind)==="shell"&&n.stream===e.stream){let i=Us(t,n.id);(i==null?void 0:i.kind)==="shell"&&(i.text=g3(i.text,e.text),i.updatedAt=t.now,e.eventId!==void 0&&(i.eventId=e.eventId));return}let r={id:Jl(t,"shell"),kind:"shell",text:C0(e.text),clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...e.eventId!==void 0?{eventId:e.eventId}:{},...e.serverTimestamp!==void 0?{serverTimestamp:e.serverTimestamp}:{},...e.stream?{stream:e.stream}:{}};qa(t,r),lu(t)}function i$(t,e){if(!e.text)return;let n=t.blocks[t.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===e.stream&&!t.pendingUserShellCommand){let a=Us(t,n.id);(a==null?void 0:a.kind)==="user_shell"&&(a.text=g3(a.text,e.text),a.updatedAt=t.now,e.eventId!==void 0&&(a.eventId=e.eventId));return}let r=t.pendingUserShellCommand,i=(n==null?void 0:n.kind)==="user_shell"?n:void 0,s={id:Jl(t,"user-shell"),kind:"user_shell",text:C0(e.text),command:(r==null?void 0:r.command)??(i==null?void 0:i.command)??"",...r!=null&&r.cwd||i!=null&&i.cwd?{cwd:(r==null?void 0:r.cwd)??(i==null?void 0:i.cwd)}:{},clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...e.eventId!==void 0?{eventId:e.eventId}:{},...e.serverTimestamp!==void 0?{serverTimestamp:e.serverTimestamp}:{},...e.stream?{stream:e.stream}:{}};t.pendingUserShellCommand=void 0,qa(t,s),lu(t)}function s$(t,e){let n=t.permissionBlockByRequestId[e.requestId];if(n===A1)return;let r=Us(t,n),i=pg(e.toolCall,{title:e.title});if((r==null?void 0:r.kind)==="permission"){r.title=e.title,r.options=e.options.map(a=>({...a})),r.toolCall=e.toolCall,r.preview=i,r.updatedAt=t.now,e.eventId!==void 0&&(r.eventId=e.eventId);return}let s={id:Jl(t,"permission"),kind:"permission",requestId:e.requestId,title:e.title,options:e.options.map(a=>({...a})),preview:i,clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...e.eventId!==void 0?{eventId:e.eventId}:{},...e.serverTimestamp!==void 0?{serverTimestamp:e.serverTimestamp}:{},...e.sessionId?{sessionId:e.sessionId}:{},...e.toolCall!==void 0?{toolCall:e.toolCall}:{}};qa(t,s),t.permissionBlockByRequestId[e.requestId]=s.id,lu(t)}function a$(t,e){let n=t.permissionBlockByRequestId[e.requestId];if(n===void 0||n===A1)return;let r=Us(t,n);if((r==null?void 0:r.kind)==="permission"){r.resolved=e.outcome,r.updatedAt=t.now,e.eventId!==void 0&&(r.eventId=e.eventId);return}let i={id:Jl(t,"permission"),kind:"permission",requestId:e.requestId,title:`Permission resolved: ${e.requestId}`,options:[],preview:{kind:"generic",summary:e.outcome},resolved:e.outcome,clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...e.eventId!==void 0?{eventId:e.eventId}:{},...e.serverTimestamp!==void 0?{serverTimestamp:e.serverTimestamp}:{}};qa(t,i),t.permissionBlockByRequestId[e.requestId]=i.id,lu(t)}function gg(t,e,n,r,i={}){let s={id:Jl(t,e),kind:e,text:C0(n),clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.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}:{}};qa(t,s),i.clearActiveText!==!1&&lu(t)}function o$(t,e){let n={id:Jl(t,"prompt_cancelled"),kind:"prompt_cancelled",clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...e.reason?{reason:e.reason}:{},...e.eventId!==void 0?{eventId:e.eventId}:{},...e.serverTimestamp!==void 0?{serverTimestamp:e.serverTimestamp}:{}};qa(t,n),lu(t)}function p3(t,e,n,r,i){return{id:Jl(t,e),kind:e,text:C0(n),clientReceivedAt:t.now,createdAt:t.now,updatedAt:t.now,...r!==void 0?{eventId:r}:{},...i!==void 0?{serverTimestamp:i}:{}}}function EA(t,e){return{...t,now:e.now??Date.now(),maxBlocks:e.maxBlocks??t.maxBlocks,blocks:t.blocks,blockIndexById:t.blockIndexById,toolBlockByCallId:{...t.toolBlockByCallId},activeAssistantBlockByParent:{...t.activeAssistantBlockByParent},activeThoughtBlockByParent:{...t.activeThoughtBlockByParent},trimmedToolNotificationByCallId:{...t.trimmedToolNotificationByCallId},permissionBlockByRequestId:{...t.permissionBlockByRequestId},toolProgress:Object.fromEntries(Object.entries(t.toolProgress).map(([n,r])=>[n,{...r}])),lastResyncRequired:t.lastResyncRequired!==void 0?{...t.lastResyncRequired}:void 0,lastFollowupSuggestion:t.lastFollowupSuggestion}}function AA(t){if(t.blocks.length<=t.maxBlocks)return t;let e=t.blocks.slice(-t.maxBlocks),n=new Set(e.map(r=>r.id));t.blocks=e,t.blockIndexById=_A(e),gx.set(t,t.blocks);for(let[r,i]of Object.entries(t.toolBlockByCallId))n.has(i)||(t.toolBlockByCallId[r]=Uc);u$(t);for(let[r]of Object.entries(t.trimmedToolNotificationByCallId))t.toolBlockByCallId[r]!==Uc&&delete t.trimmedToolNotificationByCallId[r];for(let[r,i]of Object.entries(t.permissionBlockByRequestId))n.has(i)||(t.permissionBlockByRequestId[r]=A1);d$(t);for(let r of t.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let i=Us(t,r.id);(i==null?void 0:i.kind)==="tool"&&(i.parentBlockId=void 0)}n.has(t.activeUserBlockId??"")||(t.activeUserBlockId=void 0),n.has(t.activeAssistantBlockId??"")||(t.activeAssistantBlockId=void 0),n.has(t.activeThoughtBlockId??"")||(t.activeThoughtBlockId=void 0);for(let[r,i]of Object.entries(t.activeAssistantBlockByParent))n.has(i)||delete t.activeAssistantBlockByParent[r];for(let[r,i]of Object.entries(t.activeThoughtBlockByParent))n.has(i)||delete t.activeThoughtBlockByParent[r];return t}function l$(t){return t.toolCallId===ux||t.toolKind==="updated_plan"}var gx=new WeakMap;function MA(t){gx.get(t)!==t.blocks&&(t.blocks=[...t.blocks],t.blockIndexById={...t.blockIndexById},gx.set(t,t.blocks))}function qa(t,e){MA(t),t.blockIndexById[e.id]=t.blocks.length,t.blocks.push(e)}function Us(t,e){if(!e)return;let n=t.blockIndexById[e];if(n===void 0)return;let r=t.blocks[n];if(!r||r.id!==e)return;let i=c$(r);return MA(t),t.blocks[n]=i,i}function c$(t){return t.kind==="permission"?{...t,options:t.options.map(e=>Ta(e)),toolCall:Ta(t.toolCall),preview:Ta(t.preview)}:t.kind==="tool"?{...t,preview:Ta(t.preview),content:Ta(t.content),locations:Ta(t.locations),rawInput:Ta(t.rawInput),rawOutput:Ta(t.rawOutput)}:{...t}}function Jl(t,e){let n=`${e}-${t.nextOrdinal}`;return t.nextOrdinal+=1,n}function lu(t,e){e?(h3(t,e),f3(t,e)):(m3(t),t.activeUserBlockId=void 0)}function g3(t,e){return t.length>=mx?t:C0(t+e)}function C0(t){if(t.length<=mx)return t;let e=Math.max(0,mx-g_.length);return`${t.slice(0,e)}${g_}`}function u$(t){let e=Math.max(0,t.maxBlocks),n=Object.entries(t.toolBlockByCallId).filter(([,i])=>i===Uc).map(([i])=>i),r=n.length-e;if(!(r<=0))for(let i of n.slice(0,r))delete t.toolBlockByCallId[i],delete t.trimmedToolNotificationByCallId[i]}function d$(t){let e=Math.max(0,t.maxBlocks),n=Object.entries(t.permissionBlockByRequestId).filter(([,i])=>i===A1).map(([i])=>i),r=n.length-e;if(!(r<=0))for(let i of n.slice(0,r))delete t.permissionBlockByRequestId[i]}function Ta(t,e=0){return e>GP?t:Array.isArray(t)?t.map(n=>Ta(n,e+1)):et(t)?Object.fromEntries(Object.entries(t).map(([n,r])=>[n,Ta(r,e+1)])):t}function h$(t={}){let e=b_(t),n=new Set,r=!1,i=()=>{for(let a of n)try{a()}catch(o){f$(o)}},s=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,i()}))};return{getSnapshot(){return e},subscribe(a){return n.add(a),()=>{n.delete(a)}},dispatch(a){let o=Array.isArray(a)?a:[a];o.length!==0&&(e=QP(e,o),s())},appendLocalUserMessage(a,o){e=XP(e,a,{images:o}),s()},reset(a={}){e=b_({maxBlocks:a.maxBlocks??e.maxBlocks,...a}),s()},clearAwaitingResync(){e.awaitingResync&&(e={...e,awaitingResync:!1},s())},clearFollowupSuggestion(){e.lastFollowupSuggestion!==void 0&&(e={...e,lastFollowupSuggestion:void 0},s())}}}function f$(t){var r;let e=globalThis.reportError;if(typeof e=="function"){e(t);return}let n=(r=globalThis.console)==null?void 0:r.error;typeof n=="function"&&n.call(globalThis.console,t)}function b_(t){let e=t.blocks?[...t.blocks]:[];return{...WP({maxBlocks:t.maxBlocks,now:t.now}),...t,blocks:e,blockIndexById:_A(e),toolBlockByCallId:{...t.toolBlockByCallId??{}},trimmedToolNotificationByCallId:{...t.trimmedToolNotificationByCallId??{}},permissionBlockByRequestId:{...t.permissionBlockByRequestId??{}},toolProgress:{...t.toolProgress??{}},activeAssistantBlockByParent:{...t.activeAssistantBlockByParent??{}},activeThoughtBlockByParent:{...t.activeThoughtBlockByParent??{}},lastResyncRequired:t.lastResyncRequired!==void 0?{...t.lastResyncRequired}:void 0,lastFollowupSuggestion:t.lastFollowupSuggestion!==void 0?{...t.lastFollowupSuggestion}:void 0}}var m$="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function p$(t){var e;if(!t)return{models:[]};const n=new Set,r=[];let i=(e=t.current)==null?void 0:e.modelId,s;for(const a of t.providers)for(const o of a.models){!i&&o.isCurrent&&(i=o.modelId),s===void 0&&(o.isCurrent||o.modelId===i)&&(s=o.contextLimit);const l=[a.authType,o.modelId,o.baseUrl??"",o.envKey??""].join("\0");n.has(l)||(n.add(l),r.push({id:o.modelId,baseModelId:o.baseModelId,label:o.name||o.modelId,authType:a.authType,...o.contextLimit!==void 0?{contextWindow:o.contextLimit}:{},...o.modalities!==void 0?{modalities:o.modalities}:{},...o.baseUrl!==void 0?{baseUrl:o.baseUrl}:{},...o.envKey!==void 0?{envKey:o.envKey}:{},...o.isRuntime?{isRuntime:!0}:{}}))}return{models:r,currentModel:i,contextWindow:s}}function NA(t){if(!t)return{commands:[],skills:[]};const e=t.availableCommands.map(r=>{var i;return{name:r.name,description:r.description||"",...(i=r.input)!=null&&i.hint?{argumentHint:r.input.hint}:{},...RA(r._meta),raw:r}}),n=t.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:DA(e,n),skills:t.availableSkills}}function DA(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);i?e.set(r.name,{...i,...r,description:r.description||i.description,argumentHint:r.argumentHint??i.argumentHint,raw:r.raw}):e.set(r.name,r)}return[...e.values()]}function g$(t,e){var n;if(t.type==="session_update"){const r=Zi((n=Zi(t.data))==null?void 0:n.update),i=IA(r);if(i&&e(s=>({...s,tokenUsage:i,tokenCount:y3(i)})),Is(r,"sessionUpdate")==="available_commands_update"){const{commands:s,skills:a}=x$(r);e(o=>({...o,commands:s.length>0?s:o.commands,skills:a}))}return}switch(t.type){case"session_metadata_updated":{const r=Zi(t.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&e(i=>({...i,displayName:Is(r,"displayName")}));break}case"model_switched":{const r=Is(Zi(t.data),"modelId");r&&e(i=>({...i,currentModel:r}));break}case"approval_mode_changed":{const r=Zi(t.data),i=Is(r,"next")??Is(r,"mode");i&&e(s=>({...s,currentMode:i}));break}}}function y$(t){const e=Is(t,"displayName");return e!=null&&e.trim()?e:void 0}function b$(t){var e;const n=Zi((e=t==null?void 0:t.state)==null?void 0:e.modes);return Is(n,"currentModeId")??Is(n,"currentMode")}function y3(t){const e=(t==null?void 0:t.inputTokens)??(t==null?void 0:t.totalTokens);if(e!==void 0&&e>0)return e;if(!t)return;const n=Object.values(t).reduce((r,i)=>r+(typeof i=="number"?i:0),0);return n>0?n:void 0}function v$(t){var e;for(let n=t.length-1;n>=0;n--)try{const r=t[n];if(r.type!=="session_update")continue;const i=Zi((e=Zi(r.data))==null?void 0:e.update),s=IA(i);if(s)return s}catch{}}function IA(t){const e=Zi(t==null?void 0:t._meta);if((e==null?void 0:e.parentToolCallId)!==void 0)return;const n=Zi(e==null?void 0:e.usage),r={...Ch(n,"inputTokens"),...Ch(n,"outputTokens"),...Ch(n,"totalTokens"),...Ch(n,"thoughtTokens"),...Ch(n,"cachedReadTokens")};return y3(r)!==void 0?r:void 0}function Ch(t,e){const n=w$(t,e);return n!==void 0&&n>=0?{[e]:n}:{}}function x$(t){if(!t)return{commands:[],skills:[]};const n=(Array.isArray(t.availableCommands)?t.availableCommands:[]).flatMap(s=>{var a;const o=Zi(s),l=Is(o,"name");if(!l)return[];const c=Zi(o==null?void 0:o.input),u={name:l,description:Is(o,"description")??"",input:c?{hint:Is(c,"hint")??""}:null,_meta:Zi(o==null?void 0:o._meta)??null};return[{name:l,description:u.description??"",...(a=u.input)!=null&&a.hint?{argumentHint:u.input.hint}:{},...RA(u._meta),raw:u}]}),r=Array.isArray(t.availableSkills)?t.availableSkills.filter(s=>typeof s=="string"):[],i=r.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:DA(n,i),skills:r}}function RA(t){const n=Is(t??void 0,"source");return{...n?{source:n}:{}}}function Zi(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function Is(t,e){const n=t==null?void 0:t[e];return typeof n=="string"&&n.length>0?n:void 0}function w$(t,e){const n=t==null?void 0:t[e];return typeof n=="number"&&Number.isFinite(n)?n:void 0}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function k$(t,e=[]){const n=[{type:"text",text:t}];for(const r of e){const i=r.mimeType??r.mediaType??r.media_type;i&&i!=="image/*"?n.push({type:"image",data:r.data,mimeType:i}):n.push({type:"image",data:r.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const _$=3e4;function S$(t,e,n){const r=Number.isFinite(e)&&e>0?e:1e3,i=Number.isFinite(n)&&n>0?Math.max(r,n):r,s=r*2**Math.max(0,t-1),a=Math.min(s,i),o=.8+Math.random()*.4;return Math.min(i,Math.max(1,Math.round(a*o)))}async function Ye(t,e,n=_$){let r;try{return await Promise.race([t,new Promise((i,s)=>{r=setTimeout(()=>{s(new Error(`${e} after ${n}ms`))},n)})])}finally{r!==void 0&&clearTimeout(r)}}function T$(t,e){return t<=0||e.aborted?Promise.resolve():new Promise(n=>{const r=setTimeout(i,t);function i(){clearTimeout(r),e.removeEventListener("abort",i),n()}e.addEventListener("abort",i,{once:!0})})}function Br(t){t.current!==void 0&&(clearTimeout(t.current),t.current=void 0)}function C$(t,e,n="replay",r=80,i){Br(e),e.current=setTimeout(()=>{e.current=void 0,t.getSnapshot().activeAssistantBlockId&&(t.dispatch({type:"assistant.done",reason:n}),i==null||i())},r)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function E$({store:t,sessionRef:e,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:i,pendingSessionLoadIdRef:s,heartbeatSupportedRef:a,passiveAssistantDoneTimerRef:o,addNotice:l,setConnection:c,setPromptStatus:u,setRestoreSessionId:d,setRestoreMode:h,setRestoreSessionNonce:m,setNewSessionNonce:p}){function b(x,g){const y=s.current+1;s.current=y,i.current&&(clearTimeout(i.current.timeout),i.current.reject(new DOMException(`Session ${g} superseded by a newer request`,"AbortError")));const w=new Promise((C,E)=>{const S=setTimeout(()=>{var T;((T=i.current)==null?void 0:T.id)===y&&(i.current=void 0,E(Pn(l,`${D$(g)} session failed`,new Error(`Session ${g} timed out`),g==="load"?"load_session":"resume_session")))},3e4);i.current={id:y,sessionId:x,mode:g,timeout:S,resolve:C,reject:E}});return u("idle"),r.current.clear(),Br(o),t.reset(),h(g),d(x),m(C=>C+1),w}return{async sendPrompt(x,g){var y,w,C,E;const S=hr(l,e.current,"Prompt failed","send_prompt"),T=S.sessionId;if(n.current.has(T))throw Pn(l,"Prompt failed","A prompt is already in progress","send_prompt");Br(o),u("waiting");const O=new AbortController;n.current.set(T,{controller:O});try{const z=((g==null?void 0:g.images)??[]).map(N=>({data:N.data,mimeType:N.mimeType||N.mediaType||N.media_type||"image/*"}));(g==null?void 0:g.optimisticUserMessage)!==!1&&t.appendLocalUserMessage(x,z);const I={prompt:k$(x,z)};g!=null&&g.retry&&(I.retry=!0);const j=await S.prompt(I,O.signal);return vA(j)?await A$(n.current,r.current,T,O,j.promptId):(((y=e.current)==null?void 0:y.sessionId)===T&&t.dispatch({type:"assistant.done",reason:j.stopReason}),j)}catch(z){if(bx(z))return((w=e.current)==null?void 0:w.sessionId)===T&&t.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw((C=e.current)==null?void 0:C.sessionId)===T&&t.dispatch({type:"assistant.done",reason:"error"}),yA(z)?z:Pn(l,"Prompt failed",z,"send_prompt")}finally{const z=n.current.get(T);(z==null?void 0:z.controller)===O&&n.current.delete(T),((E=e.current)==null?void 0:E.sessionId)===T&&!n.current.has(T)&&u("idle")}},async cancel(){var x,g;const y=hr(l,e.current,"Cancel failed","cancel_prompt"),w=n.current.get(y.sessionId);w==null||w.controller.abort(),Br(o);const C=w?new AbortController:void 0;C&&n.current.set(y.sessionId,{controller:C});try{await Ye(y.cancel(),"Cancel timed out")}catch(E){throw Pn(l,"Cancel failed",E,"cancel_prompt")}finally{C&&((x=n.current.get(y.sessionId))==null?void 0:x.controller)===C&&n.current.delete(y.sessionId),((g=e.current)==null?void 0:g.sessionId)===y.sessionId&&!n.current.has(y.sessionId)&&u("idle")}},async setModel(x){const g=hr(l,e.current,"Set model failed","switch_model");try{const y=await Ye(g.setModel(x),"Set model timed out");return c(w=>({...w,currentModel:x})),y}catch(y){throw Pn(l,"Set model failed",y,"switch_model")}},async setApprovalMode(x,g){const y=hr(l,e.current,"Set approval mode failed","set_approval_mode");try{const w=await Ye(y.client.setSessionApprovalMode(y.sessionId,x,{persist:g==null?void 0:g.persist,clientId:y.clientId}),"Set approval mode timed out");return c(C=>({...C,currentMode:w.mode||x})),w}catch(w){throw Pn(l,"Set approval mode failed",w,"set_approval_mode")}},async respondToPermission(x,g){const y=hr(l,e.current,"Permission response failed","submit_permission");try{return await Ye(y.respondToSessionPermission(x,g),"Permission response timed out")}catch(w){throw Pn(l,"Permission response failed",w,"submit_permission")}},async submitPermission(x,g,y){const w=hr(l,e.current,"Permission response failed","submit_permission"),C=g!==void 0&&g.length>0?{outcome:{outcome:"selected",optionId:g},...y?{answers:y}:{}}:{outcome:{outcome:"cancelled"},...y?{answers:y}:{}};try{return await Ye(w.respondToSessionPermission(x,C),"Permission response timed out")}catch(E){throw Pn(l,"Permission response failed",E,"submit_permission")}},async heartbeat(){const x=e.current;if(!(!x||!a.current))return Ye(x.heartbeat(),"Heartbeat timed out")},async listSessions(){const x=e.current;if(!x)return[];try{return await Ye(x.client.listWorkspaceSessions(x.workspaceCwd),"List sessions timed out")}catch(g){throw Pn(l,"List sessions failed",g,"list_sessions")}},async loadSession(x){return b(x,"load")},async resumeSession(x){return b(x,"resume")},async newSession(){for(const[,x]of n.current)x.controller.abort();n.current.clear(),r.current.clear(),u("idle"),Br(o),i.current&&(clearTimeout(i.current.timeout),i.current.reject(new DOMException("New session requested","AbortError")),i.current=void 0),t.reset(),d(void 0),p(x=>x+1)},async releaseSession(x){try{const g=hr(l,e.current,"Release session failed","release_session");await Ye(g.client.closeSession(x),"Release session timed out")}catch(g){throw Pn(l,"Release session failed",g,"release_session")}},async closeSession(){const x=hr(l,e.current,"Close session failed","close_session");try{await Ye(x.close(),"Close session timed out")}catch(g){throw Pn(l,"Close session failed",g,"close_session")}},async refreshCommands(){const x=hr(l,e.current,"Refresh commands failed","refresh_commands");try{const g=await Ye(x.supportedCommands(),"Refresh commands timed out"),{commands:y,skills:w}=NA(g);c(C=>({...C,commands:y,skills:w,supportedCommands:g}))}catch(g){throw Pn(l,"Refresh commands failed",g,"refresh_commands")}},async getContext(){const x=hr(l,e.current,"Load context failed","load_context");try{const g=await Ye(x.context(),"Load context timed out");return c(y=>({...y,context:g,currentMode:M$(g)??y.currentMode})),g}catch(g){throw Pn(l,"Load context failed",g,"load_context")}},async getContextUsage(x){const g=hr(l,e.current,"Load context usage failed","load_context_usage");try{return await Ye(g.contextUsage(x),"Load context usage timed out")}catch(y){throw Pn(l,"Load context usage failed",y,"load_context_usage")}},async renameSession(x){const g=hr(l,e.current,"Rename session failed","rename_session");try{return await Ye(g.updateMetadata({displayName:x}),"Rename session timed out")}catch(y){throw Pn(l,"Rename session failed",y,"rename_session")}},async recapSession(){const x=hr(l,e.current,"Recap session failed","recap_session");try{return await Ye(x.recap(),"Recap session timed out")}catch(g){throw Pn(l,"Recap session failed",g,"recap_session")}},async btwSession(x,g){var y;const w=hr(l,e.current,"Side question failed","btw_session");try{return await Ye(w.btw(x,g),"Side question timed out")}catch(C){throw(y=g==null?void 0:g.signal)!=null&&y.aborted||bx(C)?C:Pn(l,"Side question failed",C,"btw_session")}},async enqueueMidTurnMessage(x,g){const y=e.current;if(!y)return{accepted:!1};try{return await y.enqueueMidTurnMessage(x,g)}catch(w){return w instanceof DOMException&&w.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",w),{accepted:!1}}},async sendShellCommand(x){var g,y;const w=hr(l,e.current,"Shell command failed","send_shell_command"),C=`${w.sessionId}:shell`;u("waiting");const E=new AbortController;n.current.set(C,{controller:E});try{return await w.shellCommand(x,E.signal)}catch(S){throw Pn(l,"Shell command failed",S,"send_shell_command")}finally{((g=n.current.get(C))==null?void 0:g.controller)===E&&n.current.delete(C),((y=e.current)==null?void 0:y.sessionId)===w.sessionId&&u("idle")}},async getTasks(){const x=hr(l,e.current,"Get tasks failed","load_tasks");try{return await Ye(x.tasks(),"Get tasks timed out")}catch(g){throw Pn(l,"Get tasks failed",g,"load_tasks")}},async cancelTask(x,g){const y=hr(l,e.current,"Cancel task failed","cancel_task");try{return await Ye(y.cancelTask(x,g),"Cancel task timed out")}catch(w){throw Pn(l,"Cancel task failed",w,"cancel_task")}},async clearGoal(){const x=hr(l,e.current,"Clear goal failed","clear_goal");try{return await Ye(x.clearGoal(),"Clear goal timed out")}catch(g){throw Pn(l,"Clear goal failed",g,"clear_goal")}},async getStats(){const x=hr(l,e.current,"Load stats failed","load_stats");try{return await Ye(x.stats(),"Load stats timed out")}catch(g){throw Pn(l,"Load stats failed",g,"load_stats")}},async respondToGlobalPermission(x,g){const y=hr(l,e.current,"Global permission response failed","submit_permission");try{return await Ye(y.client.respondToPermission(x,g),"Global permission response timed out")}catch(w){throw Pn(l,"Global permission response failed",w,"submit_permission")}}}}function A$(t,e,n,r,i){return new Promise((s,a)=>{const o=yx(n,i),l=e.get(o);if(l){e.delete(o),l.status==="resolved"?s(l.result):a(l.error);return}const c=t.get(n);if((c==null?void 0:c.controller)!==r){a(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==i){a(new Error(`Prompt accepted with unexpected id ${i}`));return}if(r.signal.aborted){t.delete(n),a(r.signal.reason??new DOMException("Aborted","AbortError"));return}const u=()=>{r.signal.removeEventListener("abort",d)},d=()=>{const h=t.get(n);(h==null?void 0:h.controller)===r&&t.delete(n),u(),a(r.signal.reason??new DOMException("Aborted","AbortError"))};t.set(n,{...c,promptId:i,resolve:h=>{u(),s(h)},reject:h=>{u(),a(h)}}),r.signal.addEventListener("abort",d,{once:!0})})}function yx(t,e){return JSON.stringify([t,e])}function M$(t){const e=typeof t.state.modes=="object"&&t.state.modes!==null?t.state.modes:void 0,n=(e==null?void 0:e.currentModeId)??(e==null?void 0:e.currentMode);return typeof n=="string"?n:void 0}function hr(t,e,n,r){if(!e)throw Pn(t,n,"Daemon session is not connected",r);return e}function Pn(t,e,n,r){if(bx(n)){if(n instanceof Error)return n;const s=n instanceof DOMException?n.message:"Aborted",a=new Error(s);return a.name="AbortError",a}const i=n instanceof Error?n.message:String(n);return t({severity:"error",category:"user_action",operation:r,code:`daemon.${r}.failed`,message:`${e}: ${i}`,debugMessage:i,recoverable:!0}),N$(n instanceof Error?n:new Error(i))}function bx(t){return t instanceof DOMException&&t.name==="AbortError"||t instanceof Error&&t.name==="AbortError"}function N$(t){return Object.assign(t,{_alreadyDispatched:!0})}function D$(t){return t.charAt(0).toUpperCase()+t.slice(1)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const I$="qwen-code-webui-client-id:session:";function v_(t,e){if(t)return t;if(typeof window>"u")return Cb();try{if(e){const n=window.sessionStorage.getItem(OA(e));if(n)return n}return Cb()}catch{return Cb()}}function R$(t,e){if(!(!t||!e||typeof window>"u"))try{window.sessionStorage.setItem(OA(e),t)}catch{}}async function x_(t){if(!t.clientId)return;const e={"X-Qwen-Client-Id":t.clientId};t.token&&(e.Authorization=`Bearer ${t.token}`);const n=`${O$(t.baseUrl)}/session/${encodeURIComponent(t.sessionId)}/detach`,r=await fetch(n,{method:"POST",headers:e,keepalive:!0});if(!(r.status===204||r.status===404))throw new Error(`Detach client failed (${r.status})`)}function Cb(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function OA(t){return`${I$}${encodeURIComponent(t)}`}function O$(t){let e=t.length;for(;e>0&&t.charCodeAt(e-1)===47;)e-=1;return e===t.length?t:t.slice(0,e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const j$=33e4;function L$({getClient:t,getWorkspaceCwd:e,baseUrl:n,token:r}){return{async listSessions(){const i=Et(t,"List sessions failed"),s=e();return s?Ye(i.listWorkspaceSessions(s),"List sessions timed out"):[]},async deleteSession(i){const s=Et(t,"Delete session failed"),a=await Ye(s.deleteSessionsData([i]),"Delete session timed out");if(a.errors.length>0)throw new Error(a.errors[0].error);return a.removed.length>0||a.notFound.length>0},async deleteSessions(i){const s=Et(t,"Delete sessions failed");return Ye(s.deleteSessionsData(i),"Delete sessions timed out")},async loadMcpStatus(){const i=Et(t,"Load MCP status failed");return Ye(i.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(i){const s=Et(t,"Load MCP tools failed");try{return await Ye(s.workspaceMcpTools(i),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:i,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async restartMcpServer(i){const s=Et(t,"Restart MCP server failed");return Ye(s.restartMcpServer(i),"Restart MCP server timed out",5*6e4)},async manageMcpServer(i,s){const a=Et(t,"Manage MCP server failed"),o=s==="authenticate"?10*6e4:5*6e4;return Ye(a.manageMcpServer(i,s),"Manage MCP server timed out",o)},async loadSkillsStatus(){const i=Et(t,"Load skills failed");return Ye(i.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const i=Et(t,"Load extensions failed");return Ye(i.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const i=Et(t,"Load tools failed");return Ye(i.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(i,s){const a=Et(t,"Set tool enabled failed");return Ye(a.setWorkspaceToolEnabled(i,s),"Set tool enabled timed out")},async loadSettingsStatus(){const i=Et(t,"Load settings failed");return Ye(i.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(i,s,a){const o=Et(t,"Set setting failed");return Ye(o.setWorkspaceSetting(i,s,a),"Set setting timed out")},async loadMemoryStatus(){const i=Et(t,"Load memory failed");return Ye(i.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(i){const s=Et(t,"Read workspace file failed");return Ye(s.readWorkspaceFile(i),"Read workspace file timed out")},async writeMemory(i){const s=Et(t,"Write memory failed");return Ye(s.writeWorkspaceMemory(i),"Write memory timed out")},async listAgents(){const i=Et(t,"List agents failed");return Ye(i.listWorkspaceAgents(),"List agents timed out")},async getAgent(i){const s=Et(t,"Get agent failed");return Ye(s.getWorkspaceAgent(i),"Get agent timed out")},async createAgent(i){const s=Et(t,"Create agent failed");return Ye(s.createWorkspaceAgent(i),"Create agent timed out")},async generateAgent(i){const s=Et(t,"Generate agent failed");return Ye(s.generateWorkspaceAgent(i),"Generate agent timed out",j$)},async deleteAgent(i,s){const a=Et(t,"Delete agent failed");return Ye(a.deleteWorkspaceAgent(i,s?{scope:s}:{}),"Delete agent timed out")},async globWorkspace(i,s){Et(t,"Glob workspace failed");const a=Ab(n,"/glob");a.searchParams.set("pattern",i),(s==null?void 0:s.maxResults)!==void 0&&a.searchParams.set("maxResults",String(s.maxResults)),(s==null?void 0:s.includeIgnored)!==void 0&&a.searchParams.set("includeIgnored",s.includeIgnored?"1":"0"),(s==null?void 0:s.cwd)!==void 0&&a.searchParams.set("cwd",s.cwd);const o=await Ye(fetch(Mb(a,n),{headers:Eb(r)}),"Glob workspace timed out");if(!o.ok)throw new Error(await Nb(o,"GET /glob"));const l=await o.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const i=Et(t,"Load providers failed");return Ye(i.workspaceProviders(),"Load providers timed out")},async readFileBytes(i,s){const a=Et(t,"Read file bytes failed");return Ye(a.readWorkspaceFileBytes(i,s??{}),"Read file bytes timed out")},async writeFile(i){const s=Et(t,"Write file failed");return Ye(s.writeWorkspaceFile(i),"Write file timed out")},async editFile(i){const s=Et(t,"Edit file failed");return Ye(s.editWorkspaceFile(i),"Edit file timed out")},async stat(i){Et(t,"Stat file failed");const s=Ab(n,"/stat");s.searchParams.set("path",i);const a=await Ye(fetch(Mb(s,n),{headers:Eb(r)}),"Stat file timed out");if(!a.ok)throw new Error(await Nb(a,"GET /stat"));return await a.json()},async listDirectory(i){Et(t,"List directory failed");const s=Ab(n,"/list");s.searchParams.set("path",i);const a=await Ye(fetch(Mb(s,n),{headers:Eb(r)}),"List directory timed out");if(!a.ok)throw new Error(await Nb(a,"GET /list"));return await a.json()},async loadEnv(){const i=Et(t,"Load env failed");return Ye(i.workspaceEnv(),"Load env timed out")},async loadPreflight(){const i=Et(t,"Load preflight failed");return Ye(i.workspacePreflight(),"Load preflight timed out")},async initWorkspace(i){const s=Et(t,"Init workspace failed");return Ye(s.initWorkspace(i),"Init workspace timed out")},async updateAgent(i,s,a){const o=Et(t,"Update agent failed");return Ye(o.updateWorkspaceAgent(i,s,a?{scope:a}:{}),"Update agent timed out")},async installExtension(i,s){const a=Et(t,"Install extension failed");return Ye(a.installExtension(i,s),"Install extension timed out")},async checkExtensionUpdates(i){const s=Et(t,"Check extension updates failed");return Ye(s.checkExtensionUpdates(i),"Check extension updates timed out")},async refreshExtensions(i){const s=Et(t,"Refresh extensions failed");return Ye(s.refreshExtensions(i),"Refresh extensions timed out")},async enableExtension(i,s,a){const o=Et(t,"Enable extension failed");return Ye(o.enableExtension(i,s,a),"Enable extension timed out")},async disableExtension(i,s,a){const o=Et(t,"Disable extension failed");return Ye(o.disableExtension(i,s,a),"Disable extension timed out")},async updateExtension(i,s){const a=Et(t,"Update extension failed");return Ye(a.updateExtension(i,s),"Update extension timed out")},async uninstallExtension(i,s){const a=Et(t,"Uninstall extension failed");return Ye(a.uninstallExtension(i,s),"Uninstall extension timed out")},async startDeviceFlow(i){const s=Et(t,"Start device flow failed");return Ye(s.startDeviceFlow({providerId:i}),"Start device flow timed out")},async getDeviceFlow(i,s){const a=Et(t,"Get device flow failed");return Ye(a.getDeviceFlow(i,s),"Get device flow timed out")},async cancelDeviceFlow(i){const s=Et(t,"Cancel device flow failed");return Ye(s.cancelDeviceFlow(i),"Cancel device flow timed out")},async getAuthStatus(){const i=Et(t,"Get auth status failed");return Ye(i.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const i=Et(t,"Get auth providers failed");return Ye(i.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(i){const s=Et(t,"Install auth provider failed");return Ye(s.installAuthProvider(i),"Install auth provider timed out")}}}function Et(t,e){const n=t();if(!n)throw new Error(`${e}: DaemonClient is not connected`);return n}function Eb(t){const e={};return t&&(e.Authorization=`Bearer ${t}`),e}function Ab(t,e){const n=jA(t),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${e}`,r)}function Mb(t,e){return jA(e)?t.toString():`${t.pathname}${t.search}`}function jA(t){let e=t.length;for(;e>0&&t.charCodeAt(e-1)===47;)e--;return e===t.length?t:t.slice(0,e)}async function Nb(t,e){try{const n=await t.json(),r=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return r?`${e}: ${r}`:`${e}: HTTP ${t.status}`}catch{return`${e}: HTTP ${t.status}`}}const b3=v.createContext(void 0);let Eh;function B$({baseUrl:t,token:e,workspaceCwd:n,autoConnect:r=!0,transport:i,children:s}){const a=v.useMemo(()=>r?new bA({baseUrl:t,token:e,transport:i}):void 0,[r,t,e,i]),o=v.useRef(a);o.current=a;const l=v.useRef(void 0),c=v.useRef(void 0),u=v.useRef(n),[d,h]=v.useState(void 0),[m,p]=v.useState(r?"connecting":"idle"),[b,x]=v.useState(void 0),g=v.useCallback(()=>{if(!a)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==a&&(l.current=a,c.current=void 0),!c.current){const C=a.capabilities().catch(E=>{throw c.current===C&&(c.current=void 0),E});c.current=C}return c.current},[a]);v.useEffect(()=>{if(!a)return;p("connecting"),x(void 0),h(void 0),Eh===a&&(Eh=void 0);let C=!1;return g().then(E=>{C||(h(E),p("connected"))}).catch(E=>{C||(x(E instanceof Error?E:new Error(String(E))),p("error"))}),()=>{C=!0,Eh=a,queueMicrotask(()=>{Eh===a&&(Eh=void 0,a.dispose())})}},[a,g]),u.current=(d==null?void 0:d.workspaceCwd)??n;const y=v.useMemo(()=>L$({getClient:()=>o.current,getWorkspaceCwd:()=>u.current,baseUrl:t,token:e}),[t,e]),w=v.useMemo(()=>{if(a)return{client:a,token:e,baseUrl:t,workspaceCwd:(d==null?void 0:d.workspaceCwd)??n,status:m,error:b,capabilities:d,getCapabilities:g,actions:y}},[a,e,t,n,m,b,d,g,y]);return f.jsx(b3.Provider,{value:w,children:s})}function LA(){const t=v.useContext(b3);if(!t)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return t}function Zl(){return LA().actions}function BA(){return v.useContext(b3)}function z$(t){if(t.length===0)return"idle";const e=t[t.length-1];if((e==null?void 0:e.kind)==="thought"&&w_(e))return"thinking";if((e==null?void 0:e.kind)==="assistant"&&w_(e)||(e==null?void 0:e.kind)==="tool"&&k_(e))return"responding";for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.kind==="user")break;if(r.kind==="tool"&&k_(r))return"responding"}return"idle"}function P$(t,e="idle"){const n=z$(t);return e==="idle"||n!=="idle"?n:e==="waiting"?"waiting":"responding"}function w_(t){return t.streaming===!0}function k_(t){return t.status==="running"||t.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const vx=new Set;let yg;function __(){return yg}function $$(t){return vx.add(t),()=>{vx.delete(t)}}function U$(t){yg={...t},zA()}function Db(){yg!==void 0&&(yg=void 0,zA())}function zA(){for(const t of vx)t()}function H$(t){if(!t||typeof t!="object")return;const e=t;if(e.type!=="followup_suggestion")return;const n=e.data;if(!n||typeof n!="object")return;const r=n,i=r.sessionId,s=r.suggestion,a=r.promptId;if(!(typeof i!="string"||typeof s!="string"||s.length===0||typeof a!="string"))return{sessionId:i,suggestion:s,promptId:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const xx=new Set,PA=Object.freeze([]),Ib=64;let bl=PA;function S_(){return bl}function q$(t){return xx.add(t),()=>{xx.delete(t)}}function F$(t){const e=[...bl,{sessionId:t.sessionId,messages:[...t.messages],...t.originatorClientId?{originatorClientId:t.originatorClientId}:{}}];if(e.length>Ib){const n=e.length-Ib;console.debug(`[mid-turn] sidechannel buffer over ${Ib}; evicting ${n} oldest batch(es)`),bl=e.slice(n)}else bl=e;$A()}function V$(t){if(t.length===0||bl.length===0)return;const e=new Set(t),n=bl.filter(r=>!e.has(r));n.length!==bl.length&&(bl=n.length===0?PA:n,$A())}function $A(){for(const t of xx)t()}function G$(t){if(!t||typeof t!="object")return;const e=t;if(e.type!==xA)return;const n=e.data;if(!n||typeof n!="object")return;const r=n,i=r.sessionId,s=r.messages;if(typeof i!="string"||!Array.isArray(s))return;const a=s.filter(l=>typeof l=="string"&&l.length>0);if(a.length===0)return;const o=e.originatorClientId;return{sessionId:i,messages:a,...typeof o=="string"?{originatorClientId:o}:{}}}const UA=v.createContext(void 0),HA=v.createContext(void 0),v3=v.createContext(void 0),qA=v.createContext(void 0),FA=v.createContext(void 0),VA=v.createContext(void 0),W$=new Set([401,403,404,410]),K$=2e5,Y$={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},X$=new Set([401,403]);function Q$({baseUrl:t,token:e,workspaceCwd:n,initialSessionId:r,clientId:i,createSessionRequest:s,maxQueued:a=1024,maxBlocks:o=K$,suppressOwnUserEcho:l=!0,includeRawEvent:c=!1,autoConnect:u=!0,autoReconnect:d=!0,missingSessionBehavior:h="create",reconnectDelayMs:m=1e3,maxReconnectDelayMs:p=1e4,heartbeatIntervalMs:b=3e4,heartbeatFailureThreshold:x=3,loadWarnings:g,children:y}){const w=BA(),C=t??(w==null?void 0:w.baseUrl),E=e??(w==null?void 0:w.token),S=n??(w==null?void 0:w.workspaceCwd),T=v.useRef(w==null?void 0:w.client);T.current=w==null?void 0:w.client;const O=v.useRef(w==null?void 0:w.capabilities);O.current=w==null?void 0:w.capabilities;const z=v.useRef(w==null?void 0:w.getCapabilities);z.current=w==null?void 0:w.getCapabilities;const I=v.useRef(S);I.current=S;const j=v.useMemo(()=>h$({maxBlocks:o}),[o]),N=v.useRef(void 0),B=v.useRef(void 0),P=v.useRef(new Map),J=v.useRef(new Map),q=v.useRef(void 0),Y=v.useRef(0),$=v.useRef(void 0),Z=v.useRef(!1),M=v.useRef({suppressOwnUserEcho:l,includeRawEvent:c}),X=v.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),H=v.useRef(g),R=v.useRef(void 0);(!R.current||i)&&(R.current=v_(i)),M.current={suppressOwnUserEcho:l,includeRawEvent:c},X.current={reconnectDelayMs:m,maxReconnectDelayMs:p},H.current=g;const ae=s==null?void 0:s.modelServiceId,xe=s==null?void 0:s.sessionScope,[ye,Ae]=v.useState("idle"),[Fe,vt]=v.useState(r),[Nt,pt]=v.useState("load"),[Qe,Ge]=v.useState(0),[$t,Je]=v.useState(0),[re,ce]=v.useState({status:u?"connecting":"idle"}),Ie=v.useRef(0),[We,me]=v.useState([]),rt=v.useCallback(ke=>{const ze={...ke,id:ke.id??`daemon-notice-${Date.now()}-${++Ie.current}`,createdAt:ke.createdAt??Date.now()};return me(ot=>[...ot.slice(-49),ze]),ze},[]),oe=v.useCallback(ke=>{me(ze=>ze.filter(ot=>ot.id!==ke))},[]),Oe=v.useCallback(()=>{me([])},[]),Re=v.useMemo(()=>({notices:We,dismissNotice:oe,clearNotices:Oe}),[Oe,oe,We]),[$e,ne]=v.useState(Y$);v.useEffect(()=>{if(!u)return;if(!T.current&&!C){ce({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const ke=new AbortController;let ze=!1;return(async()=>{var Ut,Xt,En,Dn,Yn,wn,nr;const fe=T.current??new bA({baseUrl:C,token:E});let G,te,Ue=Fe,Gt=!Fe&&$t>0,xt=0;for(;!ze&&!ke.signal.aborted;){try{let sn=!1,Vn=!1,Hi=!1,qi,ps;if(!G){ce(ct=>({...ct,status:"connecting",error:void 0}));const It=z.current,In=O.current??(It?await It():await fe.capabilities());if(ze||ke.signal.aborted)return;te=In,Z.current=Array.isArray(In.features)&&In.features.includes("client_heartbeat");const kr=I.current??In.workspaceCwd,Za=Fe&&Nt==="resume"?mm.resume:mm.load,se=i?R.current:v_(void 0,Fe??Ue),le=Fe?await Za(fe,Fe,{workspaceCwd:kr},se):Ue?await mm.load(fe,Ue,{workspaceCwd:kr},se):await mm.createOrAttach(fe,{...ae!==void 0?{modelServiceId:ae}:{},...Gt?{sessionScope:"thread"}:xe!==void 0?{sessionScope:xe}:{},workspaceCwd:kr},se);if(!i&&le.clientId&&(R.current=le.clientId,R$(le.clientId,le.sessionId)),ze||ke.signal.aborted){x_({baseUrl:C,token:E,sessionId:le.sessionId,clientId:le.clientId}).catch(ct=>console.warn("[DaemonSessionProvider] detach failed:",ct));return}const Pe=B.current;Pe!==le.sessionId&&Oe(),Pe!==void 0&&le.sessionId!==Pe?(Ae("idle"),Br($),Hi=!0):Pe!==void 0&&(le.replaySnapshot.compactedReplay.length+le.replaySnapshot.liveJournal.length>0?(Ae("idle"),Br($),Hi=!0):(j.dispatch({type:"assistant.done",reason:"reconnected"}),j.getSnapshot().awaitingResync&&j.clearAwaitingResync())),sn=Pe!==void 0&&Pe===le.sessionId,Vn=le.replaySnapshot.compactedReplay.length>0||le.replaySnapshot.liveJournal.length>0;const St=[...le.replaySnapshot.compactedReplay,...le.replaySnapshot.liveJournal];qi=v$(St),ps=y3(qi),G=le,Ue=G.sessionId,Gt=!1,B.current=G.sessionId,N.current=G}const lt=G,[an,cr,Vs]=await Promise.allSettled([fe.workspaceProviders(),lt.supportedCommands(),lt.context()]),ua=an.status==="fulfilled"?an.value:void 0,Gs=cr.status==="fulfilled"?cr.value:void 0,Ya=Vs.status==="fulfilled"?Vs.value:void 0,Xa=[an.status==="rejected"?(Ut=H.current)==null?void 0:Ut.models:void 0,cr.status==="rejected"?(Xt=H.current)==null?void 0:Xt.commands:void 0,Vs.status==="rejected"?(En=H.current)==null?void 0:En.context:void 0].filter(It=>!!It),{models:da,currentModel:rc,contextWindow:Rr}=p$(ua),{commands:ic,skills:gs}=NA(Gs),wr=b$(Ya);ce(It=>({status:"connected",sessionId:lt.sessionId,...lt.clientId?{clientId:lt.clientId}:{},workspaceCwd:lt.workspaceCwd,commands:ic,skills:gs,models:da,currentModel:rc,currentMode:wr,displayName:y$(lt.state)??(It.sessionId===lt.sessionId?It.displayName:void 0),tokenUsage:qi!==void 0?qi:It.sessionId===lt.sessionId?It.tokenUsage:void 0,tokenCount:ps!==void 0?ps:It.sessionId===lt.sessionId?It.tokenCount??0:0,contextWindow:Rr,providers:ua,supportedCommands:Gs,context:Ya,capabilities:te,catchingUp:sn||lt.lastEventId!=null||void 0})),Ae(P.current.has(lt.sessionId)?"streaming":"idle"),Xa.length>0&&j.dispatch(Xa.map(It=>({type:"status",text:It})));const Ws=q.current,ys=(Ws==null?void 0:Ws.sessionId)===lt.sessionId?Ws:void 0,{compactedReplay:Go,liveJournal:yu}=lt.replaySnapshot,Ks=[...Go,...yu];if(Hi&&!(Vn&&Ks.length>0)&&j.reset(),Vn&&Ks.length>0){const It={...M.current,suppressOwnUserEcho:!1},In=[];for(const W of Ks)try{const se=T_(W,lt.clientId,It,ce,{updateConnection:!1});if(In.push(...C_(W,se,rt)),W.type==="turn_complete"){const le=((Dn=W.data)==null?void 0:Dn.stopReason)??"end_turn";In.push({type:"assistant.done",reason:le})}else W.type==="turn_error"&&In.push({type:"assistant.done",reason:"error"})}catch(se){const le=se instanceof Error?se.message:String(se);rt({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:le,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",se)}Hi&&j.reset(),In.length>0&&(j.dispatch(In),Ob(In,ne));for(const W of Ks)Rb(P.current,J.current,lt.sessionId,W,j,Ae,$,{requireBoundPromptId:!0});const kr=Ks.some(W=>W.type==="turn_complete"||W.type==="turn_error"||W.type==="prompt_cancelled");Ks.some(Z$)&&!kr&&Ae(W=>W==="idle"?"waiting":W),ce(W=>({...W,catchingUp:void 0}))}ys&&(q.current=void 0,clearTimeout(ys.timeout),ys.resolve());let Qa=!1,sc=!1,Fi,Ja=[];for await(const It of lt.events({signal:ke.signal,maxQueued:a})){Qa||(Qa=!0,xt=0);try{const In=H$(It);if(In){U$(In);continue}const kr=G$(It);if(kr){F$(kr);continue}const Za=T_(It,lt.clientId,M.current,ce),W=C_(It,Za,rt);if(It.type==="state_resync_required"&&(typeof It.data=="object"&&It.data!==null?It.data.reason:void 0)==="epoch_reset"){Ae("idle"),Br($),lt.setLastEventId(0),Fi=[],Ja=[];continue}if(Fi){if(Ja.push(It),Fi.push(...W),It.type==="turn_complete"){const Ct=((Yn=It.data)==null?void 0:Yn.stopReason)??"end_turn";Fi.push({type:"assistant.done",reason:Ct})}else It.type==="turn_error"&&Fi.push({type:"assistant.done",reason:"error"});if(W.some(Ct=>Ct.type==="session.replay_complete")){P.current.has(lt.sessionId)||(Br($),Fi.push({type:"assistant.done",reason:"replay_complete"}),Ae("idle"));const Ct=Fi,Xn=Ja;Fi=void 0,Ja=[],j.reset(),Ct.length>0&&(j.dispatch(Ct),Ob(Ct,ne));for(const tn of Xn)Rb(P.current,J.current,lt.sessionId,tn,j,Ae,$,{requireBoundPromptId:!0});ce(tn=>({...tn,catchingUp:void 0}))}continue}Ob(W,ne),W.length>0&&Ae(ct=>ct==="waiting"?"streaming":ct);const se=Rb(P.current,J.current,lt.sessionId,It,j,Ae,$),Pe=!P.current.has(lt.sessionId)&&j.getSnapshot().activeAssistantBlockId!=null?W.filter(ct=>ct.type!=="debug"):W;j.dispatch(Pe);for(const ct of W)ct.type==="prompt.cancelled"&&ct.originatorClientId!==lt.clientId?(Ae("idle"),Br($),P.current.delete(lt.sessionId)):ct.type==="session.replay_complete"&&(ce(Ct=>({...Ct,catchingUp:void 0})),j.getSnapshot().awaitingResync&&j.clearAwaitingResync(),P.current.has(lt.sessionId)||(Br($),j.dispatch({type:"assistant.done",reason:"replay_complete"}),Ae("idle")));const St=!se&&!P.current.has(lt.sessionId);if(St&&(W.some(Ct=>Ct.type==="user.text.delta")?Ae("waiting"):E_(W)&&Ae(Ct=>Ct==="idle"?"streaming":Ct)),St&&It.type==="turn_complete"){Br($);const ct=((wn=It.data)==null?void 0:wn.stopReason)??"end_turn";j.dispatch({type:"assistant.done",reason:ct}),Ae("idle")}else St&&It.type==="turn_error"?(Br($),j.dispatch({type:"assistant.done",reason:"error"}),Ae("idle")):St&&E_(W)&&C$(j,$,"passive_observer",3e3,()=>Ae("idle"));if(It.type==="state_resync_required"){const ct=typeof It.data=="object"&&It.data!==null?It.data.reason:void 0;if(Ae("idle"),Br($),j.reset(),ct==="epoch_reset")lt.setLastEventId(0);else{console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",lt.sessionId),sc=!0,G=void 0,N.current=void 0,ce(Ct=>({...Ct,status:"connecting",error:void 0}));break}}}catch(In){const kr=In instanceof Error?In.message:String(In);rt({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:kr,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",In)}}!ze&&!ke.signal.aborted&&!sc&&(((nr=N.current)==null?void 0:nr.sessionId)===lt.sessionId&&(Br($),Ae("idle"),console.debug("[DaemonSessionProvider] SSE stream ended"),j.dispatch({type:"assistant.done",reason:"stream_ended"})),ce(It=>({...It,status:"disconnected",error:void 0})))}catch(sn){if(ze||ke.signal.aborted)return;const Vn=sn instanceof Error?sn.message:String(sn),Hi=G==null?void 0:G.sessionId,qi=lU(sn),ps=oU(sn),lt=ps&&!qi&&h==="disconnect";if(Hi&&(qi||ps)){const cr=P.current.get(Hi);cr==null||cr.controller.abort(),P.current.delete(Hi)}Br($),Ae("idle");const an=q.current;if(an&&(an.sessionId===Fe||an.sessionId===Ue)&&(q.current=void 0,clearTimeout(an.timeout),an.reject(sn)),qi||ps){if(G=void 0,N.current=void 0,qi){ce({status:"error",error:Vn});return}if(lt){ce(cr=>({...cr,status:"disconnected",sessionId:void 0,error:Vn}));return}Ue=void 0,Fe&&vt(void 0)}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",G==null?void 0:G.sessionId);if(!d){G=void 0,N.current=void 0,ce({status:"error",error:Vn});return}ce(cr=>({...cr,status:"disconnected",error:Vn}))}if(!d){N.current=void 0,ce(sn=>({...sn,status:"disconnected"}));return}xt+=1;const zt=X.current,Tt=S$(xt,zt.reconnectDelayMs,zt.maxReconnectDelayMs);ce(sn=>({...sn,status:"disconnected",error:`Reconnecting in ${Tt}ms`})),await T$(Tt,ke.signal)}})(),()=>{const Ut=N.current;ze=!0,ke.abort(),Ae("idle"),Br($),q.current&&(clearTimeout(q.current.timeout),q.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),q.current=void 0),Ut!=null&&Ut.clientId&&x_({baseUrl:C,token:E,sessionId:Ut.sessionId,clientId:Ut.clientId}).catch(Xt=>console.warn("[DaemonSessionProvider] detach failed:",Xt)),N.current=void 0}},[u,d,h,C,E,n,ae,xe,a,j,Fe,Nt,Qe,$t,i,Oe,rt]),v.useEffect(()=>{if(!Z.current||b<=0||x<=0||!re.sessionId)return;let ke=!1,ze=0;const ot=setInterval(()=>{const Ut=N.current;Ut&&Ut.heartbeat().then(()=>{ke||(ze>=x&&ce(Xt=>Xt.sessionId===Ut.sessionId?{...Xt,status:"connected",error:void 0}:Xt),ze=0)}).catch(Xt=>{if(ke||(ze+=1,ze<x))return;const En=Xt instanceof Error?Xt.message:"Session heartbeat failed";ce(Dn=>Dn.sessionId===Ut.sessionId?{...Dn,status:"disconnected",error:En}:Dn)})},b);return()=>{ke=!0,clearInterval(ot)}},[re.sessionId,x,b]);const ge=v.useMemo(()=>E$({store:j,sessionRef:N,activePromptsRef:P,settledPromptsRef:J,pendingSessionLoadRef:q,pendingSessionLoadIdRef:Y,heartbeatSupportedRef:Z,passiveAssistantDoneTimerRef:$,addNotice:rt,setConnection:ce,setPromptStatus:Ae,setRestoreSessionId:vt,setRestoreMode:pt,setRestoreSessionNonce:Ge,setNewSessionNonce:Je}),[rt,j]);return f.jsx(UA.Provider,{value:j,children:f.jsx(HA.Provider,{value:re,children:f.jsx(qA.Provider,{value:ye,children:f.jsx(FA.Provider,{value:Re,children:f.jsx(VA.Provider,{value:$e,children:f.jsx(v3.Provider,{value:ge,children:y})})})})})})}function Rb(t,e,n,r,i,s,a,o={}){var l;if(r.type!=="turn_complete"&&r.type!=="turn_error")return!1;const c=(l=r.data)==null?void 0:l.promptId;if(!c)return!1;const u=t.get(n);if(!u||o.requireBoundPromptId&&u.promptId===void 0||u.promptId!==void 0&&u.promptId!==c)return!1;Br(a);try{const d=c3(r,c);if(!d)return!1;i.dispatch({type:"assistant.done",reason:d.stopReason}),s("idle"),u.resolve?(t.delete(n),u.resolve(d)):(t.delete(n),e.set(yx(n,c),{status:"resolved",result:d}))}catch(d){i.dispatch({type:"assistant.done",reason:"error"}),s("idle"),u.reject?(t.delete(n),u.reject(d)):(t.delete(n),e.set(yx(n,c),{status:"rejected",error:d}))}return!0}function J$(t){return t.type==="turn_complete"}function Z$(t){var e;if(t.type!=="session_update")return!1;const n=t.data;return((e=n==null?void 0:n.update)==null?void 0:e.sessionUpdate)==="user_message_chunk"}function T_(t,e,n,r,i={}){i.updateConnection!==!1&&g$(t,r);const s=Kz(t,{clientId:e,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),a=iU(t);return J$(t)?a?[a]:[]:a?[...s,a]:s}function C_(t,e,n){const r=[];for(const i of e){if(i.type!=="error"){r.push(i);continue}if(t.type==="turn_error"){r.push(i);continue}const s=n(eU(t,i));(s.category==="protocol"||s.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",s)}return r}function eU(t,e){const n={message:e.text,debugMessage:e.text,recoverable:e.recoverable};switch(t.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:e.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:e.errorKind??"daemon.stream_error"};default:return{...n,severity:"warning",category:"protocol",operation:"normalize_event",code:e.code??"daemon.protocol.error"}}}function x3(){const t=v.useContext(UA);if(!t)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return t}function N1(){const t=x3(),e=v.useCallback(()=>t.getSnapshot().blocks,[t]);return v.useSyncExternalStore(t.subscribe,e,e)}function w3(){const t=N1(),e=nU();return v.useMemo(()=>P$(t,e),[t,e])}function k3(){const t=v.useContext(v3);if(!t)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return t}function tU(){return v.useContext(v3)}function cu(){return v.useContext(VA)}function nU(){const t=v.useContext(qA);if(!t)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return t}function uu(){const t=v.useContext(HA);if(!t)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return t}function rU(){const t=v.useContext(FA);if(!t)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return t}function E_(t){return t.some(e=>e.type==="assistant.text.delta"||e.type==="thought.text.delta"||e.type==="tool.update")}function iU(t){if(t.type!=="session_update")return null;const e=fo(t.data)?t.data:void 0,n=fo(e==null?void 0:e.update)?e.update:fo(t.data)?t.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!fo(r))return null;const i=sU(r.goalStatus);if(i)return A_(t,i);const s=aU(r.goalTerminal);if(s)return A_(t,s);const a=r.stopHookLoop;if(!fo(a))return null;const o=a.goal;return!fo(o)||!Hc(o,"condition"),null}function A_(t,e){return{type:"status",...t.id!==void 0?{eventId:t.id}:{},...t.originatorClientId?{originatorClientId:t.originatorClientId}:{},text:"",source:"goal",data:e}}function sU(t){if(!fo(t))return null;const e=Hc(t,"kind");if(e!=="set"&&e!=="cleared"&&e!=="achieved"&&e!=="failed"&&e!=="aborted")return null;const n=Hc(t,"condition");if(!n)return null;const r=gf(t,"iterations"),i=gf(t,"durationMs"),s=gf(t,"setAt"),a=Hc(t,"lastReason");return{kind:e,condition:n,...r!==void 0?{iterations:r}:{},...i!==void 0?{durationMs:i}:{},...s!==void 0?{setAt:s}:{},...a?{lastReason:a}:{}}}function aU(t){if(!fo(t))return null;const e=Hc(t,"kind");if(e!=="achieved"&&e!=="failed"&&e!=="aborted")return null;const n=Hc(t,"condition");if(!n)return null;const r=gf(t,"iterations"),i=gf(t,"durationMs"),s=Hc(t,"lastReason");return{kind:e,condition:n,...r!==void 0?{iterations:r}:{},...i!==void 0?{durationMs:i}:{},...s?{lastReason:s}:{}}}function Hc(t,e){const n=t[e];return typeof n=="string"?n:void 0}function gf(t,e){const n=t[e];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Ob(t,e){let n=0,r=0,i=0,s=0,a=0,o=0,l,c=0,u=0;for(const d of t)switch(d.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":r+=1;break;case"workspace.tool.toggled":i+=1;break;case"workspace.settings.changed":s+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":a+=1;break;case"workspace.extensions.changed":o+=1,l={...d.status?{status:d.status}:{},...d.source?{source:d.source}:{},...d.name?{name:d.name}:{},...d.version?{version:d.version}:{},...d.error?{error:d.error}:{},refreshed:d.refreshed,failed:d.failed};break;case"workspace.initialized":c+=1;break;case"auth.device_flow.started":case"auth.device_flow.throttled":case"auth.device_flow.authorized":case"auth.device_flow.failed":case"auth.device_flow.cancelled":u+=1;break}n+r+i+s+a+o+c+u!==0&&e(d=>({memoryVersion:d.memoryVersion+n,agentsVersion:d.agentsVersion+r,toolsVersion:d.toolsVersion+i,settingsVersion:d.settingsVersion+s,mcpVersion:d.mcpVersion+a,extensionsVersion:d.extensionsVersion+o,...l?{lastExtensionChange:l}:{},initVersion:d.initVersion+c,authVersion:d.authVersion+u}))}function oU(t){const e=GA(t);return e!==void 0&&W$.has(e)}function lU(t){const e=GA(t);return e!==void 0&&X$.has(e)}function GA(t){if(t instanceof Md||fo(t)&&typeof t.status=="number")return t.status}function fo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Zd(t,e){const{autoLoad:n=!1,enabled:r=!0}=e,[i,s]=v.useState({data:void 0,loading:!1,error:void 0}),a=v.useRef(0),o=v.useCallback(async()=>{if(!r)return;const l=++a.current;s(c=>({...c,loading:!0,error:void 0}));try{const c=await t();return l!==a.current?void 0:(s({data:c,loading:!1,error:void 0}),c)}catch(c){if(l!==a.current)return;const u=c instanceof Error?c:new Error(String(c));s(d=>({...d,loading:!1,error:u}));return}},[r,t]);return v.useEffect(()=>{!n||!r||o()},[n,r,o]),{...i,reload:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function E0(t,e,n){const r=v.useRef(!1);v.useEffect(()=>{if(!(t===void 0||!n)){if(!r.current){r.current=!0;return}e()}},[n,e,t])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function cU(t={}){var e;const n=Zl(),r=v.useCallback(()=>n.listAgents(),[n]),i=Zd(r,t),s=cu();return E0(s==null?void 0:s.agentsVersion,i.reload,t.autoLoad===!0||i.data!==void 0),{...i,status:i.data,agents:((e=i.data)==null?void 0:e.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 uU(t={}){const e=Zl(),n=v.useCallback(()=>e.loadMcpStatus(),[e]),r=Zd(n,t),i=cu();return E0(i==null?void 0:i.mcpVersion,r.reload,t.autoLoad===!0||r.data!==void 0),{...r,status:r.data,loadTools:e.loadMcpTools,restartServer:e.restartMcpServer,manageServer:e.manageMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function dU(t={}){var e;const n=Zl(),r=v.useCallback(()=>n.loadMemoryStatus(),[n]),i=Zd(r,t),s=cu();return E0(s==null?void 0:s.memoryVersion,i.reload,t.autoLoad===!0||i.data!==void 0),{...i,status:i.data,files:((e=i.data)==null?void 0:e.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function _3(t={}){const e=LA(),n=tU(),r=v.useCallback(()=>e.actions.listSessions(),[e.actions]),i=!!e.workspaceCwd,s=Zd(r,{...t,enabled:(t.enabled??!0)&&i}),{reload:a}=s,o=v.useCallback(async c=>{const u=await e.actions.deleteSession(c);return u&&a(),u},[e.actions,a]),l=v.useCallback(async c=>{const u=await e.actions.deleteSessions(c);return(u.removed.length>0||u.notFound.length>0)&&a(),u},[e.actions,a]);return{...s,sessions:s.data??[],loadSession:n==null?void 0:n.loadSession,resumeSession:n==null?void 0:n.resumeSession,newSession:n==null?void 0:n.newSession,releaseSession:n==null?void 0:n.releaseSession,deleteSession:o,deleteSessions:l}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function WA(t={}){var e;const n=Zl(),r=v.useCallback(()=>n.loadToolsStatus(),[n]),i=Zd(r,t),s=cu();return E0(s==null?void 0:s.toolsVersion,i.reload,t.autoLoad===!0||i.data!==void 0),{...i,status:i.data,tools:((e=i.data)==null?void 0:e.tools)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function hU(t={}){var e;const n=Zl(),r=v.useCallback(()=>n.loadSettingsStatus(),[n]),i=Zd(r,t),s=cu();return E0(s==null?void 0:s.settingsVersion,i.reload,t.autoLoad===!0||i.data!==void 0),{...i,status:i.data,settings:((e=i.data)==null?void 0:e.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const fU=300,mU=100,Ou=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function jb(t){var e;const n=t;(e=n.clearFollowupSuggestion)==null||e.call(n)}function pU(t){const{enabled:e=!0,onStateChange:n,getOnAccept:r,getOnOutcome:i}=t;let s=Ou,a=null,o=!1,l=null;function c(x){s=x,n(x)}function u(){a&&(clearTimeout(a),a=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:x=>{if(a&&(clearTimeout(a),a=null),!x){c(Ou);return}e&&(a=setTimeout(()=>{c({suggestion:x,isVisible:!0,shownAt:Date.now()})},fU))},accept:(x,g)=>{var y;if(o)return;a&&(clearTimeout(a),a=null),o=!0;const w=s.suggestion,{shownAt:C}=s;if(!w){o=!1;return}try{(y=i())==null||y({outcome:"accepted",accept_method:x,time_ms:C>0?Date.now()-C:0,suggestion_length:w.length})}catch(E){console.error("[followup] onOutcome callback threw:",E)}c(Ou),queueMicrotask(()=>{var E;try{g!=null&&g.skipOnAccept||(E=r())==null||E(w)}catch(S){console.error("[followup] onAccept callback threw:",S)}finally{l&&clearTimeout(l),l=setTimeout(()=>{o=!1},mU)}})},dismiss:()=>{var x;if(a&&(clearTimeout(a),a=null),!(!s.isVisible&&!s.suggestion)){if(s.isVisible&&s.suggestion)try{(x=i())==null||x({outcome:"ignored",time_ms:s.shownAt>0?Date.now()-s.shownAt:0,suggestion_length:s.suggestion.length})}catch(g){console.error("[followup] onOutcome callback threw:",g)}c(Ou)}},clear:()=>{u(),o=!1,c(Ou)},cleanup:()=>{u(),o=!1}}}function gU(t={}){const{enabled:e=!0,onAccept:n,onOutcome:r}=t,i=x3(),[s,a]=v.useState(Ou),o=v.useRef(n);o.current=n;const l=v.useRef(r);l.current=r;const c=v.useSyncExternalStore(i.subscribe,()=>i.getSnapshot().lastFollowupSuggestion,()=>i.getSnapshot().lastFollowupSuggestion),d=v.useSyncExternalStore($$,__,__)??c,h=v.useMemo(()=>pU({enabled:e,onStateChange:a,getOnAccept:()=>o.current,getOnOutcome:()=>l.current}),[e]),{setSuggestion:m}=h;v.useEffect(()=>(e||h.clear(),()=>h.cleanup()),[h,e]);const p=v.useRef(void 0);v.useEffect(()=>{const y=d==null?void 0:d.promptId;y!==p.current&&(p.current=y,m((d==null?void 0:d.suggestion)??null))},[d,m]);const b=v.useCallback(()=>{h.clear(),jb(i),Db(),p.current=void 0},[h,i]),x=v.useCallback((y,w)=>{h.accept(y,w),jb(i),Db(),p.current=void 0},[h,i]),g=v.useCallback(()=>{h.dismiss(),jb(i),Db(),p.current=void 0},[h,i]);return v.useMemo(()=>({followupState:s,onAcceptFollowup:x,onDismissFollowup:g,clear:b}),[s,x,g,b])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function yU(){const t=v.useSyncExternalStore(q$,S_,S_),e=v.useCallback(n=>V$(n),[]);return{batches:t,consume:e}}function bU(t){for(const e of t){if(!vU(e))continue;const n=e;if(n.resolved)continue;const r=Xu(n.toolCall),i=typeof(r==null?void 0:r.toolCallId)=="string"?r.toolCallId:typeof(r==null?void 0:r.id)=="string"?r.id:void 0,s=typeof(r==null?void 0:r.kind)=="string"?r.kind:void 0,a=Xu(r==null?void 0:r._meta),o=typeof(a==null?void 0:a.toolName)=="string"?a.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:i,title:n.title,toolKind:s,toolName:o,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(l=>({id:l.optionId,label:l.label,kind:wU(l.raw)})),rawInput:xU(n.toolCall)}}return null}function vU(t){return t.kind==="permission"}function xU(t){const e=Xu(t);return e?Xu(e.rawInput)??Xu(e.input)??Xu(e.args)??e:void 0}function Xu(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function wU(t){if(!t||typeof t!="object"||Array.isArray(t))return;const e=t.kind;return e==="allow_once"||e==="allow_always"||e==="reject_once"||e==="reject_always"?e:void 0}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kU(t,e,n,r){const i=[...t];let s=!1;for(const a of e)if(a.sessionId===n&&!(a.originatorClientId!==void 0&&a.originatorClientId!==r))for(const o of a.messages){const l=i.findIndex(c=>c.text===o&&(!c.images||c.images.length===0));l>=0&&(i.splice(l,1),s=!0)}return s?i:null}function _U(t,e,n){const r=new Array(t);return new Proxy(r,{get(i,s,a){if(typeof s=="string"){const o=s.charCodeAt(0);if(o>=48&&o<=57){const l=+s;if(Number.isInteger(l)&&l>=0&&l<t){let c=i[l];if(!c){const u=e[l*2];c=i[l]={index:l,key:n(l),start:u,size:e[l*2+1],end:u+e[l*2+1],lane:0}}return c}}if(s==="length")return t}return Reflect.get(i,s,a)}})}function Eu(t,e,n){let r=n.initialDeps??[],i,s=!0;function a(){const o=t();return(o.length!==r.length||o.some((c,u)=>r[u]!==c))&&(r=o,i=e(...o),n!=null&&n.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1),i}return a.updateDeps=o=>{r=o},a}function M_(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const SU=(t,e)=>Math.abs(t-e)<1.01,TU=(t,e,n)=>{let r;return function(...i){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,i),n)}};let Ah;const Lb=()=>{if(Ah!==void 0)return Ah;if(typeof navigator>"u")return Ah=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ah=!0;const t=navigator.maxTouchPoints;return Ah=navigator.platform==="MacIntel"&&t!==void 0&&t>0},N_=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},CU=t=>t,EU=t=>{const e=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(r);for(let s=0;s<r;s++)i[s]=e+s;return i},AU=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const i=a=>{const{width:o,height:l}=a;e({width:Math.round(o),height:Math.round(l)})};if(i(N_(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(N_(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},bg={passive:!0},MU=typeof window>"u"?!0:"onscrollend"in window,NU=(t,e,n)=>{const r=t.scrollElement;if(!r)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&MU;let a=0;const o=s?null:TU(i,()=>e(a,!1),t.options.isScrollingResetDelay),l=d=>()=>{a=n(r),o==null||o(),e(a,d)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,bg),s&&r.addEventListener("scrollend",u,bg),()=>{r.removeEventListener("scroll",c),s&&r.removeEventListener("scrollend",u)}},DU=(t,e)=>NU(t,e,n=>{const{horizontal:r,isRtl:i}=t.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),IU=(t,e,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(t),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(e!=null&&e.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const r=n.indexFromElement(t),i=n.options.getItemKey(r),s=n.itemSizeCache.get(i);if(s!==void 0)return s}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},RU=(t,{adjustments:e=0,behavior:n},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:t+e,behavior:n})},OU=RU;class jU{constructor(e){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,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const a=()=>{const o=s.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[c,u]of this.elementsCache)if(u===o){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:CU,rangeExtractor:EU,onChange:()=>{},measureElement:IU,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 h in n){const m=n[h];m!==void 0&&(s[h]=m)}const a=this.options;let o=null,l=null,c=!1;if(a!==void 0&&a.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const h=a.count,m=s.count,p=this.getMeasurements(),b=h>0?((r=p[0])==null?void 0:r.key)??a.getItemKey(0):null,x=h>0?((i=p[h-1])==null?void 0:i.key)??a.getItemKey(h-1):null;if(m!==h||h>0&&m>0&&(s.getItemKey(0)!==b||s.getItemKey(m-1)!==x)){c=!0;const w=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;w&&(o=[w.key,this.getScrollOffset()-w.start]);const C=s.followOnAppend===!0?"auto":s.followOnAppend||null;C&&m>h&&this.isAtEnd(a.scrollEndThreshold)&&(h===0||s.getItemKey(m-1)!==x)&&(l=C)}}this.options=s,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(o&&this.scrollOffset!==null){const[h,m]=o,p=this.getMeasurements(),{count:b,getItemKey:x}=this.options;let g=0;for(;g<b&&x(g)!==h;)g++;if(g<b){const y=p[g];if(y){const w=y.start+m;w!==this.scrollOffset&&(d=w-this.scrollOffset,this.scrollOffset=w,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?o[0]:null,u?o[1]:0,l,d])},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Eu(()=>(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(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!Lb()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",a,bg),s.addEventListener("touchend",o,bg),this.unsubs.push(()=>{s.removeEventListener("touchstart",a),s.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,a,o,l]=i;s!==null&&!o&&(Lb()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,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 i=new Map,s=new Map;for(let a=r-1;a>=0;a--){const o=n[a];if(i.has(o.lane))continue;const l=s.get(o.lane);if(l==null||o.end>l.end?s.set(o.lane,o):o.end<l.end&&i.set(o.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,o)=>a.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=Eu(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,i,s,a,o,l)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Eu(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l},c)=>{const u=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const p of this.laneAssignments.keys())p>=n&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),o===1){const p=this.options.gap,b=n*2;let x=this._flatMeasurements;if(!x||x.length<b){const w=new Float64Array(b);x&&d>0&&w.set(x.subarray(0,d*2)),x=w,this._flatMeasurements=x}let g;if(d===0)g=r+i;else{const w=d-1;g=x[w*2]+x[w*2+1]+p}for(let w=d;w<n;w++){const C=s(w),E=u.get(C),S=typeof E=="number"?E:this.options.estimateSize(w);x[w*2]=g,x[w*2+1]=S,g+=S+p}const y=_U(n,x,s);return this.measurementsCache=y,y}const h=this.measurementsCache.slice(0,d),m=new Array(o).fill(void 0);for(let p=0;p<d;p++){const b=h[p];b&&(m[b.lane]=p)}for(let p=d;p<n;p++){const b=s(p),x=this.laneAssignments.get(p);let g,y;const w=l==="estimate"||u.has(b);if(x!==void 0&&this.options.lanes>1){g=x;const T=m[g],O=T!==void 0?h[T]:void 0;y=O?O.end+this.options.gap:r+i}else{const T=this.options.lanes===1?h[p-1]:this.getFurthestMeasurement(h,p);y=T?T.end+this.options.gap:r+i,g=T?T.lane:p%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(p,g)}const C=u.get(b),E=typeof C=="number"?C:this.options.estimateSize(p),S=y+E;h[p]={index:p,start:y,size:E,end:S,key:b,lane:g},m[g]=p}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Eu(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,s)=>this.range=n.length>0&&r>0?LU({measurements:n,outerSize:r,scrollOffset:i,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Eu(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,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 i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,i-s),o=Math.min(this.options.count-1,i+s);return n>=a&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),s=this.elementsCache.get(i);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,s;if(n<0||n>=this.options.count)return;let a,o,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),o=c[n*2],a=c[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;l=h.key,o=h.start,a=h.size}const u=this.itemSizeCache.get(l)??a,d=r-u;if(d!==0){const h=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=h?this.getTotalSize():0,p=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:o,size:a,end:o+a,lane:0},d,this):o<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-m):p&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=Eu(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let s=0,a=n.length;s<a;s++){const o=n[s],l=r[o];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,a=KA(0,r.length-1,s?o=>i[o*2]:o=>M_(r[o]).start,n);return M_(r[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(i-s)/2:r==="end"&&(n-=s);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(r==="auto")if(a.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(a.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,o]=s,l=this.now();this.scrollState={index:n,align:o,behavior:i,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{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 i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,a=this._flatMeasurements;a!=null?i=a[s*2]+a[s*2+1]:i=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(o=>o===null);){const o=r[a];s[o.lane]===null&&(s[o.lane]=o.end),a--}i=Math.max(...s.filter(o=>o!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(Lb()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,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,i=r?r[0]:this.scrollState.lastTargetOffset,s=1,a=i!==this.scrollState.lastTargetOffset;if(!a&&SU(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const o=this.getSize()||600,l=Math.abs(i-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>o;this.scrollState.lastTargetOffset=i,c||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const KA=(t,e,n,r)=>{for(;t<=e;){const i=(t+e)/2|0,s=n(i);if(s<r)t=i+1;else if(s>r)e=i-1;else return i}return t>0?t-1:0};function LU({measurements:t,outerSize:e,scrollOffset:n,lanes:r,flat:i}){const s=t.length-1,a=i?u=>i[u*2]:u=>t[u].start,o=i?u=>i[u*2]+i[u*2+1]:u=>t[u].end;if(t.length<=r)return{startIndex:0,endIndex:s};let l=KA(0,s,a,n),c=l;if(r===1)for(;c<s&&o(c)<n+e;)c++;else if(r>1){const u=Array(r).fill(0);for(;c<s&&u.some(h=>h<n+e);){const h=t[c];u[h.lane]=h.end,c++}const d=Array(r).fill(n+e);for(;l>=0&&d.some(h=>h>=n);){const h=t[l];d[h.lane]=h.start,l--}l=Math.max(0,l-l%r),c=Math.min(s,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}const Bb=typeof document<"u"?v.useLayoutEffect:v.useEffect;function BU({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...r}){const i=v.useReducer(c=>c+1,0)[1],s=v.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=e,s.current.mode=n;const a=c=>{const u=s.current;if(!u.enabled)return;const d=c.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const g=c.options.horizontal?"width":"height";u.container.style[g]=`${d}px`}const h=!!c.options.horizontal,m=u.mode==="transform",p=h?"left":"top",b=c.options.scrollMargin,x=c.getVirtualItems();for(const g of x){const y=g.start-b,w=c.elementsCache.get(g.key);w&&u.lastPositions.get(w)!==y&&(u.lastPositions.set(w,y),m?w.style.transform=h?`translate3d(${y}px, 0, 0)`:`translate3d(0, ${y}px, 0)`:w.style[p]=`${y}px`)}},o={...r,onChange:(c,u)=>{var d;const h=s.current;let m=!0;if(h.enabled){a(c);const p=c.range,b=h.prevRange;m=!b||b.isScrolling!==c.isScrolling||b.startIndex!==(p==null?void 0:p.startIndex)||b.endIndex!==(p==null?void 0:p.endIndex),m&&(h.prevRange=p?{startIndex:p.startIndex,endIndex:p.endIndex,isScrolling:c.isScrolling}:null)}m&&(t&&u?hw.flushSync(i):i()),(d=r.onChange)==null||d.call(r,c,u)}},[l]=v.useState(()=>{const c=new jU(o);return Object.assign(c,{containerRef:u=>{const d=s.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const h=c.getTotalSize();d.lastSize=h;const m=c.options.horizontal?"width":"height";u.style[m]=`${h}px`}}})});return l.setOptions(o),Bb(()=>l._didMount(),[]),Bb(()=>l._willUpdate()),Bb(()=>{a(l)}),l}function zU(t){return BU({observeElementRect:AU,observeElementOffset:DU,scrollToFn:OU,...t})}function YA(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function PU(t){var e;return((e=YA(t))==null?void 0:e.type)==="task_execution"}function D1(t){var n;const e=t.toolName.toLowerCase();return e==="agent"||e==="task"||t.subTools||t.subContent||PU(t.rawOutput)?!0:!!((n=t.args)!=null&&n.subagent_type)}function XA(t){var n;if(!D1(t))return!1;const e=YA(t.rawOutput);return(e==null?void 0:e.status)==="background"||((n=t.args)==null?void 0:n.run_in_background)===!0}const QA=v.createContext({}),$U=QA.Provider;function du(){return v.useContext(QA)}const UU="_row_40fa3_1",HU="_tip_40fa3_12",D_={row:UU,tip:HU};function JA({timestamp:t,children:e}){return t===void 0?f.jsx(f.Fragment,{children:e}):f.jsxs("div",{className:D_.row,children:[e,f.jsx("span",{className:D_.tip,"aria-hidden":"true",children:vg(t)})]})}function vg(t,e=new Date){const n=new Date(t),r=a=>String(a).padStart(2,"0"),i=`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`;return n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate()?i:`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())} ${i}`}function ZA({className:t,style:e}){return f.jsx("svg",{className:t,style:e,width:"0.6em",height:"0.85em",viewBox:"0 0 10 14",fill:"none","aria-hidden":"true",children:f.jsx("path",{d:"M1.5 1.5 L8 7 L1.5 12.5",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}const qU="modulepreload",FU=function(t){return"/"+t},I_={},U=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=FU(l),l in I_)return;I_[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":qU,c||(d.as="script"),d.crossOrigin="",d.href=l,o&&d.setAttribute("nonce",o),document.head.appendChild(d),c)return new Promise((h,m)=>{d.addEventListener("load",h),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},Oi={Dark:"dark",Light:"light"},Gh=[Oi.Dark,Oi.Light],eM=v.createContext(Oi.Dark),VU=eM.Provider;function tM(){return v.useContext(eM)}const _c="ui.theme",Qu="general.language";function S3(t,e){return t===Oi.Light||t==="Qwen Light"?Oi.Light:t===Oi.Dark||t==="Qwen Dark"?Oi.Dark:e}function R_(t){return t===Oi.Light?"Qwen Light":"Qwen Dark"}function O_(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&e.push(a),i=r+1,r=n.indexOf(",",i)}return e}function nM(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const GU=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WU=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,KU={};function j_(t,e){return(KU.jsx?WU:GU).test(t)}const YU=/[ \t\n\f\r]/g;function I1(t){return typeof t=="object"?t.type==="text"?L_(t.value):!1:L_(t)}function L_(t){return t.replace(YU,"")===""}class A0{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}A0.prototype.normal={};A0.prototype.property={};A0.prototype.space=void 0;function rM(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new A0(n,r,e)}function Ff(t){return t.toLowerCase()}class Ui{constructor(e,n){this.attribute=n,this.property=e}}Ui.prototype.attribute="";Ui.prototype.booleanish=!1;Ui.prototype.boolean=!1;Ui.prototype.commaOrSpaceSeparated=!1;Ui.prototype.commaSeparated=!1;Ui.prototype.defined=!1;Ui.prototype.mustUseProperty=!1;Ui.prototype.number=!1;Ui.prototype.overloadedBoolean=!1;Ui.prototype.property="";Ui.prototype.spaceSeparated=!1;Ui.prototype.space=void 0;let XU=0;const At=hu(),fr=hu(),wx=hu(),Te=hu(),kn=hu(),qc=hu(),Wi=hu();function hu(){return 2**++XU}const kx=Object.freeze(Object.defineProperty({__proto__:null,boolean:At,booleanish:fr,commaOrSpaceSeparated:Wi,commaSeparated:qc,number:Te,overloadedBoolean:wx,spaceSeparated:kn},Symbol.toStringTag,{value:"Module"})),zb=Object.keys(kx);class T3 extends Ui{constructor(e,n,r,i){let s=-1;if(super(e,n),B_(this,"space",i),typeof r=="number")for(;++s<zb.length;){const a=zb[s];B_(this,zb[s],(r&kx[a])===kx[a])}}}T3.prototype.defined=!0;function B_(t,e,n){n&&(t[e]=n)}function eh(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new T3(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[Ff(r)]=r,n[Ff(s.attribute)]=r}return new A0(e,n,t.space)}const iM=eh({properties:{ariaActiveDescendant:null,ariaAtomic:fr,ariaAutoComplete:null,ariaBusy:fr,ariaChecked:fr,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:kn,ariaCurrent:null,ariaDescribedBy:kn,ariaDetails:null,ariaDisabled:fr,ariaDropEffect:kn,ariaErrorMessage:null,ariaExpanded:fr,ariaFlowTo:kn,ariaGrabbed:fr,ariaHasPopup:null,ariaHidden:fr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kn,ariaLevel:Te,ariaLive:null,ariaModal:fr,ariaMultiLine:fr,ariaMultiSelectable:fr,ariaOrientation:null,ariaOwns:kn,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:fr,ariaReadOnly:fr,ariaRelevant:null,ariaRequired:fr,ariaRoleDescription:kn,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:fr,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function sM(t,e){return e in t?t[e]:e}function aM(t,e){return sM(t,e.toLowerCase())}const QU=eh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qc,acceptCharset:kn,accessKey:kn,action:null,allow:null,allowFullScreen:At,allowPaymentRequest:At,allowUserMedia:At,alpha:At,alt:null,as:null,async:At,autoCapitalize:null,autoComplete:kn,autoFocus:At,autoPlay:At,blocking:kn,capture:null,charSet:null,checked:At,cite:null,className:kn,closedBy:null,colorSpace:null,cols:Te,colSpan:Te,command:null,commandFor:null,content:null,contentEditable:fr,controls:At,controlsList:kn,coords:Te|qc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:At,defer:At,dir:null,dirName:null,disabled:At,download:wx,draggable:fr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:At,formTarget:null,headers:kn,height:Te,hidden:wx,high:Te,href:null,hrefLang:null,htmlFor:kn,httpEquiv:kn,id:null,imageSizes:null,imageSrcSet:null,inert:At,inputMode:null,integrity:null,is:null,isMap:At,itemId:null,itemProp:kn,itemRef:kn,itemScope:At,itemType:kn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:At,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:At,muted:At,name:null,nonce:null,noModule:At,noValidate:At,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:At,optimum:Te,pattern:null,ping:kn,placeholder:null,playsInline:At,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:At,referrerPolicy:null,rel:kn,required:At,reversed:At,rows:Te,rowSpan:Te,sandbox:kn,scope:null,scoped:At,seamless:At,selected:At,shadowRootClonable:At,shadowRootCustomElementRegistry:At,shadowRootDelegatesFocus:At,shadowRootMode:null,shadowRootSerializable:At,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:fr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:At,useMap:null,value:fr,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kn,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:At,declare:At,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:At,noHref:At,noShade:At,noWrap:At,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:fr,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:At,disablePictureInPicture:At,disableRemotePlayback:At,exportParts:qc,part:kn,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:aM}),JU=eh({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:Wi,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:kn,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:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:At,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,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:qc,g2:qc,glyphName:qc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:Wi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,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:Te,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:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wi,rev:Wi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wi,requiredFeatures:Wi,requiredFonts:Wi,requiredFormats:Wi,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:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:Wi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wi,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sM}),oM=eh({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),lM=eh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:aM}),cM=eh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),ZU={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"},eH=/[A-Z]/g,z_=/-[a-z]/g,tH=/^data[-\w.:]+$/i;function C3(t,e){const n=Ff(e);let r=e,i=Ui;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&tH.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(z_,rH);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!z_.test(s)){let a=s.replace(eH,nH);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=T3}return new i(r,e)}function nH(t){return"-"+t.toLowerCase()}function rH(t){return t.charAt(1).toUpperCase()}const E3=rM([iM,QU,oM,lM,cM],"html"),th=rM([iM,JU,oM,lM,cM],"svg");function P_(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function uM(t){return t.join(" ").trim()}var A3={},$_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,iH=/\n/g,sH=/^\s*/,aH=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,oH=/^:\s*/,lH=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,cH=/^[;\s]*/,uH=/^\s+|\s+$/g,dH=`
`,U_="/",H_="*",Sc="",hH="comment",fH="declaration";function mH(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(p){var b=p.match(iH);b&&(n+=b.length);var x=p.lastIndexOf(dH);r=~x?p.length-x:r+p.length}function s(){var p={line:n,column:r};return function(b){return b.position=new a(p),c(),b}}function a(p){this.start=p,this.end={line:n,column:r},this.source=e.source}a.prototype.content=t;function o(p){var b=new Error(e.source+":"+n+":"+r+": "+p);if(b.reason=p,b.filename=e.source,b.line=n,b.column=r,b.source=t,!e.silent)throw b}function l(p){var b=p.exec(t);if(b){var x=b[0];return i(x),t=t.slice(x.length),b}}function c(){l(sH)}function u(p){var b;for(p=p||[];b=d();)b!==!1&&p.push(b);return p}function d(){var p=s();if(!(U_!=t.charAt(0)||H_!=t.charAt(1))){for(var b=2;Sc!=t.charAt(b)&&(H_!=t.charAt(b)||U_!=t.charAt(b+1));)++b;if(b+=2,Sc===t.charAt(b-1))return o("End of comment missing");var x=t.slice(2,b-2);return r+=2,i(x),t=t.slice(b),r+=2,p({type:hH,comment:x})}}function h(){var p=s(),b=l(aH);if(b){if(d(),!l(oH))return o("property missing ':'");var x=l(lH),g=p({type:fH,property:q_(b[0].replace($_,Sc)),value:x?q_(x[0].replace($_,Sc)):Sc});return l(cH),g}}function m(){var p=[];u(p);for(var b;b=h();)b!==!1&&(p.push(b),u(p));return p}return c(),m()}function q_(t){return t?t.replace(uH,Sc):Sc}var pH=mH,gH=zp&&zp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(A3,"__esModule",{value:!0});A3.default=bH;const yH=gH(pH);function bH(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,yH.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:o}=s;i?e(a,o,s):o&&(n=n||{},n[a]=o)}),n}var R1={};Object.defineProperty(R1,"__esModule",{value:!0});R1.camelCase=void 0;var vH=/^--[a-zA-Z0-9_-]+$/,xH=/-([a-z])/g,wH=/^[^-]+$/,kH=/^-(webkit|moz|ms|o|khtml)-/,_H=/^-(ms)-/,SH=function(t){return!t||wH.test(t)||vH.test(t)},TH=function(t,e){return e.toUpperCase()},F_=function(t,e){return"".concat(e,"-")},CH=function(t,e){return e===void 0&&(e={}),SH(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(_H,F_):t=t.replace(kH,F_),t.replace(xH,TH))};R1.camelCase=CH;var EH=zp&&zp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},AH=EH(A3),MH=R1;function _x(t,e){var n={};return!t||typeof t!="string"||(0,AH.default)(t,function(r,i){r&&i&&(n[(0,MH.camelCase)(r,e)]=i)}),n}_x.default=_x;var NH=_x;const DH=l1(NH),dM=hM("end"),M3=hM("start");function hM(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};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 IH(t){const e=M3(t),n=dM(t);if(e&&n)return{start:e,end:n}}function yf(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?V_(t.position):"start"in t||"end"in t?V_(t):"line"in t||"column"in t?Sx(t):""}function Sx(t){return G_(t&&t.line)+":"+G_(t&&t.column)}function V_(t){return Sx(t&&t.start)+"-"+Sx(t&&t.end)}function G_(t){return t&&typeof t=="number"?t:1}class ii extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(a=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=yf(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ii.prototype.file="";ii.prototype.name="";ii.prototype.reason="";ii.prototype.message="";ii.prototype.stack="";ii.prototype.column=void 0;ii.prototype.line=void 0;ii.prototype.ancestors=void 0;ii.prototype.cause=void 0;ii.prototype.fatal=void 0;ii.prototype.place=void 0;ii.prototype.ruleId=void 0;ii.prototype.source=void 0;const N3={}.hasOwnProperty,RH=new Map,OH=/[A-Z]/g,jH=new Set(["table","tbody","thead","tfoot","tr"]),LH=new Set(["td","th"]),fM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BH(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=VH(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=FH(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?th:E3,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=mM(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function mM(t,e,n){if(e.type==="element")return zH(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return PH(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return UH(t,e,n);if(e.type==="mdxjsEsm")return $H(t,e);if(e.type==="root")return HH(t,e,n);if(e.type==="text")return qH(t,e)}function zH(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=th,t.schema=i),t.ancestors.push(e);const s=gM(t,e.tagName,!1),a=GH(t,e);let o=I3(t,e);return jH.has(e.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!I1(l):!0})),pM(t,a,s,e),D3(a,o),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function PH(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Vf(t,e.position)}function $H(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Vf(t,e.position)}function UH(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=th,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:gM(t,e.name,!0),a=WH(t,e),o=I3(t,e);return pM(t,a,s,e),D3(a,o),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function HH(t,e,n){const r={};return D3(r,I3(t,e)),t.create(e,t.Fragment,r,n)}function qH(t,e){return e.value}function pM(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function D3(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function FH(t,e,n){return r;function r(i,s,a,o){const c=Array.isArray(a.children)?n:e;return o?c(s,a,o):c(s,a)}}function VH(t,e){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=M3(r);return e(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function GH(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&N3.call(e.properties,i)){const s=KH(t,i,e.properties[i]);if(s){const[a,o]=s;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&LH.has(e.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function WH(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else Vf(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const o=r.value.data.estree.body[0];o.type,s=t.evaluater.evaluateExpression(o.expression)}else Vf(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function I3(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:RH;for(;++r<e.children.length;){const s=e.children[r];let a;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const o=mM(t,s,a);o!==void 0&&n.push(o)}return n}function KH(t,e,n){const r=C3(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?nM(n):uM(n)),r.property==="style"){let i=typeof n=="object"?n:YH(t,String(n));return t.stylePropertyNameCase==="css"&&(i=XH(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?ZU[r.property]||r.property:r.attribute,n]}}function YH(t,e){try{return DH(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new ii("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=fM+"#cannot-parse-style-attribute",i}}function gM(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,a;for(;++s<i.length;){const o=j_(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=j_(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return N3.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Vf(t)}function Vf(t,e){const n=new ii("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=fM+"#cannot-handle-mdx-estrees-without-createevaluater",n}function XH(t){const e={};let n;for(n in t)N3.call(t,n)&&(e[QH(n)]=t[n]);return e}function QH(t){let e=t.replace(OH,JH);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function JH(t){return"-"+t.toLowerCase()}const Pb={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"]},ZH={};function R3(t,e){const n=ZH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return yM(t,r,i)}function yM(t,e,n){if(eq(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return W_(t.children,e,n)}return Array.isArray(t)?W_(t,e,n):""}function W_(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=yM(t[i],e,n);return r.join("")}function eq(t){return!!(t&&typeof t=="object")}const K_=document.createElement("i");function O3(t){const e="&"+t+";";K_.innerHTML=e;const n=K_.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function os(t,e,n,r){const i=t.length;let s=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(e,0),t.splice(...a),s+=1e4,e+=1e4}function Cs(t,e){return t.length>0?(os(t,t.length,0,e),t):e}const Y_={}.hasOwnProperty;function bM(t){const e={};let n=-1;for(;++n<t.length;)tq(e,t[n]);return e}function tq(t,e){let n;for(n in e){const i=(Y_.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let a;if(s)for(a in s){Y_.call(i,a)||(i[a]=[]);const o=s[a];nq(i[a],Array.isArray(o)?o:o?[o]:[])}}}function nq(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);os(t,0,0,r)}function vM(t,e){const n=Number.parseInt(t,e);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 ia(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bi=ec(/[A-Za-z]/),ti=ec(/[\dA-Za-z]/),rq=ec(/[#-'*+\--9=?A-Z^-~]/);function xg(t){return t!==null&&(t<32||t===127)}const Tx=ec(/\d/),iq=ec(/[\dA-Fa-f]/),sq=ec(/[!-/:-@[-`{-~]/);function nt(t){return t!==null&&t<-2}function Tn(t){return t!==null&&(t<0||t===32)}function Vt(t){return t===-2||t===-1||t===32}const O1=ec(new RegExp("\\p{P}|\\p{S}","u")),Jc=ec(/\s/);function ec(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function nh(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let a="";if(s===37&&ti(t.charCodeAt(n+1))&&ti(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=t.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ht(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return Vt(l)?(t.enter(n),o(l)):e(l)}function o(l){return Vt(l)&&s++<i?(t.consume(l),o):(t.exit(n),e(l))}}const aq={tokenize:oq};function oq(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Ht(t,e,"linePrefix")}function i(o){return t.enter("paragraph"),s(o)}function s(o){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(o);return}return nt(o)?(t.consume(o),t.exit("chunkText"),s):(t.consume(o),a)}}const lq={tokenize:cq},X_={tokenize:uq};function cq(t){const e=this,n=[];let r=0,i,s,a;return o;function o(w){if(r<n.length){const C=n[r];return e.containerState=C[1],t.attempt(C[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&y();const C=e.events.length;let E=C,S;for(;E--;)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){S=e.events[E][1].end;break}g(r);let T=C;for(;T<e.events.length;)e.events[T][1].end={...S},T++;return os(e.events,E+1,0,e.events.slice(C)),e.events.length=T,c(w)}return o(w)}function c(w){if(r===n.length){if(!i)return h(w);if(i.currentConstruct&&i.currentConstruct.concrete)return p(w);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(X_,u,d)(w)}function u(w){return i&&y(),g(r),h(w)}function d(w){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,p(w)}function h(w){return e.containerState={},t.attempt(X_,m,p)(w)}function m(w){return r++,n.push([e.currentConstruct,e.containerState]),h(w)}function p(w){if(w===null){i&&y(),g(0),t.consume(w);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),b(w)}function b(w){if(w===null){x(t.exit("chunkFlow"),!0),g(0),t.consume(w);return}return nt(w)?(t.consume(w),x(t.exit("chunkFlow")),r=0,e.interrupt=void 0,o):(t.consume(w),b)}function x(w,C){const E=e.sliceStream(w);if(C&&E.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(E),e.parser.lazy[w.start.line]){let S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<a&&(!i.events[S][1].end||i.events[S][1].end.offset>a))return;const T=e.events.length;let O=T,z,I;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){if(z){I=e.events[O][1].end;break}z=!0}for(g(r),S=T;S<e.events.length;)e.events[S][1].end={...I},S++;os(e.events,O+1,0,e.events.slice(T)),e.events.length=S}}function g(w){let C=n.length;for(;C-- >w;){const E=n[C];e.containerState=E[1],E[0].exit.call(e,t)}n.length=w}function y(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function uq(t,e,n){return Ht(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nd(t){if(t===null||Tn(t)||Jc(t))return 1;if(O1(t))return 2}function j1(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Cx={name:"attention",resolveAll:dq,tokenize:hq};function dq(t,e){let n=-1,r,i,s,a,o,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},h={...t[n][1].start};Q_(d,-l),Q_(h,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Cs(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Cs(c,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",s,e]]),c=Cs(c,j1(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Cs(c,[["exit",s,e],["enter",o,e],["exit",o,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=Cs(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,os(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function hq(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Nd(r);let s;return a;function a(l){return s=l,t.enter("attentionSequence"),o(l)}function o(l){if(l===s)return t.consume(l),o;const c=t.exit("attentionSequence"),u=Nd(l),d=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!h)),c._close=!!(s===42?h:h&&(u||!d)),e(l)}}function Q_(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const fq={name:"autolink",tokenize:mq};function mq(t,e,n){let r=0;return i;function i(m){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(m){return bi(m)?(t.consume(m),a):m===64?n(m):c(m)}function a(m){return m===43||m===45||m===46||ti(m)?(r=1,o(m)):c(m)}function o(m){return m===58?(t.consume(m),r=0,l):(m===43||m===45||m===46||ti(m))&&r++<32?(t.consume(m),o):(r=0,c(m))}function l(m){return m===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):m===null||m===32||m===60||xg(m)?n(m):(t.consume(m),l)}function c(m){return m===64?(t.consume(m),u):rq(m)?(t.consume(m),c):n(m)}function u(m){return ti(m)?d(m):n(m)}function d(m){return m===46?(t.consume(m),r=0,u):m===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):h(m)}function h(m){if((m===45||ti(m))&&r++<63){const p=m===45?h:d;return t.consume(m),p}return n(m)}}const M0={partial:!0,tokenize:pq};function pq(t,e,n){return r;function r(s){return Vt(s)?Ht(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||nt(s)?e(s):n(s)}}const xM={continuation:{tokenize:yq},exit:bq,name:"blockQuote",tokenize:gq};function gq(t,e,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(t.enter("blockQuote",{_container:!0}),o.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),s}return n(a)}function s(a){return Vt(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function yq(t,e,n){const r=this;return i;function i(a){return Vt(a)?Ht(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return t.attempt(xM,e,n)(a)}}function bq(t){t.exit("blockQuote")}const wM={name:"characterEscape",tokenize:vq};function vq(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return sq(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const kM={name:"characterReference",tokenize:xq};function xq(t,e,n){const r=this;let i=0,s,a;return o;function o(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,a=ti,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,a=iq,u):(t.enter("characterReferenceValue"),s=7,a=Tx,u(d))}function u(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return a===ti&&!O3(r.sliceSerialize(h))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(d)&&i++<s?(t.consume(d),u):n(d)}}const J_={partial:!0,tokenize:kq},Z_={concrete:!0,name:"codeFenced",tokenize:wq};function wq(t,e,n){const r=this,i={partial:!0,tokenize:E};let s=0,a=0,o;return l;function l(S){return c(S)}function c(S){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=S,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===o?(a++,t.consume(S),u):a<3?n(S):(t.exit("codeFencedFenceSequence"),Vt(S)?Ht(t,d,"whitespace")(S):d(S))}function d(S){return S===null||nt(S)?(t.exit("codeFencedFence"),r.interrupt?e(S):t.check(J_,b,C)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||nt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(S)):Vt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ht(t,m,"whitespace")(S)):S===96&&S===o?n(S):(t.consume(S),h)}function m(S){return S===null||nt(S)?d(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||nt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(S)):S===96&&S===o?n(S):(t.consume(S),p)}function b(S){return t.attempt(i,C,x)(S)}function x(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),g}function g(S){return s>0&&Vt(S)?Ht(t,y,"linePrefix",s+1)(S):y(S)}function y(S){return S===null||nt(S)?t.check(J_,b,C)(S):(t.enter("codeFlowValue"),w(S))}function w(S){return S===null||nt(S)?(t.exit("codeFlowValue"),y(S)):(t.consume(S),w)}function C(S){return t.exit("codeFenced"),e(S)}function E(S,T,O){let z=0;return I;function I(J){return S.enter("lineEnding"),S.consume(J),S.exit("lineEnding"),j}function j(J){return S.enter("codeFencedFence"),Vt(J)?Ht(S,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):N(J)}function N(J){return J===o?(S.enter("codeFencedFenceSequence"),B(J)):O(J)}function B(J){return J===o?(z++,S.consume(J),B):z>=a?(S.exit("codeFencedFenceSequence"),Vt(J)?Ht(S,P,"whitespace")(J):P(J)):O(J)}function P(J){return J===null||nt(J)?(S.exit("codeFencedFence"),T(J)):O(J)}}}function kq(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const $b={name:"codeIndented",tokenize:Sq},_q={partial:!0,tokenize:Tq};function Sq(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Ht(t,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):nt(c)?t.attempt(_q,a,l)(c):(t.enter("codeFlowValue"),o(c))}function o(c){return c===null||nt(c)?(t.exit("codeFlowValue"),a(c)):(t.consume(c),o)}function l(c){return t.exit("codeIndented"),e(c)}}function Tq(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):nt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Ht(t,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):nt(a)?i(a):n(a)}}const Cq={name:"codeText",previous:Aq,resolve:Eq,tokenize:Mq};function Eq(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function Aq(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Mq(t,e,n){let r=0,i,s;return a;function a(d){return t.enter("codeText"),t.enter("codeTextSequence"),o(d)}function o(d){return d===96?(t.consume(d),r++,o):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):nt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||nt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),i++,u):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",c(d))}}class Nq{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Mh(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Mh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Mh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Mh(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Mh(this.left,n.reverse())}}}function Mh(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function _M(t){const e={};let n=-1,r,i,s,a,o,l,c;const u=new Nq(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Dq(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=u.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},o=u.slice(i,n),o.unshift(r),u.splice(i,n-i+1,o))}}return os(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Dq(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let u,d,h=-1,m=n,p=0,b=0;const x=[b];for(;m;){for(;t.get(++i)[1]!==m;);s.push(i),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),d&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(b=h+1,x.push(b),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):x.pop(),h=x.length;h--;){const g=o.slice(x[h],x[h+1]),y=s.pop();l.push([y,y+g.length-1]),t.splice(y,2,g)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}const Iq={resolve:Oq,tokenize:jq},Rq={partial:!0,tokenize:Lq};function Oq(t){return _M(t),t}function jq(t,e){let n;return r;function r(o){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):nt(o)?t.check(Rq,a,s)(o):(t.consume(o),i)}function s(o){return t.exit("chunkContent"),t.exit("content"),e(o)}function a(o){return t.consume(o),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Lq(t,e,n){const r=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ht(t,s,"linePrefix")}function s(a){if(a===null||nt(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function SM(t,e,n,r,i,s,a,o,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(g){return g===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(g),t.exit(s),h):g===null||g===32||g===41||xg(g)?n(g):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),b(g))}function h(g){return g===62?(t.enter(s),t.consume(g),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===62?(t.exit("chunkString"),t.exit(o),h(g)):g===null||g===60||nt(g)?n(g):(t.consume(g),g===92?p:m)}function p(g){return g===60||g===62||g===92?(t.consume(g),m):m(g)}function b(g){return!u&&(g===null||g===41||Tn(g))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(g)):u<c&&g===40?(t.consume(g),u++,b):g===41?(t.consume(g),u--,b):g===null||g===32||g===40||xg(g)?n(g):(t.consume(g),g===92?x:b)}function x(g){return g===40||g===41||g===92?(t.consume(g),b):b(g)}}function TM(t,e,n,r,i,s){const a=this;let o=0,l;return c;function c(m){return t.enter(r),t.enter(i),t.consume(m),t.exit(i),t.enter(s),u}function u(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(t.exit(s),t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):nt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||nt(m)||o++>999?(t.exit("chunkString"),u(m)):(t.consume(m),l||(l=!Vt(m)),m===92?h:d)}function h(m){return m===91||m===92||m===93?(t.consume(m),o++,d):d(m)}}function CM(t,e,n,r,i,s){let a;return o;function o(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),a=h===40?41:h,l):n(h)}function l(h){return h===a?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(s),c(h))}function c(h){return h===a?(t.exit(s),l(a)):h===null?n(h):nt(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),Ht(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===a||h===null||nt(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?d:u)}function d(h){return h===a||h===92?(t.consume(h),u):u(h)}}function bf(t,e){let n;return r;function r(i){return nt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Vt(i)?Ht(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Bq={name:"definition",tokenize:Pq},zq={partial:!0,tokenize:$q};function Pq(t,e,n){const r=this;let i;return s;function s(m){return t.enter("definition"),a(m)}function a(m){return TM.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return i=ia(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),l):n(m)}function l(m){return Tn(m)?bf(t,c)(m):c(m)}function c(m){return SM(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return t.attempt(zq,d,d)(m)}function d(m){return Vt(m)?Ht(t,h,"whitespace")(m):h(m)}function h(m){return m===null||nt(m)?(t.exit("definition"),r.parser.defined.push(i),e(m)):n(m)}}function $q(t,e,n){return r;function r(o){return Tn(o)?bf(t,i)(o):n(o)}function i(o){return CM(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return Vt(o)?Ht(t,a,"whitespace")(o):a(o)}function a(o){return o===null||nt(o)?e(o):n(o)}}const Uq={name:"hardBreakEscape",tokenize:Hq};function Hq(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return nt(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const qq={name:"headingAtx",resolve:Fq,tokenize:Vq};function Fq(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},os(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Vq(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(t.consume(u),a):u===null||Tn(u)?(t.exit("atxHeadingSequence"),o(u)):n(u)}function o(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||nt(u)?(t.exit("atxHeading"),e(u)):Vt(u)?Ht(t,o,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),o(u))}function c(u){return u===null||u===35||Tn(u)?(t.exit("atxHeadingText"),o(u)):(t.consume(u),c)}}const Gq=["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"],eS=["pre","script","style","textarea"],Wq={concrete:!0,name:"htmlFlow",resolveTo:Xq,tokenize:Qq},Kq={partial:!0,tokenize:Zq},Yq={partial:!0,tokenize:Jq};function Xq(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Qq(t,e,n){const r=this;let i,s,a,o,l;return c;function c(R){return u(R)}function u(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),d}function d(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),s=!0,b):R===63?(t.consume(R),i=3,r.interrupt?e:M):bi(R)?(t.consume(R),a=String.fromCharCode(R),x):n(R)}function h(R){return R===45?(t.consume(R),i=2,m):R===91?(t.consume(R),i=5,o=0,p):bi(R)?(t.consume(R),i=4,r.interrupt?e:M):n(R)}function m(R){return R===45?(t.consume(R),r.interrupt?e:M):n(R)}function p(R){const ae="CDATA[";return R===ae.charCodeAt(o++)?(t.consume(R),o===ae.length?r.interrupt?e:N:p):n(R)}function b(R){return bi(R)?(t.consume(R),a=String.fromCharCode(R),x):n(R)}function x(R){if(R===null||R===47||R===62||Tn(R)){const ae=R===47,xe=a.toLowerCase();return!ae&&!s&&eS.includes(xe)?(i=1,r.interrupt?e(R):N(R)):Gq.includes(a.toLowerCase())?(i=6,ae?(t.consume(R),g):r.interrupt?e(R):N(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):s?y(R):w(R))}return R===45||ti(R)?(t.consume(R),a+=String.fromCharCode(R),x):n(R)}function g(R){return R===62?(t.consume(R),r.interrupt?e:N):n(R)}function y(R){return Vt(R)?(t.consume(R),y):I(R)}function w(R){return R===47?(t.consume(R),I):R===58||R===95||bi(R)?(t.consume(R),C):Vt(R)?(t.consume(R),w):I(R)}function C(R){return R===45||R===46||R===58||R===95||ti(R)?(t.consume(R),C):E(R)}function E(R){return R===61?(t.consume(R),S):Vt(R)?(t.consume(R),E):w(R)}function S(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,T):Vt(R)?(t.consume(R),S):O(R)}function T(R){return R===l?(t.consume(R),l=null,z):R===null||nt(R)?n(R):(t.consume(R),T)}function O(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Tn(R)?E(R):(t.consume(R),O)}function z(R){return R===47||R===62||Vt(R)?w(R):n(R)}function I(R){return R===62?(t.consume(R),j):n(R)}function j(R){return R===null||nt(R)?N(R):Vt(R)?(t.consume(R),j):n(R)}function N(R){return R===45&&i===2?(t.consume(R),q):R===60&&i===1?(t.consume(R),Y):R===62&&i===4?(t.consume(R),X):R===63&&i===3?(t.consume(R),M):R===93&&i===5?(t.consume(R),Z):nt(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Kq,H,B)(R)):R===null||nt(R)?(t.exit("htmlFlowData"),B(R)):(t.consume(R),N)}function B(R){return t.check(Yq,P,H)(R)}function P(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return R===null||nt(R)?B(R):(t.enter("htmlFlowData"),N(R))}function q(R){return R===45?(t.consume(R),M):N(R)}function Y(R){return R===47?(t.consume(R),a="",$):N(R)}function $(R){if(R===62){const ae=a.toLowerCase();return eS.includes(ae)?(t.consume(R),X):N(R)}return bi(R)&&a.length<8?(t.consume(R),a+=String.fromCharCode(R),$):N(R)}function Z(R){return R===93?(t.consume(R),M):N(R)}function M(R){return R===62?(t.consume(R),X):R===45&&i===2?(t.consume(R),M):N(R)}function X(R){return R===null||nt(R)?(t.exit("htmlFlowData"),H(R)):(t.consume(R),X)}function H(R){return t.exit("htmlFlow"),e(R)}}function Jq(t,e,n){const r=this;return i;function i(a){return nt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Zq(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(M0,e,n)}}const eF={name:"htmlText",tokenize:tF};function tF(t,e,n){const r=this;let i,s,a;return o;function o(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),l}function l(M){return M===33?(t.consume(M),c):M===47?(t.consume(M),E):M===63?(t.consume(M),w):bi(M)?(t.consume(M),O):n(M)}function c(M){return M===45?(t.consume(M),u):M===91?(t.consume(M),s=0,p):bi(M)?(t.consume(M),y):n(M)}function u(M){return M===45?(t.consume(M),m):n(M)}function d(M){return M===null?n(M):M===45?(t.consume(M),h):nt(M)?(a=d,Y(M)):(t.consume(M),d)}function h(M){return M===45?(t.consume(M),m):d(M)}function m(M){return M===62?q(M):M===45?h(M):d(M)}function p(M){const X="CDATA[";return M===X.charCodeAt(s++)?(t.consume(M),s===X.length?b:p):n(M)}function b(M){return M===null?n(M):M===93?(t.consume(M),x):nt(M)?(a=b,Y(M)):(t.consume(M),b)}function x(M){return M===93?(t.consume(M),g):b(M)}function g(M){return M===62?q(M):M===93?(t.consume(M),g):b(M)}function y(M){return M===null||M===62?q(M):nt(M)?(a=y,Y(M)):(t.consume(M),y)}function w(M){return M===null?n(M):M===63?(t.consume(M),C):nt(M)?(a=w,Y(M)):(t.consume(M),w)}function C(M){return M===62?q(M):w(M)}function E(M){return bi(M)?(t.consume(M),S):n(M)}function S(M){return M===45||ti(M)?(t.consume(M),S):T(M)}function T(M){return nt(M)?(a=T,Y(M)):Vt(M)?(t.consume(M),T):q(M)}function O(M){return M===45||ti(M)?(t.consume(M),O):M===47||M===62||Tn(M)?z(M):n(M)}function z(M){return M===47?(t.consume(M),q):M===58||M===95||bi(M)?(t.consume(M),I):nt(M)?(a=z,Y(M)):Vt(M)?(t.consume(M),z):q(M)}function I(M){return M===45||M===46||M===58||M===95||ti(M)?(t.consume(M),I):j(M)}function j(M){return M===61?(t.consume(M),N):nt(M)?(a=j,Y(M)):Vt(M)?(t.consume(M),j):z(M)}function N(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),i=M,B):nt(M)?(a=N,Y(M)):Vt(M)?(t.consume(M),N):(t.consume(M),P)}function B(M){return M===i?(t.consume(M),i=void 0,J):M===null?n(M):nt(M)?(a=B,Y(M)):(t.consume(M),B)}function P(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Tn(M)?z(M):(t.consume(M),P)}function J(M){return M===47||M===62||Tn(M)?z(M):n(M)}function q(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),e):n(M)}function Y(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),$}function $(M){return Vt(M)?Ht(t,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Z(M)}function Z(M){return t.enter("htmlTextData"),a(M)}}const j3={name:"labelEnd",resolveAll:sF,resolveTo:aF,tokenize:oF},nF={tokenize:lF},rF={tokenize:cF},iF={tokenize:uF};function sF(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&os(t,0,t.length,n),t}function aF(t,e){let n=t.length,r=0,i,s,a,o;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[a][1].end}},u={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[a-2][1].start}};return o=[["enter",l,e],["enter",c,e]],o=Cs(o,t.slice(s+1,s+r+3)),o=Cs(o,[["enter",u,e]]),o=Cs(o,j1(e.parser.constructs.insideSpan.null,t.slice(s+r+4,a-3),e)),o=Cs(o,[["exit",u,e],t[a-2],t[a-1],["exit",c,e]]),o=Cs(o,t.slice(a+1)),o=Cs(o,[["exit",l,e]]),os(t,s,t.length,o),t}function oF(t,e,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(h){return s?s._inactive?d(h):(a=r.parser.defined.includes(ia(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),l):n(h)}function l(h){return h===40?t.attempt(nF,u,a?u:d)(h):h===91?t.attempt(rF,u,a?c:d)(h):a?u(h):d(h)}function c(h){return t.attempt(iF,u,d)(h)}function u(h){return e(h)}function d(h){return s._balanced=!0,n(h)}}function lF(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return Tn(d)?bf(t,s)(d):s(d)}function s(d){return d===41?u(d):SM(t,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Tn(d)?bf(t,l)(d):u(d)}function o(d){return n(d)}function l(d){return d===34||d===39||d===40?CM(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Tn(d)?bf(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function cF(t,e,n){const r=this;return i;function i(o){return TM.call(r,t,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(ia(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(o):n(o)}function a(o){return n(o)}}function uF(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const dF={name:"labelStartImage",resolveAll:j3.resolveAll,tokenize:hF};function hF(t,e,n){const r=this;return i;function i(o){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(o),t.exit("labelImageMarker"),s}function s(o){return o===91?(t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const fF={name:"labelStartLink",resolveAll:j3.resolveAll,tokenize:mF};function mF(t,e,n){const r=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const Ub={name:"lineEnding",tokenize:pF};function pF(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ht(t,e,"linePrefix")}}const kp={name:"thematicBreak",tokenize:gF};function gF(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||nt(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Vt(c)?Ht(t,o,"whitespace")(c):o(c))}}const Ai={continuation:{tokenize:xF},exit:kF,name:"list",tokenize:vF},yF={partial:!0,tokenize:_F},bF={partial:!0,tokenize:wF};function vF(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Tx(m)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check(kp,n,c)(m):c(m);if(!r.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(m)}return n(m)}function l(m){return Tx(m)&&++a<10?(t.consume(m),l):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):n(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,t.check(M0,r.interrupt?n:u,t.attempt(yF,h,d))}function u(m){return r.containerState.initialBlankLine=!0,s++,h(m)}function d(m){return Vt(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(m)}}function xF(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(M0,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ht(t,e,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!Vt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(bF,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ht(t,t.attempt(Ai,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function wF(t,e,n){const r=this;return Ht(t,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(s):n(s)}}function kF(t){t.exit(this.containerState.type)}function _F(t,e,n){const r=this;return Ht(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!Vt(s)&&a&&a[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const tS={name:"setextUnderline",resolveTo:SF,tokenize:TF};function SF(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",a,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function TF(t,e,n){const r=this;let i;return s;function s(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)?(t.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return t.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(t.consume(c),o):(t.exit("setextHeadingLineSequence"),Vt(c)?Ht(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||nt(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const CF={tokenize:EF};function EF(t){const e=this,n=t.attempt(M0,r,t.attempt(this.parser.constructs.flowInitial,i,Ht(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Iq,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const AF={resolveAll:AM()},MF=EM("string"),NF=EM("text");function EM(t){return{resolveAll:AM(t==="text"?DF:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,a,o);return a;function a(u){return c(u)?s(u):o(u)}function o(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let h=-1;if(d)for(;++h<d.length;){const m=d[h];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function AM(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function DF(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,a=-1,o=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(o=0),o){const c={type:n===t.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const IF={42:Ai,43:Ai,45:Ai,48:Ai,49:Ai,50:Ai,51:Ai,52:Ai,53:Ai,54:Ai,55:Ai,56:Ai,57:Ai,62:xM},RF={91:Bq},OF={[-2]:$b,[-1]:$b,32:$b},jF={35:qq,42:kp,45:[tS,kp],60:Wq,61:tS,95:kp,96:Z_,126:Z_},LF={38:kM,92:wM},BF={[-5]:Ub,[-4]:Ub,[-3]:Ub,33:dF,38:kM,42:Cx,60:[fq,eF],91:fF,92:[Uq,wM],93:j3,95:Cx,96:Cq},zF={null:[Cx,AF]},PF={null:[42,95]},$F={null:[]},UF=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:PF,contentInitial:RF,disable:$F,document:IF,flow:jF,flowInitial:OF,insideSpan:zF,string:LF,text:BF},Symbol.toStringTag,{value:"Module"}));function HF(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],o=[];const l={attempt:T(E),check:T(S),consume:y,enter:w,exit:C,interrupt:T(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:b,events:[],now:p,parser:t,previous:null,sliceSerialize:h,sliceStream:m,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function d(j){return a=Cs(a,j),x(),a[a.length-1]!==null?[]:(O(e,0),c.events=j1(s,c.events,c),c.events)}function h(j,N){return FF(m(j),N)}function m(j){return qF(a,j)}function p(){const{_bufferIndex:j,_index:N,line:B,column:P,offset:J}=r;return{_bufferIndex:j,_index:N,line:B,column:P,offset:J}}function b(j){i[j.line]=j.column,I()}function x(){let j;for(;r._index<a.length;){const N=a[r._index];if(typeof N=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<N.length;)g(N.charCodeAt(r._bufferIndex));else g(N)}}function g(j){u=u(j)}function y(j){nt(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,I()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=j}function w(j,N){const B=N||{};return B.type=j,B.start=p(),c.events.push(["enter",B,c]),o.push(B),B}function C(j){const N=o.pop();return N.end=p(),c.events.push(["exit",N,c]),N}function E(j,N){O(j,N.from)}function S(j,N){N.restore()}function T(j,N){return B;function B(P,J,q){let Y,$,Z,M;return Array.isArray(P)?H(P):"tokenize"in P?H([P]):X(P);function X(ye){return Ae;function Ae(Fe){const vt=Fe!==null&&ye[Fe],Nt=Fe!==null&&ye.null,pt=[...Array.isArray(vt)?vt:vt?[vt]:[],...Array.isArray(Nt)?Nt:Nt?[Nt]:[]];return H(pt)(Fe)}}function H(ye){return Y=ye,$=0,ye.length===0?q:R(ye[$])}function R(ye){return Ae;function Ae(Fe){return M=z(),Z=ye,ye.partial||(c.currentConstruct=ye),ye.name&&c.parser.constructs.disable.null.includes(ye.name)?xe():ye.tokenize.call(N?Object.assign(Object.create(c),N):c,l,ae,xe)(Fe)}}function ae(ye){return j(Z,M),J}function xe(ye){return M.restore(),++$<Y.length?R(Y[$]):q}}}function O(j,N){j.resolveAll&&!s.includes(j)&&s.push(j),j.resolve&&os(c.events,N,c.events.length-N,j.resolve(c.events.slice(N),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function z(){const j=p(),N=c.previous,B=c.currentConstruct,P=c.events.length,J=Array.from(o);return{from:P,restore:q};function q(){r=j,c.previous=N,c.currentConstruct=B,c.events.length=P,o=J,I()}}function I(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function qF(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let a;if(n===i)a=[t[n].slice(r,s)];else{if(a=t.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(t[i].slice(0,s))}return a}function FF(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
`;break}case-3:{a=`\r
`;break}case-2:{a=e?" ":"	";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function VF(t){const r={constructs:bM([UF,...(t||{}).extensions||[]]),content:i(aq),defined:[],document:i(lq),flow:i(CF),lazy:{},string:i(MF),text:i(NF)};return r;function i(s){return a;function a(o){return HF(r,s,o)}}}function GF(t){for(;!_M(t););return t}const nS=/[\0\t\n\r]/g;function WF(){let t=1,e="",n=!0,r;return i;function i(s,a,o){const l=[];let c,u,d,h,m;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),d=0,e="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(nS.lastIndex=d,c=nS.exec(s),h=c&&c.index!==void 0?c.index:s.length,m=s.charCodeAt(h),!c){e=s.slice(d);break}if(m===10&&d===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<h&&(l.push(s.slice(d,h)),t+=h-d),m){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=h+1}return o&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const KF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YF(t){return t.replace(KF,XF)}function XF(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return vM(n.slice(s?2:1),s?16:10)}return O3(n)||t}const MM={}.hasOwnProperty;function QF(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),JF(n)(GF(VF(n).document().write(WF()(t,e,!0))))}function JF(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(We),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(Je),blockQuote:s(Nt),characterEscape:z,characterReference:z,codeFenced:s(pt),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(pt,a),codeText:s(Qe,a),codeTextData:z,data:z,codeFlowValue:z,definition:s(Ge),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s($t),hardBreakEscape:s(re),hardBreakTrailing:s(re),htmlFlow:s(ce,a),htmlFlowData:z,htmlText:s(ce,a),htmlTextData:z,image:s(Ie),label:a,link:s(We),listItem:s(rt),listItemValue:h,listOrdered:s(me,d),listUnordered:s(me),paragraph:s(oe),reference:R,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Je),strong:s(Oe),thematicBreak:s($e)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:vt,autolinkProtocol:Fe,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:ye,characterReference:Ae,codeFenced:l(x),codeFencedFence:b,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:I,codeIndented:l(g),codeText:l(J),codeTextData:I,data:I,definition:l(),definitionDestinationString:C,definitionLabelString:y,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(B),htmlFlowData:I,htmlText:l(P),htmlTextData:I,image:l(Y),label:Z,labelText:$,lineEnding:j,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ae,resourceDestinationString:M,resourceTitleString:X,resource:H,setextHeading:l(O),setextHeadingLineSequence:T,setextHeadingText:S,strong:l(),thematicBreak:l()}};NM(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(ne){let ge={type:"root",children:[]};const ke={stack:[ge],tokenStack:[],config:e,enter:o,exit:c,buffer:a,resume:u,data:n},ze=[];let ot=-1;for(;++ot<ne.length;)if(ne[ot][1].type==="listOrdered"||ne[ot][1].type==="listUnordered")if(ne[ot][0]==="enter")ze.push(ot);else{const Ut=ze.pop();ot=i(ne,Ut,ot)}for(ot=-1;++ot<ne.length;){const Ut=e[ne[ot][0]];MM.call(Ut,ne[ot][1].type)&&Ut[ne[ot][1].type].call(Object.assign({sliceSerialize:ne[ot][2].sliceSerialize},ke),ne[ot][1])}if(ke.tokenStack.length>0){const Ut=ke.tokenStack[ke.tokenStack.length-1];(Ut[1]||rS).call(ke,void 0,Ut[0])}for(ge.position={start:Qo(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Qo(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},ot=-1;++ot<e.transforms.length;)ge=e.transforms[ot](ge)||ge;return ge}function i(ne,ge,ke){let ze=ge-1,ot=-1,Ut=!1,Xt,En,Dn,Yn;for(;++ze<=ke;){const wn=ne[ze];switch(wn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{wn[0]==="enter"?ot++:ot--,Yn=void 0;break}case"lineEndingBlank":{wn[0]==="enter"&&(Xt&&!Yn&&!ot&&!Dn&&(Dn=ze),Yn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Yn=void 0}if(!ot&&wn[0]==="enter"&&wn[1].type==="listItemPrefix"||ot===-1&&wn[0]==="exit"&&(wn[1].type==="listUnordered"||wn[1].type==="listOrdered")){if(Xt){let nr=ze;for(En=void 0;nr--;){const fe=ne[nr];if(fe[1].type==="lineEnding"||fe[1].type==="lineEndingBlank"){if(fe[0]==="exit")continue;En&&(ne[En][1].type="lineEndingBlank",Ut=!0),fe[1].type="lineEnding",En=nr}else if(!(fe[1].type==="linePrefix"||fe[1].type==="blockQuotePrefix"||fe[1].type==="blockQuotePrefixWhitespace"||fe[1].type==="blockQuoteMarker"||fe[1].type==="listItemIndent"))break}Dn&&(!En||Dn<En)&&(Xt._spread=!0),Xt.end=Object.assign({},En?ne[En][1].start:wn[1].end),ne.splice(En||ze,0,["exit",Xt,wn[2]]),ze++,ke++}if(wn[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},wn[1].start),end:void 0};Xt=nr,ne.splice(ze,0,["enter",nr,wn[2]]),ze++,ke++,Dn=void 0,Yn=!0}}}return ne[ge][1]._spread=Ut,ke}function s(ne,ge){return ke;function ke(ze){o.call(this,ne(ze),ze),ge&&ge.call(this,ze)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(ne,ge,ke){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([ge,ke||void 0]),ne.position={start:Qo(ge.start),end:void 0}}function l(ne){return ge;function ge(ke){ne&&ne.call(this,ke),c.call(this,ke)}}function c(ne,ge){const ke=this.stack.pop(),ze=this.tokenStack.pop();if(ze)ze[0].type!==ne.type&&(ge?ge.call(this,ne,ze[0]):(ze[1]||rS).call(this,ne,ze[0]));else throw new Error("Cannot close `"+ne.type+"` ("+yf({start:ne.start,end:ne.end})+"): it’s not open");ke.position.end=Qo(ne.end)}function u(){return R3(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(ne){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=ne}function p(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=ne}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ne.replace(/(\r?\n|\r)$/g,"")}function y(ne){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=ia(this.sliceSerialize(ne)).toLowerCase()}function w(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.title=ne}function C(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.url=ne}function E(ne){const ge=this.stack[this.stack.length-1];if(!ge.depth){const ke=this.sliceSerialize(ne).length;ge.depth=ke}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function T(ne){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function z(ne){const ke=this.stack[this.stack.length-1].children;let ze=ke[ke.length-1];(!ze||ze.type!=="text")&&(ze=Re(),ze.position={start:Qo(ne.start),end:void 0},ke.push(ze)),this.stack.push(ze)}function I(ne){const ge=this.stack.pop();ge.value+=this.sliceSerialize(ne),ge.position.end=Qo(ne.end)}function j(ne){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=ge.children[ge.children.length-1];ke.position.end=Qo(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ge.type)&&(z.call(this,ne),I.call(this,ne))}function N(){this.data.atHardBreak=!0}function B(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ne}function P(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ne}function J(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ne}function q(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ge,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function Y(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ge,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function $(ne){const ge=this.sliceSerialize(ne),ke=this.stack[this.stack.length-2];ke.label=YF(ge),ke.identifier=ia(ge).toLowerCase()}function Z(){const ne=this.stack[this.stack.length-1],ge=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const ze=ne.children;ke.children=ze}else ke.alt=ge}function M(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.url=ne}function X(){const ne=this.resume(),ge=this.stack[this.stack.length-1];ge.title=ne}function H(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function ae(ne){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=ia(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function xe(ne){this.data.characterReferenceType=ne.type}function ye(ne){const ge=this.sliceSerialize(ne),ke=this.data.characterReferenceType;let ze;ke?(ze=vM(ge,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ze=O3(ge);const ot=this.stack[this.stack.length-1];ot.value+=ze}function Ae(ne){const ge=this.stack.pop();ge.position.end=Qo(ne.end)}function Fe(ne){I.call(this,ne);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(ne)}function vt(ne){I.call(this,ne);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(ne)}function Nt(){return{type:"blockquote",children:[]}}function pt(){return{type:"code",lang:null,meta:null,value:""}}function Qe(){return{type:"inlineCode",value:""}}function Ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $t(){return{type:"emphasis",children:[]}}function Je(){return{type:"heading",depth:0,children:[]}}function re(){return{type:"break"}}function ce(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function me(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function rt(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function oe(){return{type:"paragraph",children:[]}}function Oe(){return{type:"strong",children:[]}}function Re(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function Qo(t){return{line:t.line,column:t.column,offset:t.offset}}function NM(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?NM(t,r):ZF(t,r)}}function ZF(t,e){let n;for(n in e)if(MM.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function rS(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+yf({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+yf({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+yf({start:e.start,end:e.end})+") is still open")}function eV(t){const e=this;e.parser=n;function n(r){return QF(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function tV(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function nV(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function rV(t,e){const n=e.value?e.value+`
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function iV(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function sV(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function aV(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=nh(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let a,o=t.footnoteCounts.get(r);o===void 0?(o=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=s+1,o+=1,t.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function oV(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function lV(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function DM(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function cV(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return DM(t,e);const i={src:nh(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function uV(t,e){const n={src:nh(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function dV(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function hV(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return DM(t,e);const i={href:nh(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function fV(t,e){const n={href:nh(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function mV(t,e,n){const r=t.all(e),i=n?pV(n):IM(e),s={},a=[];if(typeof e.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:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const u=r[o];(i||o!==0||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
`}),u.type==="element"&&u.tagName==="p"&&!i?a.push(...u.children):a.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:s,children:a};return t.patch(e,c),t.applyData(e,c)}function pV(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=IM(n[r])}return e}function IM(t){const e=t.spread;return e??t.children.length>1}function gV(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function yV(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function bV(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function vV(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function xV(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=M3(e.children[1]),l=dM(e.children[e.children.length-1]);o&&l&&(a.position={start:o,end:l}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function wV(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let l=-1;const c=[];for(;++l<o;){const d=e.children[l],h={},m=a?a[l]:void 0;m&&(h.align=m);let p={type:"element",tagName:s,properties:h,children:[]};d&&(p.children=t.all(d),t.patch(d,p),p=t.applyData(d,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function kV(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const iS=9,sS=32;function _V(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(aS(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(aS(e.slice(i),i>0,!1)),s.join("")}function aS(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===iS||s===sS;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===iS||s===sS;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function SV(t,e){const n={type:"text",value:_V(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function TV(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const CV={blockquote:tV,break:nV,code:rV,delete:iV,emphasis:sV,footnoteReference:aV,heading:oV,html:lV,imageReference:cV,image:uV,inlineCode:dV,linkReference:hV,link:fV,listItem:mV,list:gV,paragraph:yV,root:bV,strong:vV,table:xV,tableCell:kV,tableRow:wV,text:SV,thematicBreak:TV,toml:gm,yaml:gm,definition:gm,footnoteDefinition:gm};function gm(){}const RM=-1,L1=0,vf=1,wg=2,L3=3,B3=4,z3=5,P3=6,OM=7,jM=8,oS=typeof self=="object"?self:globalThis,EV=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,a]=e[i];switch(s){case L1:case RM:return n(a,i);case vf:{const o=n([],i);for(const l of a)o.push(r(l));return o}case wg:{const o=n({},i);for(const[l,c]of a)o[r(l)]=r(c);return o}case L3:return n(new Date(a),i);case B3:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case z3:{const o=n(new Map,i);for(const[l,c]of a)o.set(r(l),r(c));return o}case P3:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case OM:{const{name:o,message:l}=a;return n(new oS[o](l),i)}case jM:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new oS[s](a),i)};return r},lS=t=>EV(new Map,t)(0),Au="",{toString:AV}={},{keys:MV}=Object,Nh=t=>{const e=typeof t;if(e!=="object"||!t)return[L1,e];const n=AV.call(t).slice(8,-1);switch(n){case"Array":return[vf,Au];case"Object":return[wg,Au];case"Date":return[L3,Au];case"RegExp":return[B3,Au];case"Map":return[z3,Au];case"Set":return[P3,Au];case"DataView":return[vf,n]}return n.includes("Array")?[vf,n]:n.includes("Error")?[OM,n]:[wg,n]},ym=([t,e])=>t===L1&&(e==="function"||e==="symbol"),NV=(t,e,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=Nh(a);switch(o){case L1:{let u=a;switch(l){case"bigint":o=jM,u=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([RM],a)}return i([o,u],a)}case vf:{if(l){let h=a;return l==="DataView"?h=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(a)),i([l,[...h]],a)}const u=[],d=i([o,u],a);for(const h of a)u.push(s(h));return d}case wg:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return s(a.toJSON());const u=[],d=i([o,u],a);for(const h of MV(a))(t||!ym(Nh(a[h])))&&u.push([s(h),s(a[h])]);return d}case L3:return i([o,a.toISOString()],a);case B3:{const{source:u,flags:d}=a;return i([o,{source:u,flags:d}],a)}case z3:{const u=[],d=i([o,u],a);for(const[h,m]of a)(t||!(ym(Nh(h))||ym(Nh(m))))&&u.push([s(h),s(m)]);return d}case P3:{const u=[],d=i([o,u],a);for(const h of a)(t||!ym(Nh(h)))&&u.push(s(h));return d}}const{message:c}=a;return i([o,{name:l,message:c}],a)};return s},cS=(t,{json:e,lossy:n}={})=>{const r=[];return NV(!(e||n),!!e,new Map,r)(t),r},kg=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?lS(cS(t,e)):structuredClone(t):(t,e)=>lS(cS(t,e));function DV(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function IV(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function RV(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||DV,r=t.options.footnoteBackLabel||IV,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),h=nh(d.toLowerCase());let m=0;const p=[],b=t.footnoteCounts.get(d);for(;b!==void 0&&++m<=b;){p.length>0&&p.push({type:"text",value:" "});let y=typeof n=="string"?n:n(l,m);typeof y=="string"&&(y={type:"text",value:y}),p.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+h+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,m),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const x=u[u.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const y=x.children[x.children.length-1];y&&y.type==="text"?y.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...p)}else u.push(...p);const g={type:"element",tagName:"li",properties:{id:e+"fn-"+h},children:t.wrap(u,!0)};t.patch(c,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...kg(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:`
`}]}}const N0=function(t){if(t==null)return BV;if(typeof t=="function")return B1(t);if(typeof t=="object")return Array.isArray(t)?OV(t):jV(t);if(typeof t=="string")return LV(t);throw new Error("Expected function, string, or object as test")};function OV(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=N0(t[n]);return B1(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function jV(t){const e=t;return B1(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function LV(t){return B1(e);function e(n){return n&&n.type===t}}function B1(t){return e;function e(n,r,i){return!!(zV(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function BV(){return!0}function zV(t){return t!==null&&typeof t=="object"&&"type"in t}const LM=[],PV=!0,Ex=!1,BM="skip";function $3(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=N0(i),a=r?-1:1;o(t,void 0,[])();function o(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return h;function h(){let m=LM,p,b,x;if((!e||s(l,c,u[u.length-1]||void 0))&&(m=$V(n(l,u)),m[0]===Ex))return m;if("children"in l&&l.children){const g=l;if(g.children&&m[0]!==BM)for(b=(r?g.children.length:-1)+a,x=u.concat(g);b>-1&&b<g.children.length;){const y=g.children[b];if(p=o(y,b,x)(),p[0]===Ex)return p;b=typeof p[1]=="number"?p[1]:b+a}}return m}}}function $V(t){return Array.isArray(t)?t:typeof t=="number"?[PV,t]:t==null?LM:[t]}function U3(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),$3(t,s,o,i);function o(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return a(l,d,u)}}const Ax={}.hasOwnProperty,UV={};function HV(t,e){const n=e||UV,r=new Map,i=new Map,s=new Map,a={...CV,...n.handlers},o={all:c,applyData:FV,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:l,options:n,patch:qV,wrap:GV};return U3(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:i,h=String(u.identifier).toUpperCase();d.has(h)||d.set(h,u)}}),o;function l(u,d){const h=u.type,m=o.handlers[h];if(Ax.call(o.handlers,h)&&m)return m(o,u,d);if(o.options.passThrough&&o.options.passThrough.includes(h)){if("children"in u){const{children:b,...x}=u,g=kg(x);return g.children=o.all(u),g}return kg(u)}return(o.options.unknownHandler||VV)(o,u,d)}function c(u){const d=[];if("children"in u){const h=u.children;let m=-1;for(;++m<h.length;){const p=o.one(h[m],u);if(p){if(m&&h[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=uS(p.value)),!Array.isArray(p)&&p.type==="element")){const b=p.children[0];b&&b.type==="text"&&(b.value=uS(b.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function qV(t,e){t.position&&(e.position=IH(t))}function FV(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,kg(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function VV(t,e){const n=e.data||{},r="value"in e&&!(Ax.call(n,"hProperties")||Ax.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function GV(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
`});++r<t.length;)r&&n.push({type:"text",value:`
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
`}),n}function uS(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function dS(t,e){const n=HV(t,e),r=n.one(t,void 0),i=RV(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function WV(t,e){return t&&"run"in t?async function(n,r){const i=dS(n,{file:r,...e});await t.run(i,r)}:function(n,r){return dS(n,{file:r,...t||e})}}function hS(t){if(t)throw t}var _p=Object.prototype.hasOwnProperty,zM=Object.prototype.toString,fS=Object.defineProperty,mS=Object.getOwnPropertyDescriptor,pS=function(e){return typeof Array.isArray=="function"?Array.isArray(e):zM.call(e)==="[object Array]"},gS=function(e){if(!e||zM.call(e)!=="[object Object]")return!1;var n=_p.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&_p.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||_p.call(e,i)},yS=function(e,n){fS&&n.name==="__proto__"?fS(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},bS=function(e,n){if(n==="__proto__")if(_p.call(e,n)){if(mS)return mS(e,n).value}else return;return e[n]},KV=function t(){var e,n,r,i,s,a,o=arguments[0],l=1,c=arguments.length,u=!1;for(typeof o=="boolean"&&(u=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<c;++l)if(e=arguments[l],e!=null)for(n in e)r=bS(o,n),i=bS(e,n),o!==i&&(u&&i&&(gS(i)||(s=pS(i)))?(s?(s=!1,a=r&&pS(r)?r:[]):a=r&&gS(r)?r:{},yS(o,{name:n,newValue:t(u,a,i)})):typeof i<"u"&&yS(o,{name:n,newValue:i}));return o};const Hb=l1(KV);function Mx(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function YV(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...c){const u=t[++s];let d=-1;if(l){a(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?XV(u,o)(...c):a(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function XV(t,e){let n;return r;function r(...a){const o=t.length>a.length;let l;o&&a.push(i);try{l=t.apply(this,a)}catch(c){const u=c;if(o&&n)throw u;return i(u)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,e(a,...o))}function s(a){i(null,a)}}const Ca={basename:QV,dirname:JV,extname:ZV,join:eG,sep:"/"};function QV(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');D0(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(t.codePointAt(i)===e.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function JV(t){if(D0(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function ZV(t){D0(t);let e=t.length,n=-1,r=0,i=-1,s=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function eG(...t){let e=-1,n;for(;++e<t.length;)D0(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":tG(n)}function tG(t){D0(t);const e=t.codePointAt(0)===47;let n=nG(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function nG(t,e){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=t.length;){if(a<t.length)o=t.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===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("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function D0(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const rG={cwd:iG};function iG(){return"/"}function Nx(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function sG(t){if(typeof t=="string")t=new URL(t);else if(!Nx(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return aG(t)}function aG(t){if(t.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 e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const qb=["history","path","basename","stem","extname","dirname"];class PM{constructor(e){let n;e?Nx(e)?n={path:e}:typeof e=="string"||oG(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":rG.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qb.length;){const s=qb[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)qb.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ca.basename(this.path):void 0}set basename(e){Vb(e,"basename"),Fb(e,"basename"),this.path=Ca.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ca.dirname(this.path):void 0}set dirname(e){vS(this.basename,"dirname"),this.path=Ca.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ca.extname(this.path):void 0}set extname(e){if(Fb(e,"extname"),vS(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ca.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Nx(e)&&(e=sG(e)),Vb(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ca.basename(this.path,this.extname):void 0}set stem(e){Vb(e,"stem"),Fb(e,"stem"),this.path=Ca.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new ii(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Fb(t,e){if(t&&t.includes(Ca.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ca.sep+"`")}function Vb(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function vS(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function oG(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const lG=function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},cG={}.hasOwnProperty;class H3 extends lG{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=YV()}copy(){const e=new H3;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Hb(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Kb("data",this.frozen),this.namespace[e]=n,this):cG.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Kb("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=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 i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=bm(e),r=this.parser||this.Parser;return Gb("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Gb("process",this.parser||this.Parser),Wb("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=bm(e),l=r.parse(o);r.run(l,o,function(u,d,h){if(u||!d||!h)return c(u);const m=d,p=r.stringify(m,h);hG(p)?h.value=p:h.result=p,c(u,h)});function c(u,d){u||!d?a(u):s?s(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),Gb("processSync",this.parser||this.Parser),Wb("processSync",this.compiler||this.Compiler),this.process(e,i),wS("processSync","process",n),r;function i(s,a){n=!0,hS(s),r=a}}run(e,n,r){xS(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const l=bm(n);i.run(e,l,c);function c(u,d,h){const m=d||e;u?o(u):a?a(m):r(void 0,m,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),wS("runSync","run",r),i;function s(a,o){hS(a),i=o,r=!0}}stringify(e,n){this.freeze();const r=bm(n),i=this.compiler||this.Compiler;return Wb("stringify",i),xS(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(Kb("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?o(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(i.settings=Hb(!0,i.settings,c.settings))}function o(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===c){h=d;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[m,...p]=u;const b=r[h][1];Mx(b)&&Mx(m)&&(m=Hb(!0,b,m)),r[h]=[c,m,...p]}}}}const uG=new H3().freeze();function Gb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Wb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Kb(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xS(t){if(!Mx(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function wS(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function bm(t){return dG(t)?t:new PM(t)}function dG(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function hG(t){return typeof t=="string"||fG(t)}function fG(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const mG="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kS=[],_S={allowDangerousHtml:!0},pG=/^(https?|ircs?|mailto|xmpp)$/i,gG=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function yG(t){const e=bG(t),n=vG(t);return xG(e.runSync(e.parse(n),n),t)}function bG(t){const e=t.rehypePlugins||kS,n=t.remarkPlugins||kS,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,..._S}:_S;return uG().use(eV).use(n).use(WV,r).use(e)}function vG(t){const e=t.children||"",n=new PM;return typeof e=="string"&&(n.value=e),n}function xG(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,l=e.urlTransform||wG;for(const u of gG)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+mG+u.id,void 0);return e.className&&(t={type:"element",tagName:"div",properties:{className:e.className},children:t.type==="root"?t.children:[t]}),U3(t,c),BH(t,{Fragment:f.Fragment,components:i,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function c(u,d,h){if(u.type==="raw"&&h&&typeof d=="number")return a?h.children.splice(d,1):h.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let m;for(m in Pb)if(Object.hasOwn(Pb,m)&&Object.hasOwn(u.properties,m)){const p=u.properties[m],b=Pb[m];(b===null||b.includes(u.tagName))&&(u.properties[m]=l(String(p||""),m,u))}}if(u.type==="element"){let m=n?!n.includes(u.tagName):s?s.includes(u.tagName):!1;if(!m&&r&&typeof d=="number"&&(m=!r(u,d,h)),m&&h&&typeof d=="number")return o&&u.children?h.children.splice(d,1,...u.children):h.children.splice(d,1),d}}}function wG(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||pG.test(t.slice(0,e))?t:""}function _g(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function kG(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function _G(t,e,n){const i=N0((n||{}).ignore||[]),s=SG(e);let a=-1;for(;++a<s.length;)$3(t,"text",o);function o(c,u){let d=-1,h;for(;++d<u.length;){const m=u[d],p=h?h.children:void 0;if(i(m,p?p.indexOf(m):void 0,h))return;h=m}if(h)return l(c,u)}function l(c,u){const d=u[u.length-1],h=s[a][0],m=s[a][1];let p=0;const x=d.children.indexOf(c);let g=!1,y=[];h.lastIndex=0;let w=h.exec(c.value);for(;w;){const C=w.index,E={index:w.index,input:w.input,stack:[...u,c]};let S=m(...w,E);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=C+1:(p!==C&&y.push({type:"text",value:c.value.slice(p,C)}),Array.isArray(S)?y.push(...S):S&&y.push(S),p=C+w[0].length,g=!0),!h.global)break;w=h.exec(c.value)}return g?(p<c.value.length&&y.push({type:"text",value:c.value.slice(p)}),d.children.splice(x,1,...y)):y=[c],x+y.length}}function SG(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([TG(i[0]),CG(i[1])])}return e}function TG(t){return typeof t=="string"?new RegExp(kG(t),"g"):t}function CG(t){return typeof t=="function"?t:function(){return t}}const Yb="phrasing",Xb=["autolink","link","image","label"];function EG(){return{transforms:[OG],enter:{literalAutolink:MG,literalAutolinkEmail:Qb,literalAutolinkHttp:Qb,literalAutolinkWww:Qb},exit:{literalAutolink:RG,literalAutolinkEmail:IG,literalAutolinkHttp:NG,literalAutolinkWww:DG}}}function AG(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Yb,notInConstruct:Xb},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Yb,notInConstruct:Xb},{character:":",before:"[ps]",after:"\\/",inConstruct:Yb,notInConstruct:Xb}]}}function MG(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Qb(t){this.config.enter.autolinkProtocol.call(this,t)}function NG(t){this.config.exit.autolinkProtocol.call(this,t)}function DG(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function IG(t){this.config.exit.autolinkEmail.call(this,t)}function RG(t){this.exit(t)}function OG(t){_G(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jG],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),LG]],{ignore:["link","linkReference"]})}function jG(t,e,n,r,i){let s="";if(!$M(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!BG(n)))return!1;const a=zG(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:s+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function LG(t,e,n,r){return!$M(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function BG(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function zG(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=_g(t,"(");let s=_g(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function $M(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Jc(n)||O1(n))&&(!e||n!==47)}UM.peek=WG;function PG(){this.buffer()}function $G(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function UG(){this.buffer()}function HG(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function qG(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ia(this.sliceSerialize(t)).toLowerCase(),n.label=e}function FG(t){this.exit(t)}function VG(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ia(this.sliceSerialize(t)).toLowerCase(),n.label=e}function GG(t){this.exit(t)}function WG(){return"["}function UM(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),o(),a(),s+=i.move("]"),s}function KG(){return{enter:{gfmFootnoteCallString:PG,gfmFootnoteCall:$G,gfmFootnoteDefinitionLabelString:UG,gfmFootnoteDefinition:HG},exit:{gfmFootnoteCallString:qG,gfmFootnoteCall:FG,gfmFootnoteDefinitionLabelString:VG,gfmFootnoteDefinition:GG}}}function YG(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:UM},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const o=s.createTracker(a);let l=o.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return l+=o.move(s.safe(s.associationId(r),{before:l,after:"]"})),u(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((e?`
`:" ")+s.indentLines(s.containerFlow(r,o.current()),e?HM:XG))),c(),l}}function XG(t,e,n){return e===0?t:HM(t,e,n)}function HM(t,e,n){return(n?"":"    ")+t}const QG=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qM.peek=nW;function JG(){return{canContainEols:["delete"],enter:{strikethrough:eW},exit:{strikethrough:tW}}}function ZG(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:QG}],handlers:{delete:qM}}}function eW(t){this.enter({type:"delete",children:[]},t)}function tW(t){this.exit(t)}function qM(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(t,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function nW(){return"~"}function rW(t){return t.length}function iW(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||rW,s=[],a=[],o=[],l=[];let c=0,u=-1;for(;++u<t.length;){const b=[],x=[];let g=-1;for(t[u].length>c&&(c=t[u].length);++g<t[u].length;){const y=sW(t[u][g]);if(n.alignDelimiters!==!1){const w=i(y);x[g]=w,(l[g]===void 0||w>l[g])&&(l[g]=w)}b.push(y)}a[u]=b,o[u]=x}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)s[d]=SS(r[d]);else{const b=SS(r);for(;++d<c;)s[d]=b}d=-1;const h=[],m=[];for(;++d<c;){const b=s[d];let x="",g="";b===99?(x=":",g=":"):b===108?x=":":b===114&&(g=":");let y=n.alignDelimiters===!1?1:Math.max(1,l[d]-x.length-g.length);const w=x+"-".repeat(y)+g;n.alignDelimiters!==!1&&(y=x.length+y+g.length,y>l[d]&&(l[d]=y),m[d]=y),h[d]=w}a.splice(1,0,h),o.splice(1,0,m),u=-1;const p=[];for(;++u<a.length;){const b=a[u],x=o[u];d=-1;const g=[];for(;++d<c;){const y=b[d]||"";let w="",C="";if(n.alignDelimiters!==!1){const E=l[d]-(x[d]||0),S=s[d];S===114?w=" ".repeat(E):S===99?E%2?(w=" ".repeat(E/2+.5),C=" ".repeat(E/2-.5)):(w=" ".repeat(E/2),C=w):C=" ".repeat(E)}n.delimiterStart!==!1&&!d&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||d)&&g.push(" "),n.alignDelimiters!==!1&&g.push(w),g.push(y),n.alignDelimiters!==!1&&g.push(C),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&g.push("|")}p.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return p.join(`
`)}function sW(t){return t==null?"":String(t)}function SS(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}const TS={}.hasOwnProperty;function aW(t,e){const n=e||{};function r(i,...s){let a=r.invalid;const o=r.handlers;if(i&&TS.call(i,t)){const l=String(i[t]);a=TS.call(o,l)?o[l]:r.unknown}if(a)return a.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function oW(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(t,s.current()),lW);return i(),a}function lW(t,e,n){return">"+(n?"":" ")+t}function cW(t,e){return CS(t,e.inConstruct,!0)&&!CS(t,e.notInConstruct,!1)}function CS(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function ES(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&cW(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function FM(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+e.length,r=n.indexOf(e,i);return a}function uW(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function dW(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function hW(t,e,n,r){const i=dW(n),s=t.value||"",a=i==="`"?"GraveAccent":"Tilde";if(uW(t,n)){const d=n.enter("codeIndented"),h=n.indentLines(s,fW);return d(),h}const o=n.createTracker(r),l=i.repeat(Math.max(FM(s,i)+1,3)),c=n.enter("codeFenced");let u=o.move(l);if(t.lang){const d=n.enter(`codeFencedLang${a}`);u+=o.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...o.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${a}`);u+=o.move(" "),u+=o.move(n.safe(t.meta,{before:u,after:`
`,encode:["`"],...o.current()})),d()}return u+=o.move(`
`),s&&(u+=o.move(s+`
`)),u+=o.move(l),c(),u}function fW(t,e,n){return(n?"":"    ")+t}function q3(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function mW(t,e,n,r){const i=q3(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),o(),!t.url||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
`,...l.current()}))),o(),t.title&&(o=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),o()),a(),c}function pW(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Gf(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Sg(t,e,n){const r=Nd(t),i=Nd(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}VM.peek=gW;function VM(t,e,n,r){const i=pW(n),s=n.enter("emphasis"),a=n.createTracker(r),o=a.move(i);let l=a.move(n.containerPhrasing(t,{after:i,before:o,...a.current()}));const c=l.charCodeAt(0),u=Sg(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Gf(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Sg(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Gf(d));const m=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},o+l+m}function gW(t,e,n){return n.options.emphasis||"*"}function yW(t,e){let n=!1;return U3(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ex}),!!((!t.depth||t.depth<3)&&R3(t)&&(e.options.setext||n))}function bW(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(yW(t,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),h=n.containerPhrasing(t,{...s.current(),before:`
`,after:`
`});return d(),u(),h+`
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
`))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),l=n.enter("phrasing");s.move(a+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
`,...s.current()});return/^[\t ]/.test(c)&&(c=Gf(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),o(),c}GM.peek=vW;function GM(t){return t.value||""}function vW(){return"<"}WM.peek=xW;function WM(t,e,n,r){const i=q3(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(o=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),o(),t.title&&(o=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),o()),c+=l.move(")"),a(),c}function xW(){return"!"}KM.peek=wW;function KM(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const c=n.safe(t.alt,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...o.current()});return a(),n.stack=u,s(),i==="full"||!c||c!==d?l+=o.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function wW(){return"!"}YM.peek=kW;function YM(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],o=n.compilePattern(a);let l;if(a.atBreak)for(;l=o.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function kW(){return"`"}function XM(t,e){const n=R3(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}QM.peek=_W;function QM(t,e,n,r){const i=q3(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(XM(t,n)){const u=n.stack;n.stack=[],o=n.enter("autolink");let d=a.move("<");return d+=a.move(n.containerPhrasing(t,{before:d,after:">",...a.current()})),d+=a.move(">"),o(),n.stack=u,d}o=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(t,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(t.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(t.url,{before:c,after:t.title?" ":")",...a.current()}))),l(),t.title&&(l=n.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(n.safe(t.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function _W(t,e,n){return XM(t,n)?"<":"["}JM.peek=SW;function JM(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const c=n.containerPhrasing(t,{before:l,after:"]",...o.current()});l+=o.move(c+"]["),a();const u=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...o.current()});return a(),n.stack=u,s(),i==="full"||!c||c!==d?l+=o.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function SW(){return"["}function F3(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function TW(t){const e=F3(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function CW(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function ZM(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function EW(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=t.ordered?CW(n):F3(n);const o=t.ordered?a==="."?")":".":TW(n);let l=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),ZM(n)===a&&u){let d=-1;for(;++d<t.children.length;){const h=t.children[d];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=o),n.bulletCurrent=a;const c=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),c}function AW(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function MW(t,e,n,r){const i=AW(n);let s=n.bulletCurrent||F3(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(s+" ".repeat(a-s.length)),o.shift(a);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,o.current()),u);return l(),c;function u(d,h,m){return h?(m?"":" ".repeat(a))+d:(m?s:s+" ".repeat(a-s.length))+d}}function NW(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(t,r);return s(),i(),a}const DW=N0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function IW(t,e,n,r){return(t.children.some(function(a){return DW(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function RW(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}eN.peek=OW;function eN(t,e,n,r){const i=RW(n),s=n.enter("strong"),a=n.createTracker(r),o=a.move(i+i);let l=a.move(n.containerPhrasing(t,{after:i,before:o,...a.current()}));const c=l.charCodeAt(0),u=Sg(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Gf(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Sg(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Gf(d));const m=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},o+l+m}function OW(t,e,n){return n.options.strong||"*"}function jW(t,e,n,r){return n.safe(t.value,r)}function LW(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function BW(t,e,n){const r=(ZM(n)+(n.options.ruleSpaces?" ":"")).repeat(LW(n));return n.options.ruleSpaces?r.slice(0,-1):r}const tN={blockquote:oW,break:ES,code:hW,definition:mW,emphasis:VM,hardBreak:ES,heading:bW,html:GM,image:WM,imageReference:KM,inlineCode:YM,link:QM,linkReference:JM,list:EW,listItem:MW,paragraph:NW,root:IW,strong:eN,text:jW,thematicBreak:BW};function zW(){return{enter:{table:PW,tableData:AS,tableHeader:AS,tableRow:UW},exit:{codeText:HW,table:$W,tableData:Jb,tableHeader:Jb,tableRow:Jb}}}function PW(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function $W(t){this.exit(t),this.data.inTable=void 0}function UW(t){this.enter({type:"tableRow",children:[]},t)}function Jb(t){this.exit(t)}function AS(t){this.enter({type:"tableCell",children:[]},t)}function HW(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,qW));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function qW(t,e){return e==="|"?e:t}function FW(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=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:h,table:a,tableCell:l,tableRow:o}};function a(m,p,b,x){return c(u(m,b,x),m.align)}function o(m,p,b,x){const g=d(m,b,x),y=c([g]);return y.slice(0,y.indexOf(`
`))}function l(m,p,b,x){const g=b.enter("tableCell"),y=b.enter("phrasing"),w=b.containerPhrasing(m,{...x,before:s,after:s});return y(),g(),w}function c(m,p){return iW(m,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function u(m,p,b){const x=m.children;let g=-1;const y=[],w=p.enter("table");for(;++g<x.length;)y[g]=d(x[g],p,b);return w(),y}function d(m,p,b){const x=m.children;let g=-1;const y=[],w=p.enter("tableRow");for(;++g<x.length;)y[g]=l(x[g],m,p,b);return w(),y}function h(m,p,b){let x=tN.inlineCode(m,p,b);return b.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function VW(){return{exit:{taskListCheckValueChecked:MS,taskListCheckValueUnchecked:MS,paragraph:WW}}}function GW(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KW}}}function MS(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function WW(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,a;for(;++s<i.length;){const o=i[s];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function KW(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",o=n.createTracker(r);s&&o.move(a);let l=tN.listItem(t,e,n,{...r,...o.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+a}}function YW(){return[EG(),KG(),JG(),zW(),VW()]}function XW(t){return{extensions:[AG(),YG(t),ZG(),FW(t),GW()]}}const QW={tokenize:rK,partial:!0},nN={tokenize:iK,partial:!0},rN={tokenize:sK,partial:!0},iN={tokenize:aK,partial:!0},JW={tokenize:oK,partial:!0},sN={name:"wwwAutolink",tokenize:tK,previous:oN},aN={name:"protocolAutolink",tokenize:nK,previous:lN},$o={name:"emailAutolink",tokenize:eK,previous:cN},Fa={};function ZW(){return{text:Fa}}let uc=48;for(;uc<123;)Fa[uc]=$o,uc++,uc===58?uc=65:uc===91&&(uc=97);Fa[43]=$o;Fa[45]=$o;Fa[46]=$o;Fa[95]=$o;Fa[72]=[$o,aN];Fa[104]=[$o,aN];Fa[87]=[$o,sN];Fa[119]=[$o,sN];function eK(t,e,n){const r=this;let i,s;return a;function a(d){return!Dx(d)||!cN.call(r,r.previous)||V3(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),o(d))}function o(d){return Dx(d)?(t.consume(d),o):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(JW,u,c)(d):d===45||d===95||ti(d)?(s=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&bi(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function tK(t,e,n){const r=this;return i;function i(a){return a!==87&&a!==119||!oN.call(r,r.previous)||V3(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(QW,t.attempt(nN,t.attempt(rN,s),n),n)(a))}function s(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function nK(t,e,n){const r=this;let i="",s=!1;return a;function a(d){return(d===72||d===104)&&lN.call(r,r.previous)&&!V3(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),o):n(d)}function o(d){if(bi(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),o;if(d===58){const h=i.toLowerCase();if(h==="http"||h==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),s?c:(s=!0,l)):n(d)}function c(d){return d===null||xg(d)||Tn(d)||Jc(d)||O1(d)?n(d):t.attempt(nN,t.attempt(rN,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function rK(t,e,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),i):a===46&&r===3?(t.consume(a),s):n(a)}function s(a){return a===null?n(a):e(a)}}function iK(t,e,n){let r,i,s;return a;function a(c){return c===46||c===95?t.check(iN,l,o)(c):c===null||Tn(c)||Jc(c)||c!==45&&O1(c)?l(c):(s=!0,t.consume(c),a)}function o(c){return c===95?r=!0:(i=r,r=void 0),t.consume(c),a}function l(c){return i||r||!s?n(c):e(c)}}function sK(t,e){let n=0,r=0;return i;function i(a){return a===40?(n++,t.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(iN,e,s)(a):a===null||Tn(a)||Jc(a)?e(a):(t.consume(a),i)}function s(a){return a===41&&r++,t.consume(a),i}}function aK(t,e,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(t.consume(o),r):o===38?(t.consume(o),s):o===93?(t.consume(o),i):o===60||o===null||Tn(o)||Jc(o)?e(o):n(o)}function i(o){return o===null||o===40||o===91||Tn(o)||Jc(o)?e(o):r(o)}function s(o){return bi(o)?a(o):n(o)}function a(o){return o===59?(t.consume(o),r):bi(o)?(t.consume(o),a):n(o)}}function oK(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return ti(s)?n(s):e(s)}}function oN(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Tn(t)}function lN(t){return!bi(t)}function cN(t){return!(t===47||Dx(t))}function Dx(t){return t===43||t===45||t===46||t===95||ti(t)}function V3(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lK={tokenize:gK,partial:!0};function cK(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fK,continuation:{tokenize:mK},exit:pK}},text:{91:{name:"gfmFootnoteCall",tokenize:hK},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uK,resolveTo:dK}}}}function uK(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const c=ia(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function dK(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",a,e],["exit",a,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...o),t}function hK(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return o;function o(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!a||d===null||d===91||Tn(d))return n(d);if(d===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return i.includes(ia(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return Tn(d)||(a=!0),s++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,c):c(d)}}function fK(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,o;return l;function l(p){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(p)}function u(p){if(a>999||p===93&&!o||p===null||p===91||Tn(p))return n(p);if(p===93){t.exit("chunkString");const b=t.exit("gfmFootnoteDefinitionLabelString");return s=ia(r.sliceSerialize(b)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return Tn(p)||(o=!0),a++,t.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(t.consume(p),a++,u):u(p)}function h(p){return p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),i.includes(s)||i.push(s),Ht(t,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return e(p)}}function mK(t,e,n){return t.check(M0,e,t.attempt(lK,e,n))}function pK(t){t.exit("gfmFootnoteDefinition")}function gK(t,e,n){const r=this;return Ht(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(s):n(s)}}function yK(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},d={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},h=[["enter",u,o],["enter",a[c][1],o],["exit",a[c][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&os(h,h.length,0,j1(m,a.slice(c+1,l),o)),os(h,h.length,0,[["exit",d,o],["enter",a[l][1],o],["exit",a[l][1],o],["exit",u,o]]),os(a,c-1,l-c+3,h),l=c+h.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function s(a,o,l){const c=this.previous,u=this.events;let d=0;return h;function h(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(a.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const b=Nd(c);if(p===126)return d>1?l(p):(a.consume(p),d++,m);if(d<2&&!n)return l(p);const x=a.exit("strikethroughSequenceTemporary"),g=Nd(p);return x._open=!g||g===2&&!!b,x._close=!b||b===2&&!!g,o(p)}}}class bK{constructor(){this.map=[]}add(e,n,r){vK(this,e,n,r)}consume(e){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function vK(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function xK(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function wK(){return{flow:{null:{name:"table",tokenize:kK,resolveAll:_K}}}}function kK(t,e,n){const r=this;let i=0,s=0,a;return o;function o(I){let j=r.events.length-1;for(;j>-1;){const P=r.events[j][1].type;if(P==="lineEnding"||P==="linePrefix")j--;else break}const N=j>-1?r.events[j][1].type:null,B=N==="tableHead"||N==="tableRow"?S:l;return B===S&&r.parser.lazy[r.now().line]?n(I):B(I)}function l(I){return t.enter("tableHead"),t.enter("tableRow"),c(I)}function c(I){return I===124||(a=!0,s+=1),u(I)}function u(I){return I===null?n(I):nt(I)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),m):n(I):Vt(I)?Ht(t,u,"whitespace")(I):(s+=1,a&&(a=!1,i+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,u):(t.enter("data"),d(I)))}function d(I){return I===null||I===124||Tn(I)?(t.exit("data"),u(I)):(t.consume(I),I===92?h:d)}function h(I){return I===92||I===124?(t.consume(I),d):d(I)}function m(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,Vt(I)?Ht(t,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):p(I))}function p(I){return I===45||I===58?x(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),b):E(I)}function b(I){return Vt(I)?Ht(t,x,"whitespace")(I):x(I)}function x(I){return I===58?(s+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),g):I===45?(s+=1,g(I)):I===null||nt(I)?C(I):E(I)}function g(I){return I===45?(t.enter("tableDelimiterFiller"),y(I)):E(I)}function y(I){return I===45?(t.consume(I),y):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),w):(t.exit("tableDelimiterFiller"),w(I))}function w(I){return Vt(I)?Ht(t,C,"whitespace")(I):C(I)}function C(I){return I===124?p(I):I===null||nt(I)?!a||i!==s?E(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):E(I)}function E(I){return n(I)}function S(I){return t.enter("tableRow"),T(I)}function T(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),T):I===null||nt(I)?(t.exit("tableRow"),e(I)):Vt(I)?Ht(t,T,"whitespace")(I):(t.enter("data"),O(I))}function O(I){return I===null||I===124||Tn(I)?(t.exit("data"),T(I)):(t.consume(I),I===92?z:O)}function z(I){return I===92||I===124?(t.consume(I),O):O(I)}}function _K(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,c,u,d;const h=new bK;for(;++n<t.length;){const m=t[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(o=!1,l!==0&&(NS(h,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",c,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",u,e]])),i=p.type==="tableDelimiterRow"?2:u?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],d=vm(h,e,s,i,void 0,d),s=[0,0,0,0]),a[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],d=vm(h,e,s,i,void 0,d)),s=a,a=[s[1],n,0,0])):p.type==="tableHead"?(o=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,s[1]!==0?(a[0]=a[1],d=vm(h,e,s,i,n,d)):a[1]!==0&&(d=vm(h,e,a,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&NS(h,e,l,c,u),h.consume(e.events),n=-1;++n<e.events.length;){const m=e.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=xK(e.events,n))}return t}function vm(t,e,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},ju(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const l=ju(e.events,n[1]);if(s={type:a,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const c=ju(e.events,n[2]),u=ju(e.events,n[3]),d={type:o,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const h=e.events[n[2]],m=e.events[n[3]];if(h[1].end=Object.assign({},m[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,b=n[3]-n[2]-1;t.add(p,b,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},ju(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function NS(t,e,n,r,i){const s=[],a=ju(e.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,e])),r.end=Object.assign({},a),s.push(["exit",r,e]),t.add(n+1,0,s)}function ju(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const SK={name:"tasklistCheck",tokenize:CK};function TK(){return{text:{91:SK}}}function CK(t,e,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return Tn(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(l)}function o(l){return nt(l)?e(l):Vt(l)?t.check({tokenize:EK},e,n)(l):n(l)}}function EK(t,e,n){return Ht(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function AK(t){return bM([ZW(),cK(),yK(t),wK(),TK()])}const MK={};function DS(t){const e=this,n=t||MK,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(AK(n)),s.push(YW()),a.push(XW(n))}function NK(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(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 e(){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 i(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 s(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function a(l){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.data.hChildren.push({type:"text",value:c})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function DK(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(s,a,o,l){const c=s.value||"",u=o.createTracker(l),d="$".repeat(Math.max(FM(c,"$")+1,2)),h=o.enter("mathFlow");let m=u.move(d);if(s.meta){const p=o.enter("mathFlowMeta");m+=u.move(o.safe(s.meta,{after:`
`,before:m,encode:["$"],...u.current()})),p()}return m+=u.move(`
`),c&&(m+=u.move(c+`
`)),m+=u.move(d),h(),m}function r(s,a,o){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++d<o.unsafe.length;){const h=o.unsafe[d];if(!h.atBreak)continue;const m=o.compilePattern(h);let p;for(;p=m.exec(l);){let b=p.index;l.codePointAt(b)===10&&l.codePointAt(b-1)===13&&b--,l=l.slice(0,b)+" "+l.slice(p.index+1)}}return u+l+u}function i(){return"$"}}const IK={tokenize:RK,concrete:!0,name:"mathFlow"},IS={tokenize:OK,partial:!0};function RK(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let a=0;return o;function o(y){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(y)}function l(y){return y===36?(t.consume(y),a++,l):a<2?n(y):(t.exit("mathFlowFenceSequence"),Ht(t,c,"whitespace")(y))}function c(y){return y===null||nt(y)?d(y):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),u(y))}function u(y){return y===null||nt(y)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),d(y)):y===36?n(y):(t.consume(y),u)}function d(y){return t.exit("mathFlowFence"),r.interrupt?e(y):t.attempt(IS,h,x)(y)}function h(y){return t.attempt({tokenize:g,partial:!0},x,m)(y)}function m(y){return(s?Ht(t,p,"linePrefix",s+1):p)(y)}function p(y){return y===null?x(y):nt(y)?t.attempt(IS,h,x)(y):(t.enter("mathFlowValue"),b(y))}function b(y){return y===null||nt(y)?(t.exit("mathFlowValue"),p(y)):(t.consume(y),b)}function x(y){return t.exit("mathFlow"),e(y)}function g(y,w,C){let E=0;return Ht(y,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function S(z){return y.enter("mathFlowFence"),y.enter("mathFlowFenceSequence"),T(z)}function T(z){return z===36?(E++,y.consume(z),T):E<a?C(z):(y.exit("mathFlowFenceSequence"),Ht(y,O,"whitespace")(z))}function O(z){return z===null||nt(z)?(y.exit("mathFlowFence"),w(z)):C(z)}}}function OK(t,e,n){const r=this;return i;function i(a){return a===null?e(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function jK(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:LK,previous:BK,name:"mathText"};function r(i,s,a){let o=0,l,c;return u;function u(b){return i.enter("mathText"),i.enter("mathTextSequence"),d(b)}function d(b){return b===36?(i.consume(b),o++,d):o<2&&!n?a(b):(i.exit("mathTextSequence"),h(b))}function h(b){return b===null?a(b):b===36?(c=i.enter("mathTextSequence"),l=0,p(b)):b===32?(i.enter("space"),i.consume(b),i.exit("space"),h):nt(b)?(i.enter("lineEnding"),i.consume(b),i.exit("lineEnding"),h):(i.enter("mathTextData"),m(b))}function m(b){return b===null||b===32||b===36||nt(b)?(i.exit("mathTextData"),h(b)):(i.consume(b),m)}function p(b){return b===36?(i.consume(b),l++,p):l===o?(i.exit("mathTextSequence"),i.exit("mathText"),s(b)):(c.type="mathTextData",m(b))}}}function LK(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="mathTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function BK(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function zK(t){return{flow:{36:IK},text:{36:jK(t)}}}class Se extends Error{constructor(e,n){var r="KaTeX parse error: "+e,i,s,a=n&&n.loc;if(a&&a.start<=a.end){var o=a.lexer.input;i=a.start,s=a.end,i===o.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=o.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+o.slice(i-15,i):c=o.slice(0,i);var u;s+15<o.length?u=o.slice(s,s+15)+"…":u=o.slice(s),r+=c+l+u}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,Se.prototype),this.position=i,i!=null&&s!=null&&(this.length=s-i),this.rawMessage=e}}var PK=/([A-Z])/g,$K=t=>t.replace(PK,"-$1").toLowerCase(),UK={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},HK=/[&><"']/g,ri=t=>String(t).replace(HK,e=>UK[e]),Sp=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?Sp(t.body[0]):t:t.type==="font"?Sp(t.body):t,qK=new Set(["mathord","textord","atom"]),Uo=t=>qK.has(Sp(t).type),FK=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Tg={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:t=>"#"+t},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:(t,e)=>(e.push(t),e)},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:t=>Math.max(0,t),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:t=>Math.max(0,t),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:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function VK(t){if(typeof t!="string")return t.enum[0];switch(t){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 GK(t){if(t.default!==void 0)return t.default;var e=Array.isArray(t.type)?t.type[0]:t.type;return VK(e)}function WK(t,e,n,r){var i=n[e];t[e]=i!==void 0?r.processor?r.processor(i):i:GK(r)}class G3{constructor(e){e===void 0&&(e={}),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,e=e||{};for(var n of Object.keys(Tg)){var r=Tg[n];r&&WK(this,n,e,r)}}reportNonstrict(e,n,r){var i=this.strict;if(typeof i=="function"&&(i=i(e,n,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new Se("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var i=this.strict;if(typeof i=="function")try{i=i(e,n,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var n=FK(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Jo{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Ea[KK[this.id]]}sub(){return Ea[YK[this.id]]}fracNum(){return Ea[XK[this.id]]}fracDen(){return Ea[QK[this.id]]}cramp(){return Ea[JK[this.id]]}text(){return Ea[ZK[this.id]]}isTight(){return this.size>=2}}var W3=0,Cg=1,ud=2,Ao=3,Wf=4,Rs=5,Dd=6,xi=7,Ea=[new Jo(W3,0,!1),new Jo(Cg,0,!0),new Jo(ud,1,!1),new Jo(Ao,1,!0),new Jo(Wf,2,!1),new Jo(Rs,2,!0),new Jo(Dd,3,!1),new Jo(xi,3,!0)],KK=[Wf,Rs,Wf,Rs,Dd,xi,Dd,xi],YK=[Rs,Rs,Rs,Rs,xi,xi,xi,xi],XK=[ud,Ao,Wf,Rs,Dd,xi,Dd,xi],QK=[Ao,Ao,Rs,Rs,xi,xi,xi,xi],JK=[Cg,Cg,Ao,Ao,Rs,Rs,xi,xi],ZK=[W3,Cg,ud,Ao,ud,Ao,ud,Ao],Mt={DISPLAY:Ea[W3],TEXT:Ea[ud],SCRIPT:Ea[Wf],SCRIPTSCRIPT:Ea[Dd]},Ix=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function eY(t){for(var e=0;e<Ix.length;e++)for(var n=Ix[e],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(t>=i[0]&&t<=i[1])return n.name}return null}var Tp=[];Ix.forEach(t=>t.blocks.forEach(e=>Tp.push(...e)));function uN(t){for(var e=0;e<Tp.length;e+=2)if(t>=Tp[e]&&t<=Tp[e+1])return!0;return!1}var Sr=t=>t+" "+t,Mu=80,tY=function(e,n){return"M95,"+(622+e+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`+e/2.075+" -"+e+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+e)+`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+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},nY=function(e,n){return"M263,"+(601+e+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`+e/2.084+" -"+e+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+e)+`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+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},rY=function(e,n){return"M983 "+(10+e+n)+`
l`+e/3.13+" -"+e+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
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+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},iY=function(e,n){return"M424,"+(2398+e+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`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+e)+`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+e)+" "+n+`
h400000v`+(40+e)+"h-400000z"},sY=function(e,n){return"M473,"+(2713+e+n)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`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+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},aY=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},oY=function(e,n,r){var i=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+`
H742v`+i+`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+e)+"H742z"},lY=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=tY(n,Mu);break;case"sqrtSize1":i=nY(n,Mu);break;case"sqrtSize2":i=rY(n,Mu);break;case"sqrtSize3":i=iY(n,Mu);break;case"sqrtSize4":i=sY(n,Mu);break;case"sqrtTall":i=oY(n,Mu,r)}return i},cY=function(e,n){switch(e){case"⎜":return Sr("M291 0 H417 V"+n+" H291z");case"∣":return Sr("M145 0 H188 V"+n+" H145z");case"∥":return Sr("M145 0 H188 V"+n+" H145z")+Sr("M367 0 H410 V"+n+" H367z");case"⎟":return Sr("M457 0 H583 V"+n+" H457z");case"⎢":return Sr("M319 0 H403 V"+n+" H319z");case"⎥":return Sr("M263 0 H347 V"+n+" H263z");case"⎪":return Sr("M384 0 H504 V"+n+" H384z");case"⏐":return Sr("M312 0 H355 V"+n+" H312z");case"‖":return Sr("M257 0 H300 V"+n+" H257z")+Sr("M478 0 H521 V"+n+" H478z");default:return""}},RS={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:Sr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Sr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Sr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Sr("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:Sr("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:Sr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Sr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Sr("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`},uY=function(e,n){switch(e){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 dY(t){return"toText"in t}class rh{constructor(e){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=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){for(var e="",n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e}toText(){return this.children.map(e=>{if(dY(e))return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}}var Rx={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},hY={ex:!0,em:!0,mu:!0},dN=function(e){return typeof e!="string"&&(e=e.unit),e in Rx||e in hY||e==="ex"},Wn=function(e,n){var r;if(e.unit in Rx)r=Rx[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var i;if(n.style.isTight()?i=n.havingStyle(n.style.text()):i=n,e.unit==="ex")r=i.fontMetrics().xHeight;else if(e.unit==="em")r=i.fontMetrics().quad;else throw new Se("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},De=function(e){return+e.toFixed(4)+"em"},$l=function(e){return e.filter(n=>n).join(" ")},K3=function(e){var n="";for(var r of Object.keys(e)){var i=e[r];i!==void 0&&(n+=$K(r)+":"+i+";")}return n},hN=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var i=n.getColor();i&&(this.style.color=i)}},fN=function(e){var n=document.createElement(e);n.className=$l(this.classes),Object.assign(n.style,this.style);for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n},fY=/[\s"'>/=\x00-\x1f]/,mN=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+ri($l(this.classes))+'"');var r=K3(this.style);r&&(n+=' style="'+ri(r)+'"');for(var i of Object.keys(this.attributes)){if(fY.test(i))throw new Se("Invalid attribute name '"+i+"'");n+=" "+i+'="'+ri(this.attributes[i])+'"'}n+=">";for(var s=0;s<this.children.length;s++)n+=this.children[s].toMarkup();return n+="</"+e+">",n};class ih{constructor(e,n,r,i){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,hN.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return fN.call(this,"span")}toMarkup(){return mN.call(this,"span")}}class z1{constructor(e,n,r,i){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,hN.call(this,n,i),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return fN.call(this,"a")}toMarkup(){return mN.call(this,"a")}}class mY{constructor(e,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=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+ri(this.src)+'"'+(' alt="'+ri(this.alt)+'"'),n=K3(this.style);return n&&(e+=' style="'+ri(n)+'"'),e+="'/>",e}}var pY={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class ds{constructor(e,n,r,i,s,a,o,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=n||0,this.depth=r||0,this.italic=i||0,this.skew=s||0,this.width=a||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var c=eY(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=pY[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),n=null;return this.italic>0&&(n=document.createElement("span"),n.style.marginRight=De(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=$l(this.classes)),Object.keys(this.style).length>0&&(n=n||document.createElement("span"),Object.assign(n.style,this.style)),n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="<span";this.classes.length&&(e=!0,n+=' class="',n+=ri($l(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+De(this.italic)+";"),r+=K3(this.style),r&&(e=!0,n+=' style="'+ri(r)+'"');var i=ri(this.text);return e?(n+=">",n+=i,n+="</span>",n):i}}class Bo{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))e+=" "+n+'="'+ri(this.attributes[n])+'"';e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class Ul{constructor(e,n){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=n}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",RS[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+ri(this.alternate)+'"/>':'<path d="'+ri(RS[this.pathName])+'"/>'}}class Ox{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e="<line";for(var n of Object.keys(this.attributes))e+=" "+n+'="'+ri(this.attributes[n])+'"';return e+="/>",e}}function gY(t){if(t instanceof ds)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function yY(t){if(t instanceof ih)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var bY=t=>t instanceof ih||t instanceof z1||t instanceof rh,Ra={"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]}},xm={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]},OS={Å:"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 pN(t,e){Ra[t]=e}function Y3(t,e,n){if(!Ra[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=Ra[e][r];if(!i&&t[0]in OS&&(r=OS[t[0]].charCodeAt(0),i=Ra[e][r]),!i&&n==="text"&&uN(r)&&(i=Ra[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Zb={};function vY(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Zb[e]){var n=Zb[e]={cssEmPerMu:xm.quad[e]/18};for(var r in xm)xm.hasOwnProperty(r)&&(n[r]=xm[r][e])}return Zb[e]}var qn={math:{},text:{}};function k(t,e,n,r,i,s){qn[t][i]={font:e,group:n,replace:r},s&&r&&(qn[t][r]=qn[t][i])}var _="math",pe="text",A="main",F="ams",Fn="accent-token",Ve="bin",Si="close",sh="inner",ht="mathord",xr="op-token",fs="open",I0="punct",V="rel",Ho="spacing",K="textord";k(_,A,V,"≡","\\equiv",!0);k(_,A,V,"≺","\\prec",!0);k(_,A,V,"≻","\\succ",!0);k(_,A,V,"∼","\\sim",!0);k(_,A,V,"⊥","\\perp");k(_,A,V,"⪯","\\preceq",!0);k(_,A,V,"⪰","\\succeq",!0);k(_,A,V,"≃","\\simeq",!0);k(_,A,V,"∣","\\mid",!0);k(_,A,V,"≪","\\ll",!0);k(_,A,V,"≫","\\gg",!0);k(_,A,V,"≍","\\asymp",!0);k(_,A,V,"∥","\\parallel");k(_,A,V,"⋈","\\bowtie",!0);k(_,A,V,"⌣","\\smile",!0);k(_,A,V,"⊑","\\sqsubseteq",!0);k(_,A,V,"⊒","\\sqsupseteq",!0);k(_,A,V,"≐","\\doteq",!0);k(_,A,V,"⌢","\\frown",!0);k(_,A,V,"∋","\\ni",!0);k(_,A,V,"∝","\\propto",!0);k(_,A,V,"⊢","\\vdash",!0);k(_,A,V,"⊣","\\dashv",!0);k(_,A,V,"∋","\\owns");k(_,A,I0,".","\\ldotp");k(_,A,I0,"⋅","\\cdotp");k(_,A,I0,"⋅","·");k(pe,A,K,"⋅","·");k(_,A,K,"#","\\#");k(pe,A,K,"#","\\#");k(_,A,K,"&","\\&");k(pe,A,K,"&","\\&");k(_,A,K,"ℵ","\\aleph",!0);k(_,A,K,"∀","\\forall",!0);k(_,A,K,"ℏ","\\hbar",!0);k(_,A,K,"∃","\\exists",!0);k(_,A,K,"∇","\\nabla",!0);k(_,A,K,"♭","\\flat",!0);k(_,A,K,"ℓ","\\ell",!0);k(_,A,K,"♮","\\natural",!0);k(_,A,K,"♣","\\clubsuit",!0);k(_,A,K,"℘","\\wp",!0);k(_,A,K,"♯","\\sharp",!0);k(_,A,K,"♢","\\diamondsuit",!0);k(_,A,K,"ℜ","\\Re",!0);k(_,A,K,"♡","\\heartsuit",!0);k(_,A,K,"ℑ","\\Im",!0);k(_,A,K,"♠","\\spadesuit",!0);k(_,A,K,"§","\\S",!0);k(pe,A,K,"§","\\S");k(_,A,K,"¶","\\P",!0);k(pe,A,K,"¶","\\P");k(_,A,K,"†","\\dag");k(pe,A,K,"†","\\dag");k(pe,A,K,"†","\\textdagger");k(_,A,K,"‡","\\ddag");k(pe,A,K,"‡","\\ddag");k(pe,A,K,"‡","\\textdaggerdbl");k(_,A,Si,"⎱","\\rmoustache",!0);k(_,A,fs,"⎰","\\lmoustache",!0);k(_,A,Si,"⟯","\\rgroup",!0);k(_,A,fs,"⟮","\\lgroup",!0);k(_,A,Ve,"∓","\\mp",!0);k(_,A,Ve,"⊖","\\ominus",!0);k(_,A,Ve,"⊎","\\uplus",!0);k(_,A,Ve,"⊓","\\sqcap",!0);k(_,A,Ve,"∗","\\ast");k(_,A,Ve,"⊔","\\sqcup",!0);k(_,A,Ve,"◯","\\bigcirc",!0);k(_,A,Ve,"∙","\\bullet",!0);k(_,A,Ve,"‡","\\ddagger");k(_,A,Ve,"≀","\\wr",!0);k(_,A,Ve,"⨿","\\amalg");k(_,A,Ve,"&","\\And");k(_,A,V,"⟵","\\longleftarrow",!0);k(_,A,V,"⇐","\\Leftarrow",!0);k(_,A,V,"⟸","\\Longleftarrow",!0);k(_,A,V,"⟶","\\longrightarrow",!0);k(_,A,V,"⇒","\\Rightarrow",!0);k(_,A,V,"⟹","\\Longrightarrow",!0);k(_,A,V,"↔","\\leftrightarrow",!0);k(_,A,V,"⟷","\\longleftrightarrow",!0);k(_,A,V,"⇔","\\Leftrightarrow",!0);k(_,A,V,"⟺","\\Longleftrightarrow",!0);k(_,A,V,"↦","\\mapsto",!0);k(_,A,V,"⟼","\\longmapsto",!0);k(_,A,V,"↗","\\nearrow",!0);k(_,A,V,"↩","\\hookleftarrow",!0);k(_,A,V,"↪","\\hookrightarrow",!0);k(_,A,V,"↘","\\searrow",!0);k(_,A,V,"↼","\\leftharpoonup",!0);k(_,A,V,"⇀","\\rightharpoonup",!0);k(_,A,V,"↙","\\swarrow",!0);k(_,A,V,"↽","\\leftharpoondown",!0);k(_,A,V,"⇁","\\rightharpoondown",!0);k(_,A,V,"↖","\\nwarrow",!0);k(_,A,V,"⇌","\\rightleftharpoons",!0);k(_,F,V,"≮","\\nless",!0);k(_,F,V,"","\\@nleqslant");k(_,F,V,"","\\@nleqq");k(_,F,V,"⪇","\\lneq",!0);k(_,F,V,"≨","\\lneqq",!0);k(_,F,V,"","\\@lvertneqq");k(_,F,V,"⋦","\\lnsim",!0);k(_,F,V,"⪉","\\lnapprox",!0);k(_,F,V,"⊀","\\nprec",!0);k(_,F,V,"⋠","\\npreceq",!0);k(_,F,V,"⋨","\\precnsim",!0);k(_,F,V,"⪹","\\precnapprox",!0);k(_,F,V,"≁","\\nsim",!0);k(_,F,V,"","\\@nshortmid");k(_,F,V,"∤","\\nmid",!0);k(_,F,V,"⊬","\\nvdash",!0);k(_,F,V,"⊭","\\nvDash",!0);k(_,F,V,"⋪","\\ntriangleleft");k(_,F,V,"⋬","\\ntrianglelefteq",!0);k(_,F,V,"⊊","\\subsetneq",!0);k(_,F,V,"","\\@varsubsetneq");k(_,F,V,"⫋","\\subsetneqq",!0);k(_,F,V,"","\\@varsubsetneqq");k(_,F,V,"≯","\\ngtr",!0);k(_,F,V,"","\\@ngeqslant");k(_,F,V,"","\\@ngeqq");k(_,F,V,"⪈","\\gneq",!0);k(_,F,V,"≩","\\gneqq",!0);k(_,F,V,"","\\@gvertneqq");k(_,F,V,"⋧","\\gnsim",!0);k(_,F,V,"⪊","\\gnapprox",!0);k(_,F,V,"⊁","\\nsucc",!0);k(_,F,V,"⋡","\\nsucceq",!0);k(_,F,V,"⋩","\\succnsim",!0);k(_,F,V,"⪺","\\succnapprox",!0);k(_,F,V,"≆","\\ncong",!0);k(_,F,V,"","\\@nshortparallel");k(_,F,V,"∦","\\nparallel",!0);k(_,F,V,"⊯","\\nVDash",!0);k(_,F,V,"⋫","\\ntriangleright");k(_,F,V,"⋭","\\ntrianglerighteq",!0);k(_,F,V,"","\\@nsupseteqq");k(_,F,V,"⊋","\\supsetneq",!0);k(_,F,V,"","\\@varsupsetneq");k(_,F,V,"⫌","\\supsetneqq",!0);k(_,F,V,"","\\@varsupsetneqq");k(_,F,V,"⊮","\\nVdash",!0);k(_,F,V,"⪵","\\precneqq",!0);k(_,F,V,"⪶","\\succneqq",!0);k(_,F,V,"","\\@nsubseteqq");k(_,F,Ve,"⊴","\\unlhd");k(_,F,Ve,"⊵","\\unrhd");k(_,F,V,"↚","\\nleftarrow",!0);k(_,F,V,"↛","\\nrightarrow",!0);k(_,F,V,"⇍","\\nLeftarrow",!0);k(_,F,V,"⇏","\\nRightarrow",!0);k(_,F,V,"↮","\\nleftrightarrow",!0);k(_,F,V,"⇎","\\nLeftrightarrow",!0);k(_,F,V,"△","\\vartriangle");k(_,F,K,"ℏ","\\hslash");k(_,F,K,"▽","\\triangledown");k(_,F,K,"◊","\\lozenge");k(_,F,K,"Ⓢ","\\circledS");k(_,F,K,"®","\\circledR");k(pe,F,K,"®","\\circledR");k(_,F,K,"∡","\\measuredangle",!0);k(_,F,K,"∄","\\nexists");k(_,F,K,"℧","\\mho");k(_,F,K,"Ⅎ","\\Finv",!0);k(_,F,K,"⅁","\\Game",!0);k(_,F,K,"‵","\\backprime");k(_,F,K,"▲","\\blacktriangle");k(_,F,K,"▼","\\blacktriangledown");k(_,F,K,"■","\\blacksquare");k(_,F,K,"⧫","\\blacklozenge");k(_,F,K,"★","\\bigstar");k(_,F,K,"∢","\\sphericalangle",!0);k(_,F,K,"∁","\\complement",!0);k(_,F,K,"ð","\\eth",!0);k(pe,A,K,"ð","ð");k(_,F,K,"╱","\\diagup");k(_,F,K,"╲","\\diagdown");k(_,F,K,"□","\\square");k(_,F,K,"□","\\Box");k(_,F,K,"◊","\\Diamond");k(_,F,K,"¥","\\yen",!0);k(pe,F,K,"¥","\\yen",!0);k(_,F,K,"✓","\\checkmark",!0);k(pe,F,K,"✓","\\checkmark");k(_,F,K,"ℶ","\\beth",!0);k(_,F,K,"ℸ","\\daleth",!0);k(_,F,K,"ℷ","\\gimel",!0);k(_,F,K,"ϝ","\\digamma",!0);k(_,F,K,"ϰ","\\varkappa");k(_,F,fs,"┌","\\@ulcorner",!0);k(_,F,Si,"┐","\\@urcorner",!0);k(_,F,fs,"└","\\@llcorner",!0);k(_,F,Si,"┘","\\@lrcorner",!0);k(_,F,V,"≦","\\leqq",!0);k(_,F,V,"⩽","\\leqslant",!0);k(_,F,V,"⪕","\\eqslantless",!0);k(_,F,V,"≲","\\lesssim",!0);k(_,F,V,"⪅","\\lessapprox",!0);k(_,F,V,"≊","\\approxeq",!0);k(_,F,Ve,"⋖","\\lessdot");k(_,F,V,"⋘","\\lll",!0);k(_,F,V,"≶","\\lessgtr",!0);k(_,F,V,"⋚","\\lesseqgtr",!0);k(_,F,V,"⪋","\\lesseqqgtr",!0);k(_,F,V,"≑","\\doteqdot");k(_,F,V,"≓","\\risingdotseq",!0);k(_,F,V,"≒","\\fallingdotseq",!0);k(_,F,V,"∽","\\backsim",!0);k(_,F,V,"⋍","\\backsimeq",!0);k(_,F,V,"⫅","\\subseteqq",!0);k(_,F,V,"⋐","\\Subset",!0);k(_,F,V,"⊏","\\sqsubset",!0);k(_,F,V,"≼","\\preccurlyeq",!0);k(_,F,V,"⋞","\\curlyeqprec",!0);k(_,F,V,"≾","\\precsim",!0);k(_,F,V,"⪷","\\precapprox",!0);k(_,F,V,"⊲","\\vartriangleleft");k(_,F,V,"⊴","\\trianglelefteq");k(_,F,V,"⊨","\\vDash",!0);k(_,F,V,"⊪","\\Vvdash",!0);k(_,F,V,"⌣","\\smallsmile");k(_,F,V,"⌢","\\smallfrown");k(_,F,V,"≏","\\bumpeq",!0);k(_,F,V,"≎","\\Bumpeq",!0);k(_,F,V,"≧","\\geqq",!0);k(_,F,V,"⩾","\\geqslant",!0);k(_,F,V,"⪖","\\eqslantgtr",!0);k(_,F,V,"≳","\\gtrsim",!0);k(_,F,V,"⪆","\\gtrapprox",!0);k(_,F,Ve,"⋗","\\gtrdot");k(_,F,V,"⋙","\\ggg",!0);k(_,F,V,"≷","\\gtrless",!0);k(_,F,V,"⋛","\\gtreqless",!0);k(_,F,V,"⪌","\\gtreqqless",!0);k(_,F,V,"≖","\\eqcirc",!0);k(_,F,V,"≗","\\circeq",!0);k(_,F,V,"≜","\\triangleq",!0);k(_,F,V,"∼","\\thicksim");k(_,F,V,"≈","\\thickapprox");k(_,F,V,"⫆","\\supseteqq",!0);k(_,F,V,"⋑","\\Supset",!0);k(_,F,V,"⊐","\\sqsupset",!0);k(_,F,V,"≽","\\succcurlyeq",!0);k(_,F,V,"⋟","\\curlyeqsucc",!0);k(_,F,V,"≿","\\succsim",!0);k(_,F,V,"⪸","\\succapprox",!0);k(_,F,V,"⊳","\\vartriangleright");k(_,F,V,"⊵","\\trianglerighteq");k(_,F,V,"⊩","\\Vdash",!0);k(_,F,V,"∣","\\shortmid");k(_,F,V,"∥","\\shortparallel");k(_,F,V,"≬","\\between",!0);k(_,F,V,"⋔","\\pitchfork",!0);k(_,F,V,"∝","\\varpropto");k(_,F,V,"◀","\\blacktriangleleft");k(_,F,V,"∴","\\therefore",!0);k(_,F,V,"∍","\\backepsilon");k(_,F,V,"▶","\\blacktriangleright");k(_,F,V,"∵","\\because",!0);k(_,F,V,"⋘","\\llless");k(_,F,V,"⋙","\\gggtr");k(_,F,Ve,"⊲","\\lhd");k(_,F,Ve,"⊳","\\rhd");k(_,F,V,"≂","\\eqsim",!0);k(_,A,V,"⋈","\\Join");k(_,F,V,"≑","\\Doteq",!0);k(_,F,Ve,"∔","\\dotplus",!0);k(_,F,Ve,"∖","\\smallsetminus");k(_,F,Ve,"⋒","\\Cap",!0);k(_,F,Ve,"⋓","\\Cup",!0);k(_,F,Ve,"⩞","\\doublebarwedge",!0);k(_,F,Ve,"⊟","\\boxminus",!0);k(_,F,Ve,"⊞","\\boxplus",!0);k(_,F,Ve,"⋇","\\divideontimes",!0);k(_,F,Ve,"⋉","\\ltimes",!0);k(_,F,Ve,"⋊","\\rtimes",!0);k(_,F,Ve,"⋋","\\leftthreetimes",!0);k(_,F,Ve,"⋌","\\rightthreetimes",!0);k(_,F,Ve,"⋏","\\curlywedge",!0);k(_,F,Ve,"⋎","\\curlyvee",!0);k(_,F,Ve,"⊝","\\circleddash",!0);k(_,F,Ve,"⊛","\\circledast",!0);k(_,F,Ve,"⋅","\\centerdot");k(_,F,Ve,"⊺","\\intercal",!0);k(_,F,Ve,"⋒","\\doublecap");k(_,F,Ve,"⋓","\\doublecup");k(_,F,Ve,"⊠","\\boxtimes",!0);k(_,F,V,"⇢","\\dashrightarrow",!0);k(_,F,V,"⇠","\\dashleftarrow",!0);k(_,F,V,"⇇","\\leftleftarrows",!0);k(_,F,V,"⇆","\\leftrightarrows",!0);k(_,F,V,"⇚","\\Lleftarrow",!0);k(_,F,V,"↞","\\twoheadleftarrow",!0);k(_,F,V,"↢","\\leftarrowtail",!0);k(_,F,V,"↫","\\looparrowleft",!0);k(_,F,V,"⇋","\\leftrightharpoons",!0);k(_,F,V,"↶","\\curvearrowleft",!0);k(_,F,V,"↺","\\circlearrowleft",!0);k(_,F,V,"↰","\\Lsh",!0);k(_,F,V,"⇈","\\upuparrows",!0);k(_,F,V,"↿","\\upharpoonleft",!0);k(_,F,V,"⇃","\\downharpoonleft",!0);k(_,A,V,"⊶","\\origof",!0);k(_,A,V,"⊷","\\imageof",!0);k(_,F,V,"⊸","\\multimap",!0);k(_,F,V,"↭","\\leftrightsquigarrow",!0);k(_,F,V,"⇉","\\rightrightarrows",!0);k(_,F,V,"⇄","\\rightleftarrows",!0);k(_,F,V,"↠","\\twoheadrightarrow",!0);k(_,F,V,"↣","\\rightarrowtail",!0);k(_,F,V,"↬","\\looparrowright",!0);k(_,F,V,"↷","\\curvearrowright",!0);k(_,F,V,"↻","\\circlearrowright",!0);k(_,F,V,"↱","\\Rsh",!0);k(_,F,V,"⇊","\\downdownarrows",!0);k(_,F,V,"↾","\\upharpoonright",!0);k(_,F,V,"⇂","\\downharpoonright",!0);k(_,F,V,"⇝","\\rightsquigarrow",!0);k(_,F,V,"⇝","\\leadsto");k(_,F,V,"⇛","\\Rrightarrow",!0);k(_,F,V,"↾","\\restriction");k(_,A,K,"‘","`");k(_,A,K,"$","\\$");k(pe,A,K,"$","\\$");k(pe,A,K,"$","\\textdollar");k(_,A,K,"%","\\%");k(pe,A,K,"%","\\%");k(_,A,K,"_","\\_");k(pe,A,K,"_","\\_");k(pe,A,K,"_","\\textunderscore");k(_,A,K,"∠","\\angle",!0);k(_,A,K,"∞","\\infty",!0);k(_,A,K,"′","\\prime");k(_,A,K,"△","\\triangle");k(_,A,K,"Γ","\\Gamma",!0);k(_,A,K,"Δ","\\Delta",!0);k(_,A,K,"Θ","\\Theta",!0);k(_,A,K,"Λ","\\Lambda",!0);k(_,A,K,"Ξ","\\Xi",!0);k(_,A,K,"Π","\\Pi",!0);k(_,A,K,"Σ","\\Sigma",!0);k(_,A,K,"Υ","\\Upsilon",!0);k(_,A,K,"Φ","\\Phi",!0);k(_,A,K,"Ψ","\\Psi",!0);k(_,A,K,"Ω","\\Omega",!0);k(_,A,K,"A","Α");k(_,A,K,"B","Β");k(_,A,K,"E","Ε");k(_,A,K,"Z","Ζ");k(_,A,K,"H","Η");k(_,A,K,"I","Ι");k(_,A,K,"K","Κ");k(_,A,K,"M","Μ");k(_,A,K,"N","Ν");k(_,A,K,"O","Ο");k(_,A,K,"P","Ρ");k(_,A,K,"T","Τ");k(_,A,K,"X","Χ");k(_,A,K,"¬","\\neg",!0);k(_,A,K,"¬","\\lnot");k(_,A,K,"⊤","\\top");k(_,A,K,"⊥","\\bot");k(_,A,K,"∅","\\emptyset");k(_,F,K,"∅","\\varnothing");k(_,A,ht,"α","\\alpha",!0);k(_,A,ht,"β","\\beta",!0);k(_,A,ht,"γ","\\gamma",!0);k(_,A,ht,"δ","\\delta",!0);k(_,A,ht,"ϵ","\\epsilon",!0);k(_,A,ht,"ζ","\\zeta",!0);k(_,A,ht,"η","\\eta",!0);k(_,A,ht,"θ","\\theta",!0);k(_,A,ht,"ι","\\iota",!0);k(_,A,ht,"κ","\\kappa",!0);k(_,A,ht,"λ","\\lambda",!0);k(_,A,ht,"μ","\\mu",!0);k(_,A,ht,"ν","\\nu",!0);k(_,A,ht,"ξ","\\xi",!0);k(_,A,ht,"ο","\\omicron",!0);k(_,A,ht,"π","\\pi",!0);k(_,A,ht,"ρ","\\rho",!0);k(_,A,ht,"σ","\\sigma",!0);k(_,A,ht,"τ","\\tau",!0);k(_,A,ht,"υ","\\upsilon",!0);k(_,A,ht,"ϕ","\\phi",!0);k(_,A,ht,"χ","\\chi",!0);k(_,A,ht,"ψ","\\psi",!0);k(_,A,ht,"ω","\\omega",!0);k(_,A,ht,"ε","\\varepsilon",!0);k(_,A,ht,"ϑ","\\vartheta",!0);k(_,A,ht,"ϖ","\\varpi",!0);k(_,A,ht,"ϱ","\\varrho",!0);k(_,A,ht,"ς","\\varsigma",!0);k(_,A,ht,"φ","\\varphi",!0);k(_,A,Ve,"∗","*",!0);k(_,A,Ve,"+","+");k(_,A,Ve,"−","-",!0);k(_,A,Ve,"⋅","\\cdot",!0);k(_,A,Ve,"∘","\\circ",!0);k(_,A,Ve,"÷","\\div",!0);k(_,A,Ve,"±","\\pm",!0);k(_,A,Ve,"×","\\times",!0);k(_,A,Ve,"∩","\\cap",!0);k(_,A,Ve,"∪","\\cup",!0);k(_,A,Ve,"∖","\\setminus",!0);k(_,A,Ve,"∧","\\land");k(_,A,Ve,"∨","\\lor");k(_,A,Ve,"∧","\\wedge",!0);k(_,A,Ve,"∨","\\vee",!0);k(_,A,K,"√","\\surd");k(_,A,fs,"⟨","\\langle",!0);k(_,A,fs,"∣","\\lvert");k(_,A,fs,"∥","\\lVert");k(_,A,Si,"?","?");k(_,A,Si,"!","!");k(_,A,Si,"⟩","\\rangle",!0);k(_,A,Si,"∣","\\rvert");k(_,A,Si,"∥","\\rVert");k(_,A,V,"=","=");k(_,A,V,":",":");k(_,A,V,"≈","\\approx",!0);k(_,A,V,"≅","\\cong",!0);k(_,A,V,"≥","\\ge");k(_,A,V,"≥","\\geq",!0);k(_,A,V,"←","\\gets");k(_,A,V,">","\\gt",!0);k(_,A,V,"∈","\\in",!0);k(_,A,V,"","\\@not");k(_,A,V,"⊂","\\subset",!0);k(_,A,V,"⊃","\\supset",!0);k(_,A,V,"⊆","\\subseteq",!0);k(_,A,V,"⊇","\\supseteq",!0);k(_,F,V,"⊈","\\nsubseteq",!0);k(_,F,V,"⊉","\\nsupseteq",!0);k(_,A,V,"⊨","\\models");k(_,A,V,"←","\\leftarrow",!0);k(_,A,V,"≤","\\le");k(_,A,V,"≤","\\leq",!0);k(_,A,V,"<","\\lt",!0);k(_,A,V,"→","\\rightarrow",!0);k(_,A,V,"→","\\to");k(_,F,V,"≱","\\ngeq",!0);k(_,F,V,"≰","\\nleq",!0);k(_,A,Ho," ","\\ ");k(_,A,Ho," ","\\space");k(_,A,Ho," ","\\nobreakspace");k(pe,A,Ho," ","\\ ");k(pe,A,Ho," "," ");k(pe,A,Ho," ","\\space");k(pe,A,Ho," ","\\nobreakspace");k(_,A,Ho,"","\\nobreak");k(_,A,Ho,"","\\allowbreak");k(_,A,I0,",",",");k(_,A,I0,";",";");k(_,F,Ve,"⊼","\\barwedge",!0);k(_,F,Ve,"⊻","\\veebar",!0);k(_,A,Ve,"⊙","\\odot",!0);k(_,A,Ve,"⊕","\\oplus",!0);k(_,A,Ve,"⊗","\\otimes",!0);k(_,A,K,"∂","\\partial",!0);k(_,A,Ve,"⊘","\\oslash",!0);k(_,F,Ve,"⊚","\\circledcirc",!0);k(_,F,Ve,"⊡","\\boxdot",!0);k(_,A,Ve,"△","\\bigtriangleup");k(_,A,Ve,"▽","\\bigtriangledown");k(_,A,Ve,"†","\\dagger");k(_,A,Ve,"⋄","\\diamond");k(_,A,Ve,"⋆","\\star");k(_,A,Ve,"◃","\\triangleleft");k(_,A,Ve,"▹","\\triangleright");k(_,A,fs,"{","\\{");k(pe,A,K,"{","\\{");k(pe,A,K,"{","\\textbraceleft");k(_,A,Si,"}","\\}");k(pe,A,K,"}","\\}");k(pe,A,K,"}","\\textbraceright");k(_,A,fs,"{","\\lbrace");k(_,A,Si,"}","\\rbrace");k(_,A,fs,"[","\\lbrack",!0);k(pe,A,K,"[","\\lbrack",!0);k(_,A,Si,"]","\\rbrack",!0);k(pe,A,K,"]","\\rbrack",!0);k(_,A,fs,"(","\\lparen",!0);k(_,A,Si,")","\\rparen",!0);k(pe,A,K,"<","\\textless",!0);k(pe,A,K,">","\\textgreater",!0);k(_,A,fs,"⌊","\\lfloor",!0);k(_,A,Si,"⌋","\\rfloor",!0);k(_,A,fs,"⌈","\\lceil",!0);k(_,A,Si,"⌉","\\rceil",!0);k(_,A,K,"\\","\\backslash");k(_,A,K,"∣","|");k(_,A,K,"∣","\\vert");k(pe,A,K,"|","\\textbar",!0);k(_,A,K,"∥","\\|");k(_,A,K,"∥","\\Vert");k(pe,A,K,"∥","\\textbardbl");k(pe,A,K,"~","\\textasciitilde");k(pe,A,K,"\\","\\textbackslash");k(pe,A,K,"^","\\textasciicircum");k(_,A,V,"↑","\\uparrow",!0);k(_,A,V,"⇑","\\Uparrow",!0);k(_,A,V,"↓","\\downarrow",!0);k(_,A,V,"⇓","\\Downarrow",!0);k(_,A,V,"↕","\\updownarrow",!0);k(_,A,V,"⇕","\\Updownarrow",!0);k(_,A,xr,"∐","\\coprod");k(_,A,xr,"⋁","\\bigvee");k(_,A,xr,"⋀","\\bigwedge");k(_,A,xr,"⨄","\\biguplus");k(_,A,xr,"⋂","\\bigcap");k(_,A,xr,"⋃","\\bigcup");k(_,A,xr,"∫","\\int");k(_,A,xr,"∫","\\intop");k(_,A,xr,"∬","\\iint");k(_,A,xr,"∭","\\iiint");k(_,A,xr,"∏","\\prod");k(_,A,xr,"∑","\\sum");k(_,A,xr,"⨂","\\bigotimes");k(_,A,xr,"⨁","\\bigoplus");k(_,A,xr,"⨀","\\bigodot");k(_,A,xr,"∮","\\oint");k(_,A,xr,"∯","\\oiint");k(_,A,xr,"∰","\\oiiint");k(_,A,xr,"⨆","\\bigsqcup");k(_,A,xr,"∫","\\smallint");k(pe,A,sh,"…","\\textellipsis");k(_,A,sh,"…","\\mathellipsis");k(pe,A,sh,"…","\\ldots",!0);k(_,A,sh,"…","\\ldots",!0);k(_,A,sh,"⋯","\\@cdots",!0);k(_,A,sh,"⋱","\\ddots",!0);k(_,A,K,"⋮","\\varvdots");k(pe,A,K,"⋮","\\varvdots");k(_,A,Fn,"ˊ","\\acute");k(_,A,Fn,"ˋ","\\grave");k(_,A,Fn,"¨","\\ddot");k(_,A,Fn,"~","\\tilde");k(_,A,Fn,"ˉ","\\bar");k(_,A,Fn,"˘","\\breve");k(_,A,Fn,"ˇ","\\check");k(_,A,Fn,"^","\\hat");k(_,A,Fn,"⃗","\\vec");k(_,A,Fn,"˙","\\dot");k(_,A,Fn,"˚","\\mathring");k(_,A,ht,"","\\@imath");k(_,A,ht,"","\\@jmath");k(_,A,K,"ı","ı");k(_,A,K,"ȷ","ȷ");k(pe,A,K,"ı","\\i",!0);k(pe,A,K,"ȷ","\\j",!0);k(pe,A,K,"ß","\\ss",!0);k(pe,A,K,"æ","\\ae",!0);k(pe,A,K,"œ","\\oe",!0);k(pe,A,K,"ø","\\o",!0);k(pe,A,K,"Æ","\\AE",!0);k(pe,A,K,"Œ","\\OE",!0);k(pe,A,K,"Ø","\\O",!0);k(pe,A,Fn,"ˊ","\\'");k(pe,A,Fn,"ˋ","\\`");k(pe,A,Fn,"ˆ","\\^");k(pe,A,Fn,"˜","\\~");k(pe,A,Fn,"ˉ","\\=");k(pe,A,Fn,"˘","\\u");k(pe,A,Fn,"˙","\\.");k(pe,A,Fn,"¸","\\c");k(pe,A,Fn,"˚","\\r");k(pe,A,Fn,"ˇ","\\v");k(pe,A,Fn,"¨",'\\"');k(pe,A,Fn,"˝","\\H");k(pe,A,Fn,"◯","\\textcircled");var gN={"--":!0,"---":!0,"``":!0,"''":!0};k(pe,A,K,"–","--",!0);k(pe,A,K,"–","\\textendash");k(pe,A,K,"—","---",!0);k(pe,A,K,"—","\\textemdash");k(pe,A,K,"‘","`",!0);k(pe,A,K,"‘","\\textquoteleft");k(pe,A,K,"’","'",!0);k(pe,A,K,"’","\\textquoteright");k(pe,A,K,"“","``",!0);k(pe,A,K,"“","\\textquotedblleft");k(pe,A,K,"”","''",!0);k(pe,A,K,"”","\\textquotedblright");k(_,A,K,"°","\\degree",!0);k(pe,A,K,"°","\\degree");k(pe,A,K,"°","\\textdegree",!0);k(_,A,K,"£","\\pounds");k(_,A,K,"£","\\mathsterling",!0);k(pe,A,K,"£","\\pounds");k(pe,A,K,"£","\\textsterling",!0);k(_,F,K,"✠","\\maltese");k(pe,F,K,"✠","\\maltese");var jS='0123456789/@."';for(var ev=0;ev<jS.length;ev++){var LS=jS.charAt(ev);k(_,A,K,LS,LS)}var BS='0123456789!@*()-=+";:?/.,';for(var tv=0;tv<BS.length;tv++){var zS=BS.charAt(tv);k(pe,A,K,zS,zS)}var Eg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var nv=0;nv<Eg.length;nv++){var wm=Eg.charAt(nv);k(_,A,ht,wm,wm),k(pe,A,K,wm,wm)}k(_,F,K,"C","ℂ");k(pe,F,K,"C","ℂ");k(_,F,K,"H","ℍ");k(pe,F,K,"H","ℍ");k(_,F,K,"N","ℕ");k(pe,F,K,"N","ℕ");k(_,F,K,"P","ℙ");k(pe,F,K,"P","ℙ");k(_,F,K,"Q","ℚ");k(pe,F,K,"Q","ℚ");k(_,F,K,"R","ℝ");k(pe,F,K,"R","ℝ");k(_,F,K,"Z","ℤ");k(pe,F,K,"Z","ℤ");k(_,A,ht,"h","ℎ");k(pe,A,ht,"h","ℎ");var kt;for(var ci=0;ci<Eg.length;ci++){var Qn=Eg.charAt(ci);kt=String.fromCharCode(55349,56320+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56372+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56424+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56580+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56684+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56736+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56788+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56840+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56944+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),ci<26&&(kt=String.fromCharCode(55349,56632+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt),kt=String.fromCharCode(55349,56476+ci),k(_,A,ht,Qn,kt),k(pe,A,K,Qn,kt))}kt="𝕜";k(_,A,ht,"k",kt);k(pe,A,K,"k",kt);for(var dc=0;dc<10;dc++){var Zo=dc.toString();kt=String.fromCharCode(55349,57294+dc),k(_,A,ht,Zo,kt),k(pe,A,K,Zo,kt),kt=String.fromCharCode(55349,57314+dc),k(_,A,ht,Zo,kt),k(pe,A,K,Zo,kt),kt=String.fromCharCode(55349,57324+dc),k(_,A,ht,Zo,kt),k(pe,A,K,Zo,kt),kt=String.fromCharCode(55349,57334+dc),k(_,A,ht,Zo,kt),k(pe,A,K,Zo,kt)}var jx="ÐÞþ";for(var rv=0;rv<jx.length;rv++){var km=jx.charAt(rv);k(_,A,ht,km,km),k(pe,A,K,km,km)}var Lx={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},PS={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},$S={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},xY={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},Tc={mathClass:"",textClass:"",font:""},US={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},HS={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},qS={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Bx={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},zx={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},FS={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Px={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},VS=[Lx,Lx,PS,PS,$S,$S,xY,Tc,Tc,Tc,US,US,HS,HS,qS,qS,Bx,Bx,zx,zx,FS,FS,Tc,Tc,Px,Px],wY=[Lx,Tc,Bx,zx,Px],kY=t=>{var e=t.charCodeAt(0),n=t.charCodeAt(1),r=(e-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484){var i=Math.floor((r-119808)/26);return VS[i]}else if(120782<=r&&r<=120831){var s=Math.floor((r-120782)/10);return wY[s]}else{if(r===120485||r===120486)return VS[0];if(120486<r&&r<120782)return Tc;throw new Se("Unsupported character: "+t)}},P1=function(e,n,r){if(qn[r][e]){var i=qn[r][e].replace;i&&(e=i)}return{value:e,metrics:Y3(e,n,r)}},mi=function(e,n,r,i,s){var a=P1(e,n,r),o=a.metrics;e=a.value;var l;if(o){var c=o.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),l=new ds(e,o.height,o.depth,c,o.skew,o.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),l=new ds(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var u=i.getColor();u&&(l.style.color=u)}return l},X3=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&P1(e,"Main-Bold",n).metrics?mi(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||qn[n][e].font==="main"?mi(e,"Main-Regular",n,r,i):mi(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},_Y=function(e,n,r){return r!=="textord"&&P1(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},$1=function(e,n,r){var i=e.mode,s=e.text,a=["mord"],{font:o,fontFamily:l,fontWeight:c,fontShape:u}=n,d=i==="math"||i==="text"&&!!o,h=d?o:l,m="",p="";if(s.charCodeAt(0)===55349){var b=kY(s);m=b.font,p=b[i+"Class"]}if(m)return mi(s,m,i,n,a.concat(p));if(h){var x,g;if(h==="boldsymbol"){var y=_Y(s,i,r);x=y.fontName,g=[y.fontClass]}else d?(x=$x[o].fontName,g=[o]):(x=_m(l,c,u),g=[l,c,u]);if(P1(s,x,i).metrics)return mi(s,x,i,n,a.concat(g));if(gN.hasOwnProperty(s)&&x.slice(0,10)==="Typewriter"){for(var w=[],C=0;C<s.length;C++)w.push(mi(s[C],x,i,n,a.concat(g)));return qo(w)}}if(r==="mathord")return mi(s,"Math-Italic",i,n,a.concat(["mathnormal"]));if(r==="textord"){var E=qn[i][s]&&qn[i][s].font;if(E==="ams"){var S=_m("amsrm",c,u);return mi(s,S,i,n,a.concat("amsrm",c,u))}else if(E==="main"||!E){var T=_m("textrm",c,u);return mi(s,T,i,n,a.concat(c,u))}else{var O=_m(E,c,u);return mi(s,O,i,n,a.concat(O,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},SY=(t,e)=>{if($l(t.classes)!==$l(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r of Object.keys(t.style))if(t.style[r]!==e.style[r])return!1;for(var i of Object.keys(e.style))if(t.style[i]!==e.style[i])return!1;return!0},yN=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof ds&&r instanceof ds&&SY(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,t.splice(e+1,1),e--)}return t},Q3=function(e){for(var n=0,r=0,i=0,s=0;s<e.children.length;s++){var a=e.children[s];a.height>n&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>i&&(i=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=i},ve=function(e,n,r,i){var s=new ih(e,n,r,i);return Q3(s),s},Hl=(t,e,n,r)=>new ih(t,e,n,r),Id=function(e,n,r){var i=ve([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=De(i.height),i.maxFontSize=1,i},TY=function(e,n,r,i){var s=new z1(e,n,r,i);return Q3(s),s},qo=function(e){var n=new rh(e);return Q3(n),n},Rd=function(e,n){return e instanceof rh?ve([],[e],n):e},CY=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,s=i,a=1;a<n.length;a++){var o=-n[a].shift-s-n[a].elem.depth,l=o-(n[a-1].elem.height+n[a-1].elem.depth);s=s+o,r.push({type:"kern",size:l}),r.push(n[a])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var u=e.positionData,d=0;d<e.children.length;d++){var h=e.children[d];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var m=e.children[0];if(m.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-m.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-m.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},cn=function(e,n){for(var{children:r,depth:i}=CY(e),s=0,a=0;a<r.length;a++){var o=r[a];if(o.type==="elem"){var l=o.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=ve(["pstrut"],[]);c.style.height=De(s);for(var u=[],d=i,h=i,m=i,p=0;p<r.length;p++){var b=r[p];if(b.type==="kern")m+=b.size;else{var x=b.elem,g=b.wrapperClasses||[],y=b.wrapperStyle||{},w=ve(g,[c,x],void 0,y);w.style.top=De(-s-m-x.depth),b.marginLeft&&(w.style.marginLeft=b.marginLeft),b.marginRight&&(w.style.marginRight=b.marginRight),u.push(w),m+=x.height+x.depth}d=Math.min(d,m),h=Math.max(h,m)}var C=ve(["vlist"],u);C.style.height=De(h);var E;if(d<0){var S=ve([],[]),T=ve(["vlist"],[S]);T.style.height=De(-d);var O=ve(["vlist-s"],[new ds("​")]);E=[ve(["vlist-r"],[C,O]),ve(["vlist-r"],[T])]}else E=[ve(["vlist-r"],[C])];var z=ve(["vlist-t"],E);return E.length===2&&z.classes.push("vlist-t2"),z.height=h,z.depth=-d,z},bN=(t,e)=>{var n=ve(["mspace"],[],e),r=Wn(t,e);return n.style.marginRight=De(r),n},_m=(t,e,n)=>{var r,i;switch(t){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=t}return e==="textbf"&&n==="textit"?i="BoldItalic":e==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",r+"-"+i},$x={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"}},vN={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},xN=function(e,n){var[r,i,s]=vN[e],a=new Ul(r),o=new Bo([a],{width:De(i),height:De(s),style:"width:"+De(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=Hl(["overlay"],[o],n);return l.height=s,l.style.height=De(s),l.style.width=De(i),l},Gn={number:3,unit:"mu"},hc={number:4,unit:"mu"},ao={number:5,unit:"mu"},EY={mord:{mop:Gn,mbin:hc,mrel:ao,minner:Gn},mop:{mord:Gn,mop:Gn,mrel:ao,minner:Gn},mbin:{mord:hc,mop:hc,mopen:hc,minner:hc},mrel:{mord:ao,mop:ao,mopen:ao,minner:ao},mopen:{},mclose:{mop:Gn,mbin:hc,mrel:ao,minner:Gn},mpunct:{mord:Gn,mop:Gn,mrel:ao,mopen:Gn,mclose:Gn,mpunct:Gn,minner:Gn},minner:{mord:Gn,mop:Gn,mbin:hc,mrel:ao,mopen:Gn,mpunct:Gn,minner:Gn}},AY={mord:{mop:Gn},mop:{mord:Gn,mop:Gn},mbin:{},mrel:{},mopen:{},mclose:{mop:Gn},mpunct:{},minner:{mop:Gn}},wN={},Ag={},Mg={};function Be(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:a}=t,o={type:e,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:i},l=0;l<n.length;++l)wN[n[l]]=o;e&&(s&&(Ag[e]=s),a&&(Mg[e]=a))}function fu(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;Be({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var Ng=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},br=function(e){return e.type==="ordgroup"?e.body:[e]},MY=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),NY=new Set(["rightmost","mrel","mclose","mpunct"]),DY={display:Mt.DISPLAY,text:Mt.TEXT,script:Mt.SCRIPT,scriptscript:Mt.SCRIPTSCRIPT},IY={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Dr=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],a=0;a<e.length;a++){var o=dn(e[a],n);if(o instanceof rh){var l=o.children;s.push(...l)}else s.push(o)}if(yN(s),!r)return s;var c=n;if(e.length===1){var u=e[0];u.type==="sizing"?c=n.havingSize(u.size):u.type==="styling"&&(c=n.havingStyle(DY[u.style]))}var d=ve([i[0]||"leftmost"],[],n),h=ve([i[1]||"rightmost"],[],n),m=r==="root";return Ux(s,(p,b)=>{var x=b.classes[0],g=p.classes[0];x==="mbin"&&NY.has(g)?b.classes[0]="mord":g==="mbin"&&MY.has(x)&&(p.classes[0]="mord")},{node:d},h,m),Ux(s,(p,b)=>{var x,g,y=qx(b),w=qx(p),C=y&&w?p.hasClass("mtight")?(x=AY[y])==null?void 0:x[w]:(g=EY[y])==null?void 0:g[w]:null;if(C)return bN(C,c)},{node:d},h,m),s},Ux=function(e,n,r,i,s){i&&e.push(i);for(var a=0;a<e.length;a++){var o=e[a],l=kN(o);if(l){Ux(l.children,n,r,null,s);continue}var c=!o.hasClass("mspace");if(c){var u=n(o,r.node);u&&(r.insertAfter?r.insertAfter(u):(e.unshift(u),a++))}c?r.node=o:s&&o.hasClass("newline")&&(r.node=ve(["leftmost"])),r.insertAfter=(d=>h=>{e.splice(d+1,0,h),a++})(a)}i&&e.pop()},kN=function(e){return e instanceof rh||e instanceof z1||e instanceof ih&&e.hasClass("enclosing")?e:null},Hx=function(e,n){var r=kN(e);if(r){var i=r.children;if(i.length){if(n==="right")return Hx(i[i.length-1],"right");if(n==="left")return Hx(i[0],"left")}}return e},qx=function(e,n){if(!e)return null;n&&(e=Hx(e,n));var r=e.classes[0];return IY[r]||null},Kf=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return ve(n.concat(r))},dn=function(e,n,r){if(!e)return ve();if(Ag[e.type]){var i=Ag[e.type](e,n);if(r&&n.size!==r.size){i=ve(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new Se("Got group of unknown type: '"+e.type+"'")};function Sm(t,e){var n=ve(["base"],t,e),r=ve(["strut"]);return r.style.height=De(n.height+n.depth),n.depth&&(r.style.verticalAlign=De(-n.depth)),n.children.unshift(r),n}function Fx(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Dr(t,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],a=[],o=0;o<r.length;o++)if(a.push(r[o]),r[o].hasClass("mbin")||r[o].hasClass("mrel")||r[o].hasClass("allowbreak")){for(var l=!1;o<r.length-1&&r[o+1].hasClass("mspace")&&!r[o+1].hasClass("newline");)o++,a.push(r[o]),r[o].hasClass("nobreak")&&(l=!0);l||(s.push(Sm(a,e)),a=[])}else r[o].hasClass("newline")&&(a.pop(),a.length>0&&(s.push(Sm(a,e)),a=[]),s.push(r[o]));a.length>0&&s.push(Sm(a,e));var c;n?(c=Sm(Dr(n,e,!0),e),c.classes=["tag"],s.push(c)):i&&s.push(i);var u=ve(["katex-html"],s);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=De(u.height+u.depth),u.depth&&(d.style.verticalAlign=De(-u.depth))}return u}function _N(t){return new rh(t)}class Ee{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=$l(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof vr&&this.children[r+1]instanceof vr){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof vr;)i+=this.children[++r].toText();e.appendChild(new vr(i).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="',e+=ri(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+ri($l(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}let vr=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return ri(this.toText())}toText(){return this.text}};class SN{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",De(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+De(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var RY=new Set(["\\imath","\\jmath"]),OY=new Set(["mrow","mtable"]),Hs=function(e,n,r){return qn[n][e]&&qn[n][e].replace&&e.charCodeAt(0)!==55349&&!(gN.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=qn[n][e].replace),new vr(e)},J3=function(e){return e.length===1?e[0]:new Ee("mrow",e)},jY={mathit:"italic",boldsymbol:t=>t.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"},Z3=(t,e)=>{if(t.mode==="text"){if(e.fontFamily==="texttt")return"monospace";if(e.fontFamily==="textsf")return e.fontShape==="textit"&&e.fontWeight==="textbf"?"sans-serif-bold-italic":e.fontShape==="textit"?"sans-serif-italic":e.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(e.fontShape==="textit"&&e.fontWeight==="textbf")return"bold-italic";if(e.fontShape==="textit")return"italic";if(e.fontWeight==="textbf")return"bold"}var n=e.font;if(!n||n==="mathnormal")return null;var r=t.mode,i=jY[n];if(i)return typeof i=="function"?i(t):i;var s=t.text;if(RY.has(s))return null;if(qn[r][s]){var a=qn[r][s].replace;a&&(s=a)}var o=$x[n].fontName;return Y3(s,o,r)?$x[n].variant:null};function iv(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof vr&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof vr&&n.text===","}else return!1}var ms=function(e,n,r){if(e.length===1){var i=Cn(e[0],n);return r&&i instanceof Ee&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],a,o=0;o<e.length;o++){var l=Cn(e[o],n);if(l instanceof Ee&&a instanceof Ee){if(l.type==="mtext"&&a.type==="mtext"&&l.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...l.children);continue}else if(l.type==="mn"&&a.type==="mn"){a.children.push(...l.children);continue}else if(iv(l)&&a.type==="mn"){a.children.push(...l.children);continue}else if(l.type==="mn"&&iv(a))l.children=[...a.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(a.type==="mn"||iv(a))){var c=l.children[0];c instanceof Ee&&c.type==="mn"&&(c.children=[...a.children,...c.children],s.pop())}else if(a.type==="mi"&&a.children.length===1){var u=a.children[0];if(u instanceof vr&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof vr&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(l),a=l}return s},ql=function(e,n,r){return J3(ms(e,n,r))},Cn=function(e,n){if(!e)return new Ee("mrow");if(Mg[e.type])return Mg[e.type](e,n);throw new Se("Got group of unknown type: '"+e.type+"'")};function GS(t,e,n,r,i){var s=ms(t,n),a;s.length===1&&s[0]instanceof Ee&&OY.has(s[0].type)?a=s[0]:a=new Ee("mrow",s);var o=new Ee("annotation",[new vr(e)]);o.setAttribute("encoding","application/x-tex");var l=new Ee("semantics",[a,o]),c=new Ee("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=i?"katex":"katex-mathml";return ve([u],[c])}var LY=[[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]],WS=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],KS=function(e,n){return n.size<2?e:LY[e-1][n.size-1]};class mo{constructor(e){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=e.style,this.color=e.color,this.size=e.size||mo.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=WS[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){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,e),new mo(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:KS(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:WS[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=KS(mo.BASESIZE,e);return this.size===n&&this.textSize===mo.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==mo.BASESIZE?["sizing","reset-size"+this.size,"size"+mo.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=vY(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}mo.BASESIZE=6;var TN=function(e){return new mo({style:e.displayMode?Mt.DISPLAY:Mt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},CN=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ve(r,[e])}return e},BY=function(e,n,r){var i=TN(r),s;if(r.output==="mathml")return GS(e,n,i,r.displayMode,!0);if(r.output==="html"){var a=Fx(e,i);s=ve(["katex"],[a])}else{var o=GS(e,n,i,r.displayMode,!1),l=Fx(e,i);s=ve(["katex"],[o,l])}return CN(s,r)},zY=function(e,n,r){var i=TN(r),s=Fx(e,i),a=ve(["katex"],[s]);return CN(a,r)},PY={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":"="},U1=function(e){var n=new Ee("mo",[new vr(PY[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},$Y={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]},UY=new Set(["widehat","widecheck","widetilde","utilde"]),H1=function(e,n){function r(){var o=4e5,l=e.label.slice(1);if(UY.has(l)&&"base"in e){var c=e.base.type==="ordgroup"?e.base.body.length:1,u,d,h;if(c>5)l==="widehat"||l==="widecheck"?(u=420,o=2364,h=.42,d=l+"4"):(u=312,o=2340,h=.34,d="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][m],u=[0,239,300,360,420][m],h=[0,.24,.3,.3,.36,.42][m],d=l+m):(o=[0,600,1033,2339,2340][m],u=[0,260,286,306,312][m],h=[0,.26,.286,.3,.306,.34][m],d="tilde"+m)}var p=new Ul(d),b=new Bo([p],{width:"100%",height:De(h),viewBox:"0 0 "+o+" "+u,preserveAspectRatio:"none"});return{span:Hl([],[b],n),minWidth:0,height:h}}else{var x=[],g=$Y[l];if(!g)throw new Error('No SVG data for "'+l+'".');var[y,w,C]=g,E=C/1e3,S=y.length,T,O;if(S===1){if(g.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');T=["hide-tail"],O=[g[3]]}else if(S===2)T=["halfarrow-left","halfarrow-right"],O=["xMinYMin","xMaxYMin"];else if(S===3)T=["brace-left","brace-center","brace-right"],O=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+S+" children.");for(var z=0;z<S;z++){var I=new Ul(y[z]),j=new Bo([I],{width:"400em",height:De(E),viewBox:"0 0 "+o+" "+C,preserveAspectRatio:O[z]+" slice"}),N=Hl([T[z]],[j],n);if(S===1)return{span:N,minWidth:w,height:E};N.style.height=De(E),x.push(N)}return{span:ve(["stretchy"],x,n),minWidth:w,height:E}}}var{span:i,minWidth:s,height:a}=r();return i.height=a,i.style.height=De(a),s>0&&(i.style.minWidth=De(s)),i},HY=function(e,n,r,i,s){var a,o=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(a=ve(["stretchy",n],[],s),n==="fbox"){var l=s.color&&s.getColor();l&&(a.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new Ox({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new Ox({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Bo(c,{width:"100%",height:De(o)});a=Hl([],[u],s)}return a.height=o,a.style.height=De(o),a},qY={bin:1,close:1,inner:1,open:1,punct:1,rel:1},FY={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function VY(t){return t in qY}function Bt(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function q1(t){var e=F1(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function F1(t){return t&&(t.type==="atom"||FY.hasOwnProperty(t.type))?t:null}var EN=t=>{if(t instanceof ds)return t;if(bY(t)&&t.children.length===1)return EN(t.children[0])},ek=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Bt(t.base,"accent"),n=r.base,t.base=n,i=yY(dn(t,e)),t.base=r):(r=Bt(t,"accent"),n=r.base);var s=dn(n,e.havingCrampedStyle()),a=r.isShifty&&Uo(n),o=0;if(a){var l,c;o=(l=(c=EN(s))==null?void 0:c.skew)!=null?l:0}var u=r.label==="\\c",d=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),h;if(r.isStretchy)h=H1(r,e),h=cn({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+De(2*o)+")",marginLeft:De(2*o)}:void 0}]});else{var m,p;r.label==="\\vec"?(m=xN("vec",e),p=vN.vec[1]):(m=$1({mode:r.mode,text:r.label},e,"textord"),m=gY(m),m.italic=0,p=m.width,u&&(d+=m.depth)),h=ve(["accent-body"],[m]);var b=r.label==="\\textcircled";b&&(h.classes.push("accent-full"),d=s.height);var x=o;b||(x-=p/2),h.style.left=De(x),r.label==="\\textcircled"&&(h.style.top=".2em"),h=cn({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:h}]})}var g=ve(["mord","accent"],[h],e);return i?(i.children[0]=g,i.height=Math.max(g.height,i.height),i.classes[0]="mord",i):g},AN=(t,e)=>{var n=t.isStretchy?U1(t.label):new Ee("mo",[Hs(t.label,t.mode)]),r=new Ee("mover",[Cn(t.base,e),n]);return r.setAttribute("accent","true"),r},GY=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Be({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:(t,e)=>{var n=Ng(e[0]),r=!GY.test(t.funcName),i=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:ek,mathmlBuilder:AN});Be({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:ek,mathmlBuilder:AN});Be({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(t,e)=>{var n=dn(t.base,e),r=H1(t,e),i=t.label==="\\utilde"?.12:0,s=cn({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return ve(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=U1(t.label),r=new Ee("munder",[Cn(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Tm=t=>{var e=new Ee("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Be({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(t,e,n){var{parser:r,funcName:i}=t;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),i=Rd(dn(t.body,r,e),e),s=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=Rd(dn(t.below,r,e),e),a.classes.push(s+"-arrow-pad"));var o=H1(t,e),l=-e.fontMetrics().axisHeight+.5*o.height,c=-e.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(c-=i.depth);var u;if(a){var d=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;u=cn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:a,shift:d}]})}else u=cn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return ve(["mrel","x-arrow"],[u],e)},mathmlBuilder(t,e){var n=U1(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=Tm(Cn(t.body,e));if(t.below){var s=Tm(Cn(t.below,e));r=new Ee("munderover",[n,s,i])}else r=new Ee("mover",[n,i])}else if(t.below){var a=Tm(Cn(t.below,e));r=new Ee("munder",[n,a])}else r=Tm(),r=new Ee("mover",[n,r]);return r}});function MN(t,e){var n=Dr(t.body,e,!0);return ve([t.mclass],n,e)}function NN(t,e){var n,r=ms(t.body,e);return t.mclass==="minner"?n=new Ee("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Ee("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Ee("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Be({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:br(i),isCharacterBox:Uo(i)}},htmlBuilder:MN,mathmlBuilder:NN});var V1=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Be({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:V1(e[0]),body:br(e[1]),isCharacterBox:Uo(e[1])}}});Be({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,i=e[1],s=e[0],a;r!=="\\stackrel"?a=V1(i):a="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:br(i)},l={type:"supsub",mode:s.mode,base:o,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:n.mode,mclass:a,body:[l],isCharacterBox:Uo(l)}},htmlBuilder:MN,mathmlBuilder:NN});Be({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:V1(e[0]),body:br(e[0])}},htmlBuilder(t,e){var n=Dr(t.body,e,!0),r=ve([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=ms(t.body,e),r=new Ee("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var WY={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},YS=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),XS=t=>t.type==="textord"&&t.text==="@",KY=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function YY(t,e,n){var r=WY[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=n.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[s],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,a,o]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function XY(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Se("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var a=e[s],o=YS(),l=0;l<a.length;l++)if(!XS(a[l]))o.body.push(a[l]);else{r.push(o),l+=1;var c=q1(a[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var h=!0,m=l+1;m<a.length;m++){if(KY(a[m],c)){h=!1,l=m;break}if(XS(a[m]))throw new Se("Missing a "+c+" character to complete a CD arrow.",a[m]);u[d].body.push(a[m])}if(h)throw new Se("Missing a "+c+" character to complete a CD arrow.",a[l])}else throw new Se('Expected one of "<>AV=|." after @',a[l]);var p=YY(c,u,t),b={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(b),o=YS()}s%2===0?r.push(o):r.shift(),r=[],i.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var x=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:x,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}Be({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=Rd(dn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=De(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Ee("mrow",[Cn(t.label,e)]);return n=new Ee("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ee("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Be({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=Rd(dn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Ee("mrow",[Cn(t.fragment,e)])}});Be({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Bt(e[0],"ordgroup"),i=r.body,s="",a=0;a<i.length;a++){var o=Bt(i[a],"textord");s+=o.text}var l=parseInt(s),c;if(isNaN(l))throw new Se("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new Se("\\@char with invalid code point "+s);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 DN=(t,e)=>{var n=Dr(t.body,e.withColor(t.color),!1);return qo(n)},IN=(t,e)=>{var n=ms(t.body,e.withColor(t.color)),r=new Ee("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Be({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Bt(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:br(i)}},htmlBuilder:DN,mathmlBuilder:IN});Be({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Bt(e[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var s=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:s}},htmlBuilder:DN,mathmlBuilder:IN});Be({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:i&&Bt(i,"size").value}},htmlBuilder(t,e){var n=ve(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=De(Wn(t.size,e)))),n},mathmlBuilder(t,e){var n=new Ee("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",De(Wn(t.size,e)))),n}});var Vx={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},RN=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Se("Expected a control sequence",t);return e},QY=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},ON=(t,e,n,r)=>{var i=t.gullet.macros.get(n.text);i==null&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,i,r)};Be({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(Vx[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=Vx[r.text]),Bt(e.parseFunction(),"internal");throw new Se("Invalid token after macro prefix",r)}});Be({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new Se("Expected a control sequence",r);for(var s=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Se('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new Se('Argument number "'+r.text+'" out of order');s++,o.push([])}else{if(r.text==="EOF")throw new Se("Expected a macro definition");o[s].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return a&&l.unshift(a),(n==="\\edef"||n==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:o},n===Vx[n]),{type:"internal",mode:e.mode}}});Be({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=RN(e.gullet.popToken());e.gullet.consumeSpaces();var i=QY(e);return ON(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Be({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=RN(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return ON(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Wh=function(e,n,r){var i=qn.math[e]&&qn.math[e].replace,s=Y3(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},tk=function(e,n,r,i){var s=r.havingBaseStyle(n),a=ve(i.concat(s.sizingClasses(r)),[e],r),o=s.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=s.sizeMultiplier,a},jN=function(e,n,r){var i=n.havingBaseStyle(r),s=(1-n.sizeMultiplier/i.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=De(s),e.height-=s,e.depth+=s},JY=function(e,n,r,i,s,a){var o=mi(e,"Main-Regular",s,i),l=tk(o,n,i,a);return jN(l,i,n),l},ZY=function(e,n,r,i){return mi(e,"Size"+n+"-Regular",r,i)},LN=function(e,n,r,i,s,a){var o=ZY(e,n,s,i),l=tk(ve(["delimsizing","size"+n],[o],i),Mt.TEXT,i,a);return r&&jN(l,i,Mt.TEXT),l},sv=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=ve(["delimsizinginner",i],[ve([],[mi(e,n,r)])]);return{type:"elem",elem:s}},av=function(e,n,r){var i=Ra["Size4-Regular"][e.charCodeAt(0)]?Ra["Size4-Regular"][e.charCodeAt(0)][4]:Ra["Size1-Regular"][e.charCodeAt(0)][4],s=new Ul("inner",cY(e,Math.round(1e3*n))),a=new Bo([s],{width:De(i),height:De(n),style:"width:"+De(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=Hl([],[a],r);return o.height=n,o.style.height=De(n),o.style.width=De(i),{type:"elem",elem:o}},Gx=.008,Cm={type:"kern",size:-1*Gx},eX=new Set(["|","\\lvert","\\rvert","\\vert"]),tX=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),BN=function(e,n,r,i,s,a){var o,l,c,u,d="",h=0;o=c=u=e,l=null;var m="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?o=c="⏐":e==="\\Downarrow"?o=c="‖":e==="\\updownarrow"?(o="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",c="‖",u="\\Downarrow"):eX.has(e)?(c="∣",d="vert",h=333):tX.has(e)?(c="∥",d="doublevert",h=556):e==="["||e==="\\lbrack"?(o="⎡",c="⎢",u="⎣",m="Size4-Regular",d="lbrack",h=667):e==="]"||e==="\\rbrack"?(o="⎤",c="⎥",u="⎦",m="Size4-Regular",d="rbrack",h=667):e==="\\lfloor"||e==="⌊"?(c=o="⎢",u="⎣",m="Size4-Regular",d="lfloor",h=667):e==="\\lceil"||e==="⌈"?(o="⎡",c=u="⎢",m="Size4-Regular",d="lceil",h=667):e==="\\rfloor"||e==="⌋"?(c=o="⎥",u="⎦",m="Size4-Regular",d="rfloor",h=667):e==="\\rceil"||e==="⌉"?(o="⎤",c=u="⎥",m="Size4-Regular",d="rceil",h=667):e==="("||e==="\\lparen"?(o="⎛",c="⎜",u="⎝",m="Size4-Regular",d="lparen",h=875):e===")"||e==="\\rparen"?(o="⎞",c="⎟",u="⎠",m="Size4-Regular",d="rparen",h=875):e==="\\{"||e==="\\lbrace"?(o="⎧",l="⎨",u="⎩",c="⎪",m="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",l="⎬",u="⎭",c="⎪",m="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",u="⎩",c="⎪",m="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",u="⎭",c="⎪",m="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",u="⎭",c="⎪",m="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",u="⎩",c="⎪",m="Size4-Regular");var p=Wh(o,m,s),b=p.height+p.depth,x=Wh(c,m,s),g=x.height+x.depth,y=Wh(u,m,s),w=y.height+y.depth,C=0,E=1;if(l!==null){var S=Wh(l,m,s);C=S.height+S.depth,E=2}var T=b+w+C,O=Math.max(0,Math.ceil((n-T)/(E*g))),z=T+O*E*g,I=i.fontMetrics().axisHeight;r&&(I*=i.sizeMultiplier);var j=z/2-I,N=[];if(d.length>0){var B=z-b-w,P=Math.round(z*1e3),J=uY(d,Math.round(B*1e3)),q=new Ul(d,J),Y=De(h/1e3),$=De(P/1e3),Z=new Bo([q],{width:Y,height:$,viewBox:"0 0 "+h+" "+P}),M=Hl([],[Z],i);M.height=P/1e3,M.style.width=Y,M.style.height=$,N.push({type:"elem",elem:M})}else{if(N.push(sv(u,m,s)),N.push(Cm),l===null){var X=z-b-w+2*Gx;N.push(av(c,X,i))}else{var H=(z-b-w-C)/2+2*Gx;N.push(av(c,H,i)),N.push(Cm),N.push(sv(l,m,s)),N.push(Cm),N.push(av(c,H,i))}N.push(Cm),N.push(sv(o,m,s))}var R=i.havingBaseStyle(Mt.TEXT),ae=cn({positionType:"bottom",positionData:j,children:N});return tk(ve(["delimsizing","mult"],[ae],R),Mt.TEXT,i,a)},ov=80,lv=.08,cv=function(e,n,r,i,s){var a=lY(e,i,r),o=new Ul(e,a),l=new Bo([o],{width:"400em",height:De(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Hl(["hide-tail"],[l],s)},nX=function(e,n){var r=n.havingBaseSizing(),i=HN("\\surd",e*r.sizeMultiplier,UN,r),s=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,l,c,u,d;return i.type==="small"?(u=1e3+1e3*a+ov,e<1?s=1:e<1.4&&(s=.7),l=(1+a+lv)/s,c=(1+a)/s,o=cv("sqrtMain",l,u,a,n),o.style.minWidth="0.853em",d=.833/s):i.type==="large"?(u=(1e3+ov)*xf[i.size],c=(xf[i.size]+a)/s,l=(xf[i.size]+a+lv)/s,o=cv("sqrtSize"+i.size,l,u,a,n),o.style.minWidth="1.02em",d=1/s):(l=e+a+lv,c=e+a,u=Math.floor(1e3*e+a)+ov,o=cv("sqrtTall",l,u,a,n),o.style.minWidth="0.742em",d=1.056),o.height=c,o.style.height=De(l),{span:o,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*s}},zN=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),rX=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),PN=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),xf=[0,1.2,1.8,2.4,3],$N=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),zN.has(e)||PN.has(e))return LN(e,n,!1,r,i,s);if(rX.has(e))return BN(e,xf[n],!1,r,i,s);throw new Se("Illegal delimiter: '"+e+"'")},iX=[{type:"small",style:Mt.SCRIPTSCRIPT},{type:"small",style:Mt.SCRIPT},{type:"small",style:Mt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],sX=[{type:"small",style:Mt.SCRIPTSCRIPT},{type:"small",style:Mt.SCRIPT},{type:"small",style:Mt.TEXT},{type:"stack"}],UN=[{type:"small",style:Mt.SCRIPTSCRIPT},{type:"small",style:Mt.SCRIPT},{type:"small",style:Mt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],aX=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var n=e.type;throw new Error("Add support for delim type '"+n+"' here.")},HN=function(e,n,r,i){for(var s=Math.min(2,3-i.style.size),a=s;a<r.length;a++){var o=r[a];if(o.type==="stack")break;var l=Wh(e,aX(o),"math"),c=l.height+l.depth;if(o.type==="small"){var u=i.havingBaseStyle(o.style);c*=u.sizeMultiplier}if(c>n)return o}return r[r.length-1]},Wx=function(e,n,r,i,s,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;PN.has(e)?o=iX:zN.has(e)?o=UN:o=sX;var l=HN(e,n,o,i);return l.type==="small"?JY(e,l.style,r,i,s,a):l.type==="large"?LN(e,l.size,r,i,s,a):BN(e,n,r,i,s,a)},uv=function(e,n,r,i,s,a){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,u=Math.max(n-o,r+o),d=Math.max(u/500*l,2*u-c);return Wx(e,d,!0,i,s,a)},QS={"\\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}},oX=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 JS(t){return"isMiddle"in t}function G1(t,e){var n=F1(t);if(n&&oX.has(n.text))return n;throw n?new Se("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Se("Invalid delimiter type '"+t.type+"'",t)}Be({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:(t,e)=>{var n=G1(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:QS[t.funcName].size,mclass:QS[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ve([t.mclass]):$N(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Hs(t.delim,t.mode));var n=new Ee("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=De(xf[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function ZS(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Be({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Se("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:G1(e[0],t).text,color:n}}});Be({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=G1(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Bt(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{ZS(t);for(var n=Dr(t.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,a=0;a<n.length;a++){var o=n[a];JS(o)?s=!0:(r=Math.max(n[a].height,r),i=Math.max(n[a].depth,i))}r*=e.sizeMultiplier,i*=e.sizeMultiplier;var l;if(t.left==="."?l=Kf(e,["mopen"]):l=uv(t.left,r,i,e,t.mode,["mopen"]),n.unshift(l),s)for(var c=1;c<n.length;c++){var u=n[c];if(JS(u)){var d=u.isMiddle;n[c]=uv(d.delim,r,i,d.options,t.mode,[])}}var h;if(t.right===".")h=Kf(e,["mclose"]);else{var m=t.rightColor?e.withColor(t.rightColor):e;h=uv(t.right,r,i,m,t.mode,["mclose"])}return n.push(h),ve(["minner"],n,e)},mathmlBuilder:(t,e)=>{ZS(t);var n=ms(t.body,e);if(t.left!=="."){var r=new Ee("mo",[Hs(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new Ee("mo",[Hs(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return J3(n)}});Be({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=G1(e[0],t);if(!t.parser.leftrightDepth)throw new Se("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;return t.delim==="."?n=Kf(e,[]):(n=$N(t.delim,1,e,t.mode,[]),n.isMiddle={delim:t.delim,options:e}),n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Hs("|","text"):Hs(t.delim,t.mode),r=new Ee("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var W1=(t,e)=>{var n=Rd(dn(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,a,o=Uo(t.body);if(r==="sout")s=ve(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=Wn({number:.6,unit:"pt"},e),c=Wn({number:.35,unit:"ex"},e),u=e.havingBaseSizing();i=i/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=De(d/2+l);var h=Math.floor(1e3*d*i),m=aY(h),p=new Bo([new Ul("phase",m)],{width:"400em",height:De(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});s=Hl(["hide-tail"],[p],e),s.style.height=De(d),a=n.depth+l+c}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,x,g=0;/box/.test(r)?(g=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),b=e.fontMetrics().fboxsep+(r==="colorbox"?0:g),x=b):r==="angl"?(g=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),b=4*g,x=Math.max(0,.25-n.depth)):(b=o?.2:0,x=b),s=HY(n,r,b,x,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=De(g)):r==="angl"&&g!==.049&&(s.style.borderTopWidth=De(g),s.style.borderRightWidth=De(g)),a=n.depth+x,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var y;if(t.backgroundColor)y=cn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:a},{type:"elem",elem:n,shift:0}]});else{var w=/cancel|phase/.test(r)?["svg-align"]:[];y=cn({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:a,wrapperClasses:w}]})}return/cancel/.test(r)&&(y.height=n.height,y.depth=n.depth),/cancel/.test(r)&&!o?ve(["mord","cancel-lap"],[y],e):ve(["mord"],[y],e)},K1=(t,e)=>{var n,r=new Ee(t.label.includes("colorbox")?"mpadded":"menclose",[Cn(t.body,e)]);switch(t.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=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+De(i)+" solid "+t.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Be({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Bt(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:a}},htmlBuilder:W1,mathmlBuilder:K1});Be({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Bt(e[0],"color-token").color,a=Bt(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:a,borderColor:s,body:o}},htmlBuilder:W1,mathmlBuilder:K1});Be({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Be({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:W1,mathmlBuilder:K1});Be({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=e[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:W1,mathmlBuilder:K1});Be({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var qN={};function Va(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)qN[n[l]]=o;s&&(Ag[e]=s),a&&(Mg[e]=a)}var FN={};function D(t,e){FN[t]=e}class Di{constructor(e,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=n,this.end=r}static range(e,n){return n?!e||!e.loc||!n.loc||e.loc.lexer!==n.loc.lexer?null:new Di(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class ls{constructor(e,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=n}range(e,n){return new ls(n,Di.range(this,e))}}function e7(t){var e=[];t.consumeSpaces();var n=t.fetch().text;for(n==="\\relax"&&(t.consume(),t.consumeSpaces(),n=t.fetch().text);n==="\\hline"||n==="\\hdashline";)t.consume(),e.push(n==="\\hdashline"),t.consumeSpaces(),n=t.fetch().text;return e}var Y1=t=>{var e=t.parser.settings;if(!e.displayMode)throw new Se("{"+t.envName+"} can be used only in display mode.")},lX=new Set(["gather","gather*"]);function nk(t){if(!t.includes("ed"))return!t.includes("*")}function tc(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:a,colSeparationType:o,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:h}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var m=t.gullet.expandMacroAsText("\\arraystretch");if(m==null)a=1;else if(a=parseFloat(m),!a||a<0)throw new Se("Invalid \\arraystretch: "+m)}t.gullet.beginGroup();var p=[],b=[p],x=[],g=[],y=l!=null?[]:void 0;function w(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function C(){y&&(t.gullet.macros.get("\\df@tag")?(y.push(t.subparse([new ls("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):y.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),g.push(e7(t));;){var E=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var S={type:"ordgroup",mode:t.mode,body:E};n&&(S={type:"styling",mode:t.mode,style:n,resetFont:!0,body:[S]}),p.push(S);var T=t.fetch().text;if(T==="&"){if(d&&p.length===d){if(c||o)throw new Se("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(T==="\\end"){C(),p.length===1&&S.type==="styling"&&S.body.length===1&&S.body[0].type==="ordgroup"&&S.body[0].body.length===0&&(b.length>1||!u)&&b.pop(),g.length<b.length+1&&g.push([]);break}else if(T==="\\\\"){t.consume();var O=void 0;t.gullet.future().text!==" "&&(O=t.parseSizeGroup(!0)),x.push(O?O.value:null),C(),g.push(e7(t)),p=[],b.push(p),w()}else throw new Se("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:i,arraystretch:a,body:b,cols:s,rowGaps:x,hskipBeforeAndAfter:r,hLinesBeforeRow:g,colSeparationType:o,tags:y,leqno:h}}function rk(t){return t.slice(0,1)==="d"?"display":"text"}var Ga=function(e,n){var r,i,s=e.body.length,a=e.hLinesBeforeRow,o=0,l=new Array(s),c=[],u=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),d=1/n.fontMetrics().ptPerEm,h=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var m=n.havingStyle(Mt.SCRIPT).sizeMultiplier;h=.2778*(m/n.sizeMultiplier)}var p=e.colSeparationType==="CD"?Wn({number:3,unit:"ex"},n):12*d,b=3*d,x=e.arraystretch*p,g=.7*x,y=.3*x,w=0;function C(ke){for(var ze=0;ze<ke.length;++ze)ze>0&&(w+=.25),c.push({pos:w,isDashed:ke[ze]})}for(C(a[0]),r=0;r<e.body.length;++r){var E=e.body[r],S=g,T=y;o<E.length&&(o=E.length);var O={cells:new Array(E.length),height:0,depth:0,pos:0};for(i=0;i<E.length;++i){var z=dn(E[i],n);T<z.depth&&(T=z.depth),S<z.height&&(S=z.height),O.cells[i]=z}var I=e.rowGaps[r],j=0;I&&(j=Wn(I,n),j>0&&(j+=y,T<j&&(T=j),j=0)),e.addJot&&r<e.body.length-1&&(T+=b),O.height=S,O.depth=T,w+=S,O.pos=w,w+=T+j,l[r]=O,C(a[r+1])}var N=w/2+n.fontMetrics().axisHeight,B=e.cols||[],P=[],J,q,Y=[];if(e.tags&&e.tags.some(ke=>ke))for(r=0;r<s;++r){var $=l[r],Z=$.pos-N,M=e.tags[r],X=void 0;M===!0?X=ve(["eqn-num"],[],n):M===!1?X=ve([],[],n):X=ve([],Dr(M,n,!0),n),X.depth=$.depth,X.height=$.height,Y.push({type:"elem",elem:X,shift:Z})}for(i=0,q=0;i<o||q<B.length;++i,++q){for(var H,R=B[q],ae=!0;((xe=R)==null?void 0:xe.type)==="separator";){var xe;if(ae||(J=ve(["arraycolsep"],[]),J.style.width=De(n.fontMetrics().doubleRuleSep),P.push(J)),R.separator==="|"||R.separator===":"){var ye=R.separator==="|"?"solid":"dashed",Ae=ve(["vertical-separator"],[],n);Ae.style.height=De(w),Ae.style.borderRightWidth=De(u),Ae.style.borderRightStyle=ye,Ae.style.margin="0 "+De(-u/2);var Fe=w-N;Fe&&(Ae.style.verticalAlign=De(-Fe)),P.push(Ae)}else throw new Se("Invalid separator type: "+R.separator);q++,R=B[q],ae=!1}if(!(i>=o)){var vt=void 0;if(i>0||e.hskipBeforeAndAfter){var Nt,pt;vt=(Nt=(pt=R)==null?void 0:pt.pregap)!=null?Nt:h,vt!==0&&(J=ve(["arraycolsep"],[]),J.style.width=De(vt),P.push(J))}var Qe=[];for(r=0;r<s;++r){var Ge=l[r],$t=Ge.cells[i];if($t){var Je=Ge.pos-N;$t.depth=Ge.depth,$t.height=Ge.height,Qe.push({type:"elem",elem:$t,shift:Je})}}var re=cn({positionType:"individualShift",children:Qe}),ce=ve(["col-align-"+(((H=R)==null?void 0:H.align)||"c")],[re]);if(P.push(ce),i<o-1||e.hskipBeforeAndAfter){var Ie,We;vt=(Ie=(We=R)==null?void 0:We.postgap)!=null?Ie:h,vt!==0&&(J=ve(["arraycolsep"],[]),J.style.width=De(vt),P.push(J))}}}var me=ve(["mtable"],P);if(c.length>0){for(var rt=Id("hline",n,u),oe=Id("hdashline",n,u),Oe=[{type:"elem",elem:me,shift:0}];c.length>0;){var Re=c.pop(),$e=Re.pos-N;Re.isDashed?Oe.push({type:"elem",elem:oe,shift:$e}):Oe.push({type:"elem",elem:rt,shift:$e})}me=cn({positionType:"individualShift",children:Oe})}if(Y.length===0)return ve(["mord"],[me],n);var ne=cn({positionType:"individualShift",children:Y}),ge=ve(["tag"],[ne],n);return qo([me,ge])},cX={c:"center ",l:"left ",r:"right "},Wa=function(e,n){for(var r=[],i=new Ee("mtd",[],["mtr-glue"]),s=new Ee("mtd",[],["mml-eqn-num"]),a=0;a<e.body.length;a++){for(var o=e.body[a],l=[],c=0;c<o.length;c++)l.push(new Ee("mtd",[Cn(o[c],n)]));e.tags&&e.tags[a]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),r.push(new Ee("mtr",l))}var u=new Ee("mtable",r),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",De(d));var h="",m="";if(e.cols&&e.cols.length>0){var p=e.cols,b="",x=!1,g=0,y=p.length;p[0].type==="separator"&&(h+="top ",g=1),p[p.length-1].type==="separator"&&(h+="bottom ",y-=1);for(var w=g;w<y;w++){var C=p[w];C.type==="align"?(m+=cX[C.align],x&&(b+="none "),x=!0):C.type==="separator"&&x&&(b+=C.separator==="|"?"solid ":"dashed ",x=!1)}u.setAttribute("columnalign",m.trim()),/[sd]/.test(b)&&u.setAttribute("columnlines",b.trim())}if(e.colSeparationType==="align"){for(var E=e.cols||[],S="",T=1;T<E.length;T++)S+=T%2?"0em ":"1em ";u.setAttribute("columnspacing",S.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var O="",z=e.hLinesBeforeRow;h+=z[0].length>0?"left ":"",h+=z[z.length-1].length>0?"right ":"";for(var I=1;I<z.length-1;I++)O+=z[I].length===0?"none ":z[I][0]?"dashed ":"solid ";return/[sd]/.test(O)&&u.setAttribute("rowlines",O.trim()),h!==""&&(u=new Ee("menclose",[u]),u.setAttribute("notation",h.trim())),e.arraystretch&&e.arraystretch<1&&(u=new Ee("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},VN=function(e,n){e.envName.includes("ed")||Y1(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",a=tc(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:nk(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),o=0,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var u="",d=0;d<n[0].body.length;d++){var h=Bt(n[0].body[d],"textord");u+=h.text}o=Number(u),l=o*2}var m=!l;a.body.forEach(function(g){for(var y=1;y<g.length;y+=2){var w=Bt(g[y],"styling"),C=Bt(w.body[0],"ordgroup");C.body.unshift(c)}if(m)l<g.length&&(l=g.length);else{var E=g.length/2;if(o<E)throw new Se("Too many math in a row: "+("expected "+o+", but got "+E),g[0])}});for(var p=0;p<l;++p){var b="r",x=0;p%2===1?b="l":p>0&&m&&(x=1),r[p]={type:"align",align:b,pregap:x,postgap:0}}return a.colSeparationType=m?"align":"alignat",a};Va({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=F1(e[0]),r=n?[e[0]]:Bt(e[0],"ordgroup").body,i=r.map(function(a){var o=q1(a),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Se("Unknown column alignment: "+l,a)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return tc(t.parser,s,rk(t.envName))},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var i=t.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!"lcr".includes(n))throw new Se("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=tc(t.parser,r,rk(t.envName)),a=Math.max(0,...s.body.map(o=>o.length));return s.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=tc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=F1(e[0]),r=n?[e[0]]:Bt(e[0],"ordgroup").body,i=r.map(function(o){var l=q1(o),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Se("Unknown column alignment: "+c,o)});if(i.length>1)throw new Se("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},a=tc(t.parser,s,"script");if(a.body.length>0&&a.body[0].length>1)throw new Se("{subarray} can contain only one column");return a},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=tc(t.parser,e,rk(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:VN,htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){lX.has(t.envName)&&Y1(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:nk(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return tc(t.parser,e,"display")},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:VN,htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Y1(t);var e={autoTag:nk(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return tc(t.parser,e,"display")},htmlBuilder:Ga,mathmlBuilder:Wa});Va({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Y1(t),XY(t.parser)},htmlBuilder:Ga,mathmlBuilder:Wa});D("\\nonumber","\\gdef\\@eqnsw{0}");D("\\notag","\\nonumber");Be({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Se(t.funcName+" valid only within array environment")}});var t7=qN;Be({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];if(i.type!=="ordgroup")throw new Se("Invalid environment name",i);for(var s="",a=0;a<i.body.length;++a)s+=Bt(i.body[a],"textord").text;if(r==="\\begin"){if(!t7.hasOwnProperty(s))throw new Se("No such environment: "+s,i);var o=t7[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",o),u={mode:n.mode,envName:s,parser:n},d=o.handler(u,l,c);n.expect("\\end",!1);var h=n.nextToken,m=Bt(n.parseFunction(),"environment");if(m.name!==s)throw new Se("Mismatch: \\begin{"+s+"} matched by \\end{"+m.name+"}",h);return d}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var GN=(t,e)=>{var n=t.font,r=e.withFont(n);return dn(t.body,r)},WN=(t,e)=>{var n=t.font,r=e.withFont(n);return Cn(t.body,r)},n7={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};Be({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=Ng(e[0]),s=r;return s in n7&&(s=n7[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:GN,mathmlBuilder:WN});Be({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"mclass",mode:n.mode,mclass:V1(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Uo(r)}}});Be({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:i}=t,{mode:s}=n,a=n.parseExpression(!0,i);return{type:"font",mode:s,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:GN,mathmlBuilder:WN});var uX=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var a=dn(t.numer,s,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;a.height=a.height<o?o:a.height,a.depth=a.depth<l?l:a.depth}s=e.havingStyle(i);var c=dn(t.denom,s,e),u,d,h;t.hasBarLine?(t.barSize?(d=Wn(t.barSize,e),u=Id("frac-line",e,d)):u=Id("frac-line",e),d=u.height,h=u.height):(u=null,d=0,h=e.fontMetrics().defaultRuleThickness);var m,p,b;n.size===Mt.DISPLAY.size?(m=e.fontMetrics().num1,d>0?p=3*h:p=7*h,b=e.fontMetrics().denom1):(d>0?(m=e.fontMetrics().num2,p=h):(m=e.fontMetrics().num3,p=3*h),b=e.fontMetrics().denom2);var x;if(u){var y=e.fontMetrics().axisHeight;m-a.depth-(y+.5*d)<p&&(m+=p-(m-a.depth-(y+.5*d))),y-.5*d-(c.height-b)<p&&(b+=p-(y-.5*d-(c.height-b)));var w=-(y-.5*d);x=cn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:b},{type:"elem",elem:u,shift:w},{type:"elem",elem:a,shift:-m}]})}else{var g=m-a.depth-(c.height-b);g<p&&(m+=.5*(p-g),b+=.5*(p-g)),x=cn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:b},{type:"elem",elem:a,shift:-m}]})}s=e.havingStyle(n),x.height*=s.sizeMultiplier/e.sizeMultiplier,x.depth*=s.sizeMultiplier/e.sizeMultiplier;var C;n.size===Mt.DISPLAY.size?C=e.fontMetrics().delim1:n.size===Mt.SCRIPTSCRIPT.size?C=e.havingStyle(Mt.SCRIPT).fontMetrics().delim2:C=e.fontMetrics().delim2;var E,S;return t.leftDelim==null?E=Kf(e,["mopen"]):E=Wx(t.leftDelim,C,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?S=ve([]):t.rightDelim==null?S=Kf(e,["mclose"]):S=Wx(t.rightDelim,C,!0,e.havingStyle(n),t.mode,["mclose"]),ve(["mord"].concat(s.sizingClasses(e)),[E,ve(["mfrac"],[x]),S],e)},dX=(t,e)=>{var n=new Ee("mfrac",[Cn(t.numer,e),Cn(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Wn(t.barSize,e);n.setAttribute("linethickness",De(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new Ee("mo",[new vr(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var a=new Ee("mo",[new vr(t.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}return J3(i)}return n},KN=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};Be({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=e[1],a,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",l=")";break;case"\\\\bracefrac":a=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":a=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=r==="\\cfrac",u=null;return c||r.startsWith("\\d")?u="display":r.startsWith("\\t")&&(u="text"),KN({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:a,leftDelim:o,rightDelim:l,barSize:null},u)},htmlBuilder:uX,mathmlBuilder:dX});Be({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,i;switch(n){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:r}}});var r7=["display","text","script","scriptscript"],i7=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Be({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],i=e[5],s=Ng(e[0]),a=s.type==="atom"&&s.family==="open"?i7(s.text):null,o=Ng(e[1]),l=o.type==="atom"&&o.family==="close"?i7(o.text):null,c=Bt(e[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var h=null,m=e[3];if(m.type==="ordgroup"){if(m.body.length>0){var p=Bt(m.body[0],"textord");h=r7[Number(p.text)]}}else m=Bt(m,"textord"),h=r7[Number(m.text)];return KN({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:u,barSize:d,leftDelim:a,rightDelim:l},h)}});Be({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:i}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Bt(e[0],"size").value,token:i}}});Be({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=Bt(e[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var a=e[2],o=s.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:a,continued:!1,hasBarLine:o,barSize:s,leftDelim:null,rightDelim:null}}});var YN=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?dn(t.sup,e.havingStyle(n.sup()),e):dn(t.sub,e.havingStyle(n.sub()),e),i=Bt(t.base,"horizBrace")):i=Bt(t,"horizBrace");var s=dn(i.base,e.havingBaseStyle(Mt.DISPLAY)),a=H1(i,e),o;if(i.isOver?o=cn({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a,wrapperClasses:["svg-align"]}]}):o=cn({positionType:"bottom",positionData:s.depth+.1+a.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:s}]}),r){var l=ve(["minner",i.isOver?"mover":"munder"],[o],e);i.isOver?o=cn({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=cn({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return ve(["minner",i.isOver?"mover":"munder"],[o],e)},hX=(t,e)=>{var n=U1(t.label);return new Ee(t.isOver?"mover":"munder",[Cn(t.base,e),n])};Be({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:e[0]}},htmlBuilder:YN,mathmlBuilder:hX});Be({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Bt(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:br(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Dr(t.body,e,!1);return TY(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=ql(t.body,e);return n instanceof Ee||(n=new Ee("mrow",[n])),n.setAttribute("href",t.href),n}});Be({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Bt(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<r.length;s++){var a=r[s];a==="~"&&(a="\\textasciitilde"),i.push({type:"textord",mode:"text",text:a})}var o={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:br(o)}}});Be({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:n}=t;return{type:"hbox",mode:n.mode,body:br(e[0])}},htmlBuilder(t,e){var n=Dr(t.body,e.withFont(""),!1);return qo(n)},mathmlBuilder(t,e){return new Ee("mrow",ms(t.body,e.withFont("")))}});Be({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,token:i}=t,s=Bt(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=s,o={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,o={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,o={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),u=0;u<c.length;u++){var d=c[u],h=d.indexOf("=");if(h<0)throw new Se("\\htmlData key/value '"+d+"' missing equals sign");var m=d.slice(0,h),p=d.slice(h+1);l["data-"+m.trim()]=p}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(o)?{type:"html",mode:n.mode,attributes:l,body:br(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=Dr(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=ve(r,n,e);for(var s in t.attributes)s!=="class"&&t.attributes.hasOwnProperty(s)&&i.setAttribute(s,t.attributes[s]);return i},mathmlBuilder:(t,e)=>ql(t.body,e)});Be({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:br(e[0]),mathml:br(e[1])}},htmlBuilder:(t,e)=>{var n=Dr(t.html,e,!1);return qo(n)},mathmlBuilder:(t,e)=>ql(t.mathml,e)});var dv=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Se("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!dN(r))throw new Se("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Be({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,i={number:0,unit:"em"},s={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(n[0])for(var l=Bt(n[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var h=d[1].trim();switch(d[0].trim()){case"alt":o=h;break;case"width":i=dv(h);break;case"height":s=dv(h);break;case"totalheight":a=dv(h);break;default:throw new Se("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var m=Bt(e[0],"url").url;return o===""&&(o=m,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:r.mode,alt:o,width:i,height:s,totalheight:a,src:m}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=Wn(t.height,e),r=0;t.totalheight.number>0&&(r=Wn(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=Wn(t.width,e));var s={height:De(n+r)};i>0&&(s.width=De(i)),r>0&&(s.verticalAlign=De(-r));var a=new mY(t.src,t.alt,s);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Ee("mglyph",[]);n.setAttribute("alt",t.alt);var r=Wn(t.height,e),i=0;if(t.totalheight.number>0&&(i=Wn(t.totalheight,e)-r,n.setAttribute("valign",De(-i))),n.setAttribute("height",De(r+i)),t.width.number>0){var s=Wn(t.width,e);n.setAttribute("width",De(s))}return n.setAttribute("src",t.src),n}});Be({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=Bt(e[0],"size");if(n.settings.strict){var s=r[1]==="m",a=i.value.unit==="mu";s?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder(t,e){return bN(t.dimension,e)},mathmlBuilder(t,e){var n=Wn(t.dimension,e);return new SN(n)}});Be({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=ve([],[dn(t.body,e)]),n=ve(["inner"],[n],e)):n=ve(["inner"],[dn(t.body,e)]);var r=ve(["fix"],[]),i=ve([t.alignment],[n,r],e),s=ve(["strut"]);return s.style.height=De(i.height+i.depth),i.depth&&(s.style.verticalAlign=De(-i.depth)),i.children.unshift(s),i=ve(["thinbox"],[i],e),ve(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Ee("mpadded",[Cn(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Be({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,i=r.mode;r.switchMode("math");var s=n==="\\("?"\\)":"$",a=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:a}}});Be({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Se("Mismatched "+t.funcName)}});var s7=(t,e)=>{switch(e.style.size){case Mt.DISPLAY.size:return t.display;case Mt.TEXT.size:return t.text;case Mt.SCRIPT.size:return t.script;case Mt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Be({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:br(e[0]),text:br(e[1]),script:br(e[2]),scriptscript:br(e[3])}},htmlBuilder:(t,e)=>{var n=s7(t,e),r=Dr(n,e,!1);return qo(r)},mathmlBuilder:(t,e)=>{var n=s7(t,e);return ql(n,e)}});var XN=(t,e,n,r,i,s,a)=>{t=ve([],[t]);var o=n&&Uo(n),l,c;if(e){var u=dn(e,r.havingStyle(i.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=dn(n,r.havingStyle(i.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var h;if(c&&l){var m=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+a;h=cn({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:De(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:De(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=t.height-a;h=cn({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:De(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var b=t.depth+a;h=cn({positionType:"bottom",positionData:b,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:De(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var x=[h];if(l&&s!==0&&!o){var g=ve(["mspace"],[],r);g.style.marginRight=De(s),x.unshift(g)}return ve(["mop","op-limits"],x,r)},QN=new Set(["\\smallint"]),ah=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Bt(t.base,"op"),i=!0):s=Bt(t,"op");var a=e.style,o=!1;a.size===Mt.DISPLAY.size&&s.symbol&&!QN.has(s.name)&&(o=!0);var l,c;if(s.symbol){var u=o?"Size2-Regular":"Size1-Regular",d="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(d=s.name.slice(1),s.name=d==="oiint"?"\\iint":"\\iiint"),l=mi(s.name,u,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),c=l.italic,d.length>0){var h=xN(d+"Size"+(o?"2":"1"),e);l=cn({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:h,shift:o?.08:0}]}),s.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(s.body){var m=Dr(s.body,e,!0);m.length===1&&m[0]instanceof ds?(l=m[0],l.classes[0]="mop"):l=ve(["mop"],m,e)}else{for(var p=[],b=1;b<s.name.length;b++)p.push(X3(s.name[b],s.mode,e));l=ve(["mop"],p,e)}var x=0,g=0;if((l instanceof ds||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift){var y;x=(l.height-l.depth)/2-e.fontMetrics().axisHeight,g=(y=l.italic)!=null?y:0}return i?XN(l,n,r,e,a,g,x):(x&&(l.style.position="relative",l.style.top=De(x)),l)},R0=(t,e)=>{var n;if(t.symbol)n=new Ee("mo",[Hs(t.name,t.mode)]),QN.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ee("mo",ms(t.body,e));else{n=new Ee("mi",[new vr(t.name.slice(1))]);var r=new Ee("mo",[Hs("⁡","text")]);t.parentIsSupSub?n=new Ee("mrow",[n,r]):n=_N([n,r])}return n},fX={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Be({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=r;return i.length===1&&(i=fX[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:ah,mathmlBuilder:R0});Be({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:br(r)}},htmlBuilder:ah,mathmlBuilder:R0});var mX={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Be({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(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ah,mathmlBuilder:R0});Be({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ah,mathmlBuilder:R0});Be({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=mX[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:ah,mathmlBuilder:R0});var JN=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Bt(t.base,"operatorname"),i=!0):s=Bt(t,"operatorname");var a;if(s.body.length>0){for(var o=s.body.map(d=>{var h="text"in d?d.text:void 0;return typeof h=="string"?{type:"textord",mode:d.mode,text:h}:d}),l=Dr(o,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof ds&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}a=ve(["mop"],l,e)}else a=ve(["mop"],[],e);return i?XN(a,n,r,e,e.style,0,0):a},pX=(t,e)=>{for(var n=ms(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof SN))if(s instanceof Ee)switch(s.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var a=s.children[0];s.children.length===1&&a instanceof vr?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var o=n.map(u=>u.toText()).join("");n=[new vr(o)]}var l=new Ee("mi",n);l.setAttribute("mathvariant","normal");var c=new Ee("mo",[Hs("⁡","text")]);return t.parentIsSupSub?new Ee("mrow",[l,c]):_N([l,c])};Be({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"operatorname",mode:n.mode,body:br(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:JN,mathmlBuilder:pX});D("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");fu({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?qo(Dr(t.body,e,!1)):ve(["mord"],Dr(t.body,e,!0),e)},mathmlBuilder(t,e){return ql(t.body,e,!0)}});Be({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=dn(t.body,e.havingCrampedStyle()),r=Id("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=cn({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return ve(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new Ee("mo",[new vr("‾")]);n.setAttribute("stretchy","true");var r=new Ee("mover",[Cn(t.body,e),n]);return r.setAttribute("accent","true"),r}});Be({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:br(r)}},htmlBuilder:(t,e)=>{var n=Dr(t.body,e.withPhantom(),!1);return qo(n)},mathmlBuilder:(t,e)=>{var n=ms(t.body,e);return new Ee("mphantom",n)}});D("\\hphantom","\\smash{\\phantom{#1}}");Be({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ve(["inner"],[dn(t.body,e.withPhantom())]),r=ve(["fix"],[]);return ve(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=ms(br(t.body),e),r=new Ee("mphantom",n),i=new Ee("mpadded",[r]);return i.setAttribute("width","0px"),i}});Be({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Bt(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=dn(t.body,e),r=Wn(t.dy,e);return cn({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new Ee("mpadded",[Cn(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Be({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Be({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,i=n[0],s=Bt(e[0],"size"),a=Bt(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Bt(i,"size").value,width:s.value,height:a.value}},htmlBuilder(t,e){var n=ve(["mord","rule"],[],e),r=Wn(t.width,e),i=Wn(t.height,e),s=t.shift?Wn(t.shift,e):0;return n.style.borderRightWidth=De(r),n.style.borderTopWidth=De(i),n.style.bottom=De(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Wn(t.width,e),r=Wn(t.height,e),i=t.shift?Wn(t.shift,e):0,s=e.color&&e.getColor()||"black",a=new Ee("mspace");a.setAttribute("mathbackground",s),a.setAttribute("width",De(n)),a.setAttribute("height",De(r));var o=new Ee("mpadded",[a]);return i>=0?o.setAttribute("height",De(i)):(o.setAttribute("height",De(i)),o.setAttribute("depth",De(-i))),o.setAttribute("voffset",De(i)),o}});function ZN(t,e,n){for(var r=Dr(t,e,!1),i=e.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var a=r[s].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(n)):r[s].classes[a+1]==="reset-size"+e.size&&(r[s].classes[a+1]="reset-size"+n.size),r[s].height*=i,r[s].depth*=i}return qo(r)}var a7=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],gX=(t,e)=>{var n=e.havingSize(t.size);return ZN(t.body,n,e)};Be({type:"sizing",names:a7,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:a7.indexOf(r)+1,body:s}},htmlBuilder:gX,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=ms(t.body,n),i=new Ee("mstyle",r);return i.setAttribute("mathsize",De(n.sizeMultiplier)),i}});Be({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,i=!1,s=!1,a=n[0]&&Bt(n[0],"ordgroup");if(a)for(var o,l=0;l<a.body.length;++l){var c=a.body[l];if(o=q1(c).text,o==="t")i=!0;else if(o==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var u=e[0];return{type:"smash",mode:r.mode,body:u,smashHeight:i,smashDepth:s}},htmlBuilder:(t,e)=>{var n=ve([],[dn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0),t.smashDepth&&(n.depth=0),t.smashHeight&&t.smashDepth)return ve(["mord","smash"],[n],e);if(n.children)for(var r=0;r<n.children.length;r++)t.smashHeight&&(n.children[r].height=0),t.smashDepth&&(n.children[r].depth=0);var i=cn({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return ve(["mord"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Ee("mpadded",[Cn(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Be({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,i=n[0],s=e[0];return{type:"sqrt",mode:r.mode,body:s,index:i}},htmlBuilder(t,e){var n=dn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=Rd(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<Mt.TEXT.id&&(s=e.fontMetrics().xHeight);var a=i+s/4,o=n.height+n.depth+a+i,{span:l,ruleWidth:c,advanceWidth:u}=nX(o,e),d=l.height-c;d>n.height+n.depth+a&&(a=(a+d-n.height-n.depth)/2);var h=l.height-n.height-a-c;n.style.paddingLeft=De(u);var m=cn({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+h)},{type:"elem",elem:l},{type:"kern",size:c}]});if(t.index){var p=e.havingStyle(Mt.SCRIPTSCRIPT),b=dn(t.index,p,e),x=.6*(m.height-m.depth),g=cn({positionType:"shift",positionData:-x,children:[{type:"elem",elem:b}]}),y=ve(["root"],[g]);return ve(["mord","sqrt"],[y,m],e)}else return ve(["mord","sqrt"],[m],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Ee("mroot",[Cn(n,e),Cn(r,e)]):new Ee("msqrt",[Cn(n,e)])}});var Kx={display:Mt.DISPLAY,text:Mt.TEXT,script:Mt.SCRIPT,scriptscript:Mt.SCRIPTSCRIPT};function yX(t){return t in Kx}Be({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!0,n),a=r.slice(1,r.length-5);if(!yX(a))throw new Error("Unknown style: "+a);return{type:"styling",mode:i.mode,style:a,body:s}},htmlBuilder(t,e){var n=Kx[t.style],r=e.havingStyle(n);return t.resetFont&&(r=r.withFont("")),ZN(t.body,r,e)},mathmlBuilder(t,e){var n=Kx[t.style],r=e.havingStyle(n);t.resetFont&&(r=r.withFont(""));var i=ms(t.body,r),s=new Ee("mstyle",i),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return s.setAttribute("scriptlevel",o[0]),s.setAttribute("displaystyle",o[1]),s}});var bX=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===Mt.DISPLAY.size||r.alwaysHandleSupSub);return i?ah:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===Mt.DISPLAY.size||r.limits);return s?JN:null}else{if(r.type==="accent")return Uo(r.base)?ek:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?YN:null}else return null}else return null};fu({type:"supsub",htmlBuilder(t,e){var n=bX(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,a=dn(r,e),o,l,c=e.fontMetrics(),u=0,d=0,h=r&&Uo(r);if(i){var m=e.havingStyle(e.style.sup());o=dn(i,m,e),h||(u=a.height-m.fontMetrics().supDrop*m.sizeMultiplier/e.sizeMultiplier)}if(s){var p=e.havingStyle(e.style.sub());l=dn(s,p,e),h||(d=a.depth+p.fontMetrics().subDrop*p.sizeMultiplier/e.sizeMultiplier)}var b;e.style===Mt.DISPLAY?b=c.sup1:e.style.cramped?b=c.sup3:b=c.sup2;var x=e.sizeMultiplier,g=De(.5/c.ptPerEm/x),y=null;if(l){var w=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");if(a instanceof ds||w){var C;y=De(-((C=a.italic)!=null?C:0))}}var E;if(o&&l){u=Math.max(u,b,o.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var S=c.defaultRuleThickness,T=4*S;if(u-o.depth-(l.height-d)<T){d=T-(u-o.depth)+l.height;var O=.8*c.xHeight-(u-o.depth);O>0&&(u+=O,d-=O)}var z=[{type:"elem",elem:l,shift:d,marginRight:g,marginLeft:y},{type:"elem",elem:o,shift:-u,marginRight:g}];E=cn({positionType:"individualShift",children:z})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var I=[{type:"elem",elem:l,marginLeft:y,marginRight:g}];E=cn({positionType:"shift",positionData:d,children:I})}else if(o)u=Math.max(u,b,o.depth+.25*c.xHeight),E=cn({positionType:"shift",positionData:-u,children:[{type:"elem",elem:o,marginRight:g}]});else throw new Error("supsub must have either sup or sub.");var j=qx(a,"right")||"mord";return ve([j],[a,ve(["msupsub"],[E])],e)},mathmlBuilder(t,e){var n=!1,r,i;t.base&&t.base.type==="horizBrace"&&(i=!!t.sup,i===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var s=[Cn(t.base,e)];t.sub&&s.push(Cn(t.sub,e)),t.sup&&s.push(Cn(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===Mt.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===Mt.DISPLAY||c.limits)?a="munderover":a="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Mt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Mt.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===Mt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===Mt.DISPLAY)?a="mover":a="msup"}return new Ee(a,s)}});fu({type:"atom",htmlBuilder(t,e){return X3(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Ee("mo",[Hs(t.text,t.mode)]);if(t.family==="bin"){var r=Z3(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var eD={mi:"italic",mn:"normal",mtext:"normal"};fu({type:"mathord",htmlBuilder(t,e){return $1(t,e,"mathord")},mathmlBuilder(t,e){var n=new Ee("mi",[Hs(t.text,t.mode,e)]),r=Z3(t,e)||"italic";return r!==eD[n.type]&&n.setAttribute("mathvariant",r),n}});fu({type:"textord",htmlBuilder(t,e){return $1(t,e,"textord")},mathmlBuilder(t,e){var n=Hs(t.text,t.mode,e),r=Z3(t,e)||"normal",i;return t.mode==="text"?i=new Ee("mtext",[n]):/[0-9]/.test(t.text)?i=new Ee("mn",[n]):t.text==="\\prime"?i=new Ee("mo",[n]):i=new Ee("mi",[n]),r!==eD[i.type]&&i.setAttribute("mathvariant",r),i}});var hv={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},fv={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};fu({type:"spacing",htmlBuilder(t,e){if(fv.hasOwnProperty(t.text)){var n=fv[t.text].className||"";if(t.mode==="text"){var r=$1(t,e,"textord");return r.classes.push(n),r}else return ve(["mspace",n],[X3(t.text,t.mode,e)],e)}else{if(hv.hasOwnProperty(t.text))return ve(["mspace",hv[t.text]],[],e);throw new Se('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(fv.hasOwnProperty(t.text))n=new Ee("mtext",[new vr(" ")]);else{if(hv.hasOwnProperty(t.text))return new Ee("mspace");throw new Se('Unknown type of space "'+t.text+'"')}return n}});var o7=()=>{var t=new Ee("mtd",[]);return t.setAttribute("width","50%"),t};fu({type:"tag",mathmlBuilder(t,e){var n=new Ee("mtable",[new Ee("mtr",[o7(),new Ee("mtd",[ql(t.body,e)]),o7(),new Ee("mtd",[ql(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var l7={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},c7={"\\textbf":"textbf","\\textmd":"textmd"},vX={"\\textit":"textit","\\textup":"textup"},u7=(t,e)=>{var n=t.font;if(n){if(l7[n])return e.withTextFontFamily(l7[n]);if(c7[n])return e.withTextFontWeight(c7[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(vX[n])};Be({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"text",mode:n.mode,body:br(i),font:r}},htmlBuilder(t,e){var n=u7(t,e),r=Dr(t.body,n,!0);return ve(["mord","text"],r,n)},mathmlBuilder(t,e){var n=u7(t,e);return ql(t.body,n)}});Be({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=dn(t.body,e),r=Id("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=cn({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return ve(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new Ee("mo",[new vr("‾")]);n.setAttribute("stretchy","true");var r=new Ee("munder",[Cn(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Be({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=dn(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return cn({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new Ee("mpadded",[Cn(t.body,e)],["vcenter"]);return new Ee("mrow",[n])}});Be({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Se("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=d7(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var a=n[s];a==="~"&&(a="\\textasciitilde"),r.push(mi(a,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return ve(["mord","text"].concat(i.sizingClasses(e)),yN(r),i)},mathmlBuilder(t,e){var n=new vr(d7(t)),r=new Ee("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var d7=t=>t.body.replace(/ /g,t.star?"␣":" "),vl=wN,tD=`[ \r
	]`,xX="\\\\[a-zA-Z@]+",wX="\\\\[^\uD800-\uDFFF]",kX="("+xX+")"+tD+"*",_X=`\\\\(
|[ \r	]+
?)[ \r	]*`,Yx="[̀-ͯ]",SX=new RegExp(Yx+"+$"),TX="("+tD+"+)|"+(_X+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(Yx+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Yx+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+kX)+("|"+wX+")");class h7{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(TX,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new ls("EOF",new Di(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Se("Unexpected character: '"+e[n]+"'",new ls(e[n],new Di(this,n,n+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
`,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.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=s+1,this.lex()}return new ls(i,new Di(this,n,this.tokenRegex.lastIndex))}}class CX{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Se("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var EX=FN;D("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});D("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});D("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});D("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});D("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});D("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");D("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var f7={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(t){var e=t.popToken(),n,r=0;if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Se("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=f7[e.text],r==null||r>=n)throw new Se("Invalid base-"+n+" digit "+e.text);for(var i;(i=f7[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var ik=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new Se("\\newcommand's first argument must be a macro name");var s=i[0].text,a=t.isDefined(s);if(a&&!e)throw new Se("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!a&&!n)throw new Se("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var o=0;if(i=t.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",c=t.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Se("Invalid number of arguments: "+l);o=parseInt(l),i=t.consumeArg().tokens}return a&&r||t.macros.set(s,{tokens:i,numArgs:o}),""};D("\\newcommand",t=>ik(t,!1,!0,!1));D("\\renewcommand",t=>ik(t,!0,!1,!1));D("\\providecommand",t=>ik(t,!0,!0,!0));D("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});D("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});D("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),vl[n],qn.math[n],qn.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 m7={",":"\\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"},AX=new Set(["bin","rel"]);D("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in m7?e=m7[n]:(n.slice(0,4)==="\\not"||n in qn.math&&AX.has(qn.math[n].group))&&(e="\\dotsb"),e});var sk={")":!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(t){var e=t.future().text;return e in sk?"\\ldots\\,":"\\ldots"});D("\\dotsc",function(t){var e=t.future().text;return e in sk&&e!==","?"\\ldots\\,":"\\ldots"});D("\\cdots",function(t){var e=t.future().text;return e in sk?"\\@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",t=>{if(t.macros.get("\\df@tag"))throw new Se("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 nD=De(Ra["Main-Regular"][84][1]-.7*Ra["Main-Regular"][65][1]);D("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+nD+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");D("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+nD+"}{\\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 rD=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var l=d=>h=>{t&&(h.macros.set("|",a),i.length&&h.macros.set("\\|",o));var m=d;if(!d&&i.length){var p=h.future();p.text==="|"&&(h.popToken(),m=!0)}return{tokens:m?i:r,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};D("\\bra@ket",rD(!1));D("\\bra@set",rD(!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 iD={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class MX{constructor(e,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(e),this.macros=new CX(EX,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new h7(e,this.settings)}switchMode(e){this.mode=e}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(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:n,end:r}=this.consumeArg());return this.pushToken(new ls("EOF",r.loc)),this.pushTokens(i),new ls("",Di.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var i=this.future(),s,a=0,o=0;do{if(s=this.popToken(),n.push(s),s.text==="{")++a;else if(s.text==="}"){if(--a,a===-1)throw new Se("Extra }",s)}else if(s.text==="EOF")throw new Se("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",s);if(e&&r)if((a===0||a===1&&e[o]==="{")&&s.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==0||r);return i.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:i,end:s}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Se("The length of delimiters doesn't match the number of args!");for(var r=n[0],i=0;i<r.length;i++){var s=this.popToken();if(r[i]!==s.text)throw new Se("Use of the macro doesn't match its definition",s)}}for(var a=[],o=0;o<e;o++)a.push(this.consumeArg(n&&n[o+1]).tokens);return a}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new Se("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,i=n.noexpand?null:this._getExpansion(r);if(i==null||e&&i.unexpandable){if(e&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new Se("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var s=i.tokens,a=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var o=s.length-1;o>=0;--o){var l=s[o];if(l.text==="#"){if(o===0)throw new Se("Incomplete placeholder at end of macro body",l);if(l=s[--o],l.text==="#")s.splice(o+1,1);else if(/^[1-9]$/.test(l.text))s.splice(o,2,...a[+l.text-1]);else throw new Se("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new ls(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),n.push(i)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var i=typeof n=="function"?n(this):n;if(typeof i=="string"){var s=0;if(i.includes("#"))for(var a=i.replace(/##/g,"");a.includes("#"+(s+1));)++s;for(var o=new h7(i,this.settings),l=[],c=o.lex();c.text!=="EOF";)l.push(c),c=o.lex();l.reverse();var u={tokens:l,numArgs:s};return u}return i}isDefined(e){return this.macros.has(e)||vl.hasOwnProperty(e)||qn.math.hasOwnProperty(e)||qn.text.hasOwnProperty(e)||iD.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:vl.hasOwnProperty(e)&&!vl[e].primitive}}var p7=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Em=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),mv={"́":{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"}},g7={á:"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 sD=class aD{constructor(e,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 MX(e,n,this.mode),this.settings=n,this.leftrightDepth=0,this.nextToken=null}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Se("Expected '"+e+"', 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(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new ls("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(aD.endOfExpression.has(i.text)||n&&i.text===n||e&&vl[i.text]&&vl[i.text].infix)break;var s=this.parseAtom(n);if(s){if(s.type==="internal")continue}else break;r.push(s)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,i=0;i<e.length;i++){var s=e[i];if(s.type==="infix"){if(n!==-1)throw new Se("only one infix operator per group",s.token);n=i,r=s.replaceWith}}if(n!==-1&&r){var a,o,l=e.slice(0,n),c=e.slice(n+1);l.length===1&&l[0].type==="ordgroup"?a=l[0]:a={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?o=c[0]:o={type:"ordgroup",mode:this.mode,body:c};var u;return r==="\\\\abovefrac"?u=this.callFunction(r,[a,e[n],o],[]):u=this.callFunction(r,[a,o],[]),[u]}else return e}handleSupSubscript(e){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new Se("Expected group after '"+r+"'",n);return i}formatUnsupportedCmd(e){for(var n=[],r=0;r<e.length;r++)n.push({type:"textord",mode:"text",text:e[r]});var i={type:"text",mode:this.mode,body:n},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var n=this.parseGroup("atom",e);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(n&&n.type==="op"){var a=s.text==="\\limits";n.limits=a,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=s.text==="\\limits");else throw new Se("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new Se("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new Se("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new Se("Double superscript",s);var o={type:"textord",mode:this.mode,text:"\\prime"},l=[o];for(this.consume();this.fetch().text==="'";)l.push(o),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(Em[s.text]){var c=p7.test(s.text),u=[];for(u.push(new ls(Em[s.text])),this.consume();;){var d=this.fetch().text;if(!Em[d]||p7.test(d)!==c)break;u.unshift(new ls(Em[d])),this.consume()}var h=this.subparse(u);c?i={type:"ordgroup",mode:"math",body:h}:r={type:"ordgroup",mode:"math",body:h}}else break}return r||i?{type:"supsub",mode:this.mode,base:n,sup:r,sub:i}:n}parseFunction(e,n){var r=this.fetch(),i=r.text,s=vl[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new Se("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new Se("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new Se("Can't use function '"+i+"' in math mode",r);var{args:a,optArgs:o}=this.parseArguments(i,s);return this.callFunction(i,a,o,r,e)}callFunction(e,n,r,i,s){var a={funcName:e,parser:this,token:i,breakOnTokenText:s},o=vl[e];if(o&&o.handler)return o.handler(a,n,r);throw new Se("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],a=0;a<r;a++){var o=n.argTypes&&n.argTypes[a],l=a<n.numOptionalArgs;("primitive"in n&&n.primitive&&o==null||n.type==="sqrt"&&a===1&&s[0]==null)&&(o="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",o,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new Se("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,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 i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text",resetFont:!0}:null}case"raw":{var s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new Se("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new Se("Expected group as "+e,this.fetch());return a}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Se("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),r.text=i,r}parseRegexGroup(e,n){for(var r=this.fetch(),i=r,s="",a;(a=this.fetch()).text!=="EOF"&&e.test(s+a.text);)i=a,s+=i.text,this.consume();if(s==="")throw new Se("Invalid "+n+": '"+r.text+"'",r);return r.range(i,s)}parseColorGroup(e){var n=this.parseStringGroup("color",e);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new Se("Invalid color: '"+n.text+"'",n);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var n,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",e),!n)return null;!e&&n.text.length===0&&(n.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!i)throw new Se("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!dN(s))throw new Se("Invalid unit: '"+s.unit+"'",n);return{type:"size",mode:this.mode,value:s,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",e);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(e,n){var r=this.gullet.scanArgument(e);if(r==null)return null;var i=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var a={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return n&&this.switchMode(i),a}parseGroup(e,n){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var a=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,a),l=this.fetch();this.expect(a),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:Di.range(r,l),body:o,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!iD.hasOwnProperty(i)){if(this.settings.throwOnError)throw new Se("Undefined control sequence: "+i,r);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var n=e.length-1,r=0;r<n;++r){var i=e[r];if(i.type==="textord"){var s=i.text,a=e[r+1];if(!(!a||a.type!=="textord")){if(s==="-"&&a.text==="-"){var o=e[r+2];r+1<n&&o&&o.type==="textord"&&o.text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:Di.range(i,o),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Di.range(i,a),text:"--"}),n-=1)}(s==="'"||s==="`")&&a.text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:Di.range(i,a),text:s+s}),n-=1)}}}}parseSymbol(){var e=this.fetch(),n=e.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new Se(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}g7.hasOwnProperty(n[0])&&!qn[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=g7[n[0]]+n.slice(1));var s=SX.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var a;if(qn[this.mode][n]){this.settings.strict&&this.mode==="math"&&jx.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=qn[this.mode][n].group,l=Di.range(e),c;VY(o)?c={type:"atom",mode:this.mode,family:o,loc:l,text:n}:c={type:o,mode:this.mode,loc:l,text:n},a=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(uN(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:Di.range(e),text:n};else return null;if(this.consume(),s)for(var u=0;u<s[0].length;u++){var d=s[0][u];if(!mv[d])throw new Se("Unknown accent ' "+d+"'",e);var h=mv[d][this.mode]||mv[d].text;if(!h)throw new Se("Accent "+d+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:Di.range(e),label:h,isStretchy:!1,isShifty:!0,base:a}}return a}};sD.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var ak=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new sD(e,n);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new Se("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new ls("\\df@tag")])}]}return i},ok=function(e,n,r){n.textContent="";var i=X1(e,r).toNode();n.appendChild(i)};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."),ok=function(){throw new Se("KaTeX doesn't work in quirks mode.")});var oD=function(e,n){var r=X1(e,n).toMarkup();return r},lD=function(e,n){var r=new G3(n);return ak(e,r)},cD=function(e,n,r){if(r.throwOnError||!(e instanceof Se))throw e;var i=ve(["katex-error"],[new ds(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},X1=function(e,n){var r=new G3(n);try{var i=ak(e,r);return BY(i,e,r)}catch(s){return cD(s,e,r)}},uD=function(e,n){var r=new G3(n);try{var i=ak(e,r);return zY(i,e,r)}catch(s){return cD(s,e,r)}},dD="0.16.47",hD={Span:ih,Anchor:z1,SymbolNode:ds,SvgNode:Bo,PathNode:Ul,LineNode:Ox},Xx={version:dD,render:ok,renderToString:oD,ParseError:Se,SETTINGS_SCHEMA:Tg,__parse:lD,__renderToDomTree:X1,__renderToHTMLTree:uD,__setFontMetrics:pN,__defineSymbol:k,__defineFunction:Be,__defineMacro:D,__domTree:hD};const fxe=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Se,SETTINGS_SCHEMA:Tg,__defineFunction:Be,__defineMacro:D,__defineSymbol:k,__domTree:hD,__parse:lD,__renderToDomTree:X1,__renderToHTMLTree:uD,__setFontMetrics:pN,default:Xx,get render(){return ok},renderToString:oD,version:dD},Symbol.toStringTag,{value:"Module"})),NX={};function y7(t){const e=this,n=t||NX,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(zK(n)),s.push(NK()),a.push(DK(n))}const b7=/[#.]/g;function DX(t,e){const n=t||"",r={};let i=0,s,a;for(;i<n.length;){b7.lastIndex=i;const o=b7.exec(n),l=n.slice(i,o?o.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:a=l,i+=l.length),o&&(s=o[0],i++)}return{type:"element",tagName:a||e||"div",properties:r,children:[]}}function fD(t,e,n){const r=n?jX(n):void 0;function i(s,a,...o){let l;if(s==null){l={type:"root",children:[]};const c=a;o.unshift(c)}else{l=DX(s,e);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,IX(a))o.unshift(a);else for(const[d,h]of Object.entries(a))RX(t,l.properties,d,h)}for(const c of o)Qx(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function IX(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const a of s)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function RX(t,e,n,r){const i=C3(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=P_(r):i.commaSeparated?s=O_(r):i.commaOrSpaceSeparated?s=P_(O_(r).join(" ")):s=v7(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?OX(r):String(r);if(Array.isArray(s)){const a=[];for(const o of s)a.push(v7(i,i.property,o));s=a}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function Qx(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Qx(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Qx(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function v7(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Ff(n)===Ff(e)))return!0}return n}function OX(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function jX(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const LX=["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"],BX=fD(E3,"div"),zX=fD(th,"g",LX),pv={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function PX(t,e){return mD(t,{})||{type:"root",children:[]}}function mD(t,e){const n=$X(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function $X(t,e){switch(t.nodeType){case 1:return FX(t,e);case 3:return HX(t);case 8:return qX(t);case 9:return x7(t,e);case 10:return UX();case 11:return x7(t,e);default:return}}function x7(t,e){return{type:"root",children:pD(t,e)}}function UX(){return{type:"doctype"}}function HX(t){return{type:"text",value:t.nodeValue||""}}function qX(t){return{type:"comment",value:t.nodeValue||""}}function FX(t,e){const n=t.namespaceURI,r=n===pv.svg?zX:BX,i=n===pv.html?t.tagName.toLowerCase():t.tagName,s=n===pv.html&&i==="template"?t.content:t,a=t.getAttributeNames(),o={};let l=-1;for(;++l<a.length;)o[a[l]]=t.getAttribute(a[l])||"";return r(i,o,pD(s,e))}function pD(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=mD(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function VX(t,e){const n=GX(t);return PX(n)}function GX(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const w7=function(t,e,n){const r=N0(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]},mu=function(t){if(t==null)return YX;if(typeof t=="string")return KX(t);if(typeof t=="object")return WX(t);if(typeof t=="function")return lk(t);throw new Error("Expected function, string, or array as `test`")};function WX(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=mu(t[n]);return lk(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function KX(t){return lk(e);function e(n){return n.tagName===t}}function lk(t){return e;function e(n,r,i){return!!(XX(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function YX(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function XX(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const k7=/\n/g,_7=/[\t ]+/g,Jx=mu("br"),S7=mu(iQ),QX=mu("p"),T7=mu("tr"),JX=mu(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",rQ,sQ]),gD=mu(["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 ZX(t,e){const n=e||{},r="children"in t?t.children:[],i=gD(t),s=vD(t,{whitespace:n.whitespace||"normal"}),a=[];(t.type==="text"||t.type==="comment")&&a.push(...bD(t,{breakBefore:!0,breakAfter:!0}));let o=-1;for(;++o<r.length;)a.push(...yD(r[o],t,{whitespace:s,breakBefore:o?void 0:i,breakAfter:o<r.length-1?Jx(r[o+1]):i}));const l=[];let c;for(o=-1;++o<a.length;){const u=a[o];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function yD(t,e,n){return t.type==="element"?eQ(t,e,n):t.type==="text"?n.whitespace==="normal"?bD(t,n):tQ(t):[]}function eQ(t,e,n){const r=vD(t,n),i=t.children||[];let s=-1,a=[];if(JX(t))return a;let o,l;for(Jx(t)||T7(t)&&w7(e,t,T7)?l=`
`:QX(t)?(o=2,l=2):gD(t)&&(o=1,l=1);++s<i.length;)a=a.concat(yD(i[s],t,{whitespace:r,breakBefore:s?void 0:o,breakAfter:s<i.length-1?Jx(i[s+1]):l}));return S7(t)&&w7(e,t,S7)&&a.push("	"),o&&a.unshift(o),l&&a.push(l),a}function bD(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){k7.lastIndex=s;const l=k7.exec(n),c=l&&"index"in l?l.index:n.length;r.push(nQ(n.slice(s,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,c===n.length?e.breakAfter:!0)),s=c+1}let a=-1,o;for(;++a<r.length;)r[a].charCodeAt(r[a].length-1)===8203||a<r.length-1&&r[a+1].charCodeAt(0)===8203?(i.push(r[a]),o=void 0):r[a]?(typeof o=="number"&&i.push(o),i.push(r[a]),o=0):(a===0||a===r.length-1)&&i.push(0);return i}function tQ(t){return[String(t.value)]}function nQ(t,e,n){const r=[];let i=0,s;for(;i<t.length;){_7.lastIndex=i;const a=_7.exec(t);s=a?a.index:t.length,!i&&!s&&a&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=a?s+a[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function vD(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.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":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function rQ(t){return!!(t.properties||{}).hidden}function iQ(t){return t.tagName==="td"||t.tagName==="th"}function sQ(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const aQ={},oQ=[];function C7(t){const e=t||aQ;return function(n,r){$3(n,"element",function(i,s){const a=Array.isArray(i.properties.className)?i.properties.className:oQ,o=a.includes("language-math"),l=a.includes("math-display"),c=a.includes("math-inline");let u=l;if(!o&&!l&&!c)return;let d=s[s.length-1],h=i;if(i.tagName==="code"&&o&&d&&d.type==="element"&&d.tagName==="pre"&&(h=d,d=s[s.length-2],u=!0),!d)return;const m=ZX(h,{whitespace:"pre"});let p;try{p=Xx.renderToString(m,{...e,displayMode:u,throwOnError:!0})}catch(x){const g=x,y=g.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:g,place:i.position,ruleId:y,source:"rehype-katex"});try{p=Xx.renderToString(m,{...e,displayMode:u,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(x)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=VX(p).children);const b=d.children.indexOf(h);return d.children.splice(b,1,...p),BM})}}const xD=[{id:"abap",name:"ABAP",import:()=>U(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>U(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>U(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>U(()=>import("./angular-html-LfdN0zeE.js").then(t=>t.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>U(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>U(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>U(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>U(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>U(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>U(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>U(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>U(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>U(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>U(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>U(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>U(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>U(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>U(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>U(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>U(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>U(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>U(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>U(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>U(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>U(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>U(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>U(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>U(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>U(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>U(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>U(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>U(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>U(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>U(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>U(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>U(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>U(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>U(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>U(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>U(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>U(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>U(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>U(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>U(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>U(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>U(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>U(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>U(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>U(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>U(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>U(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>U(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>U(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>U(()=>import("./erb-BYTLMnw6.js"),__vite__mapDeps([31,1,2,3,32,33,7,8,14,34,11,35,36,21,22,23,24,26,37,38]))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>U(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>U(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>U(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>U(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>U(()=>import("./fortran-fixed-form-TqA4NnZg.js"),__vite__mapDeps([39,40]))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>U(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>U(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>U(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>U(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>U(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>U(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>U(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>U(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>U(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>U(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>U(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>U(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>U(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>U(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>U(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>U(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>U(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>U(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>U(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>U(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>U(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>U(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>U(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>U(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>U(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>U(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>U(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>U(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>U(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>U(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>U(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>U(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>U(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>U(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>U(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>U(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>U(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>U(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>U(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>U(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>U(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>U(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>U(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>U(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>U(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>U(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>U(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>U(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>U(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>U(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>U(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>U(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>U(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>U(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>U(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>U(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>U(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>U(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>U(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>U(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>U(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>U(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>U(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>U(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>U(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>U(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>U(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>U(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>U(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>U(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>U(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>U(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>U(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>U(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>U(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>U(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>U(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>U(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>U(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>U(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>U(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>U(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>U(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>U(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>U(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>U(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>U(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>U(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>U(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>U(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>U(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>U(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>U(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>U(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>U(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>U(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>U(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>U(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>U(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>U(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>U(()=>import("./rst-4NLicBqY.js"),__vite__mapDeps([75,28,1,2,3,21,22,23,24,14,18,26,38,76,32,33,7,8,34,11,35,36,37]))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>U(()=>import("./ruby-DeZ3UC14.js"),__vite__mapDeps([32,1,2,3,33,7,8,14,34,11,35,36,21,22,23,24,26,37,38]))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>U(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>U(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>U(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>U(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>U(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>U(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>U(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>U(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>U(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>U(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>U(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>U(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>U(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>U(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>U(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>U(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>U(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>U(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>U(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>U(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>U(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>U(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>U(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>U(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>U(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>U(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>U(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>U(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>U(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>U(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>U(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>U(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>U(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>U(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>U(()=>import("./twig-NC5TFiHP.js"),__vite__mapDeps([89,3,2,5,70,1,7,8,14,9,18,32,33,34,11,35,36,21,22,23,24,26,37,38]))},{id:"typescript",name:"TypeScript",aliases:["ts"],import:()=>U(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>U(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>U(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>U(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>U(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>U(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>U(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>U(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>U(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>U(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>U(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>U(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>U(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>U(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>U(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>U(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>U(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>U(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>U(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>U(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>U(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>U(()=>import("./zig-BVz_zdnA.js"),[])}],lQ=Object.fromEntries(xD.map(t=>[t.id,t.import])),cQ=Object.fromEntries(xD.flatMap(t=>{var e;return((e=t.aliases)==null?void 0:e.map(n=>[n,t.import]))||[]})),uQ={...lQ,...cQ},dQ=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>U(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>U(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>U(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>U(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>U(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>U(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>U(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>U(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>U(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>U(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>U(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>U(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>U(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>U(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>U(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>U(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>U(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>U(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>U(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>U(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>U(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>U(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>U(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>U(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>U(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>U(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>U(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>U(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>U(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>U(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>U(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>U(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>U(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>U(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>U(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>U(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>U(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>U(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>U(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>U(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>U(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>U(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>U(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>U(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>U(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>U(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>U(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>U(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>U(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>U(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>U(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>U(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>U(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>U(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],hQ=Object.fromEntries(dQ.map(t=>[t.id,t.import]));let Mo=class extends Error{constructor(e){super(e),this.name="ShikiError"}},ck=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function fQ(){return 2147483648}function mQ(){return typeof performance<"u"?performance.now():Date.now()}const pQ=(t,e)=>t+(e-t%e)%e;async function gQ(t){let e,n;const r={};function i(m){n=m,r.HEAPU8=new Uint8Array(m),r.HEAPU32=new Uint32Array(m)}function s(m,p,b){r.HEAPU8.copyWithin(m,p,p+b)}function a(m){try{return e.grow(m-n.byteLength+65535>>>16),i(e.buffer),1}catch{}}function o(m){const p=r.HEAPU8.length;m=m>>>0;const b=fQ();if(m>b)return!1;for(let x=1;x<=4;x*=2){let g=p*(1+.2/x);g=Math.min(g,m+100663296);const y=Math.min(b,pQ(Math.max(m,g),65536));if(a(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,p,b=1024){const x=p+b;let g=p;for(;m[g]&&!(g>=x);)++g;if(g-p>16&&m.buffer&&l)return l.decode(m.subarray(p,g));let y="";for(;p<g;){let w=m[p++];if(!(w&128)){y+=String.fromCharCode(w);continue}const C=m[p++]&63;if((w&224)===192){y+=String.fromCharCode((w&31)<<6|C);continue}const E=m[p++]&63;if((w&240)===224?w=(w&15)<<12|C<<6|E:w=(w&7)<<18|C<<12|E<<6|m[p++]&63,w<65536)y+=String.fromCharCode(w);else{const S=w-65536;y+=String.fromCharCode(55296|S>>10,56320|S&1023)}}return y}function u(m,p){return m?c(r.HEAPU8,m,p):""}const d={emscripten_get_now:mQ,emscripten_memcpy_big:s,emscripten_resize_heap:o,fd_write:()=>0};async function h(){const p=await t({env:d,wasi_snapshot_preview1:d});e=p.memory,i(e.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var yQ=Object.defineProperty,bQ=(t,e,n)=>e in t?yQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Cr=(t,e,n)=>(bQ(t,typeof e!="symbol"?e+"":e,n),n);let zr=null;function vQ(t){throw new ck(t.UTF8ToString(t.getLastOnigError()))}class Q1{constructor(e){Cr(this,"utf16Length"),Cr(this,"utf8Length"),Cr(this,"utf16Value"),Cr(this,"utf8Value"),Cr(this,"utf16OffsetToUtf8"),Cr(this,"utf8OffsetToUtf16");const n=e.length,r=Q1._utf8ByteLength(e),i=r!==n,s=i?new Uint32Array(n+1):null;i&&(s[n]=r);const a=i?new Uint32Array(r+1):null;i&&(a[r]=n);const o=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let d=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const m=e.charCodeAt(c+1);m>=56320&&m<=57343&&(d=(u-55296<<10)+65536|m-56320,h=!0)}i&&(s[c]=l,h&&(s[c+1]=l),d<=127?a[l+0]=c:d<=2047?(a[l+0]=c,a[l+1]=c):d<=65535?(a[l+0]=c,a[l+1]=c,a[l+2]=c):(a[l+0]=c,a[l+1]=c,a[l+2]=c,a[l+3]=c)),d<=127?o[l++]=d:d<=2047?(o[l++]=192|(d&1984)>>>6,o[l++]=128|(d&63)>>>0):d<=65535?(o[l++]=224|(d&61440)>>>12,o[l++]=128|(d&4032)>>>6,o[l++]=128|(d&63)>>>0):(o[l++]=240|(d&1835008)>>>18,o[l++]=128|(d&258048)>>>12,o[l++]=128|(d&4032)>>>6,o[l++]=128|(d&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=o,this.utf16OffsetToUtf8=s,this.utf8OffsetToUtf16=a}static _utf8ByteLength(e){let n=0;for(let r=0,i=e.length;r<i;r++){const s=e.charCodeAt(r);let a=s,o=!1;if(s>=55296&&s<=56319&&r+1<i){const l=e.charCodeAt(r+1);l>=56320&&l<=57343&&(a=(s-55296<<10)+65536|l-56320,o=!0)}a<=127?n+=1:a<=2047?n+=2:a<=65535?n+=3:n+=4,o&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const ka=class{constructor(t){if(Cr(this,"id",++ka.LAST_ID),Cr(this,"_onigBinding"),Cr(this,"content"),Cr(this,"utf16Length"),Cr(this,"utf8Length"),Cr(this,"utf16OffsetToUtf8"),Cr(this,"utf8OffsetToUtf16"),Cr(this,"ptr"),!zr)throw new ck("Must invoke loadWasm first.");this._onigBinding=zr,this.content=t;const e=new Q1(t);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!ka._sharedPtrInUse?(ka._sharedPtr||(ka._sharedPtr=zr.omalloc(1e4)),ka._sharedPtrInUse=!0,zr.HEAPU8.set(e.utf8Value,ka._sharedPtr),this.ptr=ka._sharedPtr):this.ptr=e.createString(zr)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===ka._sharedPtr?ka._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let O0=ka;Cr(O0,"LAST_ID",0);Cr(O0,"_sharedPtr",0);Cr(O0,"_sharedPtrInUse",!1);class xQ{constructor(e){if(Cr(this,"_onigBinding"),Cr(this,"_ptr"),!zr)throw new ck("Must invoke loadWasm first.");const n=[],r=[];for(let o=0,l=e.length;o<l;o++){const c=new Q1(e[o]);n[o]=c.createString(zr),r[o]=c.utf8Length}const i=zr.omalloc(4*e.length);zr.HEAPU32.set(n,i/4);const s=zr.omalloc(4*e.length);zr.HEAPU32.set(r,s/4);const a=zr.createOnigScanner(i,s,e.length);for(let o=0,l=e.length;o<l;o++)zr.ofree(n[o]);zr.ofree(s),zr.ofree(i),a===0&&vQ(zr),this._onigBinding=zr,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let i=0;if(typeof r=="number"&&(i=r),typeof e=="string"){e=new O0(e);const s=this._findNextMatchSync(e,n,!1,i);return e.dispose(),s}return this._findNextMatchSync(e,n,!1,i)}_findNextMatchSync(e,n,r,i){const s=this._onigBinding,a=s.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),i);if(a===0)return null;const o=s.HEAPU32;let l=a/4;const c=o[l++],u=o[l++],d=[];for(let h=0;h<u;h++){const m=e.convertUtf8OffsetToUtf16(o[l++]),p=e.convertUtf8OffsetToUtf16(o[l++]);d[h]={start:m,end:p,length:p-m}}return{index:c,captureIndices:d}}}function wQ(t){return typeof t.instantiator=="function"}function kQ(t){return typeof t.default=="function"}function _Q(t){return typeof t.data<"u"}function SQ(t){return typeof Response<"u"&&t instanceof Response}function TQ(t){var e;return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&((e=Buffer.isBuffer)==null?void 0:e.call(Buffer,t))||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Am;function CQ(t){if(Am)return Am;async function e(){zr=await gQ(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),wQ(r)?r=await r.instantiator(n):kQ(r)?r=await r.default(n):(_Q(r)&&(r=r.data),SQ(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await EQ(r)(n):r=await AQ(r)(n):TQ(r)?r=await gv(r)(n):r instanceof WebAssembly.Module?r=await gv(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await gv(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Am=e(),Am}function gv(t){return e=>WebAssembly.instantiate(t,e)}function EQ(t){return e=>WebAssembly.instantiateStreaming(t,e)}function AQ(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}let MQ;function NQ(){return MQ}async function wD(t){return t&&await CQ(t),{createScanner(e){return new xQ(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new O0(e)}}}function DQ(t){return uk(t)}function uk(t){return Array.isArray(t)?IQ(t):t instanceof RegExp?t:typeof t=="object"?RQ(t):t}function IQ(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=uk(t[n]);return e}function RQ(t){let e={};for(let n in t)e[n]=uk(t[n]);return e}function kD(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function _D(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?_D(t.substring(0,t.length-1)):t.substr(~e+1)}var yv=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Mm=class{static hasCaptures(t){return t===null?!1:(yv.lastIndex=0,yv.test(t))}static replaceCaptures(t,e,n){return t.replace(yv,(r,i,s,a)=>{let o=n[parseInt(i||s,10)];if(o){let l=e.substring(o.start,o.end);for(;l[0]===".";)l=l.substring(1);switch(a){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function SD(t,e){return t<e?-1:t>e?1:0}function TD(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let i=0;i<n;i++){let s=SD(t[i],e[i]);if(s!==0)return s}return 0}return n-r}function E7(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function CD(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ED=class{constructor(t){ie(this,"cache",new Map);this.fn=t}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Dg=class{constructor(t,e,n){ie(this,"_cachedMatchRoot",new ED(t=>this._root.match(t)));this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(LQ(t),e)}static createFromParsedTheme(t,e){return zQ(t,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(i=>OQ(t.parent,i.parentScopes));return r?new AD(r.fontStyle,r.foreground,r.background):null}},bv=class Cp{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Cp(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Cp(n,e[r]);return n}push(e){return new Cp(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function OQ(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],i=!0}for(;t&&!jQ(t.scopeName,r);){if(i)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function jQ(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var AD=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function LQ(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let i=0,s=e.length;i<s;i++){let a=e[i];if(!a.settings)continue;let o;if(typeof a.scope=="string"){let d=a.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),o=d.split(",")}else Array.isArray(a.scope)?o=a.scope:o=[""];let l=-1;if(typeof a.settings.fontStyle=="string"){l=0;let d=a.settings.fontStyle.split(" ");for(let h=0,m=d.length;h<m;h++)switch(d[h]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof a.settings.foreground=="string"&&E7(a.settings.foreground)&&(c=a.settings.foreground);let u=null;typeof a.settings.background=="string"&&E7(a.settings.background)&&(u=a.settings.background);for(let d=0,h=o.length;d<h;d++){let p=o[d].trim().split(" "),b=p[p.length-1],x=null;p.length>1&&(x=p.slice(0,p.length-1),x.reverse()),n[r++]=new BQ(b,x,i,l,c,u)}}return n}var BQ=class{constructor(t,e,n,r,i,s){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=i,this.background=s}},_o=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(_o||{});function zQ(t,e){t.sort((l,c)=>{let u=SD(l.scope,c.scope);return u!==0||(u=TD(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",i="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(i=l.background)}let s=new PQ(e),a=new AD(n,s.getId(r),s.getId(i)),o=new UQ(new Zx(0,null,-1,0,0),[]);for(let l=0,c=t.length;l<c;l++){let u=t[l];o.insert(0,u.scope,u.parentScopes,u.fontStyle,s.getId(u.foreground),s.getId(u.background))}return new Dg(s,a,o)}var PQ=class{constructor(t){ie(this,"_isFrozen");ie(this,"_lastColorId");ie(this,"_id2color");ie(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},$Q=Object.freeze([]),Zx=class MD{constructor(e,n,r,i,s){ie(this,"scopeDepth");ie(this,"parentScopes");ie(this,"fontStyle");ie(this,"foreground");ie(this,"background");this.scopeDepth=e,this.parentScopes=n||$Q,this.fontStyle=r,this.foreground=i,this.background=s}clone(){return new MD(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,i=e.length;r<i;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,i){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},UQ=class e2{constructor(e,n=[],r={}){ie(this,"_rulesWithParentScopes");this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,i=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=e.parentScopes.length||i>=n.parentScopes.length);){const s=n.parentScopes[i].length-e.parentScopes[r].length;if(s!==0)return s;r++,i++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),i,s;if(r===-1?(i=e,s=""):(i=e.substring(0,r),s=e.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(s)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e2._cmpBySpecificity),n}insert(e,n,r,i,s,a){if(n===""){this._doInsertHere(e,r,i,s,a);return}let o=n.indexOf("."),l,c;o===-1?(l=n,c=""):(l=n.substring(0,o),c=n.substring(o+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new e2(this._mainRule.clone(),Zx.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(e+1,c,r,i,s,a)}_doInsertHere(e,n,r,i,s){if(n===null){this._mainRule.acceptOverwrite(e,r,i,s);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let l=this._rulesWithParentScopes[a];if(TD(l.parentScopes,n)===0){l.acceptOverwrite(e,r,i,s);return}}r===-1&&(r=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),s===0&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new Zx(e,n,r,i,s))}},Od=class ws{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=ws.getLanguageId(e),r=ws.getTokenType(e),i=ws.getFontStyle(e),s=ws.getForeground(e),a=ws.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:s,background:a})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,i,s,a,o){let l=ws.getLanguageId(e),c=ws.getTokenType(e),u=ws.containsBalancedBrackets(e)?1:0,d=ws.getFontStyle(e),h=ws.getForeground(e),m=ws.getBackground(e);return n!==0&&(l=n),r!==8&&(c=r),i!==null&&(u=i?1:0),s!==-1&&(d=s),a!==0&&(h=a),o!==0&&(m=o),(l<<0|c<<8|u<<10|d<<11|h<<15|m<<24)>>>0}};function Ig(t,e){const n=[],r=HQ(t);let i=r.next();for(;i!==null;){let l=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let c=a();if(n.push({matcher:c,priority:l}),i!==",")break;i=r.next()}return n;function s(){if(i==="-"){i=r.next();const l=s();return c=>!!l&&!l(c)}if(i==="("){i=r.next();const l=o();return i===")"&&(i=r.next()),l}if(A7(i)){const l=[];do l.push(i),i=r.next();while(A7(i));return c=>e(l,c)}return null}function a(){const l=[];let c=s();for(;c;)l.push(c),c=s();return u=>l.every(d=>d(u))}function o(){const l=[];let c=a();for(;c&&(l.push(c),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");c=a()}return u=>l.some(d=>d(u))}}function A7(t){return!!t&&!!t.match(/[\w\.:]+/)}function HQ(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function ND(t){typeof t.dispose=="function"&&t.dispose()}var Yf=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},qQ=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},FQ=class{constructor(){ie(this,"_references",[]);ie(this,"_seenReferenceKeys",new Set);ie(this,"visitedRule",new Set)}get references(){return this._references}add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},VQ=class{constructor(t,e){ie(this,"seenFullScopeRequests",new Set);ie(this,"seenPartialScopeRequests",new Set);ie(this,"Q");this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Yf(this.initialScopeName)]}processQueue(){const t=this.Q;this.Q=[];const e=new FQ;for(const n of t)GQ(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Yf){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 GQ(t,e,n,r){const i=n.lookup(t.scopeName);if(!i){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const s=n.lookup(e);t instanceof Yf?Ep({baseGrammar:s,selfGrammar:i},r):t2(t.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},r);const a=n.injections(t.scopeName);if(a)for(const o of a)r.add(new Yf(o))}function t2(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Rg([r],e,n)}}function Ep(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Rg(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Rg(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Rg(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?kD({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Rg(r.patterns,{...e,repository:i},n);const s=r.include;if(!s)continue;const a=DD(s);switch(a.kind){case 0:Ep({...e,selfGrammar:e.baseGrammar},n);break;case 1:Ep(e,n);break;case 2:t2(a.ruleName,{...e,repository:i},n);break;case 3:case 4:const o=a.scopeName===e.selfGrammar.scopeName?e.selfGrammar:a.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const l={baseGrammar:e.baseGrammar,selfGrammar:o,repository:i};a.kind===4?t2(a.ruleName,l,n):Ep(l,n)}else a.kind===4?n.add(new qQ(a.scopeName,a.ruleName)):n.add(new Yf(a.scopeName));break}}}var WQ=class{constructor(){ie(this,"kind",0)}},KQ=class{constructor(){ie(this,"kind",1)}},YQ=class{constructor(t){ie(this,"kind",2);this.ruleName=t}},XQ=class{constructor(t){ie(this,"kind",3);this.scopeName=t}},QQ=class{constructor(t,e){ie(this,"kind",4);this.scopeName=t,this.ruleName=e}};function DD(t){if(t==="$base")return new WQ;if(t==="$self")return new KQ;const e=t.indexOf("#");if(e===-1)return new XQ(t);if(e===0)return new YQ(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new QQ(n,r)}}var JQ=/\\(\d+)/,M7=/\\(\d+)/g,ZQ=-1,ID=-2;var j0=class{constructor(e,n,r,i){ie(this,"$location");ie(this,"id");ie(this,"_nameIsCapturing");ie(this,"_name");ie(this,"_contentNameIsCapturing");ie(this,"_contentName");this.$location=e,this.id=n,this._name=r||null,this._nameIsCapturing=Mm.hasCaptures(this._name),this._contentName=i||null,this._contentNameIsCapturing=Mm.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${_D(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,n){return!this._nameIsCapturing||this._name===null||e===null||n===null?this._name:Mm.replaceCaptures(this._name,e,n)}getContentName(e,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Mm.replaceCaptures(this._contentName,e,n)}},eJ=class extends j0{constructor(e,n,r,i,s){super(e,n,r,i);ie(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,n){throw new Error("Not supported!")}compile(e,n){throw new Error("Not supported!")}compileAG(e,n,r,i){throw new Error("Not supported!")}},tJ=class extends j0{constructor(e,n,r,i,s){super(e,n,r,null);ie(this,"_match");ie(this,"captures");ie(this,"_cachedCompiledPatterns");this._match=new Xf(i,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,n){n.push(this._match)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,r,i){return this._getCachedCompiledPatterns(e).compileAG(e,r,i)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Qf,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},N7=class extends j0{constructor(e,n,r,i,s){super(e,n,r,i);ie(this,"hasMissingPatterns");ie(this,"patterns");ie(this,"_cachedCompiledPatterns");this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,n){for(const r of this.patterns)e.getRule(r).collectPatterns(e,n)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,r,i){return this._getCachedCompiledPatterns(e).compileAG(e,r,i)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Qf,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},n2=class extends j0{constructor(e,n,r,i,s,a,o,l,c,u){super(e,n,r,i);ie(this,"_begin");ie(this,"beginCaptures");ie(this,"_end");ie(this,"endHasBackReferences");ie(this,"endCaptures");ie(this,"applyEndPatternLast");ie(this,"hasMissingPatterns");ie(this,"patterns");ie(this,"_cachedCompiledPatterns");this._begin=new Xf(s,this.id),this.beginCaptures=a,this._end=new Xf(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,n){return this._end.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e,n).compile(e)}compileAG(e,n,r,i){return this._getCachedCompiledPatterns(e,n).compileAG(e,r,i)}_getCachedCompiledPatterns(e,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Qf;for(const r of this.patterns)e.getRule(r).collectPatterns(e,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}},Og=class extends j0{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i);ie(this,"_begin");ie(this,"beginCaptures");ie(this,"whileCaptures");ie(this,"_while");ie(this,"whileHasBackReferences");ie(this,"hasMissingPatterns");ie(this,"patterns");ie(this,"_cachedCompiledPatterns");ie(this,"_cachedCompiledWhilePatterns");this._begin=new Xf(s,this.id),this.beginCaptures=a,this.whileCaptures=l,this._while=new Xf(o,ID),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(e,n){return this._while.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,r,i){return this._getCachedCompiledPatterns(e).compileAG(e,r,i)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Qf;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,n){return this._getCachedCompiledWhilePatterns(e,n).compile(e)}compileWhileAG(e,n,r,i){return this._getCachedCompiledWhilePatterns(e,n).compileAG(e,r,i)}_getCachedCompiledWhilePatterns(e,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Qf,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},RD=class Zr{static createCaptureRule(e,n,r,i,s){return e.registerRule(a=>new eJ(n,a,r,i,s))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(i=>{if(e.id=i,e.match)return new tJ(e.$vscodeTextmateLocation,e.id,e.name,e.match,Zr._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=kD({},r,e.repository));let s=e.patterns;return typeof s>"u"&&e.include&&(s=[{include:e.include}]),new N7(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,Zr._compilePatterns(s,n,r))}return e.while?new Og(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,Zr._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,Zr._compileCaptures(e.whileCaptures||e.captures,n,r),Zr._compilePatterns(e.patterns,n,r)):new n2(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,Zr._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,Zr._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,Zr._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let i=[];if(e){let s=0;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const o=parseInt(a,10);o>s&&(s=o)}for(let a=0;a<=s;a++)i[a]=null;for(const a in e){if(a==="$vscodeTextmateLocation")continue;const o=parseInt(a,10);let l=0;e[a].patterns&&(l=Zr.getCompiledRuleId(e[a],n,r)),i[o]=Zr.createCaptureRule(n,e[a].$vscodeTextmateLocation,e[a].name,e[a].contentName,l)}}return i}static _compilePatterns(e,n,r){let i=[];if(e)for(let s=0,a=e.length;s<a;s++){const o=e[s];let l=-1;if(o.include){const c=DD(o.include);switch(c.kind){case 0:case 1:l=Zr.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=Zr.getCompiledRuleId(u,n,r));break;case 3:case 4:const d=c.scopeName,h=c.kind===4?c.ruleName:null,m=n.getExternalGrammar(d,r);if(m)if(h){let p=m.repository[h];p&&(l=Zr.getCompiledRuleId(p,n,m.repository))}else l=Zr.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=Zr.getCompiledRuleId(o,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof N7||c instanceof n2||c instanceof Og)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;i.push(l)}}return{patterns:i,hasMissingPatterns:(e?e.length:0)!==i.length}}},Xf=class OD{constructor(e,n){ie(this,"source");ie(this,"ruleId");ie(this,"hasAnchor");ie(this,"hasBackReferences");ie(this,"_anchorCache");if(e&&typeof e=="string"){const r=e.length;let i=0,s=[],a=!1;for(let o=0;o<r;o++)if(e.charAt(o)==="\\"&&o+1<r){const c=e.charAt(o+1);c==="z"?(s.push(e.substring(i,o)),s.push("$(?!\\n)(?<!\\n)"),i=o+2):(c==="A"||c==="G")&&(a=!0),o++}this.hasAnchor=a,i===0?this.source=e:(s.push(e.substring(i,r)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=JQ.test(this.source):this.hasBackReferences=!1}clone(){return new OD(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,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(i=>e.substring(i.start,i.end));return M7.lastIndex=0,this.source.replace(M7,(i,s)=>CD(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],i=[],s,a,o,l;for(s=0,a=this.source.length;s<a;s++)o=this.source.charAt(s),e[s]=o,n[s]=o,r[s]=o,i[s]=o,o==="\\"&&s+1<a&&(l=this.source.charAt(s+1),l==="A"?(e[s+1]="",n[s+1]="",r[s+1]="A",i[s+1]="A"):l==="G"?(e[s+1]="",n[s+1]="G",r[s+1]="",i[s+1]="G"):(e[s+1]=l,n[s+1]=l,r[s+1]=l,i[s+1]=l),s++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:i.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Qf=class{constructor(){ie(this,"_items");ie(this,"_hasAnchors");ie(this,"_cached");ie(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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new D7(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(i=>i.resolveAnchors(e,n));return new D7(t,r,this._items.map(i=>i.ruleId))}},D7=class{constructor(t,e,n){ie(this,"scanner");this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push("   - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
`)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},vv=class{constructor(t,e){this.languageId=t,this.tokenType=e}},bo,nJ=(bo=class{constructor(e,n){ie(this,"_defaultAttributes");ie(this,"_embeddedLanguagesMatcher");ie(this,"_getBasicScopeAttributes",new ED(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new vv(n,r)}));this._defaultAttributes=new vv(e,8),this._embeddedLanguagesMatcher=new rJ(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?bo._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(bo.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!")}},ie(bo,"_NULL_SCOPE_METADATA",new vv(0,0)),ie(bo,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),bo),rJ=class{constructor(t){ie(this,"values");ie(this,"scopesRegExp");if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>CD(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},I7=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function jD(t,e,n,r,i,s,a,o){const l=e.content.length;let c=!1,u=-1;if(a){const m=iJ(t,e,n,r,i,s);i=m.stack,r=m.linePos,n=m.isFirstLine,u=m.anchorPosition}const d=Date.now();for(;!c;){if(o!==0&&Date.now()-d>o)return new I7(i,!0);h()}return new I7(i,!1);function h(){const m=sJ(t,e,n,r,i,u);if(!m){s.produce(i,l),c=!0;return}const p=m.captureIndices,b=m.matchedRuleId,x=p&&p.length>0?p[0].end>r:!1;if(b===ZQ){const g=i.getRule(t);s.produce(i,p[0].start),i=i.withContentNameScopesList(i.nameScopesList),Kh(t,e,n,i,s,g.endCaptures,p),s.produce(i,p[0].end);const y=i;if(i=i.parent,u=y.getAnchorPos(),!x&&y.getEnterPos()===r){i=y,s.produce(i,l),c=!0;return}}else{const g=t.getRule(b);s.produce(i,p[0].start);const y=i,w=g.getName(e.content,p),C=i.contentNameScopesList.pushAttributed(w,t);if(i=i.push(b,r,u,p[0].end===l,null,C,C),g instanceof n2){const E=g;Kh(t,e,n,i,s,E.beginCaptures,p),s.produce(i,p[0].end),u=p[0].end;const S=E.getContentName(e.content,p),T=C.pushAttributed(S,t);if(i=i.withContentNameScopesList(T),E.endHasBackReferences&&(i=i.withEndRule(E.getEndWithResolvedBackReferences(e.content,p))),!x&&y.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),c=!0;return}}else if(g instanceof Og){const E=g;Kh(t,e,n,i,s,E.beginCaptures,p),s.produce(i,p[0].end),u=p[0].end;const S=E.getContentName(e.content,p),T=C.pushAttributed(S,t);if(i=i.withContentNameScopesList(T),E.whileHasBackReferences&&(i=i.withEndRule(E.getWhileWithResolvedBackReferences(e.content,p))),!x&&y.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),c=!0;return}}else if(Kh(t,e,n,i,s,g.captures,p),s.produce(i,p[0].end),i=i.pop(),!x){i=i.safePop(),s.produce(i,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function iJ(t,e,n,r,i,s){let a=i.beginRuleCapturedEOL?0:-1;const o=[];for(let l=i;l;l=l.pop()){const c=l.getRule(t);c instanceof Og&&o.push({rule:c,stack:l})}for(let l=o.pop();l;l=o.pop()){const{ruleScanner:c,findOptions:u}=lJ(l.rule,t,l.stack.endRule,n,r===a),d=c.findNextMatchSync(e,r,u);if(d){if(d.ruleId!==ID){i=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(s.produce(l.stack,d.captureIndices[0].start),Kh(t,e,n,l.stack,s,l.rule.whileCaptures,d.captureIndices),s.produce(l.stack,d.captureIndices[0].end),a=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{i=l.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:a,isFirstLine:n}}function sJ(t,e,n,r,i,s){const a=aJ(t,e,n,r,i,s),o=t.getInjections();if(o.length===0)return a;const l=oJ(o,t,e,n,r,i,s);if(!l)return a;if(!a)return l;const c=a.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:a}function aJ(t,e,n,r,i,s){const a=i.getRule(t),{ruleScanner:o,findOptions:l}=LD(a,t,i.endRule,n,r===s),c=o.findNextMatchSync(e,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function oJ(t,e,n,r,i,s,a){let o=Number.MAX_VALUE,l=null,c,u=0;const d=s.contentNameScopesList.getScopeNames();for(let h=0,m=t.length;h<m;h++){const p=t[h];if(!p.matcher(d))continue;const b=e.getRule(p.ruleId),{ruleScanner:x,findOptions:g}=LD(b,e,null,r,i===a),y=x.findNextMatchSync(n,i,g);if(!y)continue;const w=y.captureIndices[0].start;if(!(w>=o)&&(o=w,l=y.captureIndices,c=y.ruleId,u=p.priority,o===i))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function LD(t,e,n,r,i){return{ruleScanner:t.compileAG(e,n,r,i),findOptions:0}}function lJ(t,e,n,r,i){return{ruleScanner:t.compileWhileAG(e,n,r,i),findOptions:0}}function Kh(t,e,n,r,i,s,a){if(s.length===0)return;const o=e.content,l=Math.min(s.length,a.length),c=[],u=a[0].end;for(let d=0;d<l;d++){const h=s[d];if(h===null)continue;const m=a[d];if(m.length===0)continue;if(m.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?i.produceFromScopes(c[c.length-1].scopes,m.start):i.produce(r,m.start),h.retokenizeCapturedWithRuleId){const b=h.getName(o,a),x=r.contentNameScopesList.pushAttributed(b,t),g=h.getContentName(o,a),y=x.pushAttributed(g,t),w=r.push(h.retokenizeCapturedWithRuleId,m.start,-1,!1,null,x,y),C=t.createOnigString(o.substring(0,m.end));jD(t,C,n&&m.start===0,m.start,w,i,!1,0),ND(C);continue}const p=h.getName(o,a);if(p!==null){const x=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);c.push(new cJ(x,m.end))}}for(;c.length>0;)i.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var cJ=class{constructor(t,e){ie(this,"scopes");ie(this,"endPos");this.scopes=t,this.endPos=e}};function uJ(t,e,n,r,i,s,a,o){return new hJ(t,e,n,r,i,s,a,o)}function R7(t,e,n,r,i){const s=Ig(e,jg),a=RD.getCompiledRuleId(n,r,i.repository);for(const o of s)t.push({debugSelector:e,matcher:o.matcher,ruleId:a,grammar:i,priority:o.priority})}function jg(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let i=n;i<e.length;i++)if(dJ(e[i],r))return n=i+1,!0;return!1})}function dJ(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var hJ=class{constructor(t,e,n,r,i,s,a,o){ie(this,"_rootId");ie(this,"_lastRuleId");ie(this,"_ruleId2desc");ie(this,"_includedGrammars");ie(this,"_grammarRepository");ie(this,"_grammar");ie(this,"_injections");ie(this,"_basicScopeAttributesProvider");ie(this,"_tokenTypeMatchers");if(this._rootScopeName=t,this.balancedBracketSelectors=s,this._onigLib=o,this._basicScopeAttributesProvider=new nJ(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=O7(e,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const l of Object.keys(i)){const c=Ig(l,jg);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:i[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const i=r.injections;if(i)for(let a in i)R7(e,a,i[a],this,r);const s=this._grammarRepository.injections(n);s&&s.forEach(a=>{const o=this.getExternalGrammar(a);if(o){const l=o.injectionSelector;l&&R7(e,l,o,this,o)}})}return e.sort((i,s)=>i.priority-s.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=O7(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=RD.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!e||e===r2.NULL){i=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=Od.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let m;h?m=wf.createRootAndLookUpScopeName(h,d,this):m=wf.createRoot("unknown",d),e=new r2(null,this._rootId,-1,-1,!1,null,m,m)}else i=!1,e.reset();t=t+`
`;const s=this.createOnigString(t),a=s.content.length,o=new mJ(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=jD(this,s,i,0,e,o,!0,r);return ND(s),{lineLength:a,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function O7(t,e){return t=DQ(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var wf=class _a{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,i=(e==null?void 0:e.scopePath)??null;for(const s of n)i=bv.push(i,s.scopeNames),r=new _a(r,i,s.encodedTokenAttributes);return r}static createRoot(e,n){return new _a(null,new bv(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const i=r.getMetadataForScope(e),s=new bv(null,e),a=r.themeProvider.themeMatch(s),o=_a.mergeAttributes(n,i,a);return new _a(null,s,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return _a.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let i=-1,s=0,a=0;return r!==null&&(i=r.fontStyle,s=r.foregroundId,a=r.backgroundId),Od.set(e,n.languageId,n.tokenType,null,i,s,a)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return _a._pushAttributed(this,e,n);const r=e.split(/ /g);let i=this;for(const s of r)i=_a._pushAttributed(i,s,n);return i}static _pushAttributed(e,n,r){const i=r.getMetadataForScope(n),s=e.scopePath.push(n),a=r.themeProvider.themeMatch(s),o=_a.mergeAttributes(e.tokenAttributes,i,a);return new _a(e,s,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var i;const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((i=r.parent)==null?void 0:i.scopePath)??null)}),r=r.parent;return r===e?n.reverse():void 0}},As,r2=(As=class{constructor(e,n,r,i,s,a,o,l){ie(this,"_stackElementBrand");ie(this,"_enterPos");ie(this,"_anchorPos");ie(this,"depth");this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=s,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=i}equals(e){return e===null?!1:As._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?wf.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){As._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,i,s,a,o){return new As(this,e,n,r,i,s,a,o)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){var r,i;return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(i=this.contentNameScopesList)==null?void 0:i.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new As(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var e,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,n){const r=wf.fromExtension((e==null?void 0:e.nameScopesList)??null,n.nameScopesList);return new As(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,wf.fromExtension(r,n.contentNameScopesList))}},ie(As,"NULL",new As(null,0,0,0,!1,null,null,null)),As),fJ=class{constructor(t,e){ie(this,"balancedBracketScopes");ie(this,"unbalancedBracketScopes");ie(this,"allowAny",!1);this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Ig(n,jg).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Ig(n,jg).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},mJ=class{constructor(t,e,n,r){ie(this,"_emitBinaryTokens");ie(this,"_lineText");ie(this,"_tokens");ie(this,"_binaryTokens");ie(this,"_lastTokenEndIndex");ie(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){var r;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let i=(t==null?void 0:t.tokenAttributes)??0,s=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=(t==null?void 0:t.getScopeNames())??[];for(const o of this._tokenTypeOverrides)o.matcher(a)&&(i=Od.set(i,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(a))}if(s&&(i=Od.set(i,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===i){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(i),this._lastTokenEndIndex=e;return}const n=(t==null?void 0:t.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,i=this._binaryTokens.length;r<i;r++)n[r]=this._binaryTokens[r];return n}},pJ=class{constructor(t,e){ie(this,"_grammars",new Map);ie(this,"_rawGrammars",new Map);ie(this,"_injectionGrammars",new Map);ie(this,"_theme");this._onigLib=e,this._theme=t}dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,i){if(!this._grammars.has(t)){let s=this._rawGrammars.get(t);if(!s)return null;this._grammars.set(t,uJ(t,s,e,n,r,i,this,this._onigLib))}return this._grammars.get(t)}},gJ=class{constructor(e){ie(this,"_options");ie(this,"_syncRegistry");ie(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new pJ(Dg.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(Dg.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new fJ(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,i,s){const a=new VQ(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(o=>this._loadSingleGrammar(o.scopeName)),a.processQueue();return this._grammarForScopeName(e,n,r,i,s)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,i=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,i)}_grammarForScopeName(e,n=0,r=null,i=null,s=null){return this._syncRegistry.grammarForScopeName(e,n,r,i,s)}},i2=r2.NULL;const yJ=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],bJ=/["&'<>`]/g,vJ=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,xJ=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wJ=/[|\\{}()[\]^$+*?.]/g,j7=new WeakMap;function kJ(t,e){if(t=t.replace(e.subset?_J(e.subset):bJ,r),e.subset||e.escapeOnly)return t;return t.replace(vJ,n).replace(xJ,r);function n(i,s,a){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,a.charCodeAt(s+2),e)}function r(i,s,a){return e.format(i.charCodeAt(0),a.charCodeAt(s+1),e)}}function _J(t){let e=j7.get(t);return e||(e=SJ(t),j7.set(t,e)),e}function SJ(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(wJ,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const TJ=/[\dA-Fa-f]/;function CJ(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!TJ.test(String.fromCharCode(e))?r:r+";"}const EJ=/\d/;function AJ(t,e,n){const r="&#"+String(t);return n&&e&&!EJ.test(String.fromCharCode(e))?r:r+";"}const MJ=["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"],xv={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:"€"},NJ=["cent","copy","divide","gt","lt","not","para","times"],BD={}.hasOwnProperty,s2={};let Nm;for(Nm in xv)BD.call(xv,Nm)&&(s2[xv[Nm]]=Nm);const DJ=/[^\dA-Za-z]/;function IJ(t,e,n,r){const i=String.fromCharCode(t);if(BD.call(s2,i)){const s=s2[i],a="&"+s;return n&&MJ.includes(s)&&!NJ.includes(s)&&(!r||e&&e!==61&&DJ.test(String.fromCharCode(e)))?a:a+";"}return""}function RJ(t,e,n){let r=CJ(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=IJ(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const s=AJ(t,e,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function dd(t,e){return kJ(t,Object.assign({format:RJ},e))}const OJ=/^>|^->|<!--|-->|--!>|<!-$/g,jJ=[">"],LJ=["<",">"];function BJ(t,e,n,r){return r.settings.bogusComments?"<?"+dd(t.value,Object.assign({},r.settings.characterReferences,{subset:jJ}))+">":"<!--"+t.value.replace(OJ,i)+"-->";function i(s){return dd(s,Object.assign({},r.settings.characterReferences,{subset:LJ}))}}function zJ(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const Ir=PD(1),zD=PD(-1),PJ=[];function PD(t){return e;function e(n,r,i){const s=n?n.children:PJ;let a=(r||0)+t,o=s[a];if(!i)for(;o&&I1(o);)a+=t,o=s[a];return o}}const $J={}.hasOwnProperty;function $D(t){return e;function e(n,r,i){return $J.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const dk=$D({body:HJ,caption:wv,colgroup:wv,dd:GJ,dt:VJ,head:wv,html:UJ,li:FJ,optgroup:WJ,option:KJ,p:qJ,rp:L7,rt:L7,tbody:XJ,td:B7,tfoot:QJ,th:B7,thead:YJ,tr:JJ});function wv(t,e,n){const r=Ir(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&I1(r.value.charAt(0)))}function UJ(t,e,n){const r=Ir(n,e);return!r||r.type!=="comment"}function HJ(t,e,n){const r=Ir(n,e);return!r||r.type!=="comment"}function qJ(t,e,n){const r=Ir(n,e);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 FJ(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&r.tagName==="li"}function VJ(t,e,n){const r=Ir(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function GJ(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function L7(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function WJ(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function KJ(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function YJ(t,e,n){const r=Ir(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function XJ(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function QJ(t,e,n){return!Ir(n,e)}function JJ(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function B7(t,e,n){const r=Ir(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ZJ=$D({body:nZ,colgroup:rZ,head:tZ,html:eZ,tbody:iZ});function eZ(t){const e=Ir(t,-1);return!e||e.type!=="comment"}function tZ(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function nZ(t){const e=Ir(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&I1(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function rZ(t,e,n){const r=zD(n,e),i=Ir(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&dk(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function iZ(t,e,n){const r=zD(n,e),i=Ir(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&dk(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Dm={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 sZ(t,e,n,r){const i=r.schema,s=i.space==="svg"?!1:r.settings.omitOptionalTags;let a=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const o=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=th);const c=aZ(r,t.properties),u=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,u&&(a=!1),(c||!s||!ZJ(t,e,n))&&(o.push("<",t.tagName,c?" "+c:""),a&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(u),!a&&(!s||!dk(t,e,n))&&o.push("</"+t.tagName+">"),o.join("")}function aZ(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const s=oZ(t,i,e[i]);s&&n.push(s)}}for(;++r<n.length;){const s=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function oZ(t,e,n){const r=C3(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,s=t.settings.allowDangerousCharacters?0:1;let a=t.quote,o;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=dd(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Dm.name[i][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?nM:uM)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(o=dd(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Dm.unquoted[i][s]}))),o!==n&&(t.settings.quoteSmart&&_g(n,a)>_g(n,t.alternative)&&(a=t.alternative),o=a+dd(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?Dm.single:Dm.double)[i][s],attribute:!0}))+a),l+(o&&"="+o))}const lZ=["<","&"];function UD(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:dd(t.value,Object.assign({},r.settings.characterReferences,{subset:lZ}))}function cZ(t,e,n,r){return r.settings.allowDangerousHtml?t.value:UD(t,e,n,r)}function uZ(t,e,n,r){return r.all(t)}const dZ=aW("type",{invalid:hZ,unknown:fZ,handlers:{comment:BJ,doctype:zJ,element:sZ,raw:cZ,root:uZ,text:UD}});function hZ(t){throw new Error("Expected node, not `"+t+"`")}function fZ(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const mZ={},pZ={},gZ=[];function yZ(t,e){const n=mZ,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:bZ,all:vZ,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||yJ,characterReferences:n.characterReferences||pZ,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?th:E3,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function bZ(t,e,n){return dZ(t,e,n,this)}function vZ(t){const e=[],n=t&&t.children||gZ;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function xZ(t){return Array.isArray(t)?t:[t]}function J1(t,e=!1){var s;const n=t.split(/(\r?\n)/g);let r=0;const i=[];for(let a=0;a<n.length;a+=2){const o=e?n[a]+(n[a+1]||""):n[a];i.push([o,r]),r+=n[a].length,r+=((s=n[a+1])==null?void 0:s.length)||0}return i}function hk(t){return!t||["plaintext","txt","text","plain"].includes(t)}function HD(t){return t==="ansi"||hk(t)}function fk(t){return t==="none"}function qD(t){return fk(t)}function FD(t,e){var r;if(!e)return t;t.properties||(t.properties={}),(r=t.properties).class||(r.class=[]),typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const i of n)i&&!t.properties.class.includes(i)&&t.properties.class.push(i);return t}function wZ(t,e){let n=0;const r=[];for(const i of e)i>n&&r.push({...t,content:t.content.slice(n,i),offset:t.offset+n}),n=i;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function kZ(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,i)=>r-i);return n.length?t.map(r=>r.flatMap(i=>{const s=n.filter(a=>i.offset<a&&a<i.offset+i.content.length).map(a=>a-i.offset).sort((a,o)=>a-o);return s.length?wZ(i,s):i})):t}async function VD(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function Lg(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[i,s]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof s=="string"?n[i]=s:i===r&&Object.assign(n,s);return n}function Mc(t,e){return t&&((e==null?void 0:e[t==null?void 0:t.toLowerCase()])||t)}function GD(t){const e={};return t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle&&(t.fontStyle&_o.Italic&&(e["font-style"]="italic"),t.fontStyle&_o.Bold&&(e["font-weight"]="bold"),t.fontStyle&_o.Underline&&(e["text-decoration"]="underline")),e}function _Z(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function SZ(t){const e=J1(t,!0).map(([i])=>i);function n(i){if(i===t.length)return{line:e.length-1,character:e[e.length-1].length};let s=i,a=0;for(const o of e){if(s<o.length)break;s-=o.length,a++}return{line:a,character:s}}function r(i,s){let a=0;for(let o=0;o<i;o++)a+=e[o].length;return a+=s,a}return{lines:e,indexToPos:n,posToIndex:r}}class gi extends Error{constructor(e){super(e),this.name="ShikiError"}}const WD=new WeakMap;function Z1(t,e){WD.set(t,e)}function Jf(t){return WD.get(t)}class oh{constructor(...e){ie(this,"_stacks",{});ie(this,"lang");if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,i]=e;this.lang=r,this._stacks={[i]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new oh(Object.fromEntries(xZ(n).map(r=>[r,i2])),e)}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return z7(this._stacks[this.theme])}getScopes(e=this.theme){return z7(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function z7(t){const e=[],n=new Set;function r(i){var a;if(n.has(i))return;n.add(i);const s=(a=i==null?void 0:i.nameScopesList)==null?void 0:a.scopeName;s&&e.push(s),i.parent&&r(i.parent)}return r(t),e}function TZ(t,e){if(!(t instanceof oh))throw new gi("Invalid grammar state");return t.getInternalStack(e)}function CZ(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new gi(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...i.indexToPos(a),offset:a}}else{const o=i.lines[a.line];if(o===void 0)throw new gi(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${i.lines.length}`);if(a.character<0||a.character>o.length)throw new gi(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${o.length}`);return{...a,offset:i.posToIndex(a.line,a.character)}}};const i=SZ(n.source),s=(n.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));EZ(s),t.set(n.meta,{decorations:s,converter:i,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){var a;if(!((a=this.options.decorations)!=null&&a.length))return;const i=e(this).decorations.flatMap(o=>[o.start.offset,o.end.offset]);return kZ(n,i)},code(n){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const r=e(this),i=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(i.length!==r.converter.lines.length)throw new gi(`Number of lines in code element (${i.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function s(d,h,m,p){const b=i[d];let x="",g=-1,y=-1;if(h===0&&(g=0),m===0&&(y=0),m===Number.POSITIVE_INFINITY&&(y=b.children.length),g===-1||y===-1)for(let C=0;C<b.children.length;C++)x+=KD(b.children[C]),g===-1&&x.length===h&&(g=C+1),y===-1&&x.length===m&&(y=C+1);if(g===-1)throw new gi(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(y===-1)throw new gi(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const w=b.children.slice(g,y);if(!p.alwaysWrap&&w.length===b.children.length)o(b,p,"line");else if(!p.alwaysWrap&&w.length===1&&w[0].type==="element")o(w[0],p,"token");else{const C={type:"element",tagName:"span",properties:{},children:w};o(C,p,"wrapper"),b.children.splice(g,w.length,C)}}function a(d,h){i[d]=o(i[d],h,"line")}function o(d,h,m){var x;const p=h.properties||{},b=h.transform||(g=>g);return d.tagName=h.tagName||"span",d.properties={...d.properties,...p,class:d.properties.class},(x=h.properties)!=null&&x.class&&FD(d,h.properties.class),d=b(d,m)||d,d}const l=[],c=r.decorations.sort((d,h)=>h.start.offset-d.start.offset);for(const d of c){const{start:h,end:m}=d;if(h.line===m.line)s(h.line,h.character,m.character,d);else if(h.line<m.line){s(h.line,h.character,Number.POSITIVE_INFINITY,d);for(let p=h.line+1;p<m.line;p++)l.unshift(()=>a(p,d));s(m.line,0,m.character,d)}}l.forEach(d=>d())}}}function EZ(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new gi(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const i=t[r],s=n.start.offset<i.start.offset&&i.start.offset<n.end.offset,a=n.start.offset<i.end.offset&&i.end.offset<n.end.offset,o=i.start.offset<n.start.offset&&n.start.offset<i.end.offset,l=i.start.offset<n.end.offset&&n.end.offset<i.end.offset;if(s||a||o||l){if(a&&a||o&&l)continue;throw new gi(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(i.start)} intersect.`)}}}}function KD(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(KD).join(""):""}const AZ=[CZ()];function Bg(t){return[...t.transformers||[],...AZ]}var Nc=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],kv={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function MZ(t,e){const n=t.indexOf("\x1B[",e);if(n!==-1){const r=t.indexOf("m",n);return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function P7(t,e){let n=1;const r=t[e+n++];let i;if(r==="2"){const s=[t[e+n++],t[e+n++],t[e+n]].map(a=>Number.parseInt(a));s.length===3&&!s.some(a=>Number.isNaN(a))&&(i={type:"rgb",rgb:s})}else if(r==="5"){const s=Number.parseInt(t[e+n]);Number.isNaN(s)||(i={type:"table",index:Number(s)})}return[n,i]}function NZ(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n],i=Number.parseInt(r);if(!Number.isNaN(i))if(i===0)e.push({type:"resetAll"});else if(i<=9)kv[i]&&e.push({type:"setDecoration",value:kv[i]});else if(i<=29){const s=kv[i-20];s&&e.push({type:"resetDecoration",value:s})}else if(i<=37)e.push({type:"setForegroundColor",value:{type:"named",name:Nc[i-30]}});else if(i===38){const[s,a]=P7(t,n);a&&e.push({type:"setForegroundColor",value:a}),n+=s}else if(i===39)e.push({type:"resetForegroundColor"});else if(i<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:Nc[i-40]}});else if(i===48){const[s,a]=P7(t,n);a&&e.push({type:"setBackgroundColor",value:a}),n+=s}else i===49?e.push({type:"resetBackgroundColor"}):i>=90&&i<=97?e.push({type:"setForegroundColor",value:{type:"named",name:Nc[i-90+8]}}):i>=100&&i<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:Nc[i-100+8]}})}return e}function DZ(){let t=null,e=null,n=new Set;return{parse(r){const i=[];let s=0;do{const a=MZ(r,s),o=a.sequence?r.substring(s,a.startPosition):r.substring(s);if(o.length>0&&i.push({value:o,foreground:t,background:e,decorations:new Set(n)}),a.sequence){const l=NZ(a.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}s=a.position}while(s<r.length);return i}}}var IZ={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 RZ(t=IZ){function e(o){return t[o]}function n(o){return`#${o.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function i(){if(r)return r;r=[];for(let c=0;c<Nc.length;c++)r.push(e(Nc[c]));let o=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let d=0;d<6;d++)r.push(n([o[c],o[u],o[d]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function s(o){return i()[o]}function a(o){switch(o.type){case"named":return e(o.name);case"rgb":return n(o.rgb);case"table":return s(o.index)}}return{value:a}}function OZ(t,e,n){const r=Lg(t,n),i=J1(e),s=RZ(Object.fromEntries(Nc.map(o=>{var l;return[o,(l=t.colors)==null?void 0:l[`terminal.ansi${o[0].toUpperCase()}${o.substring(1)}`]]}))),a=DZ();return i.map(o=>a.parse(o[0]).map(l=>{let c,u;l.decorations.has("reverse")?(c=l.background?s.value(l.background):t.bg,u=l.foreground?s.value(l.foreground):t.fg):(c=l.foreground?s.value(l.foreground):t.fg,u=l.background?s.value(l.background):void 0),c=Mc(c,r),u=Mc(u,r),l.decorations.has("dim")&&(c=jZ(c));let d=_o.None;return l.decorations.has("bold")&&(d|=_o.Bold),l.decorations.has("italic")&&(d|=_o.Italic),l.decorations.has("underline")&&(d|=_o.Underline),{content:l.value,offset:o[1],color:c,bgColor:u,fontStyle:d}}))}function jZ(t){const e=t.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const r=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${r}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(r=>`${r}${r}`).join("")}80`;const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function mk(t,e,n={}){const{lang:r="text",theme:i=t.getLoadedThemes()[0]}=n;if(hk(r)||fk(i))return J1(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:s,colorMap:a}=t.setTheme(i);if(r==="ansi")return OZ(s,e,n);const o=t.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new Mo(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(s.name))throw new Mo(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return BZ(e,o,s,a,n)}function LZ(...t){if(t.length===2)return Jf(t[1]);const[e,n,r={}]=t,{lang:i="text",theme:s=e.getLoadedThemes()[0]}=r;if(hk(i)||fk(s))throw new Mo("Plain language does not have grammar state");if(i==="ansi")throw new Mo("ANSI language does not have grammar state");const{theme:a,colorMap:o}=e.setTheme(s),l=e.getLanguage(i);return new oh(zg(n,l,a,o,r).stateStack,l.name,a.name)}function BZ(t,e,n,r,i){const s=zg(t,e,n,r,i),a=new oh(zg(t,e,n,r,i).stateStack,e.name,n.name);return Z1(s.tokens,a),s.tokens}function zg(t,e,n,r,i){const s=Lg(n,i),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:o=500}=i,l=J1(t);let c=i.grammarState?TZ(i.grammarState,n.name)??i2:i.grammarContextCode!=null?zg(i.grammarContextCode,e,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:i2,u=[];const d=[];for(let h=0,m=l.length;h<m;h++){const[p,b]=l[h];if(p===""){u=[],d.push([]);continue}if(a>0&&p.length>=a){u=[],d.push([{content:p,offset:b,color:"",fontStyle:0}]);continue}let x,g,y;i.includeExplanation&&(x=e.tokenizeLine(p,c),g=x.tokens,y=0);const w=e.tokenizeLine2(p,c,o),C=w.tokens.length/2;for(let E=0;E<C;E++){const S=w.tokens[2*E],T=E+1<C?w.tokens[2*E+2]:p.length;if(S===T)continue;const O=w.tokens[2*E+1],z=Mc(r[Od.getForeground(O)],s),I=Od.getFontStyle(O),j={content:p.substring(S,T),offset:b+S,color:z,fontStyle:I};if(i.includeExplanation){const N=[];if(i.includeExplanation!=="scopeName")for(const P of n.settings){let J;switch(typeof P.scope){case"string":J=P.scope.split(/,/).map(q=>q.trim());break;case"object":J=P.scope;break;default:continue}N.push({settings:P,selectors:J.map(q=>q.split(/ /))})}j.explanation=[];let B=0;for(;S+B<T;){const P=g[y],J=p.substring(P.startIndex,P.endIndex);B+=J.length,j.explanation.push({content:J,scopes:i.includeExplanation==="scopeName"?zZ(P.scopes):PZ(N,P.scopes)}),y+=1}}u.push(j)}d.push(u),u=[],c=w.ruleStack}return{tokens:d,stateStack:c}}function zZ(t){return t.map(e=>({scopeName:e}))}function PZ(t,e){const n=[];for(let r=0,i=e.length;r<i;r++){const s=e[r];n[r]={scopeName:s,themeMatches:UZ(t,s,e.slice(0,r))}}return n}function $7(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function $Z(t,e,n){if(!$7(t[t.length-1],e))return!1;let r=t.length-2,i=n.length-1;for(;r>=0&&i>=0;)$7(t[r],n[i])&&(r-=1),i-=1;return r===-1}function UZ(t,e,n){const r=[];for(const{selectors:i,settings:s}of t)for(const a of i)if($Z(a,e,n)){r.push(s);break}return r}function YD(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),i=r.map(l=>{const c=mk(t,e,{...n,theme:l.theme}),u=Jf(c),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:d}}),s=HZ(...i.map(l=>l.tokens)),a=s[0].map((l,c)=>l.map((u,d)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),s.forEach((m,p)=>{const{content:b,explanation:x,offset:g,...y}=m[c][d];h.variants[r[p].color]=y}),h})),o=i[0].state?new oh(Object.fromEntries(i.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),i[0].state.lang):void 0;return o&&Z1(a,o),a}function HZ(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const i=t.map(l=>l[r]),s=e.map(()=>[]);e.forEach((l,c)=>l.push(s[c]));const a=i.map(()=>0),o=i.map(l=>l[0]);for(;o.every(l=>l);){const l=Math.min(...o.map(c=>c.content.length));for(let c=0;c<n;c++){const u=o[c];u.content.length===l?(s[c].push(u),a[c]+=1,o[c]=i[c][a[c]]):(s[c].push({...u,content:u.content.slice(0,l)}),o[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return e}function Pg(t,e,n){let r,i,s,a,o,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,g)=>x.color===c?-1:g.color===c?1:0);if(d.length===0)throw new Mo("`themes` option must not be empty");const h=YD(t,e,n);if(l=Jf(h),c&&!d.find(x=>x.color===c))throw new Mo(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=d.map(x=>t.getTheme(x.theme)),p=d.map(x=>x.color);s=h.map(x=>x.map(g=>qZ(g,p,u,c))),l&&Z1(s,l);const b=d.map(x=>Lg(x.theme,n));i=d.map((x,g)=>(g===0&&c?"":`${u+x.color}:`)+(Mc(m[g].fg,b[g])||"inherit")).join(";"),r=d.map((x,g)=>(g===0&&c?"":`${u+x.color}-bg:`)+(Mc(m[g].bg,b[g])||"inherit")).join(";"),a=`shiki-themes ${m.map(x=>x.name).join(" ")}`,o=c?void 0:[i,r].join(";")}else if("theme"in n){const c=Lg(n.theme,n);s=mk(t,e,n);const u=t.getTheme(n.theme);r=Mc(u.bg,c),i=Mc(u.fg,c),a=u.name,l=Jf(s)}else throw new Mo("Invalid options, either `theme` or `themes` must be provided");return{tokens:s,fg:i,bg:r,themeName:a,rootStyle:o,grammarState:l}}function qZ(t,e,n,r){const i={content:t.content,explanation:t.explanation,offset:t.offset},s=e.map(l=>GD(t.variants[l])),a=new Set(s.flatMap(l=>Object.keys(l))),o={};return s.forEach((l,c)=>{for(const u of a){const d=l[u]||"inherit";if(c===0&&r)o[u]=d;else{const h=u==="color"?"":u==="background-color"?"-bg":`-${u}`,m=n+e[c]+(u==="color"?"":h);o[m]=d}}}),i.htmlStyle=o,i}function $g(t,e,n,r={meta:{},options:n,codeToHast:(i,s)=>$g(t,i,s),codeToTokens:(i,s)=>Pg(t,i,s)}){var m,p;let i=e;for(const b of Bg(n))i=((m=b.preprocess)==null?void 0:m.call(r,i,n))||i;let{tokens:s,fg:a,bg:o,themeName:l,rootStyle:c,grammarState:u}=Pg(t,i,n);const{mergeWhitespaces:d=!0}=n;d===!0?s=VZ(s):d==="never"&&(s=GZ(s));const h={...r,get source(){return i}};for(const b of Bg(n))s=((p=b.tokens)==null?void 0:p.call(h,s))||s;return FZ(s,{...n,fg:a,bg:o,themeName:l,rootStyle:c},h,u)}function FZ(t,e,n,r=Jf(t)){var p,b,x;const i=Bg(e),s=[],a={type:"root",children:[]},{structure:o="classic",tabindex:l="0"}=e;let c={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([g])=>!g.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:s};const d=[],h={...n,structure:o,addClassToHast:FD,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return a},get pre(){return c},get code(){return u},get lines(){return d}};if(t.forEach((g,y)=>{var E,S;y&&(o==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):o==="classic"&&s.push({type:"text",value:`
`}));let w={type:"element",tagName:"span",properties:{class:"line"},children:[]},C=0;for(const T of g){let O={type:"element",tagName:"span",properties:{...T.htmlAttrs},children:[{type:"text",value:T.content}]};T.htmlStyle;const z=_Z(T.htmlStyle||GD(T));z&&(O.properties.style=z);for(const I of i)O=((E=I==null?void 0:I.span)==null?void 0:E.call(h,O,y+1,C,w,T))||O;o==="inline"?a.children.push(O):o==="classic"&&w.children.push(O),C+=T.content.length}if(o==="classic"){for(const T of i)w=((S=T==null?void 0:T.line)==null?void 0:S.call(h,w,y+1))||w;d.push(w),s.push(w)}}),o==="classic"){for(const g of i)u=((p=g==null?void 0:g.code)==null?void 0:p.call(h,u))||u;c.children.push(u);for(const g of i)c=((b=g==null?void 0:g.pre)==null?void 0:b.call(h,c))||c;a.children.push(c)}let m=a;for(const g of i)m=((x=g==null?void 0:g.root)==null?void 0:x.call(h,m))||m;return r&&Z1(m,r),m}function VZ(t){return t.map(e=>{const n=[];let r="",i=0;return e.forEach((s,a)=>{const l=!(s.fontStyle&&s.fontStyle&_o.Underline);l&&s.content.match(/^\s+$/)&&e[a+1]?(i||(i=s.offset),r+=s.content):r?(l?n.push({...s,offset:i,content:r+s.content}):n.push({content:r,offset:i},s),i=0,r=""):n.push(s)}),n})}function GZ(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,i,s,a]=r;if(!i&&!a)return n;const o=[{...n,offset:n.offset+i.length,content:s}];return i&&o.unshift({content:i,offset:n.offset}),a&&o.push({content:a,offset:n.offset+i.length+s.length}),o}))}function WZ(t,e,n){var s;const r={meta:{},options:n,codeToHast:(a,o)=>$g(t,a,o),codeToTokens:(a,o)=>Pg(t,a,o)};let i=yZ($g(t,e,n,r));for(const a of Bg(n))i=((s=a.postprocess)==null?void 0:s.call(r,i,n))||i;return i}const U7={light:"#333333",dark:"#bbbbbb"},H7={light:"#fffffe",dark:"#1e1e1e"},q7="__shiki_resolved";function pk(t){var o,l,c,u,d;if(t!=null&&t[q7])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||(e.type="dark"),e.colorReplacements={...e.colorReplacements},e.settings||(e.settings=[]);let{bg:n,fg:r}=e;if(!n||!r){const h=e.settings?e.settings.find(m=>!m.name&&!m.scope):void 0;(o=h==null?void 0:h.settings)!=null&&o.foreground&&(r=h.settings.foreground),(l=h==null?void 0:h.settings)!=null&&l.background&&(n=h.settings.background),!r&&((c=e==null?void 0:e.colors)!=null&&c["editor.foreground"])&&(r=e.colors["editor.foreground"]),!n&&((u=e==null?void 0:e.colors)!=null&&u["editor.background"])&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?U7.light:U7.dark),n||(n=e.type==="light"?H7.light:H7.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let i=0;const s=new Map;function a(h){var p;if(s.has(h))return s.get(h);i+=1;const m=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return(p=e.colorReplacements)!=null&&p[`#${m}`]?a(h):(s.set(h,m),m)}e.settings=e.settings.map(h=>{var x,g;const m=((x=h.settings)==null?void 0:x.foreground)&&!h.settings.foreground.startsWith("#"),p=((g=h.settings)==null?void 0:g.background)&&!h.settings.background.startsWith("#");if(!m&&!p)return h;const b={...h,settings:{...h.settings}};if(m){const y=a(h.settings.foreground);e.colorReplacements[y]=h.settings.foreground,b.settings.foreground=y}if(p){const y=a(h.settings.background);e.colorReplacements[y]=h.settings.background,b.settings.background=y}return b});for(const h of Object.keys(e.colors||{}))if((h==="editor.foreground"||h==="editor.background"||h.startsWith("terminal.ansi"))&&!((d=e.colors[h])!=null&&d.startsWith("#"))){const m=a(e.colors[h]);e.colorReplacements[m]=e.colors[h],e.colors[h]=m}return Object.defineProperty(e,q7,{enumerable:!1,writable:!1,value:!0}),e}async function XD(t){return Array.from(new Set((await Promise.all(t.filter(e=>!HD(e)).map(async e=>await VD(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function QD(t){return(await Promise.all(t.map(async n=>qD(n)?null:pk(await VD(n))))).filter(n=>!!n)}class KZ extends gJ{constructor(n,r,i,s={}){super(n);ie(this,"_resolvedThemes",new Map);ie(this,"_resolvedGrammars",new Map);ie(this,"_langMap",new Map);ie(this,"_langGraph",new Map);ie(this,"_textmateThemeCache",new WeakMap);ie(this,"_loadedThemesCache",null);ie(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=i,this._alias=s,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=pk(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=Dg.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 gi(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var a,o,l,c;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(u=>{var d;return(d=u.embeddedLangsLazy)==null?void 0:d.includes(n.name)}));this._resolver.addLanguage(n);const i={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const s=this.loadGrammarWithConfiguration(n.scopeName,1,i);if(s.name=n.name,this._resolvedGrammars.set(n.name,s),n.aliases&&n.aliases.forEach(u=>{this._alias[u]=n.name}),this._loadedLanguagesCache=null,r.size)for(const u of r)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(o=(a=this._syncRegistry)==null?void 0:a._injectionGrammars)==null||o.delete(u.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const s of n)this.resolveEmbeddedLanguages(s);const r=Array.from(this._langGraph.entries()),i=r.filter(([s,a])=>!a);if(i.length){const s=r.filter(([a,o])=>{var l;return o&&((l=o.embeddedLangs)==null?void 0:l.some(c=>i.map(([u])=>u).includes(c)))}).filter(a=>!i.includes(a));throw new gi(`Missing languages ${i.map(([a])=>`\`${a}\``).join(", ")}, required by ${s.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[s,a]of r)this._resolver.addLanguage(a);for(const[s,a]of r)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class YZ{constructor(e,n){ie(this,"_langs",new Map);ie(this,"_scopeToLang",new Map);ie(this,"_injections",new Map);ie(this,"_onigLib");this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let i=1;i<=n.length;i++){const s=n.slice(0,i).join(".");r=[...r,...this._injections.get(s)||[]]}return r}}let Dh=0;function XZ(t){Dh+=1,t.warnings!==!1&&Dh>=10&&Dh%10===0&&console.warn(`[Shiki] ${Dh} 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 e=!1;if(!t.engine)throw new gi("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(pk),i=new YZ(t.engine,n),s=new KZ(i,r,n,t.langAlias);let a;function o(y){x();const w=s.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new gi(`Language \`${y}\` not found, you may need to load it first`);return w}function l(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};x();const w=s.getTheme(y);if(!w)throw new gi(`Theme \`${y}\` not found, you may need to load it first`);return w}function c(y){x();const w=l(y);a!==y&&(s.setTheme(w),a=y);const C=s.getColorMap();return{theme:w,colorMap:C}}function u(){return x(),s.getLoadedThemes()}function d(){return x(),s.getLoadedLanguages()}function h(...y){x(),s.loadLanguages(y.flat(1))}async function m(...y){return h(await XD(y))}function p(...y){x();for(const w of y.flat(1))s.loadTheme(w)}async function b(...y){return x(),p(await QD(y))}function x(){if(e)throw new gi("Shiki instance has been disposed")}function g(){e||(e=!0,s.dispose(),Dh-=1)}return{setTheme:c,getTheme:l,getLanguage:o,getLoadedThemes:u,getLoadedLanguages:d,loadLanguage:m,loadLanguageSync:h,loadTheme:b,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function QZ(t={}){t.loadWasm;const[e,n,r]=await Promise.all([QD(t.themes||[]),XD(t.langs||[]),t.engine||wD(t.loadWasm||NQ())]);return XZ({...t,themes:e,langs:n,engine:r})}async function JZ(t={}){const e=await QZ(t);return{getLastGrammarState:(...n)=>LZ(e,...n),codeToTokensBase:(n,r)=>mk(e,n,r),codeToTokensWithThemes:(n,r)=>YD(e,n,r),codeToTokens:(n,r)=>Pg(e,n,r),codeToHast:(n,r)=>$g(e,n,r),codeToHtml:(n,r)=>WZ(e,n,r),...e,getInternalContext:()=>e}}function ZZ(t,e,n){let r,i,s;{const o=t;r=o.langs,i=o.themes,s=o.engine}async function a(o){function l(m){if(typeof m=="string"){if(HD(m))return[];const p=r[m];if(!p)throw new Mo(`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(qD(m))return"none";if(typeof m=="string"){const p=i[m];if(!p)throw new Mo(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}const u=(o.themes??[]).map(m=>c(m)),d=(o.langs??[]).map(m=>l(m)),h=await JZ({engine:o.engine??s(),...o,themes:u,langs:d});return{...h,loadLanguage(...m){return h.loadLanguage(...m.map(l))},loadTheme(...m){return h.loadTheme(...m.map(c))}}}return a}function eee(t){let e;async function n(r={}){if(e){const i=await e;return await Promise.all([i.loadTheme(...r.themes||[]),i.loadLanguage(...r.langs||[])]),i}else return e=t({...r,themes:r.themes||[],langs:r.langs||[]}),e}return n}function tee(t){const e=eee(t);return{getSingletonHighlighter(n){return e(n)},async codeToHtml(n,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHtml(n,r)},async codeToHast(n,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHast(n,r)},async codeToTokens(n,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToTokens(n,r)},async codeToTokensBase(n,r){return(await e({langs:[r.lang],themes:[r.theme]})).codeToTokensBase(n,r)},async codeToTokensWithThemes(n,r){return(await e({langs:[r.lang],themes:Object.values(r.themes).filter(Boolean)})).codeToTokensWithThemes(n,r)},async getLastGrammarState(n,r){return(await e({langs:[r.lang],themes:[r.theme]})).getLastGrammarState(n,r)}}}const nee=ZZ({langs:uQ,themes:hQ,engine:()=>wD(U(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:ree}=tee(nee),Im=["en","zh-CN"],gk={"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":t=>`Choose action for ${(t==null?void 0:t.name)??""}`,"agent.chooseActionTitle":"Choose Action","agent.colorLabel":"Color: ","agent.colorUpdated":t=>`Updated color for ${(t==null?void 0:t.name)??""}`,"agent.create":"Create a new subagent","agent.create.button":"Create Agent","agent.create.colorSelection":"Choose Background Color","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":t=>`Failed to generate subagent: ${(t==null?void 0:t.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":t=>`Created ${(t==null?void 0:t.name)??""}`,"agent.delete":"Delete","agent.delete.confirm":t=>`Are you sure you want to delete "${(t==null?void 0:t.name)??""}"?`,"agent.delete.loading":"Deleting...","agent.delete.no":"No","agent.delete.title":t=>`Delete ${(t==null?void 0:t.name)??""}`,"agent.delete.yes":"Yes, delete","agent.deleted":t=>`Deleted ${(t==null?void 0:t.name)??""}`,"agent.edit":"Edit","agent.edit.color":"Edit Color","agent.edit.tools":"Edit Tools","agent.editColorTitle":t=>`Edit Color: ${(t==null?void 0:t.name)??""}`,"agent.editTitle":t=>`Edit ${(t==null?void 0:t.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":t=>`Step ${(t==null?void 0:t.n)??""}`,"agent.tools":"Tools","agent.toolsLabel":"Tools: ","agent.toolsUpdated":t=>`Updated tools for ${(t==null?void 0:t.name)??""}`,"agent.usingCount":t=>`Using: ${(t==null?void 0:t.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":t=>`Allow execution of: '${(t==null?void 0:t.tool)??""}'?`,"approval.changeQuestion":"Apply this change?","approval.launchAgentQuestion":"Launch this agent?","approval.option.allowOnce":"Yes, allow once","approval.option.rejectOnce":"No, suggest changes (esc)","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","common.back":"back","common.cancel":"cancel","common.close":"close","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.refresh":"refresh","common.search":"Search","common.valid":"valid","common.clients":t=>`${(t==null?void 0:t.count)??0} clients`,"agent.count":t=>`${(t==null?void 0:t.count)??0} agents`,"askUser.footer":"↑/↓: Navigate | ←/→: Switch tabs | Enter: Select | Esc: Cancel","askUser.footerMulti":"↑/↓: Navigate | Space: Toggle | ←/→: Switch tabs | Enter: Confirm | Esc: Cancel","askUser.submit":"Submit","askUser.submitAnswers":"Submit answers","askUser.cancel":"Cancel","askUser.confirmTitle":"Your answers:","askUser.confirmPrompt":"Ready to submit your answers?","askUser.multiHint":"multiple choice","askUser.typePlaceholder":"Type something...","askUser.title":t=>`Ask user ${(t==null?void 0:t.count)??0} question${Number((t==null?void 0:t.count)??0)===1?"":"s"} ←`,"copy.failedFallback":"Failed to copy to the clipboard","copy.inlineLatexMissing":"No matching inline LaTeX expression found in the last AI output.","copy.latexMissing":"No matching LaTeX block found in the last AI output.","copy.noOutput":"No output in history","copy.noText":"Last AI output contains no text to copy.","copy.codeMissing":"No matching code block found in the last AI output.","copy.outputCopied":"Last output copied to the clipboard","copy.toClipboard":t=>`${(t==null?void 0:t.label)??"Selection"} copied to the clipboard`,"code.copy":"Copy","code.copied":"Copied!","mermaid.rendering":"Rendering diagram...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"active","contextUsage.autocompactBuffer":"Autocompact buffer","contextUsage.bodyLoaded":"body loaded","contextUsage.builtinTools":"Built-in tools","contextUsage.contextWindow":"Context window","contextUsage.detailHint":"Run /context detail for per-item breakdown.","contextUsage.estimatedOverhead":"Estimated pre-conversation overhead","contextUsage.free":"Free","contextUsage.memoryFiles":"Memory files","contextUsage.messages":"Messages","contextUsage.mcpTools":"MCP tools","contextUsage.model":"Model","contextUsage.noApiResponse":"No API response yet. Send a message to see actual usage.","contextUsage.overLimit":"Context exceeds limit! Use /compress or /clear to reduce.","contextUsage.skills":"Skills","contextUsage.systemPrompt":"System prompt","contextUsage.title":"Context Usage","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"Usage by category","contextUsage.used":"Used","delete.cannotCurrent":"Cannot delete the current active session.","delete.deleted":"Session deleted.","delete.deletedCount":t=>`${(t==null?void 0:t.count)??0} session(s) deleted.`,"delete.deleting":"Deleting...","delete.failed":t=>`Failed to delete session.${t!=null&&t.reason?` ${t.reason}`:""}`,"delete.footer":"↑↓ navigate · Space select · Enter delete · Esc cancel","delete.noMatch":t=>`No session matching "${(t==null?void 0:t.query)??""}"`,"delete.none":"No sessions to delete","delete.allFailed":t=>`Failed to delete ${(t==null?void 0:t.count)??0} session(s): ${(t==null?void 0:t.reason)??"unknown error"}`,"delete.nonRemoved":"No sessions were deleted.","delete.notFound":"Session not found — it may have been deleted already.","delete.partialFail":t=>`${(t==null?void 0:t.removed)??0} deleted, ${(t==null?void 0:t.failed)??0} failed: ${(t==null?void 0:t.detail)??"unknown error"}`,"delete.matches":t=>`${(t==null?void 0:t.count)??0} matches`,"delete.pressSearch":"Press / to search; Space to select; Enter to delete","delete.selected":t=>`${(t==null?void 0:t.count)??0} selected`,"delete.title":"Delete Session","time.justNow":"just now","time.minutesAgo":t=>`${(t==null?void 0:t.count)??0} min ago`,"time.hoursAgo":t=>`${(t==null?void 0:t.count)??0}h ago`,"time.daysAgo":t=>`${(t==null?void 0:t.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.released":"Session released successfully.","release.failed":t=>`Failed to release session.${t!=null&&t.reason?` ${t.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":t=>`No session matching "${(t==null?void 0:t.query)??""}"`,"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.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...","error.unsupportedTheme":"Unsupported theme. Use /theme light or /theme dark.","queue.cleared":"Queued messages cleared","queue.footer":"Press ↑ to edit queued messages · Esc to clear queue","queue.imageCount":t=>`(+${(t==null?void 0:t.count)??0} images)`,"queue.more":t=>`... (+${(t==null?void 0:t.count)??0} more)`,"help.builtIn":"Built-in commands","help.commandCount":t=>`${(t==null?void 0:t.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":t=>`${(t==null?void 0:t.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.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.","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":"commands","help.tab.custom":"custom-commands","help.tab.general":"general","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":t=>`UI language changed to ${(t==null?void 0:t.language)??""}`,"language.current":t=>`Current UI language: ${(t==null?void 0:t.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.protocol":"Protocol","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"Model IDs","auth.step.advanced":"Advanced Config","auth.stepCount":t=>`Step ${(t==null?void 0:t.step)??""}/${(t==null?void 0:t.total)??""}`,"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.saving":"Saving...","auth.termsTitle":"Terms of Services and Privacy Notice","auth.continue":"Continue","auth.footer.back":"Enter to select, ↑↓ to navigate, Esc to go back","auth.footer.close":"Enter to select, ↑↓ to navigate, Esc to close","auth.footer.input":"Enter to submit, Esc to go back","auth.footer.save":"Enter to save, Esc to go back","auth.footer.advanced":"↑↓ to navigate, Space to toggle, Enter to continue, Esc to go back","auth.modelsPrompt":t=>`Enter model IDs separated by commas. Examples: ${(t==null?void 0:t.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.help":"Show help and commands","local.language":"Change UI language","local.mcp":"Manage MCP servers","local.memory":"Manage memory","local.model":"Switch model or set fast model","local.new":"Start a new conversation","local.plan":"Enter Plan mode","local.goal":"Set a goal and keep working until it is met","local.recap":"Generate a session recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":t=>`Session renamed to ${(t==null?void 0:t.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":t=>`Extension action failed${t!=null&&t.name?` for "${t.name}"`:t!=null&&t.source?` from "${t.source}"`:""}: ${(t==null?void 0:t.error)??"Unknown error"}`,"extensions.commands.refreshFailed":"Failed to refresh extension commands.","extensions.install.failed":t=>`Failed to install extension${t!=null&&t.source?` from "${t.source}"`:""}: ${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.count)??0} extensions installed`,"extensions.manage.detailsTitle":"Extension Details","extensions.manage.disable":"Disable Extension","extensions.manage.disabled":t=>`Extension "${(t==null?void 0:t.name)??"extension"}" disabled.`,"extensions.manage.empty":"No extensions installed.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":t=>`Extension "${(t==null?void 0:t.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":t=>`Extension action queued for "${(t==null?void 0:t.name)??"extension"}".`,"extensions.manage.refreshed":t=>`Extensions refreshed in ${(t==null?void 0:t.refreshed)??0} session(s), ${(t==null?void 0:t.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":t=>`Extension "${(t==null?void 0:t.name)??"extension"}" uninstalled.`,"extensions.manage.uninstallAction":"Uninstall Extension","extensions.manage.uninstallConfirm":t=>`Uninstall extension "${(t==null?void 0:t.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":t=>`Extension "${(t==null?void 0:t.name)??"extension"}" updated.`,"extensions.manage.updatedWithVersion":t=>`Extension "${(t==null?void 0:t.name)??"extension"}" updated to v${(t==null?void 0:t.version)??""}.`,"extensions.manage.version":"Version:","extensions.manage.viewDetails":"View Details","extensions.install.installed":t=>`Extension "${(t==null?void 0:t.name)??"extension"}" installed.`,"extensions.install.installedWithVersion":t=>`Extension "${(t==null?void 0:t.name)??"extension"}" v${(t==null?void 0:t.version)??""} installed.`,"extensions.install.missingOptionValue":t=>`Missing value for ${(t==null?void 0:t.option)??"option"}`,"extensions.install.requestFailed":"Failed to install extension","extensions.install.started":t=>`Installing extension from "${(t==null?void 0:t.source)??""}"...`,"extensions.install.unknownOption":t=>`Unknown option ${(t==null?void 0:t.option)??""}`,"extensions.install.usage":"Usage: /extensions manage|install <source>","extensions.install.waitForSession":"Wait for the session to connect before installing an extension.","extensions.install.waitForTurn":"Wait for the current turn to finish before installing an extension.","local.tools":"List available tools. Usage: /tools [desc]","loadWarning.commands":"Failed to load command list; slash commands may be incomplete.","loadWarning.context":"Failed to load session context; current mode may be inaccurate.","loadWarning.models":"Failed to load model list; some model details may be unavailable.","mcp.action.auth":"Authenticate","mcp.action.authHint":"Not exposed by daemon yet","mcp.action.authMessage":"Daemon serve does not expose MCP authentication yet.","mcp.action.clearAuth":"Clear Authentication","mcp.action.disable":"Disable","mcp.action.done":t=>`${(t==null?void 0:t.action)??"Action"} complete.`,"mcp.action.enable":"Enable","mcp.action.enableMessage":"Daemon serve does not expose MCP enable/disable yet.","mcp.action.failed":t=>`Failed: ${(t==null?void 0:t.error)??""}`,"mcp.action.running":t=>`${(t==null?void 0:t.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":t=>`Starting OAuth authentication for MCP server '${(t==null?void 0:t.name)??""}'...`,"mcp.oauth.title":"OAuth Authentication","mcp.clientBudget":t=>`${(t==null?void 0:t.count)??0}/${(t==null?void 0:t.budget)??0} clients · ${(t==null?void 0:t.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.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":t=>`${(t==null?void 0:t.count)??0} servers`,"mcp.configuredServers":"Configured MCP servers:","mcp.fromExtension":t=>`(from ${(t==null?void 0:t.name)??""})`,"mcp.extensionMcp":"Extension MCP","mcp.invalidReason":t=>`invalid: ${(t==null?void 0:t.reason)??""}`,"mcp.invalidReasonLabel":"Reason:","mcp.invalidToolHelp":"Tools must have both name and description to be used by the LLM.","mcp.invalidToolWarning":"Warning: This tool cannot be called by the LLM","mcp.manageServers":"Manage MCP servers","mcp.parameters":"Parameters:","mcp.required":" required","mcp.scrollPosition":t=>`${(t==null?void 0:t.current)??0}/${(t==null?void 0:t.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":t=>`Extension: ${(t==null?void 0:t.name)??""}`,"mcp.starting":t=>`⏳ MCP servers are starting up (${(t==null?void 0:t.count)??0} initializing)...`,"mcp.startingNote":"Note: First startup may take longer. Tool availability will update automatically.","mcp.restartSkipped":t=>`Skipped ${(t==null?void 0:t.name)??""}: ${(t==null?void 0:t.reason)??""}`,"mcp.restarted":t=>`Restarted ${(t==null?void 0:t.name)??""} in ${(t==null?void 0:t.duration)??0}ms`,"mcp.restartEntries":t=>`Restarted ${(t==null?void 0:t.restarted)??0}/${(t==null?void 0:t.total)??0} ${(t==null?void 0:t.name)??""} entries${t!=null&&t.failedReasons?` (failed: ${t.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":t=>`${(t==null?void 0:t.count)??0} tool`,"mcp.toolsCount":t=>`${(t==null?void 0:t.count)??0} tools`,"mcp.toolsLabel":"Tools:","mcp.title":"MCP Servers","mcp.toolDetail":"Tool Detail","mcp.tools":"Tools","mcp.toolsForServer":t=>`Tools for ${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.count)??0} turn`,"goal.turnLabel":t=>`turn ${(t==null?void 0:t.count)??0}`,"goal.turns":t=>`${(t==null?void 0:t.count)??0} turns`,"memory.add":"Add","memory.add.desc":"Write a durable memory","memory.autoDream":t=>`Auto-dream: ${(t==null?void 0:t.status)??"unknown"} · ${(t==null?void 0:t.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":t=>`Auto-memory: ${(t==null?void 0:t.status)??"unknown"}`,"memory.autoMemoryUnsupported":"Auto-memory settings are not available from web-shell yet.","memory.autoSkill":t=>`Auto-skill: ${(t==null?void 0:t.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","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":t=>`Write ${(t==null?void 0:t.scope)??"memory"} content...`,"memory.project":"Project memory","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":t=>`Saved in ${(t==null?void 0:t.path)??""}`,"memory.saved":t=>`${(t==null?void 0:t.scope)??"Memory"} saved: ${(t==null?void 0:t.bytes)??0} bytes -> ${(t==null?void 0:t.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":"Auto mode","mode.auto.desc":"Automatically decide when approval is needed","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.desc.plan":"Analyze only, do not modify files or execute commands","mode.desc.default":"Require approval for file edits or shell commands","mode.desc.auto-edit":"Automatically approve file edits","mode.desc.auto":"auto mode","mode.desc.yolo":"Automatically approve all tools","mode.select":"Approval Mode","mode.autoApproved":t=>t!=null&&t.tool?`Auto-approved: ${t.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":t=>`current: ${(t==null?void 0:t.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":t=>`No model matching "${(t==null?void 0:t.query)??""}"`,"model.none":"No models available","model.select":"Select Model","model.setFast":"Set Fast Model","model.switch":"Switch Model","model.unknown":"unknown","resume.current":"current","resume.activePrompt":"active prompt","resume.filter":"Filter","resume.noMatch":t=>`No session matching "${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.done)??0}/${(t==null?void 0:t.total)??0} done`,"skills.available":"Available skills:","skills.none":"No skills are currently available.","skills.empty":"No skills available.","skills.footer":t=>t!=null&&t.name?`Use /skills ${t.name} to invoke · r to refresh · Esc to close`:"r to refresh · Esc to close","skills.invocable":t=>`${(t==null?void 0:t.enabled)??0}/${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.pct)??"0.0"}% context used`,"status.disconnected":"Disconnected","status.modeHint":"(shift + tab or click to switch)","status.shortcuts":"? for shortcuts","stream.cancel":"esc to cancel","stream.tokens":t=>`${(t==null?void 0:t.count)??0} tokens`,"theme.current":t=>`current: ${(t==null?void 0:t.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":t=>`✓ ${(t==null?void 0:t.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.locate":"Show in transcript","todo.more":t=>`... ${(t==null?void 0:t.count)??0} more`,"todo.moreAbove":t=>`... ${(t==null?void 0:t.count)??0} earlier`,"todo.showLess":"Show less","todo.title":"Current tasks","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":t=>{const e=(t==null?void 0:t.count)??0;return`Execution ${e} step${e===1?"":"s"}`},"turn.toolCalls":t=>{const e=(t==null?void 0:t.count)??0;return`${e} tool call${e===1?"":"s"}`},"tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":t=>`^ ${(t==null?void 0:t.count)??0} more above`,"tasks.moreBelow":t=>`v ${(t==null?void 0:t.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.pill.agent":t=>`${(t==null?void 0:t.count)??0} local agent`,"tasks.pill.agents":t=>`${(t==null?void 0:t.count)??0} local agents`,"tasks.pill.agentPaused":t=>`${(t==null?void 0:t.count)??0} local agent paused`,"tasks.pill.agentsPaused":t=>`${(t==null?void 0:t.count)??0} local agents paused`,"tasks.pill.done":t=>`${(t==null?void 0:t.count)??0} task done`,"tasks.pill.doneMany":t=>`${(t==null?void 0:t.count)??0} tasks done`,"tasks.pill.monitor":t=>`${(t==null?void 0:t.count)??0} monitor`,"tasks.pill.monitors":t=>`${(t==null?void 0:t.count)??0} monitors`,"tasks.pill.shell":t=>`${(t==null?void 0:t.count)??0} shell`,"tasks.pill.shells":t=>`${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.count)??0} events`,"tasks.detail.exit":t=>`exit ${(t==null?void 0:t.exitCode)??""}`,"tasks.detail.dropped":t=>`${(t==null?void 0:t.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.tokens":t=>`${(t==null?void 0:t.count)??0} tokens`,"tasks.detail.toolCalls":t=>`${(t==null?void 0:t.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":t=>t!=null&&t.name?`${t!=null&&t.details?"Enter/Space for details · ":""}t to toggle ${t.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":t=>`${(t==null?void 0:t.enabled)??0}/${(t==null?void 0:t.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.showAll":t=>`▼ Show all (${(t==null?void 0:t.count)??0} lines)`,"tool.showLess":"▲ Show less","tool.showFullLines":"▼ Show full lines","tool.linesTotal":t=>`▼ ${(t==null?void 0:t.count)??0} lines total`,"thinking.expand":"Expand thinking","thinking.collapse":"Collapse 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.modifiedIn":t=>`(Modified in ${(t==null?void 0:t.scope)??""})`,"settings.alsoModifiedIn":t=>`(Also modified in ${(t==null?void 0:t.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":t=>`Settings file was corrupted${(t==null?void 0:t.recovered)==="true"?" (recovered from backup)":""}`,"welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.tipLabel":"Tips:"},iee={...gk,"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.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.write":"写入文件","toolName.search":"Grep","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":t=>`选择操作：${(t==null?void 0:t.name)??""}`,"agent.chooseActionTitle":"选择操作","agent.colorLabel":"颜色：","agent.colorUpdated":t=>`已更新 ${(t==null?void 0:t.name)??""} 的颜色`,"agent.create":"创建新的智能体","agent.create.button":"创建智能体","agent.create.colorSelection":"选择背景颜色","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":t=>`生成子智能体失败：${(t==null?void 0:t.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":t=>`已创建 ${(t==null?void 0:t.name)??""}`,"agent.delete":"删除","agent.delete.confirm":t=>`确定要删除 "${(t==null?void 0:t.name)??""}" 吗？`,"agent.delete.loading":"删除中...","agent.delete.no":"否","agent.delete.title":t=>`删除 ${(t==null?void 0:t.name)??""}`,"agent.delete.yes":"是，删除","agent.deleted":t=>`已删除 ${(t==null?void 0:t.name)??""}`,"agent.edit":"编辑","agent.edit.color":"编辑颜色","agent.edit.tools":"编辑工具","agent.editColorTitle":t=>`编辑颜色：${(t==null?void 0:t.name)??""}`,"agent.editTitle":t=>`编辑 ${(t==null?void 0:t.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":t=>`步骤 ${(t==null?void 0:t.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","agent.toolsUpdated":t=>`已更新 ${(t==null?void 0:t.name)??""} 的工具`,"agent.usingCount":t=>`使用中：${(t==null?void 0:t.count)??0} 个智能体`,"agent.view":"查看","agents.closed":"智能体面板已关闭。","agents.title":"智能体","subagent.toggleStream":"展开/收起子智能体详情","toast.dismiss":"关闭通知","toast.dismissShort":"关闭","insight.ready":"Insight 报告已生成！","request.cancelled":"请求已取消。","approval.execQuestion":t=>`允许执行：'${(t==null?void 0:t.tool)??""}'？`,"approval.changeQuestion":"是否继续？","approval.launchAgentQuestion":"启动这个 agent？","approval.option.allowOnce":"是，允许一次","approval.option.rejectOnce":"否，建议更改 (esc)","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"在本项目中总是允许","approval.option.allowAlwaysUser":"对该用户总是允许","common.back":"返回","common.cancel":"取消","common.close":"关闭","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.navigate":"↑↓ 导航","common.refresh":"刷新","common.search":"搜索","common.valid":"有效","common.clients":t=>`${(t==null?void 0:t.count)??0} 个客户端`,"agent.count":t=>`${(t==null?void 0:t.count)??0} 个智能体`,"askUser.footer":"↑/↓: 导航 | ←/→: 切换标签页 | Enter: 选择 | Esc: 取消","askUser.footerMulti":"↑/↓: 导航 | 空格: 切换 | ←/→: 切换标签页 | Enter: 确认 | Esc: 取消","askUser.submit":"提交","askUser.submitAnswers":"提交答案","askUser.cancel":"取消","askUser.confirmTitle":"您的答案：","askUser.confirmPrompt":"准备好提交您的答案了吗？","askUser.multiHint":"可多选","askUser.typePlaceholder":"输入内容...","askUser.title":t=>`向用户询问 ${(t==null?void 0:t.count)??0} 个问题 ←`,"copy.failedFallback":"复制到剪贴板失败","copy.inlineLatexMissing":"最后一条 AI 输出中没有匹配的行内 LaTeX 表达式。","copy.latexMissing":"最后一条 AI 输出中没有匹配的 LaTeX 块。","copy.noOutput":"历史记录中没有可复制的输出","copy.noText":"最后一条 AI 输出没有可复制的文本。","copy.codeMissing":"最后一条 AI 输出中没有匹配的代码块。","copy.outputCopied":"已复制最后一条输出到剪贴板","copy.toClipboard":t=>`${(t==null?void 0:t.label)??"内容"} 已复制到剪贴板`,"code.copy":"复制","code.copied":"已复制！","mermaid.rendering":"正在渲染图表...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"已激活","contextUsage.autocompactBuffer":"自动压缩缓冲区","contextUsage.bodyLoaded":"已加载正文","contextUsage.builtinTools":"内置工具","contextUsage.contextWindow":"上下文窗口","contextUsage.detailHint":"运行 /context detail 查看逐项明细。","contextUsage.estimatedOverhead":"预估的对话前开销","contextUsage.free":"空闲","contextUsage.memoryFiles":"Memory 文件","contextUsage.messages":"消息","contextUsage.mcpTools":"MCP 工具","contextUsage.model":"模型","contextUsage.noApiResponse":"尚无 API 响应。发送一条消息后可查看实际使用量。","contextUsage.overLimit":"上下文已超过限制！请使用 /compress 或 /clear 减少占用。","contextUsage.skills":"Skills","contextUsage.systemPrompt":"系统提示词","contextUsage.title":"上下文使用情况","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"按类别统计","contextUsage.used":"已用","delete.cannotCurrent":"无法删除当前活动会话。","delete.deleted":"会话已删除。","delete.deletedCount":t=>`已删除 ${(t==null?void 0:t.count)??0} 个会话。`,"delete.deleting":"删除中...","delete.failed":t=>`删除会话失败。${t!=null&&t.reason?` ${t.reason}`:""}`,"delete.footer":"↑↓ 导航 · Space 选择 · Enter 删除 · Esc 取消","delete.noMatch":t=>`没有匹配 "${(t==null?void 0:t.query)??""}" 的会话`,"delete.none":"没有可删除的会话","delete.allFailed":t=>`删除 ${(t==null?void 0:t.count)??0} 个会话失败: ${(t==null?void 0:t.reason)??"未知错误"}`,"delete.nonRemoved":"没有会话被删除。","delete.notFound":"会话未找到，可能已被删除。","delete.partialFail":t=>`已删除 ${(t==null?void 0:t.removed)??0} 个，${(t==null?void 0:t.failed)??0} 个失败: ${(t==null?void 0:t.detail)??"未知错误"}`,"delete.matches":t=>`${(t==null?void 0:t.count)??0} 个匹配`,"delete.pressSearch":"按 / 搜索；Space 选择；Enter 删除","delete.selected":t=>`已选 ${(t==null?void 0:t.count)??0} 个`,"delete.title":"删除会话","time.justNow":"刚刚","time.minutesAgo":t=>`${(t==null?void 0:t.count)??0} 分钟前`,"time.hoursAgo":t=>`${(t==null?void 0:t.count)??0} 小时前`,"time.daysAgo":t=>`${(t==null?void 0:t.count)??0} 天前`,"dialog.footer.close":"Esc 关闭","dialog.footer.confirmCancel":"Enter 确认 · Esc 取消","release.cannotCurrent":"不能释放当前活动会话。","release.released":"会话已释放。","release.failed":t=>`释放会话失败。${t!=null&&t.reason?` ${t.reason}`:""}`,"release.footer":"↑↓ 导航 · Enter 释放 · Esc 取消","release.inactive":"只有活跃的 live session 才能释放。","release.inactiveBadge":"非活跃","release.noMatch":t=>`没有匹配 "${(t==null?void 0:t.query)??""}" 的会话`,"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.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.cleared":"已清空排队消息","queue.footer":"按 ↑ 编辑排队消息 · Esc 清空队列","queue.imageCount":t=>`（+${(t==null?void 0:t.count)??0} 张图片）`,"queue.more":t=>`...（还有 ${(t==null?void 0:t.count)??0} 条）`,"help.builtIn":"内置命令","help.commandCount":t=>`${(t==null?void 0:t.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":t=>`${(t==null?void 0:t.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.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":"没有可重试的失败请求。","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":t=>`UI 语言已切换为 ${(t==null?void 0:t.language)??""}`,"language.current":t=>`当前 UI 语言：${(t==null?void 0:t.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.protocol":"协议","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"模型 ID","auth.step.advanced":"高级配置","auth.stepCount":t=>`步骤 ${(t==null?void 0:t.step)??""}/${(t==null?void 0:t.total)??""}`,"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.saving":"正在保存...","auth.termsTitle":"服务条款和隐私声明","auth.continue":"继续","auth.footer.back":"Enter 选择 · ↑↓ 导航 · Esc 返回","auth.footer.close":"Enter 选择 · ↑↓ 导航 · Esc 关闭","auth.footer.input":"Enter 提交 · Esc 返回","auth.footer.save":"Enter 保存 · Esc 返回","auth.footer.advanced":"↑↓ 导航 · Space 切换 · Enter 继续 · Esc 返回","auth.modelsPrompt":t=>`输入以逗号分隔的模型 ID。例如：${(t==null?void 0:t.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.help":"查看帮助和可用命令","local.language":"切换 UI 语言","local.mcp":"管理 MCP servers","local.memory":"管理 memory","local.model":"切换模型或设置 fast model","local.new":"开始新对话","local.plan":"进入 Plan 模式","local.goal":"设置目标并持续工作直到完成","local.recap":"生成会话摘要","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":t=>`会话已重命名为 ${(t==null?void 0:t.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":t=>`扩展操作失败${t!=null&&t.name?`（${t.name}）`:t!=null&&t.source?`（${t.source}）`:""}：${(t==null?void 0:t.error)??"未知错误"}`,"extensions.commands.refreshFailed":"刷新扩展命令失败。","extensions.install.failed":t=>`安装扩展失败${t!=null&&t.source?`（${t.source}）`:""}：${(t==null?void 0:t.error)??"未知错误"}`,"extensions.manage.agents":"智能体：","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":t=>`已安装 ${(t==null?void 0:t.count)??0} 个扩展`,"extensions.manage.detailsTitle":"扩展详情","extensions.manage.disable":"禁用扩展","extensions.manage.disabled":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" 已禁用。`,"extensions.manage.empty":"未安装扩展。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":t=>`扩展 "${(t==null?void 0:t.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":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshed":t=>`已刷新 ${(t==null?void 0:t.refreshed)??0} 个 session，${(t==null?void 0:t.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":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" 已卸载。`,"extensions.manage.uninstallAction":"卸载扩展","extensions.manage.uninstallConfirm":t=>`确定卸载扩展 "${(t==null?void 0:t.name)??"扩展"}"？`,"extensions.manage.upToDate":"已是最新","extensions.manage.update":"更新扩展","extensions.manage.updateAvailable":"有可用更新","extensions.manage.updateError":"检查更新失败","extensions.manage.updated":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" 已更新。`,"extensions.manage.updatedWithVersion":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" 已更新到 v${(t==null?void 0:t.version)??""}。`,"extensions.manage.version":"版本：","extensions.manage.viewDetails":"查看详情","extensions.install.installed":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" 已安装。`,"extensions.install.installedWithVersion":t=>`扩展 "${(t==null?void 0:t.name)??"扩展"}" v${(t==null?void 0:t.version)??""} 已安装。`,"extensions.install.missingOptionValue":t=>`${(t==null?void 0:t.option)??"选项"} 缺少值`,"extensions.install.requestFailed":"安装扩展失败","extensions.install.started":t=>`正在从 "${(t==null?void 0:t.source)??""}" 安装扩展...`,"extensions.install.unknownOption":t=>`未知选项 ${(t==null?void 0:t.option)??""}`,"extensions.install.usage":"用法: /extensions manage|install <source>","extensions.install.waitForSession":"等待会话连接后再安装扩展。","extensions.install.waitForTurn":"等待当前回合结束后再安装扩展。","local.tools":"列出可用工具。用法: /tools [desc]","loadWarning.commands":"命令列表加载失败，斜杠命令可能不完整。","loadWarning.context":"会话上下文加载失败，当前模式可能不准确。","loadWarning.models":"模型列表加载失败，部分模型详情可能不可用。","mcp.action.auth":"认证","mcp.action.authHint":"daemon 尚未暴露","mcp.action.authMessage":"daemon serve 尚未暴露 MCP 认证能力。","mcp.action.clearAuth":"清空认证","mcp.action.disable":"禁用","mcp.action.done":t=>`${(t==null?void 0:t.action)??"操作"}完成。`,"mcp.action.enable":"启用","mcp.action.enableMessage":"daemon serve 尚未暴露 MCP 启用/禁用能力。","mcp.action.failed":t=>`失败：${(t==null?void 0:t.error)??""}`,"mcp.action.running":t=>`${(t==null?void 0:t.action)??"操作"}中...`,"mcp.action.reauth":"重新认证","mcp.annotation.destructive":"破坏性","mcp.annotation.idempotent":"幂等","mcp.annotation.openWorld":"开放世界","mcp.annotation.readOnly":"只读","mcp.annotations":"注解","mcp.oauth.server":"服务器","mcp.oauth.starting":t=>`正在为 MCP server '${(t==null?void 0:t.name)??""}' 启动 OAuth 认证...`,"mcp.oauth.title":"OAuth 认证","mcp.clientBudget":t=>`${(t==null?void 0:t.count)??0}/${(t==null?void 0:t.budget)??0} 个客户端 · ${(t==null?void 0:t.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.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noSchema":"没有输入 schema。","mcp.serverTool":"服务器工具","mcp.servers":t=>`${(t==null?void 0:t.count)??0} 个服务器`,"mcp.configuredServers":"已配置的 MCP 服务器：","mcp.fromExtension":t=>`（来自 ${(t==null?void 0:t.name)??""}）`,"mcp.extensionMcp":"扩展 MCP","mcp.invalidReason":t=>`无效：${(t==null?void 0:t.reason)??""}`,"mcp.invalidReasonLabel":"原因：","mcp.invalidToolHelp":"工具必须同时包含 name 和 description 才能被 LLM 使用。","mcp.invalidToolWarning":"警告：这个工具不能被 LLM 调用","mcp.manageServers":"管理 MCP servers","mcp.parameters":"参数：","mcp.required":" 必填","mcp.scrollPosition":t=>`${(t==null?void 0:t.current)??0}/${(t==null?void 0:t.total)??0}`,"mcp.shortcut.back":"Esc 返回","mcp.shortcut.close":"Esc 关闭","mcp.shortcut.selectBack":"↑↓ 导航 · Enter 选择 · Esc 返回","mcp.shortcut.selectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","mcp.settings":"设置","mcp.extension":t=>`扩展：${(t==null?void 0:t.name)??""}`,"mcp.starting":t=>`⏳ MCP 服务器正在启动（${(t==null?void 0:t.count)??0} 个初始化中）...`,"mcp.startingNote":"注意：首次启动可能需要更长时间。工具可用性会自动更新。","mcp.restartSkipped":t=>`已跳过 ${(t==null?void 0:t.name)??""}：${(t==null?void 0:t.reason)??""}`,"mcp.restarted":t=>`已重启 ${(t==null?void 0:t.name)??""}，耗时 ${(t==null?void 0:t.duration)??0}ms`,"mcp.restartEntries":t=>`已重启 ${(t==null?void 0:t.name)??""} 的 ${(t==null?void 0:t.restarted)??0}/${(t==null?void 0:t.total)??0} 个条目${t!=null&&t.failedReasons?`（失败：${t.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":t=>`${(t==null?void 0:t.count)??0} 个工具`,"mcp.toolsCount":t=>`${(t==null?void 0:t.count)??0} 个工具`,"mcp.toolsLabel":"工具：","mcp.title":"MCP Servers","mcp.toolDetail":"工具详情","mcp.tools":"工具","mcp.toolsForServer":t=>`${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.count)??0} 轮`,"goal.turnLabel":t=>`第 ${(t==null?void 0:t.count)??0} 轮`,"goal.turns":t=>`${(t==null?void 0:t.count)??0} 轮`,"memory.add":"添加","memory.add.desc":"写入一条持久 memory","memory.autoDream":t=>`自动整理：${(t==null?void 0:t.status)??"未知"} · ${(t==null?void 0:t.lastDream)??"从未"} · /dream 立即运行`,"memory.autoDreamUnsupported":"web-shell 暂不支持修改自动整理设置。","memory.autoFolder":"打开自动记忆文件夹","memory.autoMemory":t=>`自动记忆：${(t==null?void 0:t.status)??"未知"}`,"memory.autoMemoryUnsupported":"web-shell 暂不支持修改自动记忆设置。","memory.autoSkill":t=>`自动技能：${(t==null?void 0:t.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":"User memory","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":t=>`写入${(t==null?void 0:t.scope)??"memory"}内容...`,"memory.project":"Project memory","memory.project.desc":"保存到当前 workspace memory 文件","memory.refresh":"刷新","memory.refresh.desc":"重新加载 memory 文件信息","memory.refreshed":"Memory 已刷新。","memory.save":"保存 Memory","memory.savedIn":t=>`Saved in ${(t==null?void 0:t.path)??""}`,"memory.saved":t=>`${(t==null?void 0:t.scope)??"Memory"} 已保存：${(t==null?void 0:t.bytes)??0} 字节 -> ${(t==null?void 0:t.path)??""}`,"memory.saving":"保存中...","memory.show":"查看","memory.show.desc":"查看已配置的 memory 文件","memory.status":"Workspace 和用户 memory 文件","memory.unknown":"未知","memory.write":"写入 memory 内容","mode.auto":"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.desc.plan":"仅分析，不修改文件或执行命令","mode.desc.default":"编辑文件或执行命令前需要批准","mode.desc.auto-edit":"自动批准文件编辑","mode.desc.auto":"auto 模式","mode.desc.yolo":"自动批准所有工具","mode.select":"审批模式","mode.autoApproved":t=>t!=null&&t.tool?`已自动批准：${t.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":t=>`当前：${(t==null?void 0:t.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":t=>`没有匹配 "${(t==null?void 0:t.query)??""}" 的模型`,"model.none":"没有可用模型","model.select":"选择模型","model.setFast":"设置 Fast Model","model.switch":"切换模型","model.unknown":"未知","resume.current":"当前","resume.activePrompt":"正在运行","resume.filter":"筛选","resume.noMatch":t=>`没有匹配 "${(t==null?void 0:t.query)??""}" 的会话`,"resume.none":"没有可恢复的会话","resume.pressSearch":"按 / 搜索","resume.search":"搜索","resume.title":"恢复会话","parallelAgents.title":"并行智能体","parallelAgents.done":t=>`${(t==null?void 0:t.done)??0}/${(t==null?void 0:t.total)??0} 完成`,"skills.available":"可用 skills:","skills.none":"当前没有可用 skill。","skills.empty":"没有可用 skill。","skills.footer":t=>t!=null&&t.name?`使用 /skills ${t.name} 调用 · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","skills.invocable":t=>`${(t==null?void 0:t.enabled)??0}/${(t==null?void 0:t.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":t=>`上下文已用 ${(t==null?void 0:t.pct)??"0.0"}%`,"status.disconnected":"断开连接","status.modeHint":"(shift + tab 或点击切换)","status.shortcuts":"? 查看快捷键","stream.cancel":"esc 取消","stream.tokens":t=>`${(t==null?void 0:t.count)??0} tokens`,"theme.current":t=>`当前：${(t==null?void 0:t.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":t=>`✓ 已完成 ${(t==null?void 0:t.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.locate":"在会话中定位","todo.more":t=>`... 还有 ${(t==null?void 0:t.count)??0} 项`,"todo.moreAbove":t=>`... 前面还有 ${(t==null?void 0:t.count)??0} 项`,"todo.showLess":"收起","todo.title":"当前任务","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":t=>`执行过程 ${(t==null?void 0:t.count)??0} 步`,"turn.toolCalls":t=>`工具 ${(t==null?void 0:t.count)??0} 次`,"tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":t=>`^ 上方还有 ${(t==null?void 0:t.count)??0} 个`,"tasks.moreBelow":t=>`v 下方还有 ${(t==null?void 0:t.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.pill.agent":t=>`${(t==null?void 0:t.count)??0} 个本地智能体`,"tasks.pill.agents":t=>`${(t==null?void 0:t.count)??0} 个本地智能体`,"tasks.pill.agentPaused":t=>`${(t==null?void 0:t.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":t=>`${(t==null?void 0:t.count)??0} 个本地智能体已暂停`,"tasks.pill.done":t=>`${(t==null?void 0:t.count)??0} 个任务完成`,"tasks.pill.doneMany":t=>`${(t==null?void 0:t.count)??0} 个任务完成`,"tasks.pill.monitor":t=>`${(t==null?void 0:t.count)??0} 个监控`,"tasks.pill.monitors":t=>`${(t==null?void 0:t.count)??0} 个监控`,"tasks.pill.shell":t=>`${(t==null?void 0:t.count)??0} 个 shell`,"tasks.pill.shells":t=>`${(t==null?void 0:t.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":t=>`${(t==null?void 0:t.count)??0} 个事件`,"tasks.detail.exit":t=>`退出码 ${(t==null?void 0:t.exitCode)??""}`,"tasks.detail.dropped":t=>`${(t==null?void 0:t.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.tokens":t=>`${(t==null?void 0:t.count)??0} tokens`,"tasks.detail.toolCalls":t=>`${(t==null?void 0:t.count)??0} 次工具调用`,"tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":t=>t!=null&&t.name?`${t!=null&&t.details?"Enter/Space 查看详情 · ":""}t 切换 ${t.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.loading":"正在加载工具...","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":t=>`${(t==null?void 0:t.enabled)??0}/${(t==null?void 0:t.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.showAll":t=>`▼ 显示全部（${(t==null?void 0:t.count)??0} 行）`,"tool.showLess":"▲ 显示更少","tool.showFullLines":"▼ 显示完整行","tool.linesTotal":t=>`▼ 共 ${(t==null?void 0:t.count)??0} 行`,"thinking.expand":"展开思考","thinking.collapse":"收起思考","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.modifiedIn":t=>`（已在${(t==null?void 0:t.scope)??""}中修改）`,"settings.alsoModifiedIn":t=>`（同时在${(t==null?void 0:t.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.readOnly":"User 级别设置在 daemon 模式下为只读。","settings.requiresRestart":"此更改需要重启后才能生效。","settings.corrupted":t=>`设置文件已损坏${(t==null?void 0:t.recovered)==="true"?"（已从备份恢复）":""}`,"settings.category.General":"通用","settings.category.UI":"界面","settings.category.Privacy":"隐私","settings.category.Model":"模型","settings.category.Context":"上下文","settings.category.Tools":"工具","settings.category.Daemon":"守护进程","settings.category.Experimental":"实验性","settings.category.Advanced":"高级","settings.label.general.enableAutoUpdate":"启用自动更新","settings.description.general.enableAutoUpdate":"启动时自动检查并安装更新。","settings.label.general.showSessionRecap":"显示会话回顾","settings.description.general.showSessionRecap":"离开终端一段时间后返回时，自动显示一行“上次停在这里”的回顾。默认关闭。也可以随时使用 /recap 手动触发。","settings.label.general.sessionRecapAwayThresholdMinutes":"会话回顾离开阈值（分钟）","settings.description.general.sessionRecapAwayThresholdMinutes":"终端失焦多少分钟后，下一次重新聚焦时触发自动回顾。默认与 Claude Code 一致为 5 分钟；如果只是短暂切换窗口，可以调高。","settings.label.general.cleanupPeriodDays":"清理周期（天）","settings.description.general.cleanupPeriodDays":"~/.qwen/file-history/ 中用于 /rewind 的会话备份保留天数。后台清理最多每天运行一次。设为 0 表示最小保留（约 1 小时），仍会保护最近一小时触碰过的会话和当前活动会话。","settings.label.general.gitCoAuthor.commit":"归因：commit","settings.description.general.gitCoAuthor.commit":"通过 Qwen Code 创建 commit 时，添加 Co-authored-by trailer，并写入逐文件 AI 归因 git note。关闭后两者都会跳过。","settings.label.general.gitCoAuthor.pr":"归因：PR","settings.description.general.gitCoAuthor.pr":"运行 gh pr create 时，在 PR 描述中追加 Qwen Code 归因行。","settings.label.general.language":"语言：界面","settings.description.general.language":"用户界面的语言。使用 auto 可根据系统设置自动检测；也可以在 ~/.qwen/locales/ 中放置 JS 语言文件来使用自定义语言代码。","settings.label.general.dynamicCommandTranslation":"语言：动态命令翻译","settings.description.general.dynamicCommandTranslation":"为动态 slash command 描述启用 AI 翻译。关闭后动态命令使用原始描述，也不会触发翻译模型调用。","settings.label.general.preventSystemSleep":"运行时防止系统睡眠","settings.description.general.preventSystemSleep":"当 Qwen Code 正在流式生成模型回复或执行工具时防止系统睡眠。空闲输入状态和权限确认状态不会阻止睡眠。","settings.label.ui.theme":"主题","settings.description.ui.theme":"界面的颜色主题。","settings.label.ui.hideTips":"隐藏提示","settings.description.ui.hideTips":"隐藏界面中的帮助提示。","settings.label.ui.enableWelcomeBack":"显示欢迎回来对话框","settings.description.ui.enableWelcomeBack":"回到有历史会话的项目时显示欢迎回来对话框。选择“开始新的聊天会话”后，在项目摘要变化前不会再次显示。","settings.label.ui.enableUserFeedback":"启用用户反馈","settings.description.ui.enableUserFeedback":"对话结束后显示可选反馈对话框，帮助改进 Qwen 表现。","settings.label.ui.enableFollowupSuggestions":"启用后续建议","settings.description.ui.enableFollowupSuggestions":"任务完成后显示上下文相关的后续建议。按 Tab 或右方向键接受，按 Enter 接受并提交。","settings.label.ui.compactMode":"紧凑模式","settings.description.ui.compactMode":"隐藏工具输出和思考内容，显示更简洁的视图（可用 Ctrl+O 切换）。","settings.label.ui.compactInline":"紧凑内联","settings.description.ui.compactInline":"在每个分组内紧凑显示工具内容，而不是跨分组合并。需要先启用紧凑模式。","settings.label.ui.shellOutputMaxLines":"Shell 输出最大行数","settings.description.ui.shellOutputMaxLines":"内联显示的 shell 输出最大行数。设为 0 可取消限制并显示完整输出；隐藏行数仍会通过 +N lines 指示器展示。","settings.label.privacy.usageStatisticsEnabled":"启用使用统计","settings.description.privacy.usageStatisticsEnabled":"启用使用统计收集。","settings.label.fastModel":"快速模型","settings.description.fastModel":"用于生成提示建议和推测执行的模型。留空则使用主模型。较小/更快的模型（例如 qwen3-coder-flash）可以降低延迟和成本。","settings.label.context.fileFiltering.respectGitIgnore":"遵守 .gitignore","settings.description.context.fileFiltering.respectGitIgnore":"搜索时遵守 .gitignore 文件。","settings.label.context.fileFiltering.respectQwenIgnore":"遵守 .qwenignore","settings.description.context.fileFiltering.respectQwenIgnore":"搜索时遵守 .qwenignore 文件。","settings.label.context.fileFiltering.enableFuzzySearch":"启用模糊搜索","settings.description.context.fileFiltering.enableFuzzySearch":"搜索文件时启用模糊搜索。","settings.label.tools.toolSearch.enabled":"启用 ToolSearch","settings.description.tools.toolSearch.enabled":"启用后，MCP 工具会通过 ToolSearch 按需加载，以减少提示词大小。对于依赖前缀 KV 缓存的模型（如 DeepSeek），可关闭此项来保持提示词前缀稳定并提高缓存命中率。","settings.label.tools.shell.enableInteractiveShell":"交互式 Shell（PTY）","settings.description.tools.shell.enableInteractiveShell":"使用 node-pty 提供交互式 shell 体验。PTY 不可用时回退到 child_process。","settings.label.tools.computerUse.enabled":"启用 Computer Use","settings.description.tools.computerUse.enabled":"启用后（默认），会注册 9 个 computer_use__* 延迟内置工具。","settings.label.policy.permissionStrategy":"权限协调策略","settings.description.policy.permissionStrategy":"多个客户端连接时权限请求的决策方式。first-responder 表示任意客户端先响应者生效；designated 表示仅提示发起方决策；consensus 表示需要 N-of-M 投票同意；local-only 表示只有 loopback 客户端可决策。需要重启 daemon 后生效。","settings.option.policy.permissionStrategy.first-responder":"先响应者","settings.option.policy.permissionStrategy.designated":"指定发起方","settings.option.policy.permissionStrategy.consensus":"共识法定人数","settings.option.policy.permissionStrategy.local-only":"仅本机","settings.label.experimental.enableCronTools":"启用 Cron/Loop 工具","settings.description.experimental.enableCronTools":"启用会话内 cron/loop 工具（实验性）。启用后，模型可以用 cron_create、cron_list 和 cron_delete 创建周期性提示。也可通过 QWEN_CODE_ENABLE_CRON=1 环境变量启用。","settings.label.experimental.emitToolUseSummaries":"工具使用摘要","settings.description.experimental.emitToolUseSummaries":"每个工具批次完成后生成一个简短的 LLM 标签。紧凑模式下会替代通用的 Tool × N 标题；完整模式下显示为工具组下方的弱化 ● <label> 行。需要配置快速模型。","settings.label.agents.arena.preserveArtifacts":"保留 Arena 产物","settings.description.agents.arena.preserveArtifacts":"启用后，Arena worktree 和会话状态文件会在会话结束或主智能体退出后保留。","welcome.modeHint":"Shift+Tab 或 /approval-mode","welcome.tipLabel":"提示："},see={en:gk,"zh-CN":iee},aee={en:"English [en]","zh-CN":"中文 [zh-CN]"},JD=v.createContext({language:"en",t:t=>t});function Rl(t){const e=t==null?void 0:t.trim().toLowerCase();return e&&(e==="zh"||e==="zh-cn"||e==="zh_cn")?"zh-CN":"en"}function yk(t){if(typeof t!="string")return;const e=t.trim().toLowerCase().replace(/_/g,"-");if(e){if(e==="auto")return Rl(typeof navigator<"u"?navigator.language:void 0);if(e==="zh"||e==="zh-cn"||e==="chinese"||e==="中文")return"zh-CN";if(e==="en"||e==="en-us"||e==="english")return"en"}}function bk(t){return aee[t]}function ZD(t){const e=see[t];return(n,r)=>{const i=e[n]??gk[n]??n;return typeof i=="function"?i(r):i}}function oee({language:t,children:e}){const n=v.useMemo(()=>({language:t,t:ZD(t)}),[t]);return f.jsx(JD.Provider,{value:n,children:e})}function dt(){return v.useContext(JD)}const lee="_content_dkiti_1",cee="_inlineCode_dkiti_62",uee="_link_dkiti_71",dee="_tableWrapper_dkiti_80",hee="_table_dkiti_80",fee="_image_dkiti_103",mee="_codeBlock_dkiti_109",pee="_codeBlockHeader_dkiti_118",gee="_codeBlockLang_dkiti_127",yee="_codeBlockCopy_dkiti_133",bee="_codeBlockContent_dkiti_149",vee="_codeBlockPlain_dkiti_166",xee="_mermaidBlock_dkiti_181",wee="_mermaidInline_dkiti_193",kee="_mermaidLoading_dkiti_212",_ee="_mermaidActions_dkiti_219",on={content:lee,inlineCode:cee,link:uee,tableWrapper:dee,table:hee,image:fee,codeBlock:mee,codeBlockHeader:pee,codeBlockLang:gee,codeBlockCopy:yee,codeBlockContent:bee,codeBlockPlain:vee,mermaidBlock:xee,mermaidInline:wee,mermaidLoading:kee,mermaidActions:_ee},See=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","ruby","php","swift","kotlin","scala","shell","bash","zsh","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),eI=/^(https?:|mailto:)/i,Tee=/^data:image\/(png|jpeg|gif|webp);base64,/i;function Cee(t){if(!t)return!1;const e=t.trim();return e?e.startsWith("#")||e.startsWith("/")&&!e.startsWith("//")?!0:eI.test(e):!1}function tI(t){if(!t)return!1;const e=t.trim();return e?e.startsWith("#")||e.startsWith("/")&&!e.startsWith("//")||Tee.test(e)?!0:eI.test(e):!1}const Eee=128,Cc=new Map;function Aee(t,e,n){const r=`${e}\0${n}\0${t}`,i=Cc.get(r);return i!==void 0?Promise.resolve(i):ree(t,{lang:e,theme:n}).then(s=>{if(Cc.size>=Eee){const a=Cc.keys().next().value;a!==void 0&&Cc.delete(a)}return Cc.set(r,s),s})}let F7,Mee=0;function Nee({code:t}){const{t:e}=dt(),n=tM(),[r,i]=v.useState(null),[s,a]=v.useState(null),[o,l]=v.useState("diagram"),[c,u]=v.useState(!1),d=n==="light"?"default":"dark";v.useEffect(()=>{let m=!1;i(null),a(null);const p=setTimeout(()=>{U(()=>import("./mermaid.core-D1KEFDhn.js").then(b=>b.bm),[]).then(async b=>{if(m)return;const x=b.default;F7!==d&&(x.initialize({startOnLoad:!1,theme:d,securityLevel:"strict",suppressErrorRendering:!0}),F7=d);try{const g=`mermaid-${++Mee}`,{svg:y}=await x.render(g,t.trim());m||i(y)}catch(g){m||a(g instanceof Error?g.message:"Mermaid render failed")}})},150);return()=>{m=!0,clearTimeout(p)}},[t,d]);const h=()=>{navigator.clipboard.writeText(t).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)},()=>{})};return s?f.jsxs("div",{className:on.codeBlock,children:[f.jsx("div",{className:on.codeBlockHeader,children:f.jsx("span",{className:on.codeBlockLang,children:"mermaid (error)"})}),f.jsx("pre",{className:`${on.codeBlockContent} ${on.codeBlockPlain}`,children:f.jsx("code",{children:t})})]}):f.jsxs("div",{className:on.codeBlock,children:[f.jsxs("div",{className:on.codeBlockHeader,children:[f.jsx("span",{className:on.codeBlockLang,children:"mermaid"}),f.jsxs("span",{className:on.mermaidActions,children:[f.jsx("button",{className:on.codeBlockCopy,onClick:()=>l(o==="diagram"?"code":"diagram"),children:e(o==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),f.jsx("button",{className:on.codeBlockCopy,onClick:h,children:e(c?"code.copied":"code.copy")})]})]}),o==="code"?f.jsx("pre",{className:`${on.codeBlockContent} ${on.codeBlockPlain}`,children:f.jsx("code",{children:t})}):r?f.jsx("div",{className:`${on.mermaidBlock} ${on.mermaidInline}`,dangerouslySetInnerHTML:{__html:r}}):f.jsx("div",{className:`${on.mermaidBlock} ${on.mermaidLoading} ${on.mermaidInline}`,children:f.jsx("span",{children:e("mermaid.rendering")})})]})}function Dee({className:t,children:e,deferMermaid:n}){const{t:r}=dt(),i=tM(),[s,a]=v.useState(null),[o,l]=v.useState(!1),c=t==null?void 0:t.match(/language-(\w+)/),u=(c==null?void 0:c[1])||"",d=String(e).replace(/\n$/,""),h=See.has(u)?u:"text",m=i==="light"?"github-light-default":"github-dark-default";v.useEffect(()=>{if(u==="mermaid"||h==="text"){a(null);return}const b=`${h}\0${m}\0${d}`;if(Cc.has(b)){a(Cc.get(b));return}let x=!1;a(null);const g=setTimeout(()=>{Aee(d,h,m).then(y=>{x||a(y)}).catch(()=>{x||a(null)})},120);return()=>{x=!0,clearTimeout(g)}},[d,u,h,m]);const p=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return u==="mermaid"&&!n?f.jsx(Nee,{code:d}):f.jsxs("div",{className:on.codeBlock,children:[f.jsxs("div",{className:on.codeBlockHeader,children:[f.jsx("span",{className:on.codeBlockLang,children:u||"text"}),f.jsx("button",{className:on.codeBlockCopy,onClick:p,children:r(o?"code.copied":"code.copy")})]}),s?f.jsx("div",{className:on.codeBlockContent,dangerouslySetInnerHTML:{__html:s}}):f.jsx("pre",{className:`${on.codeBlockContent} ${on.codeBlockPlain}`,children:f.jsx("code",{children:d})})]})}function Iee({children:t}){return f.jsx("code",{className:on.inlineCode,children:t})}function nI(t){return{code({className:e,children:n}){return(e==null?void 0:e.startsWith("language-"))||typeof n=="string"&&n.includes(`
`)?f.jsx(Dee,{className:e,deferMermaid:t,children:String(n)}):f.jsx(Iee,{children:n})},pre({children:e}){return f.jsx(f.Fragment,{children:e})},a({href:e,children:n}){const r=Cee(e)?e:void 0;return f.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:on.link,children:n})},table({children:e}){return f.jsx("div",{className:on.tableWrapper,children:f.jsx("table",{className:on.table,children:e})})},img({src:e,alt:n}){const r=tI(e)?e:void 0;return f.jsx("img",{src:r,alt:n||"",className:on.image})}}}const Ree=nI(),Oee=nI(!0),hd=v.memo(function({content:e,source:n,deferMermaid:r}){const{markdown:i}=du();if(!e)return null;const s=n?i:void 0,a=n&&(s!=null&&s.transformMarkdown)?s.transformMarkdown(e,{source:n}):e,o=r?Oee:Ree,l=s!=null&&s.components?{...o,...s.components}:o,c=s!=null&&s.remarkPlugins?[DS,y7,...s.remarkPlugins]:[DS,y7],u=s!=null&&s.rehypePlugins?[C7,...s.rehypePlugins]:[C7];return f.jsx("div",{className:n!=="thinking"?on.content:void 0,"data-markdown-source":n,children:f.jsx(yG,{remarkPlugins:c,rehypePlugins:u,components:l,children:a})})}),jee="_message_1htq5_1",Lee="_collapsedHead_1htq5_14",Bee="_prefix_1htq5_18",zee="_body_1htq5_24",Pee="_collapseRow_1htq5_38",$ee="_collapseToggle_1htq5_54",Uee="_collapseMeta_1htq5_74",Hee="_images_1htq5_80",qee="_imageThumb_1htq5_87",ma={message:jee,collapsedHead:Lee,prefix:Bee,body:zee,collapseRow:Pee,collapseToggle:$ee,collapseMeta:Uee,images:Hee,imageThumb:qee};function Fee(t){if(t<1e3)return`${Math.max(0,Math.round(t))}ms`;const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=Math.round(e-n*60);return`${n}m ${r}s`}function _v(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:`${t}`}function Vee(t,e,n){const r=[];if(e!==void 0&&r.push(Fee(e)),t.inputTokens!==void 0&&t.outputTokens!==void 0){const i=t.cachedTokens??0,s=i>0&&t.inputTokens>0?` (${_v(i)} ${n("turn.cached")}, ${Math.round(i/t.inputTokens*100)}%)`:"";r.push(`↑${_v(t.inputTokens)}${s} ↓${_v(t.outputTokens)}`)}return t.toolCallCount!==void 0&&t.toolCallCount>0&&r.push(n("turn.toolCalls",{count:t.toolCallCount})),r.join(" · ")}function Gee(t){return t.inputTokens!==void 0&&t.outputTokens!==void 0||t.toolCallCount!==void 0&&t.toolCallCount>0}function Wee(t){const[e,n]=v.useState(()=>Date.now());return v.useEffect(()=>{if(!t)return;n(Date.now());const r=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(r)},[t]),e}const Kee=v.memo(function({content:e,images:n,collapse:r,onToggleCollapse:i}){const{t:s}=dt(),a=!!r&&r.hiddenCount>0,o=r==null?void 0:r.liveStartedAt,l=!!r&&(a||o!==void 0||Gee(r)),c=Wee(o!==void 0&&l),u=v.useRef(0);let d;o!==void 0&&l?(u.current=Math.max(u.current,Math.max(0,c-o)),d=u.current):l&&(r==null?void 0:r.elapsedMs)!==void 0?(u.current=Math.max(u.current,r.elapsedMs),d=u.current):d=void 0;const h=r?Vee(r,d,s):"",m=!!h&&l;return f.jsxs("div",{className:r!=null&&r.collapsed?`${ma.message} ${ma.collapsedHead}`:ma.message,children:[f.jsx("span",{className:ma.prefix,children:f.jsx(ZA,{})}),f.jsxs("div",{className:ma.body,children:[n&&n.length>0&&f.jsx("div",{className:ma.images,children:n.map((p,b)=>{const x=p.data.startsWith("data:")?p.data:`data:${p.mimeType};base64,${p.data}`;return tI(x)?f.jsx("img",{src:x,alt:`User uploaded image ${b+1}`,className:ma.imageThumb},b):null})}),e,r&&i&&(a||m)&&f.jsxs("div",{className:ma.collapseRow,children:[a&&f.jsx("button",{type:"button",className:ma.collapseToggle,onClick:()=>i(r.turnId),"aria-expanded":!r.collapsed,"aria-label":r.collapsed?s("turn.expand"):s("turn.collapse"),title:r.collapsed?s("turn.expand"):s("turn.collapse"),children:`${r.collapsed?"▸":"▾"} ${s("turn.executionSteps",{count:r.hiddenCount})}`}),m&&f.jsx("span",{className:ma.collapseMeta,children:a?` · ${h}`:h})]})]})]})}),Yee="_message_hrrk6_1",Xee="_prefix_hrrk6_8",Qee="_thinking_hrrk6_15",Jee="_thinkingBody_hrrk6_28",Zee="_thinkingPreviewWrap_hrrk6_59",ete="_thinkingExpandedWrap_hrrk6_60",tte="_thinkingPreview_hrrk6_59",nte="_thinkingPreviewTail_hrrk6_73",rte="_expandToggle_hrrk6_88",ite="_thinkingPreviewOverflow_hrrk6_111",ste="_content_hrrk6_147",ate="_contentBody_hrrk6_152",ui={message:Yee,prefix:Xee,thinking:Qee,thinkingBody:Jee,thinkingPreviewWrap:Zee,thinkingExpandedWrap:ete,thinkingPreview:tte,thinkingPreviewTail:nte,expandToggle:rte,thinkingPreviewOverflow:ite,content:ste,contentBody:ate},ote=v.memo(function({content:e,thinking:n,isStreaming:r}){const{t:i}=dt(),s=v.useContext(dh),{compactThinking:a}=du(),[o,l]=v.useState(!1),[c,u]=v.useState(!1),d=v.useRef(null),h=a&&!o;v.useEffect(()=>{const p=d.current;!p||!h||u(p.scrollHeight>p.clientHeight)},[h,n]),v.useEffect(()=>{const p=d.current;if(!p||!h)return;let b=0;const x=()=>{u(p.scrollHeight>p.clientHeight)},g=()=>{cancelAnimationFrame(b),b=requestAnimationFrame(x)};g();const y=new ResizeObserver(g);return y.observe(p),()=>{cancelAnimationFrame(b),y.disconnect()}},[h]),v.useEffect(()=>{const p=d.current;!p||!h||(r&&!e?p.scrollTop=p.scrollHeight:p.scrollTop=0)},[h,r,n,e]);const m=v.useCallback(()=>{l(p=>!p)},[]);return f.jsxs("div",{className:ui.message,children:[n&&!s&&f.jsxs("div",{className:ui.thinking,children:[f.jsx("span",{className:ui.prefix,children:"✦"}),f.jsx("div",{className:ui.thinkingBody,children:h?f.jsxs("div",{className:c?`${ui.thinkingPreviewWrap} ${ui.thinkingPreviewOverflow}`:ui.thinkingPreviewWrap,children:[f.jsx("div",{ref:d,className:`${ui.thinkingPreview} ${r?ui.thinkingPreviewTail:""}`,children:f.jsx(hd,{content:n,source:"thinking",deferMermaid:r})}),c&&f.jsx("button",{className:ui.expandToggle,onClick:m,"aria-expanded":!1,"aria-label":i("thinking.expand"),title:i("thinking.expand"),children:"▼"})]}):f.jsxs("div",{className:ui.thinkingExpandedWrap,children:[f.jsx(hd,{content:n,source:"thinking",deferMermaid:r}),a&&o&&f.jsx("button",{className:ui.expandToggle,onClick:m,"aria-expanded":!0,"aria-label":i("thinking.collapse"),title:i("thinking.collapse"),children:"▲"})]})})]}),e&&f.jsxs("div",{className:ui.content,children:[f.jsx("span",{className:ui.prefix,children:"✦"}),f.jsx("div",{className:ui.contentBody,children:f.jsx(hd,{content:e,source:"assistant",deferMermaid:r})})]})]})}),lte="_panel_1mqv4_1",cte="_title_1mqv4_17",ute="_metaLine_1mqv4_23",dte="_progress_1mqv4_33",hte="_spacer_1mqv4_39",fte="_row_1mqv4_43",mte="_detailRow_1mqv4_44",pte="_subDetailRow_1mqv4_45",gte="_symbol_1mqv4_66",yte="_label_1mqv4_70",bte="_value_1mqv4_74",vte="_detailName_1mqv4_81",xte="_sectionTitle_1mqv4_89",wte="_detailSection_1mqv4_95",kte="_skillBlock_1mqv4_101",_te="_hint_1mqv4_106",Ste="_detailCommand_1mqv4_112",Tte="_bodyLoaded_1mqv4_133",Cte="_accent_1mqv4_138",Ete="_secondary_1mqv4_142",Ate="_warning_1mqv4_146",Mte="_error_1mqv4_150",Nte="_success_1mqv4_154",yt={panel:lte,title:cte,metaLine:ute,progress:dte,spacer:hte,row:fte,detailRow:mte,subDetailRow:pte,symbol:gte,label:yte,value:bte,detailName:vte,sectionTitle:xte,detailSection:wte,skillBlock:kte,hint:_te,detailCommand:Ste,bodyLoaded:Tte,accent:Cte,secondary:Ete,warning:Ate,error:Mte,success:Nte},a2="web-shell:context-usage:v1:",nl="█",rI="▒",iI="░",sI=30;function Dte(t){return`${a2}${JSON.stringify(t)}`}function Ite(t){if(!t.startsWith(a2))return null;try{const e=JSON.parse(t.slice(a2.length));return!(e!=null&&e.usage)||typeof e.usage.totalTokens!="number"?null:e}catch{return null}}function aI(t,e){return t.length<=e?t:`${t.slice(0,e-1)}…`}function jd(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:`${t}`}function Rte(t,e){if(e<=0)return"0.0";const n=t/e*100;return n>100?">100":n.toFixed(1)}function Ote(t){return[...t].sort((e,n)=>n.tokens-e.tokens)}function jte({usedPercentage:t,bufferPercentage:e}){const r=Math.round(Math.min(t,100)/100*56),i=Math.round(Math.min(e,Math.max(0,100-t))/100*56),s=Math.max(0,56-r-i),a=t>80?yt.error:t>60?yt.warning:yt.accent;return f.jsxs("div",{className:yt.progress,"aria-hidden":"true",children:[f.jsx("span",{className:a,children:nl.repeat(Math.max(0,r))}),f.jsx("span",{className:yt.secondary,children:iI.repeat(Math.max(0,s))}),f.jsx("span",{className:yt.warning,children:rI.repeat(Math.max(0,i))})]})}function oo({symbol:t,label:e,tokens:n,tokenLabel:r,contextWindowSize:i,symbolClassName:s=yt.secondary,isOverLimit:a}){return f.jsxs("div",{className:yt.row,children:[f.jsx("span",{className:`${yt.symbol} ${s}`,children:t}),f.jsx("span",{className:yt.label,children:e}),f.jsxs("span",{className:a?yt.error:yt.value,children:[jd(n)," ",r," (",Rte(n,i),"%)"]})]})}const Sv="/context detail";function Lte({hint:t,onShowDetail:e}){const n=e?t.indexOf(Sv):-1;return n<0?f.jsx("div",{className:yt.hint,children:t}):f.jsxs("div",{className:yt.hint,children:[t.slice(0,n),f.jsx("button",{type:"button",className:yt.detailCommand,onClick:e,children:Sv}),t.slice(n+Sv.length)]})}function Bte({name:t,tokens:e,tokenLabel:n}){return f.jsxs("div",{className:yt.detailRow,children:[f.jsxs("span",{className:yt.secondary,children:["└"," "]}),f.jsx("span",{className:yt.detailName,title:t,children:aI(t,sI)}),f.jsxs("span",{className:yt.value,children:[jd(e)," ",n]})]})}function Tv({title:t,items:e,getName:n,tokenLabel:r}){const i=Ote(e);return i.length===0?null:f.jsxs("section",{className:yt.detailSection,children:[f.jsx("div",{className:yt.sectionTitle,children:t}),i.map(s=>f.jsx(Bte,{name:n(s),tokens:s.tokens,tokenLabel:r},n(s)))]})}function zte({skills:t,labels:e}){const n=[...t].sort((r,i)=>r.loaded!==i.loaded?r.loaded?-1:1:i.tokens+(i.bodyTokens??0)-(r.tokens+(r.bodyTokens??0)));return n.length===0?null:f.jsxs("section",{className:yt.detailSection,children:[f.jsx("div",{className:yt.sectionTitle,children:e.skills}),n.map(r=>f.jsxs("div",{className:yt.skillBlock,children:[f.jsxs("div",{className:yt.detailRow,children:[f.jsxs("span",{className:yt.secondary,children:["└"," "]}),f.jsxs("span",{className:yt.detailName,title:r.name,children:[aI(r.name,sI),r.loaded&&f.jsxs("span",{className:yt.success,children:[" ",e.active]})]}),f.jsxs("span",{className:yt.value,children:[jd(r.tokens)," ",e.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&f.jsxs("div",{className:yt.subDetailRow,children:[f.jsxs("span",{className:yt.secondary,children:["  └"," "]}),f.jsx("span",{className:yt.bodyLoaded,children:e.bodyLoaded}),f.jsxs("span",{className:yt.success,children:["+",jd(r.bodyTokens)," ",e.tokens]})]})]},r.name))]})}function Pte({status:t,onShowDetail:e}){const{t:n}=dt(),{usage:r}=t,{breakdown:i,contextWindowSize:s}=r,a=s>0?r.totalTokens/s*100:0,o=a>100,l=s>0?i.autocompactBuffer/s*100:0;return f.jsxs("div",{className:yt.panel,children:[f.jsx("div",{className:yt.title,children:n("contextUsage.title")}),r.isEstimated?f.jsx(f.Fragment,{children:f.jsxs("div",{className:yt.metaLine,children:[f.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),f.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",jd(s)," ",n("contextUsage.tokens")]})]})}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:yt.metaLine,children:[f.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),f.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",jd(s)," ",n("contextUsage.tokens")]})]}),o&&f.jsx("div",{className:yt.error,children:n("contextUsage.overLimit")})]}),f.jsx(jte,{usedPercentage:Math.min(a,100),bufferPercentage:l}),f.jsx("div",{className:yt.spacer}),f.jsx(oo,{symbol:nl,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:o?yt.error:yt.accent,isOverLimit:o}),f.jsx(oo,{symbol:iI,label:n("contextUsage.free"),tokens:i.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s}),f.jsx(oo,{symbol:rI,label:n("contextUsage.autocompactBuffer"),tokens:i.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.warning}),f.jsx("div",{className:yt.spacer}),f.jsx("div",{className:yt.sectionTitle,children:n("contextUsage.usageByCategory")}),f.jsx(oo,{symbol:nl,label:n("contextUsage.systemPrompt"),tokens:i.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.accent}),f.jsx(oo,{symbol:nl,label:n("contextUsage.builtinTools"),tokens:i.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.accent}),i.mcpTools>0&&f.jsx(oo,{symbol:nl,label:n("contextUsage.mcpTools"),tokens:i.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.accent}),f.jsx(oo,{symbol:nl,label:n("contextUsage.memoryFiles"),tokens:i.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.accent}),f.jsx(oo,{symbol:nl,label:n("contextUsage.skills"),tokens:i.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.accent}),!r.isEstimated&&f.jsx(oo,{symbol:nl,label:n("contextUsage.messages"),tokens:i.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:s,symbolClassName:yt.accent}),r.showDetails?f.jsxs(f.Fragment,{children:[f.jsx(Tv,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),f.jsx(Tv,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),f.jsx(Tv,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),f.jsx(zte,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):f.jsx(Lte,{hint:n("contextUsage.detailHint"),onShowDetail:e})]})}const $te={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",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 oI(t){return $te[t]??t}function pu(t,e){const n=`toolName.${t}`,r=e(n);return r===n?oI(t):r}function L0(t){const e=t.toLowerCase();return e==="ask_user_question"||e==="askuserquestion"}function Hr(t,e){return t.length<=e?t:t.slice(0,e)+"..."}const o2=2e3;function lI(t,e){const n=Hte(t,e);if(n)return Hr(n,o2);const r=qte(t,e);return r?Hr(r,o2):""}function za(t){var e;if(!t.content)return c2(t.rawOutput);for(const n of t.content)if(n.type==="content"&&((e=n.content)!=null&&e.text))return n.content.text;return c2(t.rawOutput)}function Ute(t){if(t.status!=="completed"&&t.status!=="failed")return"";const e=t.toolName.toLowerCase();if(e==="grep_search"||e==="grep"||e==="search"){const a=V7((c2(t.rawOutput)??"").trim());if(a)return a}const n=za(t);if(!n)return"";const r=n.split(`
`),i=r.length;if(e==="read"||e==="read_file"||e==="readfile")return`${i} line(s)`;if(e==="glob")return`Found ${r.filter(o=>o.trim()).length} matching file(s)`;if(e==="list_directory"||e==="listfiles")return`${r.filter(o=>o.trim()).length} item(s)`;if(Fl(e)){if(i>3)return`${i} lines of output`;const a=r[0]||"";return Hr(a,80)}if(e==="grep_search"||e==="grep"||e==="search"){const a=V7(n.trim());return a||`${r.filter(l=>l.trim()).length} result(s)`}if(e==="edit"||e==="write"||e==="write_file"||e==="editfile")return"";if(e==="webfetch"||e==="web_fetch"||e==="fetch"){const a=r[0]||"";return Hr(a,80)}if(e==="websearch"||e==="web_search"){const a=r.filter(o=>o.trim()).length;return a>1?`${a} result(s)`:r[0]||""}if(L0(e))return"";const s=r[0]||"";return Hr(s,80)}function Hte(t,e){if(!t.title)return null;const n=oI(t.toolName),r=t.title.trim();if(r===t.toolName||r===n)return null;const i=[n,t.toolName];for(const s of i)if(r.startsWith(s)){const a=r.slice(s.length);if(/^(:\s*|\s+)/.test(a))return G7(a.replace(/^:\s*|\s+/,""),e)}return G7(r,e)}function V7(t){return t==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(t)?t:null}function qte(t,e){const n=t.args||{},r=t.toolName.toLowerCase();if(n.command){let i=String(n.command);return n.directory&&r!=="shell"&&(i+=` [in ${Ju(String(n.directory),e)}]`),n.is_background?i+=" [background]":n.timeout&&(i+=` [timeout: ${String(n.timeout)}ms]`),n.description&&(i+=` (${String(n.description).replace(/\n/g," ")})`),Hr(i,o2)}if(r==="grep_search"||r==="grep"||r==="search"){const i=n.pattern??n.query;if(i){let s=`'${String(i)}'`;return n.path?s+=` in path '${String(n.path)}'`:(r==="grep_search"||r==="grep")&&(s+=" in path './'"),n.glob&&(s+=` (filter: '${String(n.glob)}')`),s}}if(r==="glob"&&n.pattern){let i=`'${String(n.pattern)}'`;return n.path&&(i+=` in path '${String(n.path)}'`),i}if(n.file_path)return n.description?String(n.description):Ju(String(n.file_path),e);if(n.url){const i=String(n.url),s=typeof n.prompt=="string"?n.prompt:void 0,a=s?`${i} — "${Hr(s,40)}"`:i;return Hr(a,80)}if(n.path)return Ju(String(n.path),e);if(n.query)return Hr(String(n.query),60);if(r==="list_directory"||r==="listfiles"){const i=n.path||n.directory||"";return Ju(String(i),e)}return n.description?String(n.description):""}function Fl(t){const e=t.toLowerCase();return e==="run_shell_command"||e==="bash"||e==="shell"||e==="execute_command"}function $a(t,e){var n;return t.callId===e?!0:((n=t.subTools)==null?void 0:n.some(r=>$a(r,e)))??!1}function G7(t,e){const n=t.trim();return cI(l2(n))?Ju(n,e):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>Ju(r,e))}function Ju(t,e){const n=l2(t),r=e?l2(e).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":cI(n)?Fte(n):n}function l2(t){return t.replace(/\\/g,"/")}function cI(t){return t.startsWith("/")||/^[A-Za-z]:\//.test(t)}function Fte(t){return t.replace(/\/+$/,"").split("/").pop()||t}function ey(t){if(!t||typeof t!="object")return;const e=t;return e.type==="task_execution"?e:void 0}function vk(t){if(!t.rawOutput||typeof t.rawOutput!="object")return"";const e=t.rawOutput,n=typeof e.terminateReason=="string"?e.terminateReason:"";return typeof e.reason=="string"&&e.reason||n&&n!=="GOAL"&&n||typeof e.error=="string"&&e.error||""}function ty(t){if(t.status==="failed")return"failed";if(!t.rawOutput||typeof t.rawOutput!="object")return t.status;const e=t.rawOutput,n=typeof e.status=="string"?e.status.toLowerCase():"",r=vk(t);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":t.status}function xk(t){return t>=1e6?`${(t/1e6).toFixed(1)}M tokens`:t>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${t} tokens`}const Vte="general-purpose";function wk(t){var r;const e=ey(t.rawOutput);if(e){const i=e.subagentName;if(typeof i=="string"&&i)return i}const n=(r=t.args)==null?void 0:r.subagent_type;return typeof n=="string"&&n?n:t.toolName==="task"?"task":Vte}function kk(t){var s,a;if(t.title){const o=t.title.indexOf(": ");if(o>0)return t.title.slice(o+2)}const e=(s=t.args)==null?void 0:s.description;if(typeof e=="string"&&e.trim())return e.trim();const n=ey(t.rawOutput),r=n==null?void 0:n.taskDescription;if(typeof r=="string"&&r.trim())return r.trim();const i=(a=t.args)==null?void 0:a.prompt;return typeof i=="string"&&i.trim()?i.trim().split(`
`)[0]??"":""}function uI(t,e){var s,a;if(t.status!=="in_progress")return"";const n=t.subTools;if(!n||n.length===0)return"";const r=n[n.length-1];if(r.status!=="in_progress"&&r.status!=="pending")return"";let i=pu(r.toolName??"",e);if(r.title){const o=r.title.indexOf(": ");i+=" "+(o>0?r.title.slice(o+2):r.title)}else(s=r.args)!=null&&s.command?i+=" "+String(r.args.command):(a=r.args)!=null&&a.file_path&&(i+=" "+String(r.args.file_path));return Hr(i,50)}function c2(t){if(!t)return null;if(typeof t=="string")return t;if(typeof t!="object")return null;const e=t;return typeof e.output=="string"?e.output:typeof e.stdout=="string"?e.stdout:typeof e.content=="string"?e.content:typeof e.reason=="string"?e.reason:typeof e.terminateReason=="string"?e.terminateReason:typeof e.error=="string"?e.error:typeof e.text=="string"?e.text:null}const Gte="_panel_9jmqd_1",Wte="_title_9jmqd_18",Kte="_sectionTitle_9jmqd_24",Yte="_spacer_9jmqd_30",Xte="_pivotRow_9jmqd_36",Qte="_metricCell_9jmqd_42",Jte="_metricCellSection_9jmqd_49",Zte="_metricCellSub_9jmqd_57",ene="_modelCell_9jmqd_65",tne="_modelCellHeader_9jmqd_72",nne="_divider_9jmqd_80",rne="_kvRow_9jmqd_88",ine="_kvSubRow_9jmqd_95",sne="_kvLabel_9jmqd_103",ane="_kvValue_9jmqd_107",one="_tableRow_9jmqd_116",lne="_tableNameCol_9jmqd_122",cne="_tableToolCol_9jmqd_132",une="_tableNumCol_9jmqd_140",dne="_success_9jmqd_150",hne="_error_9jmqd_154",fne="_secondary_9jmqd_158",mne="_warning_9jmqd_162",Me={panel:Gte,title:Wte,sectionTitle:Kte,spacer:Yte,pivotRow:Xte,metricCell:Qte,metricCellSection:Jte,metricCellSub:Zte,modelCell:ene,modelCellHeader:tne,divider:nne,kvRow:rne,kvSubRow:ine,kvLabel:sne,kvValue:ane,tableRow:one,tableNameCol:lne,tableToolCol:cne,tableNumCol:une,success:dne,error:hne,secondary:fne,warning:mne},u2="web-shell:session-stats:v1:";function pne(t,e="overview"){return`${u2}${JSON.stringify({_view:e,...t})}`}function gne(t){if(!t.startsWith(u2))return null;try{const e=JSON.parse(t.slice(u2.length));if(!e||typeof e.durationMs!="number")return null;const n=e._view??"overview";return delete e._view,{view:n,status:e}}catch{return null}}function Ol(t){if(t<=0)return"0s";if(t<1e3)return`${Math.round(t)}ms`;const e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60),s=[];return n>0&&s.push(`${n}h`),r>0&&s.push(`${r}m`),i>0&&s.push(`${i}s`),s.join(" ")||"0s"}function Ec({label:t,children:e}){return f.jsxs("div",{className:Me.kvRow,children:[f.jsx("span",{className:Me.kvLabel,children:t}),f.jsx("span",{className:Me.kvValue,children:e})]})}function kf({label:t,children:e}){return f.jsxs("div",{className:Me.kvSubRow,children:[f.jsxs("span",{className:Me.secondary,children:["»"," ",t]}),f.jsx("span",{className:Me.kvValue,children:e})]})}function dI(t){return Object.entries(t).filter(([,e])=>e.api.totalRequests>0).map(([e,n])=>{const r=e.split("::"),i=r[0],s=r[1],a=s?`${i} (${s})`:i;return{key:e,label:a,metrics:n}})}function yne(t){return t.api.totalRequests===0?0:t.api.totalErrors/t.api.totalRequests*100}function bne(t){return t.api.totalRequests===0?0:t.api.totalLatencyMs/t.api.totalRequests}function vne(t){return t.tokens.prompt===0?0:t.tokens.cached/t.tokens.prompt*100}function pa({metric:t,values:e,variant:n="normal"}){const r=n==="section"?Me.metricCellSection:n==="sub"?Me.metricCellSub:Me.metricCell;return f.jsxs("div",{className:Me.pivotRow,children:[f.jsx("span",{className:r,children:n==="sub"?`↳ ${t}`:t}),e.map((i,s)=>f.jsx("span",{className:Me.modelCell,children:i},s))]})}function xne({status:t}){const{t:e}=dt(),{models:n,tools:r,files:i}=t,s=Object.values(n).reduce((b,x)=>b+x.api.totalLatencyMs,0),a=r.totalDurationMs,o=s+a,l=o>0?s/o*100:0,c=o>0?a/o*100:0,u=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,d=dI(n),h=d.reduce((b,x)=>b+x.metrics.tokens.cached,0),m=d.reduce((b,x)=>b+x.metrics.tokens.prompt,0),p=m>0?h/m*100:0;return f.jsxs("div",{className:Me.panel,children:[f.jsx("div",{className:Me.title,children:e("stats.title")}),f.jsx("div",{className:Me.sectionTitle,children:e("stats.overview")}),f.jsx(Ec,{label:e("stats.duration"),children:Ol(t.durationMs)}),f.jsx(Ec,{label:e("stats.prompts"),children:t.promptCount}),f.jsx(Ec,{label:e("stats.toolCalls"),children:f.jsxs("span",{children:[r.totalCalls," ",f.jsx("span",{className:Me.secondary,children:"("}),f.jsxs("span",{className:Me.success,children:["✓",r.totalSuccess]})," ",f.jsxs("span",{className:Me.error,children:["✗",r.totalFail]}),f.jsx("span",{className:Me.secondary,children:")"})]})}),f.jsx(Ec,{label:e("stats.successRate"),children:f.jsxs("span",{className:u>=90?Me.success:u>=70?Me.warning:Me.error,children:[u.toFixed(1),"%"]})}),(i.totalLinesAdded>0||i.totalLinesRemoved>0)&&f.jsx(Ec,{label:e("stats.codeChanges"),children:f.jsxs("span",{children:[f.jsxs("span",{className:Me.success,children:["+",i.totalLinesAdded]})," ",f.jsxs("span",{className:Me.error,children:["-",i.totalLinesRemoved]})]})}),f.jsx("div",{className:Me.spacer}),f.jsx("div",{className:Me.sectionTitle,children:e("stats.performance")}),f.jsxs(kf,{label:e("stats.apiTime"),children:[Ol(s)," ",f.jsxs("span",{className:Me.secondary,children:["(",l.toFixed(1),"%)"]})]}),f.jsxs(kf,{label:e("stats.toolTime"),children:[Ol(a)," ",f.jsxs("span",{className:Me.secondary,children:["(",c.toFixed(1),"%)"]})]}),d.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:Me.spacer}),f.jsx("div",{className:Me.sectionTitle,children:e("stats.modelUsage")}),f.jsx("div",{className:Me.spacer}),f.jsxs("div",{className:Me.tableRow,children:[f.jsx("span",{className:Me.tableNameCol,children:e("stats.modelUsage")}),f.jsx("span",{className:Me.tableNumCol,children:e("stats.reqs")}),f.jsx("span",{className:Me.tableNumCol,children:e("stats.inputTokens")}),f.jsx("span",{className:Me.tableNumCol,children:e("stats.outputTokens")})]}),f.jsx("div",{className:Me.divider}),d.map(b=>f.jsxs("div",{className:Me.tableRow,children:[f.jsx("span",{className:Me.tableNameCol,children:b.label}),f.jsx("span",{className:Me.tableNumCol,children:b.metrics.api.totalRequests}),f.jsx("span",{className:`${Me.tableNumCol} ${Me.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),f.jsx("span",{className:`${Me.tableNumCol} ${Me.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),p>0&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:Me.spacer}),f.jsxs("div",{children:[f.jsx("span",{className:Me.success,children:e("stats.savingsHighlight")})," ",h.toLocaleString()," (",p.toFixed(1),"%)"," ",e("stats.cacheDesc")]}),f.jsxs("div",{className:Me.secondary,children:["»"," ",e("stats.modelTip")]})]})]})]})}function wne({status:t}){const{t:e}=dt(),n=dI(t.models);if(n.length===0)return f.jsxs("div",{className:Me.panel,children:[f.jsx("div",{className:Me.title,children:e("stats.modelStats")}),f.jsx("div",{children:e("stats.noApiCalls")})]});const r=n.some(a=>a.metrics.tokens.cached>0),i=n.some(a=>a.metrics.tokens.thoughts>0),s=a=>n.map(o=>a(o.metrics));return f.jsxs("div",{className:Me.panel,children:[f.jsx("div",{className:Me.title,children:e("stats.modelStats")}),f.jsx("div",{className:Me.spacer}),f.jsxs("div",{className:Me.pivotRow,children:[f.jsx("span",{className:Me.metricCellSection,children:e("stats.metric")}),n.map(a=>f.jsx("span",{className:Me.modelCellHeader,children:a.label},a.key))]}),f.jsx("div",{className:Me.divider}),f.jsx(pa,{metric:e("stats.api"),values:[],variant:"section"}),f.jsx(pa,{metric:e("stats.requests"),values:s(a=>a.api.totalRequests.toLocaleString())}),f.jsx(pa,{metric:e("stats.errors"),values:s(a=>{const o=yne(a);return f.jsxs("span",{className:a.api.totalErrors>0?Me.error:void 0,children:[a.api.totalErrors.toLocaleString()," (",o.toFixed(1),"%)"]})})}),f.jsx(pa,{metric:e("stats.avgLatency"),values:s(a=>Ol(bne(a)))}),f.jsx("div",{className:Me.spacer}),f.jsx(pa,{metric:e("stats.tokens"),values:[],variant:"section"}),f.jsx(pa,{metric:e("stats.total"),values:s(a=>f.jsx("span",{className:Me.warning,children:a.tokens.total.toLocaleString()}))}),f.jsx(pa,{metric:e("stats.prompt"),values:s(a=>a.tokens.prompt.toLocaleString()),variant:"sub"}),r&&f.jsx(pa,{metric:e("stats.cached"),values:s(a=>f.jsxs("span",{className:Me.success,children:[a.tokens.cached.toLocaleString()," (",vne(a).toFixed(1),"%)"]})),variant:"sub"}),i&&f.jsx(pa,{metric:e("stats.thoughts"),values:s(a=>a.tokens.thoughts.toLocaleString()),variant:"sub"}),f.jsx(pa,{metric:e("stats.output"),values:s(a=>a.tokens.candidates.toLocaleString()),variant:"sub"})]})}function kne(t){return Object.entries(t).filter(([,e])=>e.count>0).sort((e,n)=>n[1].count-e[1].count).map(([e,n])=>({name:e,stats:n}))}function _ne({status:t}){const{t:e}=dt(),n=kne(t.tools.byName);if(n.length===0)return f.jsxs("div",{className:Me.panel,children:[f.jsx("div",{className:Me.title,children:e("stats.toolStats")}),f.jsx("div",{children:e("stats.noToolCalls")})]});const r=Object.values(t.tools.byName).reduce((a,o)=>{var l,c,u;return a.accept+=((l=o.decisions)==null?void 0:l.accept)??0,a.reject+=((c=o.decisions)==null?void 0:c.reject)??0,a.modify+=((u=o.decisions)==null?void 0:u.modify)??0,a},{accept:0,reject:0,modify:0}),i=r.accept+r.reject+r.modify,s=i>0?r.accept/i*100:0;return f.jsxs("div",{className:Me.panel,children:[f.jsx("div",{className:Me.title,children:e("stats.toolStats")}),f.jsx("div",{className:Me.spacer}),f.jsxs("div",{className:Me.tableRow,children:[f.jsx("span",{className:Me.tableToolCol,children:e("stats.toolName")}),f.jsx("span",{className:Me.tableNumCol,children:e("stats.calls")}),f.jsx("span",{className:Me.tableNumCol,children:e("stats.successRate")}),f.jsx("span",{className:Me.tableNumCol,children:e("stats.avgDuration")})]}),f.jsx("div",{className:Me.divider}),n.map(a=>{const o=a.stats.count>0?a.stats.success/a.stats.count*100:0,l=a.stats.count>0?a.stats.durationMs/a.stats.count:0;return f.jsxs("div",{className:Me.tableRow,children:[f.jsx("span",{className:`${Me.tableToolCol} ${Me.metricCell}`,children:pu(a.name,e)}),f.jsx("span",{className:Me.tableNumCol,children:a.stats.count}),f.jsxs("span",{className:`${Me.tableNumCol} ${o>=90?Me.success:o>=70?Me.warning:Me.error}`,children:[o.toFixed(1),"%"]}),f.jsx("span",{className:Me.tableNumCol,children:Ol(l)})]},a.name)}),f.jsx("div",{className:Me.spacer}),f.jsx("div",{className:Me.sectionTitle,children:e("stats.decisionSummary")}),f.jsx(Ec,{label:e("stats.totalReviewed"),children:i}),f.jsx(kf,{label:e("stats.accepted"),children:f.jsx("span",{className:Me.success,children:r.accept})}),f.jsx(kf,{label:e("stats.rejected"),children:f.jsx("span",{className:Me.error,children:r.reject})}),f.jsx(kf,{label:e("stats.modified"),children:f.jsx("span",{className:Me.warning,children:r.modify})}),f.jsx("div",{className:Me.divider}),f.jsx(Ec,{label:e("stats.agreementRate"),children:f.jsx("span",{className:i>0?s>=90?Me.success:s>=70?Me.warning:Me.error:void 0,children:i>0?`${s.toFixed(1)}%`:"--"})})]})}function Sne({view:t,status:e}){switch(t){case"model":return f.jsx(wne,{status:e});case"tools":return f.jsx(_ne,{status:e});default:return f.jsx(xne,{status:e})}}function ny(t){return{serialize(e){return`${t}${JSON.stringify(e)}`},parse(e){if(!e.startsWith(t))return null;try{const n=JSON.parse(e.slice(t.length));return!n||typeof n!="object"?null:n}catch{return null}}}}const Tne="_panel_1qrll_1",Cne="_title_1qrll_17",Ene="_row_1qrll_23",Ane="_rowGap_1qrll_31",Mne="_label_1qrll_35",Nne="_value_1qrll_41",Dne="_accent_1qrll_46",Dc={panel:Tne,title:Cne,row:Ene,rowGap:Ane,label:Mne,value:Nne,accent:Dne},{serialize:Ine,parse:Rne}=ny("web-shell:status:v1:");function Js({label:t,children:e,gap:n}){return f.jsxs("div",{className:`${Dc.row}${n?` ${Dc.rowGap}`:""}`,children:[f.jsx("span",{className:Dc.label,children:t}),f.jsx("span",{className:Dc.value,children:e})]})}function One({info:t}){const{t:e}=dt();return f.jsxs("div",{className:Dc.panel,children:[f.jsx("div",{className:Dc.title,children:e("about.title")}),t.cliVersion&&f.jsx(Js,{label:e("about.qwenCode"),children:f.jsx("span",{className:Dc.accent,children:t.cliVersion})}),t.runtime&&f.jsx(Js,{label:e("about.runtime"),children:t.runtime}),t.platform&&f.jsx(Js,{label:e("about.platform"),children:t.platform}),t.auth&&f.jsx(Js,{label:e("about.auth"),gap:!0,children:t.auth}),t.baseUrl&&f.jsx(Js,{label:e("about.baseUrl"),children:t.baseUrl}),t.model&&f.jsx(Js,{label:e("about.model"),children:t.model}),t.fastModel&&t.fastModel!==t.model&&f.jsx(Js,{label:e("about.fastModel"),children:t.fastModel}),t.sessionId&&f.jsx(Js,{label:e("about.sessionId"),children:t.sessionId}),f.jsx(Js,{label:e("about.sandbox"),children:t.sandbox||e("about.noSandbox")}),f.jsx(Js,{label:e("about.proxy"),children:t.proxy||e("about.noProxy")}),t.memoryUsage&&f.jsx(Js,{label:e("about.memoryUsage"),children:t.memoryUsage})]})}function Ug(t){return t instanceof HTMLElement?t.isContentEditable?!0:!!t.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function jne(t){return t instanceof HTMLElement?!!t.closest("[data-keyboard-scope]"):!1}function si(t,e,n=50){const r=v.useRef(t);v.useEffect(()=>{r.current=t},[t]),v.useEffect(()=>{const i=a=>{a.defaultPrevented||Ug(a.target)&&!jne(a.target)||r.current(a)},s=setTimeout(()=>{window.addEventListener("keydown",i)},n);return()=>{clearTimeout(s),window.removeEventListener("keydown",i)}},e)}const Lne="_panel_1ndg7_1",Bne="_title_1ndg7_14",zne="_header_1ndg7_19",Pne="_startup_1ndg7_25",$ne="_note_1ndg7_29",Une="_secondary_1ndg7_30",Hne="_row_1ndg7_40",qne="_selected_1ndg7_49",Fne="_disabled_1ndg7_53",Vne="_pointer_1ndg7_57",Gne="_nameCell_1ndg7_63",Wne="_truncate_1ndg7_70",Kne="_separator_1ndg7_76",Yne="_sectionTitle_1ndg7_80",Xne="_groupTitle_1ndg7_81",Qne="_success_1ndg7_85",Jne="_warning_1ndg7_89",Zne="_error_1ndg7_93",ere="_group_1ndg7_81",tre="_list_1ndg7_103",nre="_description_1ndg7_109",rre="_schema_1ndg7_114",ire="_shortcuts_1ndg7_132",sre="_detail_1ndg7_138",are="_serverFields_1ndg7_144",ore="_serverField_1ndg7_144",lre="_serverFieldLabel_1ndg7_157",cre="_detailBlock_1ndg7_161",ure="_parameters_1ndg7_162",dre="_invalidBlock_1ndg7_163",hre="_parameterRow_1ndg7_173",fre="_actionMessage_1ndg7_178",mre="_oauthPage_1ndg7_184",pre="_scrollHint_1ndg7_190",He={panel:Lne,title:Bne,header:zne,startup:Pne,note:$ne,secondary:Une,row:Hne,selected:qne,disabled:Fne,pointer:Vne,nameCell:Gne,truncate:Wne,separator:Kne,sectionTitle:Yne,groupTitle:Xne,success:Qne,warning:Jne,error:Zne,group:ere,list:tre,description:nre,schema:rre,shortcuts:ire,detail:sre,serverFields:are,serverField:ore,serverFieldLabel:lre,detailBlock:cre,parameters:ure,invalidBlock:dre,parameterRow:hre,actionMessage:fre,oauthPage:mre,scrollHint:pre},Zf="web-shell:mcp-panel-active",fc=10,{serialize:gre,parse:yre}=ny("web-shell:mcp-status:v1:");function hI(t){const e=yre(t);return!e||!e.status?null:e}function Rm(t,e){if(t.disabled)return{icon:"✗",text:e("mcp.status.disabled"),className:He.error};switch(t.mcpStatus){case"connected":return{icon:"✓",text:e("mcp.status.connected"),className:He.success};case"connecting":return{icon:"🔄",text:e("mcp.status.starting"),className:He.warning};case"disconnected":default:return{icon:"🔴",text:e("mcp.status.disconnectedTitle"),className:He.error}}}function fI(t){const e=t.schema,n=(e==null?void 0:e.parametersJsonSchema)??(e==null?void 0:e.parameters)??e;return n&&typeof n=="object"?n:null}function bre(t){const e=fI(t);return e?JSON.stringify(e,null,2):""}function vre(t,e){return t.extensionName?e("mcp.extensionMcp"):e("mcp.userMcp")}function xre(t,e){return t.source==="project"?e("mcp.source.project"):t.source==="extension"||t.extensionName?e("mcp.source.extension"):e("mcp.source.user")}function wre(t,e){var r;const n=t.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 i=((r=n.args)==null?void 0:r.join(" "))??"";return`${n.command} ${i} (stdio)`.trim()}return t.transport?`(${t.transport})`:e("mcp.status.unknown")}function Cv(t,e){const n=t.annotations??{},r=[];return n.destructiveHint&&r.push(e("mcp.annotation.destructive")),n.readOnlyHint&&r.push(e("mcp.annotation.readOnly")),n.openWorldHint&&r.push(e("mcp.annotation.openWorld")),n.idempotentHint&&r.push(e("mcp.annotation.idempotent")),r.join(", ")}function W7(t,e){window.dispatchEvent(new CustomEvent(Zf,{detail:{id:t,active:e}}))}function K7(t){if(t&&typeof t=="object"){const e=t.body;if(e&&typeof e=="object"){const n=e.data;if(n&&typeof n=="object"){const i=n.details;if(typeof i=="string"&&i)return i}const r=e.error;if(typeof r=="string"&&r)return r}if(t instanceof Error&&t.message)return t.message}return String(t)}function Om(t,e,n){return[`${e("mcp.oauth.server")}: ${t}`,"",e("mcp.oauth.starting",{name:t}),...n?["",n]:[]].join(`
`)}function kre(t,e){return t?e("mcp.required"):""}function _re(t,e){const n=fI(t),r=n==null?void 0:n.properties,i=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(a=>typeof a=="string")):new Set;if(!r||typeof r!="object"){const a=bre(t);return a?f.jsx("pre",{className:He.schema,children:a}):null}const s=Object.entries(r);return s.length===0?null:f.jsxs("div",{className:He.parameters,children:[f.jsx("div",{className:He.sectionTitle,children:e("mcp.parameters")}),s.map(([a,o])=>{const l=o&&typeof o=="object"?o:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return f.jsx("div",{className:He.parameterRow,children:`• ${a}${kre(i.has(a),e)}: ${c}${u?` - ${u}`:""}`},a)})]})}function Sre({message:t}){var X;const{t:e}=dt(),n=uU({autoLoad:!1}),[r,i]=v.useState(t.status),[s,a]=v.useState(t.toolsByServer),[o,l]=v.useState(null),[c,u]=v.useState(!1),d=v.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[h,m]=v.useState(!0),[p,b]=v.useState("servers"),[x,g]=v.useState(0),[y,w]=v.useState(0),[C,E]=v.useState(0),S=v.useMemo(()=>r.servers??[],[r.servers]),T=S[x]??null,O=v.useMemo(()=>{var H;return T?((H=s[T.name])==null?void 0:H.tools)??[]:[]},[T,s]),z=O[C]??null,I=v.useMemo(()=>O.length<=fc||C<fc-1?0:Math.min(C-fc+1,O.length-fc),[C,O.length]),j=v.useMemo(()=>O.slice(I,I+fc),[O,I]),N=S.filter(H=>!H.disabled&&H.mcpStatus==="connecting").length,B=v.useMemo(()=>{const H=[];for(const R of S){const ae=vre(R,e),xe=H.find(ye=>ye.label===ae);xe?xe.servers.push(R):H.push({label:ae,servers:[R]})}return H},[S,e]),P=v.useMemo(()=>S.length===0?20:Math.min(Math.max(...S.map(H=>H.name.length))+2,35),[S]),J=v.useMemo(()=>O.length===0?30:Math.min(Math.max(...O.map(H=>H.name.length))+2,50),[O]),q=v.useMemo(()=>{if(!T)return[];const H=[];return!T.disabled&&O.length>0&&H.push({id:"view-tools",label:e("mcp.action.tools")}),!T.disabled&&T.mcpStatus==="disconnected"&&H.push({id:"reconnect",label:e("mcp.action.reconnect")}),H.push({id:T.disabled?"enable":"disable",label:T.disabled?e("mcp.action.enable"):e("mcp.action.disable")}),T.disabled||(H.push({id:"authenticate",label:T.hasOAuthTokens?e("mcp.action.reauth"):e("mcp.action.auth")}),T.hasOAuthTokens&&H.push({id:"clear-auth",label:e("mcp.action.clearAuth")})),H},[T,O.length,e]),Y=v.useCallback(async()=>{var R;const H=await n.reload();if(H){i(H);const ae=((R=H.servers)==null?void 0:R.find(xe=>xe.name===(T==null?void 0:T.name)))??null;if(ae){const xe=await n.loadTools(ae.name);a(ye=>({...ye,[ae.name]:xe}))}}},[n,T==null?void 0:T.name]),$=v.useCallback(async H=>{if(!(!T||H.disabled||c)){if(H.id==="view-tools"){b("tools"),E(0),l(null);return}u(!0),H.id==="authenticate"&&b("oauth"),l(H.id==="authenticate"?Om(T.name,e):e("mcp.action.running",{action:H.label}));try{let R=null;if(H.id==="reconnect")await n.restartServer(T.name);else{const ae=await n.manageServer(T.name,H.id),xe=[...ae.messages??[],...ae.authUrl?[ae.authUrl]:[]].join(`
`);xe&&(R=H.id==="authenticate"?Om(T.name,e,xe):xe)}await Y(),l(R??e("mcp.action.done",{action:H.label}))}catch(R){l(H.id==="authenticate"?Om(T.name,e,K7(R)):e("mcp.action.failed",{error:K7(R)}))}finally{u(!1)}}},[c,n,Y,T,e]);if(v.useEffect(()=>{const H=d.current;return W7(H,h),()=>W7(H,!1)},[h]),v.useEffect(()=>{const H=R=>{const ae=R.detail;ae!=null&&ae.active&&ae.id&&ae.id!==d.current&&m(!1)};return window.addEventListener(Zf,H),()=>window.removeEventListener(Zf,H)},[]),si(H=>{if(h){if(H.key==="Escape"){H.preventDefault(),H.stopPropagation(),p==="servers"?m(!1):p==="server"?(b("servers"),w(0),l(null)):p==="oauth"?(b("server"),l(null)):p==="tools"?(b("server"),E(0)):b("tools");return}if(H.key==="ArrowUp"||H.key==="ArrowDown"){H.preventDefault(),H.stopPropagation();const R=H.key==="ArrowUp"?-1:1;p==="servers"?(g(ae=>Math.min(Math.max(ae+R,0),S.length-1)),w(0)):p==="server"?w(ae=>Math.min(Math.max(ae+R,0),q.length-1)):p==="tools"&&E(ae=>Math.min(Math.max(ae+R,0),O.length-1));return}if(H.key==="Enter")if(H.preventDefault(),H.stopPropagation(),p==="servers"&&S.length>0)b("server"),w(0);else if(p==="server"&&q.length>0){const R=q[y];R&&$(R)}else p==="tools"&&O.length>0&&b("tool")}},[h,y,O.length,q,$,S.length,p]),!h)return null;if(S.length===0)return f.jsxs("div",{className:He.panel,"data-keyboard-scope":!0,children:[f.jsxs("div",{className:He.header,children:[f.jsx("div",{className:He.title,children:e("mcp.manageServers")}),f.jsx("div",{className:He.secondary,children:e("mcp.servers",{count:0})})]}),f.jsx("div",{className:He.secondary,children:e("mcp.empty")}),f.jsx("div",{className:He.shortcuts,children:e("mcp.shortcut.close")})]});const Z=p==="servers"?e("mcp.manageServers"):p==="server"?(T==null?void 0:T.name)??e("mcp.manageServers"):p==="oauth"?e("mcp.oauth.title"):p==="tools"?e("mcp.toolsForServer",{name:(T==null?void 0:T.name)??"Server"}):(z==null?void 0:z.name)??e("mcp.toolDetail"),M=p==="servers"?e("mcp.servers",{count:S.length}):p==="server"||p==="oauth"?"":p==="tools"?e(O.length===1?"mcp.toolCount":"mcp.toolsCount",{count:O.length}):(z==null?void 0:z.serverToolName)??(T==null?void 0:T.name)??"";return f.jsxs("div",{className:He.panel,"data-keyboard-scope":!0,children:[N>0&&f.jsxs("div",{children:[f.jsx("div",{className:He.startup,children:e("mcp.starting",{count:N})}),f.jsx("div",{className:He.note,children:e("mcp.startingNote")})]}),f.jsxs("div",{className:He.header,children:[f.jsx("div",{className:He.title,children:Z}),M&&f.jsx("div",{className:He.secondary,children:M})]}),p==="servers"&&f.jsx("div",{className:He.list,children:B.map(H=>{let R=0;for(const ae of B){if(ae===H)break;R+=ae.servers.length}return f.jsxs("div",{className:He.group,children:[f.jsx("div",{className:He.groupTitle,children:H.label}),H.servers.map((ae,xe)=>{const ye=R+xe,Ae=ye===x,Fe=Rm(ae,e);return f.jsxs("div",{className:Ae?`${He.row} ${He.selected}`:He.row,onClick:()=>{g(ye),b("server"),w(0)},onMouseEnter:()=>g(ye),children:[f.jsx("span",{className:He.pointer,children:Ae?"❯":""}),f.jsx("span",{className:He.nameCell,style:{width:`${P}ch`},children:ae.name}),f.jsx("span",{className:He.separator,children:"·"}),f.jsxs("span",{className:Fe.className,children:[Fe.icon," ",Fe.text]})]},ae.name)})]},H.label)})}),p==="server"&&T&&f.jsxs("div",{className:He.detail,children:[f.jsxs("div",{className:He.serverFields,children:[f.jsxs("div",{className:He.serverField,children:[f.jsxs("span",{className:He.serverFieldLabel,children:[e("mcp.status"),":"]}),f.jsxs("span",{className:Rm(T,e).className,children:[Rm(T,e).icon," ",Rm(T,e).text]})]}),f.jsxs("div",{className:He.serverField,children:[f.jsxs("span",{className:He.serverFieldLabel,children:[e("mcp.source"),":"]}),f.jsx("span",{children:xre(T,e)})]}),f.jsxs("div",{className:He.serverField,children:[f.jsxs("span",{className:He.serverFieldLabel,children:[e("mcp.command"),":"]}),f.jsx("span",{className:He.truncate,children:wre(T,e)})]}),((X=T.config)==null?void 0:X.cwd)&&f.jsxs("div",{className:He.serverField,children:[f.jsxs("span",{className:He.serverFieldLabel,children:[e("mcp.workingDirectory"),":"]}),f.jsx("span",{className:He.truncate,children:T.config.cwd})]}),!T.disabled&&f.jsxs("div",{className:He.serverField,children:[f.jsxs("span",{className:He.serverFieldLabel,children:[e("mcp.tools"),":"]}),f.jsx("span",{children:e(O.length===1?"mcp.toolCount":"mcp.toolsCount",{count:O.length})})]})]}),f.jsx("div",{className:He.list,children:q.map((H,R)=>{const ae=R===y,xe=[He.row,ae?He.selected:"",H.disabled?He.disabled:""].filter(Boolean).join(" ");return f.jsxs("div",{className:xe,onClick:()=>{w(R),$(H)},children:[f.jsx("span",{className:He.pointer,children:ae?"❯":""}),f.jsx("span",{children:H.label})]},H.id)})}),o&&f.jsx("pre",{className:He.actionMessage,children:o})]}),p==="oauth"&&f.jsx("div",{className:He.oauthPage,children:f.jsx("pre",{className:He.actionMessage,children:o??(T?Om(T.name,e):e("mcp.status.unknown"))})}),p==="tools"&&f.jsx("div",{className:He.list,children:O.length===0?f.jsx("div",{className:He.secondary,children:e("mcp.emptyTools")}):j.map((H,R)=>{const ae=I+R,xe=ae===C,ye=Cv(H,e);return f.jsxs("div",{className:xe?`${He.row} ${He.selected}`:He.row,onClick:()=>{E(ae),b("tool")},onMouseEnter:()=>E(ae),children:[f.jsx("span",{className:He.pointer,children:xe?"❯":""}),f.jsx("span",{className:He.nameCell,style:{width:`${J}ch`},children:H.name}),H.isValid?ye?f.jsx("span",{className:He.secondary,children:ye}):null:f.jsx("span",{className:He.warning,children:e("mcp.invalidReason",{reason:H.invalidReason||e("mcp.status.unknown")})})]},H.name)})}),p==="tools"&&O.length>fc&&f.jsxs("div",{className:He.scrollHint,children:[I>0?"↑ ":"  ",e("mcp.scrollPosition",{current:C+1,total:O.length}),I+fc<O.length?" ↓":""]}),p==="tool"&&z&&f.jsxs("div",{className:He.detail,children:[!z.isValid&&f.jsxs("div",{className:He.invalidBlock,children:[f.jsx("div",{className:He.sectionTitle,children:e("mcp.invalidToolWarning")}),f.jsxs("div",{children:[e("mcp.invalidReasonLabel")," ",z.invalidReason||e("mcp.status.unknown")]}),f.jsx("div",{className:He.secondary,children:e("mcp.invalidToolHelp")})]}),z.description&&f.jsxs("div",{className:He.detailBlock,children:[f.jsx("div",{className:He.sectionTitle,children:e("mcp.description")}),f.jsx("div",{className:He.description,children:z.description.trim()})]}),Cv(z,e)&&f.jsxs("div",{className:He.detailBlock,children:[f.jsx("span",{className:He.sectionTitle,children:e("mcp.annotations")})," ",f.jsx("span",{children:Cv(z,e)})]}),_re(z,e)]}),f.jsx("div",{className:He.shortcuts,children:e(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function mI(t){const e=Math.max(0,Math.floor(t/1e3)),n=e%60,r=Math.floor(e/60);if(r===0)return`${n}s`;const i=r%60,s=Math.floor(r/60);return s===0?`${i}m ${n}s`:`${s}h ${i}m`}const Tre="_panel_jsvnw_1",Cre="_title_jsvnw_13",Ere="_sectionTitle_jsvnw_18",Are="_overflowHint_jsvnw_22",Mre="_header_jsvnw_27",Nre="_secondary_jsvnw_33",Dre="_row_jsvnw_37",Ire="_selected_jsvnw_45",Rre="_pointer_jsvnw_49",Ore="_nameCell_jsvnw_55",jre="_truncate_jsvnw_62",Lre="_separator_jsvnw_68",Bre="_list_jsvnw_72",zre="_success_jsvnw_78",Pre="_warning_jsvnw_82",$re="_error_jsvnw_86",Ure="_detail_jsvnw_90",Hre="_detailField_jsvnw_99",qre="_detailFieldLabel_jsvnw_106",Fre="_shortcuts_jsvnw_111",Vre="_confirmHint_jsvnw_117",Gre="_statusBadge_jsvnw_121",Wre="_activityCurrent_jsvnw_127",Kre="_activityPast_jsvnw_134",Yre="_promptContent_jsvnw_141",st={panel:Tre,title:Cre,sectionTitle:Ere,overflowHint:Are,header:Mre,secondary:Nre,row:Dre,selected:Ire,pointer:Rre,nameCell:Ore,truncate:jre,separator:Lre,list:Bre,success:zre,warning:Pre,error:$re,detail:Ure,detailField:Hre,detailFieldLabel:qre,shortcuts:Fre,confirmHint:Vre,statusBadge:Gre,activityCurrent:Wre,activityPast:Kre,promptContent:Yre},Ld="web-shell:tasks-panel-active",Xre=3e3,Y7=8,{serialize:Qre,parse:Jre}=ny("web-shell:tasks-status:v1:");function Zre(t){const e=Jre(t);return!e||!e.snapshot?null:e}function X7(t,e){window.dispatchEvent(new CustomEvent(Ld,{detail:{id:t,active:e}}))}function Q7(t){return t.status==="running"||t.status==="paused"}function Ev(t){return[...t].sort((e,n)=>{const r=Q7(e),i=Q7(n);return r!==i?r?-1:1:r?n.startTime-e.startTime:(n.endTime??n.startTime)-(e.endTime??e.startTime)})}function eie(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function pI(t){switch(t){case"running":return st.success;case"paused":return st.warning;case"completed":return st.success;case"failed":return st.error;case"cancelled":return st.warning;default:return""}}function tie(t){switch(t){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function nie(t){switch(t.kind){case"agent":return t.isBackgrounded?t.label:`[blocking] ${t.label}`;case"shell":return`[shell] ${t.command}`;case"monitor":return`[monitor] ${t.description}`}}function rie(t,e){if(t.length<=Y7)return{visible:t,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,Y7-2),r=Math.max(0,Math.min(e-Math.floor(n/2),t.length-n)),i=Math.min(t.length,r+n);return{visible:t.slice(r,i),windowStart:r,hiddenAbove:r,hiddenBelow:t.length-i}}function iie(t,e,n){const r=pu(t,n),i=e?e.replace(/\s*\n\s*/g," ").trim():"";return i?`${r}(${i})`:r}function gI({message:t,manageActiveEvent:e=!0,onClose:n}){const{t:r}=dt(),i=k3(),[s,a]=v.useState(()=>Ev(t.snapshot.tasks)),[o,l]=v.useState(!0),[c,u]=v.useState("list"),[d,h]=v.useState(0),[m,p]=v.useState(null),[b,x]=v.useState(!1),[g,y]=v.useState(!1),[w,C]=v.useState(null),E=v.useRef(`tasks-${Math.random().toString(36).slice(2)}`),S=v.useRef(!1),T=v.useRef(null),O=s.length===0?0:Math.min(d,s.length-1),z=s[O]??null;v.useEffect(()=>{if(!o)return;const Z=setInterval(()=>{S.current||(S.current=!0,i.getTasks().then(M=>{a(Ev(M.tasks)),y(!1)}).catch(M=>{console.warn("[web-shell] failed to refresh tasks:",M),y(!0)}).finally(()=>{S.current=!1}))},Xre);return()=>clearInterval(Z)},[o,i]),v.useEffect(()=>{s.length===0&&d!==0&&h(0),d>=s.length&&s.length>0&&h(s.length-1)},[s.length,d]),v.useEffect(()=>{if(!o||c!=="detail"){T.current=null;return}if(!z){T.current=null,u("list");return}const $=T.current;if(!$||$.taskId!==z.id){T.current={taskId:z.id,status:z.status};return}$.status==="running"&&z.status!=="running"&&(p(null),u("list"))},[o,c,z]),v.useEffect(()=>{if(!e)return;const $=E.current;return X7($,o),()=>X7($,!1)},[o,e]),v.useEffect(()=>{if(!e)return;const $=Z=>{const M=Z.detail;M!=null&&M.active&&M.id&&M.id!==E.current&&l(!1)};return window.addEventListener(Ld,$),()=>window.removeEventListener(Ld,$)},[e]),v.useEffect(()=>{o||n==null||n()},[o,n]);const I=v.useCallback(async $=>{if(b)return;const Z=$.status==="running",M=$.kind==="agent"&&$.status==="paused";if(!Z&&!M)return;if($.kind==="agent"&&!$.isBackgrounded&&m!==$.id){p($.id);return}p(null),x(!0);try{if(!(await i.cancelTask($.id,$.kind)).cancelled){C(r("tasks.alreadyStopped"));return}const R=await i.getTasks();a(Ev(R.tasks)),C(null)}catch(H){console.warn("[web-shell] failed to cancel task:",H),C(r("tasks.cancelFailed"))}finally{x(!1)}},[i,b,m,r]);if(si($=>{if(o){if($.key==="Escape"){if($.preventDefault(),$.stopPropagation(),m){p(null);return}c==="detail"?u("list"):l(!1);return}if($.key==="ArrowLeft"){$.preventDefault(),$.stopPropagation(),c==="detail"?(p(null),u("list")):l(!1);return}if(($.key==="ArrowUp"||$.key==="ArrowDown")&&c==="list"){if($.preventDefault(),$.stopPropagation(),s.length===0)return;const Z=$.key==="ArrowUp"?-1:1;h(M=>Math.min(Math.max(M+Z,0),s.length-1)),p(null);return}if($.key==="Enter"){$.preventDefault(),$.stopPropagation(),c==="list"&&z?u("detail"):c==="detail"&&l(!1);return}if($.key===" "&&c==="detail"){$.preventDefault(),$.stopPropagation(),l(!1);return}if($.key==="x"&&!$.ctrlKey&&!$.metaKey){$.preventDefault(),$.stopPropagation(),z&&I(z);return}}},[o,c,s.length,z,I,m]),!o)return null;const j=m!==null&&z!==null&&m===z.id,N=[];j?(N.push(r("tasks.confirmStop")),N.push(r("tasks.shortcut.cancelConfirm"))):(N.push(r("tasks.shortcut.select")),N.push(r("tasks.shortcut.view")),(z==null?void 0:z.status)==="running"?N.push(r("tasks.shortcut.stop")):(z==null?void 0:z.kind)==="agent"&&(z==null?void 0:z.status)==="paused"&&N.push(r("tasks.shortcut.abandon")),N.push(r("tasks.shortcut.listClose")));const B=[];if(j?(B.push(r("tasks.confirmStop")),B.push(r("tasks.shortcut.cancelConfirm"))):(B.push(r("tasks.shortcut.detailBack")),B.push(r("tasks.shortcut.detailClose")),(z==null?void 0:z.status)==="running"?B.push(r("tasks.shortcut.stop")):(z==null?void 0:z.kind)==="agent"&&(z==null?void 0:z.status)==="paused"&&B.push(r("tasks.shortcut.abandon"))),s.length===0)return f.jsxs("div",{className:st.panel,"data-keyboard-scope":!0,children:[f.jsxs("div",{className:st.header,children:[f.jsx("div",{className:st.title,children:r("tasks.title")}),g&&f.jsx("div",{className:st.warning,children:r("tasks.refreshStale")}),w&&f.jsx("div",{className:st.error,children:w})]}),f.jsxs("div",{children:[f.jsxs("div",{className:st.sectionTitle,children:[r("tasks.title")," ",f.jsx("span",{className:st.secondary,children:"(0)"})]}),f.jsx("div",{className:st.secondary,children:r("tasks.empty")})]}),f.jsx("div",{className:st.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:P,windowStart:J,hiddenAbove:q,hiddenBelow:Y}=rie(s,O);return f.jsxs("div",{className:st.panel,"data-keyboard-scope":!0,children:[c==="list"&&f.jsxs("div",{className:st.header,children:[f.jsx("div",{className:st.title,children:r("tasks.title")}),g&&f.jsx("div",{className:st.warning,children:r("tasks.refreshStale")}),w&&f.jsx("div",{className:st.error,children:w})]}),c==="list"&&f.jsxs("div",{className:st.list,children:[f.jsxs("div",{className:st.sectionTitle,children:[r("tasks.title")," ",f.jsxs("span",{className:st.secondary,children:["(",s.length,")"]})]}),q>0&&f.jsx("div",{className:st.overflowHint,children:r("tasks.moreAbove",{count:q})}),P.map(($,Z)=>{const M=J+Z,X=M===O,H=pI($.status);return f.jsxs("div",{className:X?`${st.row} ${st.selected}`:st.row,onClick:()=>{h(M),u("detail")},onMouseEnter:()=>h(M),children:[f.jsx("span",{className:st.pointer,children:X?"❯":""}),f.jsx("span",{className:$.status==="running"?st.nameCell:`${st.nameCell} ${H}`,children:nie($)})]},$.id)}),Y>0&&f.jsx("div",{className:st.overflowHint,children:r("tasks.moreBelow",{count:Y})})]}),c==="detail"&&z&&f.jsxs(f.Fragment,{children:[w&&f.jsx("div",{className:st.error,children:w}),f.jsx(aie,{task:z,t:r})]}),f.jsx("div",{className:j?`${st.shortcuts} ${st.confirmHint}`:st.shortcuts,children:(c==="list"?N:B).join(" · ")})]})}function sie(t,e){switch(t.kind){case"agent":return`${t.subagentType??"Agent"} › ${t.label}`;case"shell":return`${e("tasks.kind.shell")} › ${t.command}`;case"monitor":return`${e("tasks.kind.monitor")} › ${t.description}`}}function aie({task:t,t:e}){var a,o;const n=tie(t.status),r=pI(t.status),i=[mI(t.runtimeMs)];t.kind==="agent"&&((a=t.stats)!=null&&a.totalTokens)&&i.push(e("tasks.detail.tokens",{count:eie(t.stats.totalTokens)})),t.kind==="agent"&&((o=t.stats)==null?void 0:o.toolUses)!==void 0&&i.push(e("tasks.detail.toolCalls",{count:t.stats.toolUses})),t.kind!=="agent"&&t.pid!==void 0&&i.push(`pid ${t.pid}`),t.kind==="shell"&&t.exitCode!==void 0&&i.push(e("tasks.detail.exit",{exitCode:t.exitCode})),t.kind==="monitor"&&(i.push(e("tasks.detail.events",{count:t.eventCount})),t.droppedLines>0&&i.push(e("tasks.detail.dropped",{count:t.droppedLines})),t.exitCode!==void 0&&i.push(e("tasks.detail.exit",{exitCode:t.exitCode})));const s=t.kind==="agent"&&t.prompt?t.prompt.split(`
`):[];return f.jsxs("div",{className:st.detail,children:[f.jsx("div",{className:st.title,children:sie(t,e)}),f.jsxs("div",{className:st.statusBadge,children:[n&&f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:r,children:[n," ",e(`tasks.${t.status}`)]}),f.jsx("span",{className:st.separator,children:"·"})]}),f.jsx("span",{className:st.secondary,children:i.join(" · ")})]}),t.kind==="shell"&&f.jsxs(f.Fragment,{children:[f.jsx(Ih,{label:e("tasks.detail.workingDir"),value:t.cwd}),t.outputFile&&f.jsx(Ih,{label:e("tasks.detail.outputFile"),value:t.outputFile})]}),t.kind==="monitor"&&f.jsx(Ih,{label:e("tasks.detail.command"),value:t.command}),t.kind==="agent"&&t.subagentType&&f.jsx(Ih,{label:e("tasks.detail.type"),value:t.subagentType}),t.kind==="agent"&&t.recentActivities&&t.recentActivities.length>0&&f.jsxs("div",{children:[f.jsx("div",{className:st.detailFieldLabel,children:e("tasks.detail.progress")}),t.recentActivities.slice(-5).map((l,c,u)=>{const d=c===u.length-1,h=iie(l.name,l.description,e);return f.jsxs("div",{className:d?st.activityCurrent:st.activityPast,children:[d?"> ":"  ",h]},`${l.at}-${c}`)})]}),t.kind==="agent"&&t.prompt&&f.jsxs("div",{children:[f.jsx("div",{className:st.detailFieldLabel,children:e("tasks.detail.prompt")}),f.jsx("div",{className:st.promptContent,children:s.slice(0,5).map((l,c,u)=>f.jsx("div",{className:st.truncate,children:c===u.length-1&&s.length>5?`${l}…`:l||" "},c))})]}),t.kind==="agent"&&t.outputFile&&f.jsx(Ih,{label:e("tasks.detail.outputFile"),value:t.outputFile}),t.kind==="agent"&&t.status==="paused"&&t.resumeBlockedReason&&f.jsxs("div",{children:[f.jsx("div",{className:`${st.detailFieldLabel} ${st.error}`,children:e("tasks.detail.resumeBlocked")}),f.jsx("div",{className:st.error,children:t.resumeBlockedReason})]}),t.error&&f.jsxs("div",{children:[f.jsx("div",{className:`${st.detailFieldLabel} ${t.kind==="monitor"&&t.status!=="failed"?st.warning:st.error}`,children:t.kind==="monitor"&&t.status!=="failed"?e("tasks.detail.stoppedBecause"):e("tasks.detail.error")}),f.jsx("div",{className:t.kind==="monitor"&&t.status!=="failed"?st.warning:st.error,children:t.error})]})]})}function Ih({label:t,value:e}){return f.jsxs("div",{className:st.detailField,children:[f.jsx("span",{className:st.detailFieldLabel,children:t}),f.jsx("span",{className:st.truncate,children:e})]})}const oie="_message_1obwq_1",lie="_prefix_1obwq_11",cie="_body_1obwq_16",uie="_title_1obwq_21",die="_muted_1obwq_25",hie="_accent_1obwq_29",fie="_success_1obwq_33",mie="_error_1obwq_37",pie="_warning_1obwq_41",gie="_row_1obwq_45",yie="_label_1obwq_51",bie="_value_1obwq_56",fi={message:oie,prefix:lie,body:cie,title:uie,muted:die,accent:hie,success:fie,error:mie,warning:pie,row:gie,label:yie,value:bie},d2="web-shell-goal-status-active",{serialize:J7,parse:vie}=ny(m$),xie=new Set(["set","achieved","cleared","failed","aborted","checking"]);function Hg(t){const e=typeof t=="string"?vie(t):t;return wie(e)}function wie(t){if(!t||typeof t!="object")return null;const e=t,n=e.kind,r=e.condition;if(typeof n!="string"||!xie.has(n)||typeof r!="string")return null;const i=Av(e.iterations),s=Av(e.durationMs),a=Av(e.setAt),o=typeof e.lastReason=="string"?e.lastReason:void 0;return{kind:n,condition:r,...i!==void 0?{iterations:i}:{},...s!==void 0?{durationMs:s}:{},...a!==void 0?{setAt:a}:{},...o!==void 0?{lastReason:o}:{}}}function Av(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function kie(t,e){return e(t===1?"goal.turn":"goal.turns",{count:t})}function _ie(t,e){switch(t.kind){case"checking":return{prefix:"○",title:`${e("goal.check")}${t.iterations&&t.iterations>0?` · ${e("goal.turnLabel",{count:t.iterations})}`:""} · ${e("goal.notYetMet")}`,colorClass:fi.muted};case"set":return{prefix:"◎",title:e("goal.set"),colorClass:fi.accent};case"achieved":return{prefix:"✓",title:e("goal.achieved"),colorClass:fi.success};case"cleared":return{prefix:"○",title:e("goal.cleared"),colorClass:fi.muted};case"failed":return{prefix:"✖",title:e("goal.failed"),colorClass:fi.error};case"aborted":return{prefix:"!",title:e("goal.aborted"),colorClass:fi.warning}}}function Sie({status:t,activateFooter:e=!1}){var l;const{t:n}=dt();v.useEffect(()=>{if(!e)return;const c=t.kind==="set"||t.kind==="checking";window.dispatchEvent(new CustomEvent(d2,{detail:{active:c,condition:t.condition,setAt:t.setAt}}))},[e,t.condition,t.kind,t.setAt]);const r=_ie(t,n),i=[];t.kind!=="checking"&&(t.iterations&&t.iterations>0&&i.push(kie(t.iterations,n)),typeof t.durationMs=="number"&&i.push(mI(t.durationMs)));const s=i.length>0?` · ${i.join(" · ")}`:"",a=(t.kind==="checking"||t.kind==="achieved"||t.kind==="failed"||t.kind==="aborted")&&((l=t.lastReason)==null?void 0:l.trim()),o=t.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return f.jsxs("div",{className:fi.message,children:[f.jsx("span",{className:`${fi.prefix} ${r.colorClass}`,children:r.prefix}),f.jsxs("div",{className:fi.body,children:[f.jsxs("div",{className:`${fi.title} ${r.colorClass}`,children:[r.title,s&&f.jsx("span",{className:fi.muted,children:s})]}),f.jsxs("div",{className:fi.row,children:[f.jsxs("span",{className:fi.label,children:[n("goal.label"),":"]}),f.jsx("span",{className:fi.value,children:t.condition})]}),a&&f.jsxs("div",{className:fi.muted,children:[o,": ",a]})]})]})}const Tie="_message_t0ujh_1",Cie="_flushMessage_t0ujh_9",Eie="_info_t0ujh_27",Aie="_modelSwitch_t0ujh_33",Mie="_error_t0ujh_37",Nie="_warning_t0ujh_43",Die="_retryHint_t0ujh_49",Iie="_retryButton_t0ujh_56",Zs={message:Tie,flushMessage:Cie,info:Eie,modelSwitch:Aie,error:Mie,warning:Nie,retryHint:Die,retryButton:Iie},Rie=v.memo(function({content:e,variant:n,source:r,data:i,onShowContextDetail:s,isLatest:a=!1,showRetryHint:o=!1,onRetryClick:l}){const{t:c}=dt(),u=n==="info"?Ite(e):null;if(u)return f.jsx("div",{className:Zs.flushMessage,children:f.jsx(Pte,{status:u,onShowDetail:s})});const d=n==="info"?gne(e):null;if(d)return f.jsx("div",{className:Zs.flushMessage,children:f.jsx(Sne,{view:d.view,status:d.status})});const h=n==="info"?Rne(e):null;if(h)return f.jsx("div",{className:Zs.flushMessage,children:f.jsx(One,{info:h})});const m=n==="info"?hI(e):null;if(m)return f.jsx("div",{className:Zs.flushMessage,children:f.jsx(Sre,{message:m})});const p=n==="info"?Zre(e):null;if(p)return f.jsx("div",{className:Zs.flushMessage,children:f.jsx(gI,{message:p})});const b=n==="info"?Hg(r==="goal"?i:e):null;if(b)return f.jsx("div",{className:Zs.flushMessage,children:f.jsx(Sie,{status:b,activateFooter:a})});const x=n==="info"&&e.startsWith("● authType:");return f.jsxs("div",{className:`${Zs.message} ${Zs[n]} ${x?Zs.modelSwitch:""}`,children:[x?f.jsx("pre",{children:e}):n==="info"?f.jsx(hd,{content:e}):f.jsx("pre",{children:e}),o&&l&&f.jsx("div",{className:Zs.retryHint,children:f.jsx("button",{type:"button",className:Zs.retryButton,onClick:l,children:c("retry.hint")})})]})}),Oie="_group_gkc7z_1",jie="_line_gkc7z_15",Lie="_lineMain_gkc7z_20",Bie="_icon_gkc7z_27",zie="_iconDone_gkc7z_32",Pie="_iconError_gkc7z_36",$ie="_iconPending_gkc7z_40",Uie="_iconSpin_gkc7z_44",Hie="_lineName_gkc7z_56",qie="_lineArg_gkc7z_63",Fie="_lineElapsed_gkc7z_73",Vie="_lineExpandable_gkc7z_80",Gie="_agentSummary_gkc7z_95",Wie="_lineOutput_gkc7z_104",Kie="_lineFullArg_gkc7z_116",Yie="_lineDetail_gkc7z_128",Xie="_expandedBash_gkc7z_131",Qie="_expandedRead_gkc7z_132",Jie="_expandedOutput_gkc7z_136",Zie="_expandedEdit_gkc7z_149",ese="_expandBtn_gkc7z_163",tse="_todoProgress_gkc7z_182",nse="_todoBody_gkc7z_189",rse="_compactGroup_gkc7z_193",ise="_compactHeader_gkc7z_201",sse="_compactCount_gkc7z_208",ase="_compactHint_gkc7z_214",tt={group:Oie,line:jie,lineMain:Lie,icon:Bie,iconDone:zie,iconError:Pie,iconPending:$ie,iconSpin:Uie,lineName:Hie,lineArg:qie,lineElapsed:Fie,lineExpandable:Vie,agentSummary:Gie,lineOutput:Wie,lineFullArg:Kie,lineDetail:Yie,expandedBash:Xie,expandedRead:Qie,expandedOutput:Jie,expandedEdit:Zie,expandBtn:ese,todoProgress:tse,todoBody:nse,compactGroup:rse,compactHeader:ise,compactCount:sse,compactHint:ase};function xl({status:t}){switch(t){case"completed":case"success":return f.jsx("span",{className:`${tt.icon} ${tt.iconDone}`,children:"✓"});case"failed":case"error":case"cancelled":case"canceled":return f.jsx("span",{className:`${tt.icon} ${tt.iconError}`,children:"✗"});case"in_progress":case"running":return f.jsx("span",{className:`${tt.icon} ${tt.iconSpin}`,children:"⟳"});default:return f.jsx("span",{className:`${tt.icon} ${tt.iconPending}`,children:"○"})}}function B0(t,e){if(!t)return"";const n=Math.round(((e||Date.now())-t)/1e3);if(n<3)return"";if(n<60)return`${n}s`;const r=Math.floor(n/60),i=n%60;return`${r}m ${i}s`}function yI(t){if(!t)return"";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/60),r=e%60;return`${n}m ${r}s`}const ose="_panel_zc0gy_1",lse="_header_zc0gy_13",cse="_desc_zc0gy_25",use="_toggle_zc0gy_34",dse="_meta_zc0gy_40",hse="_body_zc0gy_46",fse="_content_zc0gy_57",mse="_stream_zc0gy_72",pse="_streamCollapsed_zc0gy_82",gse="_scrollWindow_zc0gy_89",yse="_expandToggle_zc0gy_94",bse="_tabBar_zc0gy_109",vse="_tab_zc0gy_109",xse="_tabActive_zc0gy_131",wse="_tools_zc0gy_136",kse="_toolTimeRow_zc0gy_153",_se="_toolTimeTip_zc0gy_157",Un={panel:ose,header:lse,desc:cse,toggle:use,meta:dse,body:hse,content:fse,stream:mse,streamCollapsed:pse,scrollWindow:gse,expandToggle:yse,tabBar:bse,tab:vse,tabActive:xse,tools:wse,toolTimeRow:kse,toolTimeTip:_se};function bI(t){return!!t&&typeof t=="object"&&t.type==="task_execution"}function Sse({timestamp:t,children:e}){return t===void 0?f.jsx(f.Fragment,{children:e}):f.jsxs("div",{className:Un.toolTimeRow,children:[e,f.jsx("span",{className:Un.toolTimeTip,"aria-hidden":"true",children:vg(t)})]})}const Tse=v.memo(function({tool:e}){const n=e.subTools||e.subContent?f.jsx(_k,{tool:e}):f.jsx(SI,{tool:e});return f.jsx(Sse,{timestamp:e.startTime,children:n})});function Cse({tc:t}){const{t:e}=dt(),n=t.description||"";return f.jsx("div",{className:tt.line,children:f.jsxs("div",{className:tt.lineMain,children:[f.jsx(xl,{status:t.status}),f.jsx("span",{className:tt.lineName,children:pu(t.name,e)}),n&&f.jsx("span",{className:tt.lineArg,children:Hr(n,70)})]})})}function Ese(t){var e;if(t.rawOutput&&bI(t.rawOutput)&&t.rawOutput.result)return t.rawOutput.result;if(t.content){for(const n of t.content)if(n.type==="content"&&((e=n.content)!=null&&e.text))return n.content.text}if(t.rawOutput){if(typeof t.rawOutput=="string")return t.rawOutput;const n=t.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 Ase({text:t}){const{compactThinking:e}=du(),{t:n}=dt(),[r,i]=v.useState(!1),[s,a]=v.useState(!1),o=v.useRef(null),l=e&&!r;return v.useEffect(()=>{const c=o.current;!c||!l||(a(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,t]),v.useEffect(()=>{const c=o.current;if(!c||!l)return;const u=()=>a(c.scrollHeight>c.clientHeight),d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[l]),f.jsxs("div",{children:[f.jsx("pre",{ref:o,className:l?`${Un.stream} ${Un.streamCollapsed}`:Un.stream,children:t}),e&&(s||r)&&f.jsx("button",{className:Un.expandToggle,onClick:()=>i(c=>!c),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function Mse({content:t}){const{compactThinking:e}=du();return f.jsx("div",{className:e?Un.scrollWindow:void 0,children:f.jsx(hd,{content:t,source:"assistant"})})}function Z7({pinTail:t,itemCount:e,children:n}){const{compactThinking:r}=du(),i=v.useRef(null);return v.useEffect(()=>{const s=i.current;!s||!r||(s.scrollTop=t?s.scrollHeight:0)},[r,t,e]),f.jsx("div",{ref:i,className:r?`${Un.tools} ${Un.scrollWindow}`:Un.tools,children:n})}function _k({tool:t,defaultExpanded:e,hideHeader:n,inline:r}){var S,T,O,z;const i=t.status==="completed"||t.status==="failed",s=ty(t),[a,o]=v.useState(e??!1),[l,c]=v.useState("result"),u=bI(t.rawOutput)?t.rawOutput:null,d=((S=t.subTools)==null?void 0:S.length)||((T=u==null?void 0:u.toolCalls)==null?void 0:T.length)||0,h=kk(t),m=wk(t),p=B0(t.startTime,t.endTime)||yI((O=u==null?void 0:u.executionSummary)==null?void 0:O.totalDurationMs),b=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(z=u==null?void 0:u.executionSummary)==null?void 0:z.totalTokens,x=b?xk(b):"",g=i?Ese(t):"",y=v.useMemo(()=>t.subTools&&t.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[t.subTools,u]),w=!!(t.subContent||g),C=!!(t.subTools&&t.subTools.length>0||y&&y.length>0),E=w&&C;return f.jsxs("div",{className:r?void 0:Un.panel,children:[!n&&f.jsxs("div",{className:Un.header,onClick:()=>o(!a),children:[f.jsx(xl,{status:s}),f.jsxs("span",{className:tt.lineName,children:[m,":"]}),h&&f.jsx("span",{className:Un.desc,children:Hr(h,50)}),i&&d>0&&f.jsxs("span",{className:Un.meta,children:["· ",d," tools"]}),p&&f.jsxs("span",{className:Un.meta,children:["· ",p]}),x&&f.jsxs("span",{className:Un.meta,children:["· ",x]}),!i&&f.jsx("span",{className:Un.toggle,children:a?"▼":"▶"})]}),(a||n)&&f.jsxs("div",{className:Un.body,children:[E&&f.jsxs("div",{className:Un.tabBar,children:[f.jsx("button",{className:`${Un.tab} ${l==="result"?Un.tabActive:""}`,onClick:()=>c("result"),children:"Result"}),f.jsxs("button",{className:`${Un.tab} ${l==="tools"?Un.tabActive:""}`,onClick:()=>c("tools"),children:["Tools (",d,")"]})]}),(!E||l==="result")&&w&&f.jsx("div",{className:Un.content,children:i?f.jsx(Mse,{content:t.subContent||g}):t.subContent&&f.jsx(Ase,{text:t.subContent})}),(!E||l==="tools")&&f.jsxs(f.Fragment,{children:[t.subTools&&t.subTools.length>0&&f.jsx(Z7,{pinTail:!i,itemCount:t.subTools.length,children:t.subTools.map(I=>f.jsx(Tse,{tool:I},I.callId))}),y&&y.length>0&&f.jsx(Z7,{pinTail:!i,itemCount:y.length,children:y.map(I=>f.jsx(Cse,{tc:I},I.callId))})]})]})]})}const Nse="_view_f1xgr_1",Dse="_stats_f1xgr_9",Ise="_statAdd_f1xgr_18",Rse="_statDel_f1xgr_22",Ose="_lines_f1xgr_26",jse="_line_f1xgr_26",Lse="_lineAdd_f1xgr_38",Bse="_lineDel_f1xgr_42",zse="_lineHeader_f1xgr_46",Pse="_lineContext_f1xgr_52",$se="_lineNo_f1xgr_56",Use="_marker_f1xgr_66",Hse="_content_f1xgr_81",ga={view:Nse,stats:Dse,statAdd:Ise,statDel:Rse,lines:Ose,line:jse,lineAdd:Lse,lineDel:Bse,lineHeader:zse,lineContext:Pse,lineNo:$se,marker:Use,content:Hse};function qse(t){let e=0,n=0;const r=[];let i=0,s=0;for(const a of t.split(`
`))if(a.startsWith("@@")){const o=a.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);o&&(i=parseInt(o[1],10),s=parseInt(o[2],10)),r.push({type:"header",content:a})}else a.startsWith("+")&&!a.startsWith("+++ ")?(e++,r.push({type:"add",content:a.slice(1),newLine:s}),s++):a.startsWith("-")&&!a.startsWith("--- ")?(n++,r.push({type:"del",content:a.slice(1),oldLine:i}),i++):(r.push({type:"context",content:a.startsWith(" ")?a.slice(1):a,oldLine:i,newLine:s}),i++,s++);return{lines:r,additions:e,deletions:n}}const Fse=v.memo(function({diff:e}){if(!e)return null;const{lines:n,additions:r,deletions:i}=qse(e);return f.jsxs("div",{className:ga.view,children:[f.jsxs("div",{className:ga.stats,children:[r>0&&f.jsxs("span",{className:ga.statAdd,children:["+",r]}),i>0&&f.jsxs("span",{className:ga.statDel,children:["-",i]})]}),f.jsx("div",{className:ga.lines,children:n.map((s,a)=>f.jsxs("div",{className:`${ga.line} ${ga[`line${s.type[0].toUpperCase()}${s.type.slice(1)}`]}`,children:[f.jsx("span",{className:ga.lineNo,children:s.type==="header"?"":s.oldLine??s.newLine}),f.jsx("span",{className:ga.marker,children:s.type==="add"?"+":s.type==="del"?"-":s.type==="header"?"":" "}),f.jsx("span",{className:ga.content,children:s.content})]},a))})]})}),Vse="_approval_1ucyy_1",Gse="_header_1ucyy_10",Wse="_icon_1ucyy_20",Kse="_name_1ucyy_26",Yse="_desc_1ucyy_35",Xse="_content_1ucyy_44",Qse="_code_1ucyy_58",Jse="_codeBlock_1ucyy_66",Zse="_question_1ucyy_76",eae="_options_1ucyy_81",tae="_option_1ucyy_81",nae="_optionActive_1ucyy_99",rae="_pointer_1ucyy_103",iae="_num_1ucyy_109",sae="_label_1ucyy_114",di={approval:Vse,header:Gse,icon:Wse,name:Kse,desc:Yse,content:Xse,code:Qse,codeBlock:Jse,question:Zse,options:eae,option:tae,optionActive:nae,pointer:rae,num:iae,label:sae};function aae(t){if(!t)return{toolName:"",description:""};const e=t.indexOf(": ");if(e>0){const n=t.slice(0,e);return/^[A-Za-z][\w.-]{0,40}$/.test(n)?{toolName:n,description:t.slice(e+2)}:{toolName:t,description:""}}return{toolName:t,description:""}}function oae(t){const e=[];for(const n of t.content)n.type==="text"&&n.text&&e.push(n.text);return e.join(`
`)}function lae(t){return t.kind==="bash"||t.kind==="exec"||t.kind==="shell"}function cae(t){if(!t.rawInput)return null;const e=t.rawInput;return typeof e.command=="string"?e.command:typeof e.input=="string"?e.input:null}function e8(t){if(t.length>1&&(t[0].kind==="allow_always"||t[0].kind==="reject_always")){const e=t.findIndex(n=>n.kind==="allow_once"||n.kind==="reject_once");return e>=0?e:1}return 0}function t8(t){return t.kind==="allow_once"?0:t.kind==="allow_always"&&t.id==="proceed_always_project"?1:t.kind==="allow_always"&&t.id==="proceed_always_user"?2:t.kind==="allow_always"?3:t.kind==="reject_once"||t.kind==="reject_always"?4:5}function jm(t){return t.map((e,n)=>({option:e,index:n})).sort((e,n)=>{const r=t8(e.option)-t8(n.option);return r===0?e.index-n.index:r}).map(({option:e})=>e)}function uae(t){if(t.kind==="allow_once")return"approval.option.allowOnce";if(t.kind==="reject_once")return"approval.option.rejectOnce";if(t.kind==="allow_always"){if(t.id==="proceed_always_project")return"approval.option.allowAlwaysProject";if(t.id==="proceed_always_user")return"approval.option.allowAlwaysUser";if(t.id==="proceed_always")return"approval.option.allowAllEdits"}}function Ic({request:t,onConfirm:e}){const{t:n}=dt(),r=v.useMemo(()=>jm(t.options),[t.options]),[i,s]=v.useState(()=>e8(jm(t.options))),a=v.useRef(t);a.current=t;const o=v.useRef(i),l=v.useRef(!1),c=v.useRef(!1);v.useEffect(()=>{const y=e8(jm(a.current.options));l.current=!1,c.current=!1,o.current=y,s(y)},[t.id]);const{toolName:u,description:d}=aae(t.title),h=oae(t),m=v.useCallback(y=>{l.current||(l.current=!0,e(a.current.id,y))},[e]),p=v.useCallback(y=>{if(y.defaultPrevented||Ug(y.target))return;const w=a.current,C=jm(w.options),E=C.length;if(y.key==="ArrowUp"||y.key==="k")y.preventDefault(),c.current=!0,s(S=>{const T=(S-1+E)%E;return o.current=T,T});else if(y.key==="ArrowDown"||y.key==="j")y.preventDefault(),c.current=!0,s(S=>{const T=(S+1)%E;return o.current=T,T});else if(y.key==="Enter"){if(y.preventDefault(),!c.current){c.current=!0;return}const S=C[o.current];S&&m(S.id)}else if(y.key==="Escape"){y.preventDefault();const S=w.options.find(T=>T.kind==="reject_once"||T.kind==="reject_always");S&&m(S.id)}else if(y.key>="1"&&y.key<="9"){const S=parseInt(y.key)-1;S<E&&(y.preventDefault(),c.current=!0,m(C[S].id))}},[m]);v.useEffect(()=>{const y=setTimeout(()=>{window.addEventListener("keydown",p)},250);return()=>{clearTimeout(y),window.removeEventListener("keydown",p)}},[p]);const b=lae(t),x=Cz(t.toolName),g=cae(t);return f.jsxs("div",{className:di.approval,children:[f.jsxs("div",{className:di.header,children:[f.jsx("span",{className:di.icon,children:"?"}),f.jsx("span",{className:di.name,children:u}),d&&f.jsx("span",{className:di.desc,children:d})]}),b&&g?f.jsx("div",{className:di.code,children:f.jsx("pre",{className:di.codeBlock,children:g})}):h&&h!==t.title?f.jsx("pre",{className:di.content,children:h}):null,f.jsx("div",{className:di.question,children:x?n("approval.launchAgentQuestion"):b?n("approval.execQuestion",{tool:u}):n("approval.changeQuestion")}),f.jsx("div",{className:di.options,children:r.map((y,w)=>{const C=w===i,E=uae(y),S=E?n(E):y.label;return f.jsxs("div",{className:`${di.option} ${C?di.optionActive:""}`,onClick:()=>m(y.id),children:[f.jsx("span",{className:di.pointer,children:C?"›":" "}),f.jsxs("span",{className:di.num,children:[w+1,"."]}),f.jsx("span",{className:di.label,children:S})]},y.id)})})]})}const n8={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 dae(t){const e=[];let n,r=!1,i=!1,s=0;const a=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let o;for(;(o=a.exec(t))!==null;){o.index>s&&e.push({text:t.slice(s,o.index),color:n,bold:r,dim:i}),s=o.index+o[0].length;const l=o[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,r=!1,i=!1):c===1?r=!0:c===2?i=!0:c===22?(r=!1,i=!1):c>=30&&c<=37||c>=90&&c<=97?n=n8[c]:c===39&&(n=void 0)}return s<t.length&&e.push({text:t.slice(s),color:n,bold:r,dim:i}),e}function hae(t){return new RegExp(String.raw`\x1b\[`).test(t)}function lh(t){const e=t.toLowerCase();return e==="todo_write"||e==="todowrite"}function Mv(t){const e=t.flatMap((n,r)=>{const i=qg(n),s=Lm(i,"content");return s?[{id:Lm(i,"id")??`plan-${r}`,content:s,status:Tae(Lm(i,"status")),priority:Cae(Lm(i,"priority"))}]:[]});return e.length>0?e:void 0}function Sk(t){if(!lh(t.toolName)&&t.kind!=="other")return;const e=i8(t.args);if(e)return Mv(e);const n=qg(t.rawOutput),r=i8(n);if(r)return Mv(r);const i=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return i?Mv(i):void 0}function fae(t){return t.some(e=>e.status==="pending"||e.status==="in_progress")}function e0(t){switch(t){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const r8={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function mae(t){let e=[],n=null,r=null,i=!1;for(const a of t){if(a.role==="user"){i=!0;continue}if(a.role==="plan"){e=a.todos,n=a.id,r=null,i=!1;continue}if(a.role==="tool_group")for(const o of a.tools){const l=Sk(o);l&&(e=l,n=a.id,r=o.callId,i=!1)}}if(e.length===0)return r8;const s=!fae(e);return s&&i?r8:{todos:e,allCompleted:s,sourceMessageId:n,sourceCallId:r}}function Tk(t){return JSON.stringify([t.id,t.content])}function ry(t){if(t.role==="plan")return[{key:t.id,todos:t.todos}];if(t.role==="tool_group"){const e=[];for(const n of t.tools){const r=Sk(n);r&&e.push({key:n.callId,todos:r,stats:vae(n)})}return e}return[]}function pae(t){const e=new Map,n=new Map;for(const r of t)for(const{key:i,todos:s}of ry(r)){const a=[];for(const o of s){const l=Tk(o),c=n.get(l);o.status==="in_progress"&&c!=="in_progress"?a.push({kind:"started",id:o.id,content:o.content}):o.status==="completed"&&c!=="completed"&&c!==void 0&&a.push({kind:"completed",id:o.id,content:o.content}),n.set(l,o.status)}e.set(i,{events:a})}return e}function gae(t){const e=[];for(const n of t)for(const{key:r,todos:i}of ry(n))e.push(JSON.stringify([r,i.map(s=>[s.id,s.status,s.content])]));return e.join(`
`)}function yae(t){const e=[];for(const n of t){if(n.role==="tool_group")for(const r of n.tools)!lh(r.toolName)&&(r.startTime!==void 0||r.endTime!==void 0)&&e.push(JSON.stringify(["span",r.callId,r.startTime,r.endTime]));for(const{key:r,todos:i,stats:s}of ry(n))e.push(JSON.stringify([r,n.timestamp,i.map(a=>[a.id,a.status,a.content]),s]))}return e.join(`
`)}function bae(t,e){if(t.length<=e)return{start:0,end:t.length};const n=t.findIndex(a=>a.status==="in_progress"),r=n>=0?n:t.findIndex(a=>a.status==="pending");let i=Math.max(0,Math.max(0,r)-1);const s=Math.min(t.length,i+e);return i=Math.max(0,s-e),{start:i,end:s}}function vae(t){var a;const e=qg((a=qg(t.rawOutput))==null?void 0:a.stats);if(!e)return;const n=o=>{const l=e[o];return typeof l=="number"&&Number.isFinite(l)?l:void 0},r=n("promptTokens"),i=n("cachedTokens"),s=n("candidateTokens");if(!(r===void 0||i===void 0||s===void 0))return{promptTokens:r,cachedTokens:i,candidateTokens:s,apiTimeMs:n("apiTimeMs")??0}}function xae(t){const e=[];for(const n of t)if(n.role==="tool_group")for(const r of n.tools){if(lh(r.toolName))continue;const{startTime:i,endTime:s}=r;typeof i=="number"&&typeof s=="number"&&s>=i&&e.push({start:i,end:s})}return e.sort((n,r)=>n.start-r.start),e}function wae(t,e,n){let r=0,i=t.length;for(;r<i;){const a=r+i>>>1;t[a].start<e?r=a+1:i=a}let s=0;for(let a=r;a<t.length&&t[a].start<=n;a++)s+=t[a].end-t[a].start;return s}function kae(t,e){const n=(r,i)=>Math.max(0,i-r);return{inputTokens:n(t.promptTokens,e.promptTokens),cachedTokens:n(t.cachedTokens,e.cachedTokens),outputTokens:n(t.candidateTokens,e.candidateTokens),apiTimeMs:n(t.apiTimeMs,e.apiTimeMs)}}function _ae(t,e){const n={};return t&&(t.inputTokens>0||t.outputTokens>0||t.cachedTokens>0||t.apiTimeMs>0)&&(n.inputTokens=t.inputTokens,n.cachedTokens=t.cachedTokens,n.outputTokens=t.outputTokens,t.apiTimeMs>0&&(n.apiTimeMs=t.apiTimeMs)),e!==void 0&&e>0&&(n.toolTimeMs=e),Object.keys(n).length>0?n:void 0}function Sae(t){var o;const e=new Map,n=new Map,r=new Map,i=new Set,s=xae(t),a=l=>{let c=e.get(l);return c||(c={},e.set(l,c)),c};for(const l of t){const c=l.timestamp;for(const{todos:u,stats:d}of ry(l))for(const h of u){const m=Tk(h),p=n.get(m);if(h.status==="in_progress"&&p!=="in_progress")i.has(m)&&(i.delete(m),r.delete(m),e.delete(m)),r.get(m)===void 0&&(r.set(m,d),c!==void 0&&(a(m).startTs=c));else if(h.status==="completed"&&p!=="completed"&&p!==void 0){const b=r.get(m),x=b&&d?kae(b,d):void 0,g=(o=e.get(m))==null?void 0:o.startTs,y=g!==void 0&&c!==void 0?wae(s,g,c):void 0,w=_ae(x,y);if(c!==void 0||w){const C=a(m);c!==void 0&&(C.endTs=c),w&&(C.resources=w)}}h.status==="completed"&&i.add(m),n.set(m,h.status)}}return e}function i8(t){const e=t==null?void 0:t.todos;return Array.isArray(e)?e:void 0}function Tae(t){return t==="completed"||t==="in_progress"||t==="pending"?t:"pending"}function Cae(t){return t==="high"||t==="medium"||t==="low"?t:void 0}function qg(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function Lm(t,e){const n=t==null?void 0:t[e];return typeof n=="string"&&n.length>0?n:void 0}const Eae="_list_wqkzx_1",Aae="_summary_wqkzx_2",Mae="_row_wqkzx_8",Nae="_num_wqkzx_16",Dae="_icon_wqkzx_23",Iae="_text_wqkzx_29",Rae="_inProgress_wqkzx_43",Oae="_completed_wqkzx_48",jae="_item_wqkzx_62",Lae="_rowButton_wqkzx_69",Bae="_detailChevron_wqkzx_82",zae="_detail_wqkzx_82",Pae="_detailSection_wqkzx_100",$ae="_detailSectionTitle_wqkzx_106",Uae="_detailRows_wqkzx_114",Hae="_detailLabel_wqkzx_122",qae="_detailValue_wqkzx_126",Fae="_detailDuration_wqkzx_132",Vae="_detailHint_wqkzx_136",Jt={list:Eae,summary:Aae,row:Mae,num:Nae,icon:Dae,text:Iae,inProgress:Rae,completed:Oae,item:jae,rowButton:Lae,detailChevron:Bae,detail:zae,detailSection:Pae,detailSectionTitle:$ae,detailRows:Uae,detailLabel:Hae,detailValue:qae,detailDuration:Fae,detailHint:Vae};function h2(t){switch(t){case"completed":return Jt.completed;case"in_progress":return Jt.inProgress;case"pending":return""}}function vI({todos:t,events:e}){const{t:n}=dt();if(e.length===0){if(t.length>0&&t.every(s=>s.status==="completed"))return f.jsx("div",{className:Jt.summary,children:f.jsxs("div",{className:`${Jt.row} ${Jt.completed}`,children:[f.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:"✓"}),f.jsx("span",{className:Jt.text,children:n("todo.allDone")})]})});const i=t.find(s=>s.status==="in_progress")??t.find(s=>s.status==="pending");return i?f.jsx("div",{className:Jt.summary,children:f.jsxs("div",{className:`${Jt.row} ${h2(i.status)}`,children:[f.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:e0(i.status)}),f.jsx("span",{className:Jt.text,children:i.content})]})}):null}return f.jsx("div",{className:Jt.summary,children:e.map(r=>f.jsxs("div",{className:`${Jt.row} ${r.kind==="completed"?Jt.completed:Jt.inProgress}`,children:[f.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:e0(r.kind==="completed"?"completed":"in_progress")}),f.jsx("span",{className:Jt.text,children:r.content})]},`${r.kind}-${r.id}`))})}function mc({label:t,value:e,suffix:n}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:Jt.detailLabel,children:t}),f.jsxs("span",{className:Jt.detailValue,children:[e,n]})]})}function Nv({title:t,children:e}){return f.jsxs("div",{className:Jt.detailSection,children:[f.jsx("div",{className:Jt.detailSectionTitle,children:t}),f.jsx("div",{className:Jt.detailRows,children:e})]})}function Gae({detail:t}){const{t:e}=dt(),{startTs:n,endTs:r,resources:i}=t,s=n!==void 0||r!==void 0,a=(i==null?void 0:i.inputTokens)!==void 0,o=(i==null?void 0:i.apiTimeMs)!==void 0||(i==null?void 0:i.toolTimeMs)!==void 0;return f.jsxs("div",{className:Jt.detail,children:[s&&f.jsxs(Nv,{title:e("todo.detail.sectionTime"),children:[n!==void 0&&f.jsx(mc,{label:e("todo.detail.start"),value:vg(n)}),r!==void 0&&f.jsx(mc,{label:e("todo.detail.end"),value:vg(r),suffix:n!==void 0?f.jsxs("span",{className:Jt.detailDuration,children:[" ","(",Ol(r-n),")"]}):void 0})]}),a&&f.jsxs(Nv,{title:e("todo.detail.sectionTokens"),children:[f.jsx(mc,{label:e("todo.detail.input"),value:((i==null?void 0:i.inputTokens)??0).toLocaleString()}),f.jsx(mc,{label:e("todo.detail.output"),value:((i==null?void 0:i.outputTokens)??0).toLocaleString()}),f.jsx(mc,{label:e("todo.detail.cached"),value:((i==null?void 0:i.cachedTokens)??0).toLocaleString()})]}),o&&f.jsxs(Nv,{title:e("todo.detail.sectionSpent"),children:[(i==null?void 0:i.apiTimeMs)!==void 0&&f.jsx(mc,{label:e("todo.detail.api"),value:Ol(i.apiTimeMs)}),(i==null?void 0:i.toolTimeMs)!==void 0&&f.jsx(mc,{label:e("todo.detail.tool"),value:Ol(i.toolTimeMs)})]}),!i&&f.jsx("div",{className:Jt.detailHint,children:e("todo.detail.noResources")})]})}function Wae(t){return!!t&&(t.endTs!==void 0||t.resources!==void 0)}function xI({todos:t,numbered:e=!1}){const{t:n}=dt(),r=v.useContext(ej),[i,s]=v.useState(()=>new Set),a=`${String(t.length).length+1}ch`,o=l=>s(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return f.jsx("div",{className:Jt.list,children:t.map((l,c)=>{const u=l.id||String(c),d=r.get(Tk(l)),h=Wae(d),m=h&&i.has(u),p=f.jsxs(f.Fragment,{children:[e&&f.jsxs("span",{className:Jt.num,style:{minWidth:a},children:[c+1,"."]}),f.jsx("span",{className:Jt.icon,"aria-hidden":"true",children:e0(l.status)}),f.jsx("span",{className:Jt.text,children:l.content}),h&&f.jsx("span",{className:Jt.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return f.jsxs("div",{className:Jt.item,children:[h?f.jsx("button",{type:"button",className:`${Jt.row} ${Jt.rowButton} ${h2(l.status)}`,onClick:b=>{b.stopPropagation(),o(u)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:p}):f.jsx("div",{className:`${Jt.row} ${h2(l.status)}`,children:p}),m&&d&&f.jsx(Gae,{detail:d})]},u)})})}const wI=5;function Kae(t){const e=t.toolName.toLowerCase();if(L0(t.toolName))return!!za(t);if(e==="write_file"||e==="writefile")return!!soe(t)||s8(t);if(t.status!=="completed"&&t.status!=="failed")return!1;if(Fl(e)){const n=za(t);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(e==="edit"||e==="write"||e==="editfile")return s8(t);if(e==="read"||e==="read_file"||e==="readfile"){const n=za(t);return!!n&&n.split(`
`).length>3}return!1}function Yae(t){const e=t.toolName.toLowerCase();return Fl(e)||e==="write_file"||e==="writefile"||e==="edit"||e==="write"||e==="editfile"||e==="read"||e==="read_file"||e==="readfile"||L0(t.toolName)}function Xae(t){var e;return(e=t.content)!=null&&e.some(n=>n.type==="diff")?!0:!!kI(t)}function s8(t){return Xae(t)||!!za(t)}function Qae(t){if(t.content){const e=t.content.find(n=>n.type==="diff");if(e&&e.type==="diff")return eoe(e.oldText||"",e.newText||"")}return kI(t)}function kI(t){if(t.rawOutput&&typeof t.rawOutput=="object"){const e=t.rawOutput;if(Jae(e))return"";if(typeof e.fileDiff=="string")return e.fileDiff}return""}function Jae(t){return t.truncatedForSession===!0&&"fileName"in t&&"newContent"in t}const Zae=25e4;function eoe(t,e){const n=t.split(`
`),r=e.split(`
`),i=n.length,s=r.length;if(i*s>Zae){const u=n.map(h=>h?`-${h}`:"-"),d=r.map(h=>h?`+${h}`:"+");return[...u,...d].join(`
`)}const a=Array.from({length:i+1},()=>Array(s+1).fill(0));for(let u=1;u<=i;u++)for(let d=1;d<=s;d++)a[u][d]=n[u-1]===r[d-1]?a[u-1][d-1]+1:Math.max(a[u-1][d],a[u][d-1]);const o=[];let l=i,c=s;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(o.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||a[l][c-1]>=a[l-1][c])?(o.push(`+${r[c-1]}`),c--):(o.push(`-${n[l-1]}`),l--);return o.reverse().join(`
`)}const Dv=150,a8=25,toe=60;function noe(t){const e=t.find(i=>i.key==="ui.shellOutputMaxLines"),n=e==null?void 0:e.values.effective;return Math.max(0,Math.floor((typeof n=="number"?n:wI)||0))}function o8(t,e){return t.length<=e?t:t.slice(0,e)+" …"}function roe({tool:t,maxLines:e}){const{t:n}=dt(),[r,i]=v.useState(!1),s=v.useMemo(()=>za(t)||"",[t]),a=v.useMemo(()=>s.split(`
`),[s]),o=e>0&&a.length>e,l=Math.max(0,a.length-e),c=v.useMemo(()=>a.some(m=>m.length>Dv),[a]),u=o||c,d=v.useMemo(()=>r?s:o?[`... first ${l} lines hidden ...`,...a.slice(-e).map(m=>o8(m,Dv))].join(`
`):a.map(m=>o8(m,Dv)).join(`
`),[l,o,a,e,s,r]),h=v.useMemo(()=>hae(d)?dae(d):null,[d]);return f.jsxs("div",{className:tt.expandedBash,children:[f.jsx("pre",{className:tt.expandedOutput,children:h?h.map((m,p)=>f.jsx("span",{style:{color:m.color,fontWeight:m.bold?"bold":void 0,opacity:m.dim?.6:void 0},children:m.text},p)):d}),u&&f.jsx("button",{className:tt.expandBtn,onClick:()=>i(!r),"aria-expanded":r,children:r?n("tool.showLess"):o?n("tool.showAll",{count:a.length}):n("tool.showFullLines")})]})}function ioe({tool:t}){const{t:e}=dt(),[n,r]=v.useState(!1),i=v.useMemo(()=>za(t)||"",[t]),s=v.useMemo(()=>i.split(`
`),[i]),a=s.length>a8,o=v.useMemo(()=>a&&!n?s.slice(0,a8).join(`
`):i,[i,a,s,n]);return f.jsxs("div",{className:tt.expandedRead,children:[f.jsx("pre",{className:tt.expandedOutput,children:o}),a&&f.jsx("button",{className:tt.expandBtn,onClick:()=>r(!n),"aria-expanded":n,children:n?e("tool.showLess"):e("tool.linesTotal",{count:s.length})})]})}function l8({tool:t}){const e=v.useMemo(()=>Qae(t),[t]),n=v.useMemo(()=>za(t)||"",[t]);return!e&&!n?null:f.jsx("div",{className:tt.expandedEdit,children:e?f.jsx(Fse,{diff:e}):f.jsx("pre",{className:tt.expandedOutput,children:n})})}function soe(t){var n,r;if((n=t.args)!=null&&n.content)return t.args.content;if((r=t.args)!=null&&r.new_string)return t.args.new_string;const e=za(t);if(e)return e;if(t.rawOutput&&typeof t.rawOutput=="object"){const i=t.rawOutput;if(typeof i.content=="string")return i.content;if(typeof i.newContent=="string")return i.newContent}return""}function aoe({tool:t,todos:e,expanded:n}){var s;const i=((s=v.useContext(o5).get(t.callId))==null?void 0:s.events)??[];return f.jsx("div",{className:tt.todoBody,children:n?f.jsx(xI,{todos:e}):f.jsx(vI,{todos:e,events:i})})}function ooe(t,e){var h,m;const n=ey(t.rawOutput),r=vk(t),i=ty(t),s=wk(t),a=kk(t),o=((h=t.subTools)==null?void 0:h.length)||((m=n==null?void 0:n.toolCalls)==null?void 0:m.length)||0,l=n==null?void 0:n.executionSummary,c=l&&typeof l.totalDurationMs=="number"?yI(l.totalDurationMs):B0(t.startTime,t.endTime??(t.status==="in_progress"&&e?e:void 0)),u=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:l&&typeof l.totalTokens=="number"&&l.totalTokens>0?l.totalTokens:0,d=u>0?xk(u):"";return{agentType:s,description:a,subToolCount:o,elapsed:c,tokens:d,status:i,reason:r}}function c8(t){if(t.status==="completed")return!1;const e=t.toolName.toLowerCase();return!!(L0(t.toolName)||e==="write_file"||e==="writefile"||e==="edit"||e==="editfile"||Fl(e))}function loe({tool:t}){const e=za(t)||"";return f.jsx("pre",{className:tt.expandedOutput,children:e})}function _I(t){const e=t.toolName.toLowerCase();return D1(t)?"agent":Fl(e)?"shell":Ck(e)?"fetch":lh(e)?"todo":e==="read"||e==="read_file"||e==="readfile"?"read":e==="edit"||e==="editfile"?"edit":e==="write"||e==="write_file"||e==="writefile"?"write":"other"}function coe({description:t,elapsed:e}){return f.jsxs(f.Fragment,{children:[t&&f.jsx("span",{className:tt.lineArg,children:t}),e&&f.jsx("span",{className:tt.lineElapsed,children:e})]})}function f2({info:t}){const{renderToolHeaderExtra:e}=du(),n=e==null?void 0:e(t);return n?f.jsx(f.Fragment,{children:n}):f.jsx(coe,{description:t.description,elapsed:t.elapsed})}function uoe(t){return t.length>toe||t.includes(`
`)}function doe(t){return t.find(e=>e.status==="in_progress")??t[t.length-1]}function Ck(t){const e=t.toLowerCase();return e==="web_fetch"||e==="webfetch"||e==="fetch"}const hoe=ty;function foe({tools:t,workspaceCwd:e}){const{t:n}=dt(),r=doe(t),i=pu(r.toolName,n),s=hoe(r),a=lI(r,e),o=Fl(r.toolName)||Ck(r.toolName)?"":B0(r.startTime,r.endTime);return f.jsxs("div",{className:tt.compactGroup,children:[f.jsxs("div",{className:tt.compactHeader,children:[f.jsx(xl,{status:s}),f.jsx("span",{className:tt.lineName,children:i}),t.length>1&&f.jsxs("span",{className:tt.compactCount,children:["× ",t.length]}),f.jsx(f2,{info:{kind:_I(r),tool:r,displayName:i,description:a,elapsed:o,workspaceCwd:e}})]}),f.jsx("div",{className:tt.compactHint,children:n("compact.hint")})]})}function moe(t,e){var i,s;if(((i=t.approval)==null?void 0:i.id)!==((s=e.approval)==null?void 0:s.id)||t.onConfirm!==e.onConfirm||t.workspaceCwd!==e.workspaceCwd||t.shellOutputMaxLines!==e.shellOutputMaxLines)return!1;const n=t.tool,r=e.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&&poe(n.subTools,r.subTools)}function poe(t,e){if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let n=0;n<t.length;n++){const r=t[n],i=e[n];if(r.callId!==i.callId||r.toolName!==i.toolName||r.status!==i.status||r.endTime!==i.endTime||r.rawOutput!==i.rawOutput||r.args!==i.args||r.subContent!==i.subContent||r.title!==i.title)return!1}return!0}const SI=v.memo(function({tool:e,approval:n,onConfirm:r,workspaceCwd:i,shellOutputMaxLines:s=wI}){const{t:a}=dt(),o=v.useContext(dh),[l,c]=v.useState(()=>!o&&c8(e)),u=v.useRef(!1),[d,h]=v.useState(()=>Date.now());v.useEffect(()=>{c(o?!1:c8(e)),u.current=!1},[o,e.callId,e.toolName]);const m=D1(e),p=n&&n.toolCallId===e.callId,b=!p&&(n==null?void 0:n.toolCallId)&&m&&$a(e,n.toolCallId),x=m&&e.status==="in_progress";if(v.useEffect(()=>{if(!x)return;h(Date.now());const P=setInterval(()=>h(Date.now()),1e3);return()=>clearInterval(P)},[x]),v.useEffect(()=>{!m&&e.status==="completed"&&!u.current&&c(!1)},[m,e.status]),m){if(p&&r)return f.jsx("div",{className:tt.line,children:f.jsx(Ic,{request:n,onConfirm:r})});const P=ooe(e,d),J=a("agent.label"),q=e.status==="completed"||e.status==="failed",Y=uI(e,a),$=e.status==="pending"?"pending":"running",Z=[Y,$,P.elapsed].filter(Boolean).join(" · "),M=l||!!b;return f.jsxs("div",{className:tt.line,children:[f.jsxs("div",{className:tt.lineMain,children:[f.jsx(xl,{status:e.status}),f.jsx("span",{className:tt.lineName,children:J}),f.jsx(f2,{info:{kind:"agent",tool:e,displayName:J,description:P.description?Hr(P.description,60):"",elapsed:"",workspaceCwd:i}})]}),!q&&f.jsxs("div",{className:`${tt.agentSummary} ${tt.lineExpandable}`,onClick:()=>c(!l),children:[f.jsx(xl,{status:e.status}),f.jsxs("span",{className:tt.lineName,children:[P.agentType,":"]}),f.jsx("span",{className:tt.lineArg,children:Hr(P.description||P.agentType,50)}),Z&&f.jsxs("span",{className:tt.lineElapsed,children:["· ",Z]})]}),q&&f.jsxs("div",{className:`${tt.agentSummary} ${tt.lineExpandable}`,onClick:()=>c(!l),children:[f.jsx(xl,{status:P.status}),f.jsxs("span",{className:tt.lineName,children:[P.agentType,":"]}),f.jsx("span",{className:tt.lineArg,children:Hr(P.description,50)}),P.subToolCount>0&&f.jsxs("span",{className:tt.lineElapsed,children:["· ",P.subToolCount," tools"]}),P.elapsed&&f.jsxs("span",{className:tt.lineElapsed,children:["· ",P.elapsed]}),P.tokens&&f.jsxs("span",{className:tt.lineElapsed,children:["· ",P.tokens]}),P.reason&&f.jsxs("span",{className:tt.lineElapsed,children:["· ",Hr(P.reason,80)]})]}),p&&r&&f.jsx(Ic,{request:n,onConfirm:r}),b&&r&&f.jsx(Ic,{request:n,onConfirm:r}),M&&f.jsx("div",{className:tt.lineDetail,children:f.jsx(_k,{tool:e,hideHeader:!0,defaultExpanded:!0,inline:!0})})]})}const g=lI(e,i),y=Ute(e),w=pu(e.toolName,a),C=Fl(e.toolName)||Ck(e.toolName)?"":B0(e.startTime,e.endTime),E=e.toolName.toLowerCase(),S=lh(E),T=S?Sk(e):void 0,O=!!T&&T.length>0,z=T?T.filter(P=>P.status==="completed").length:0,I=!S&&uoe(g),j=S?O:Kae(e)||I,N=l&&I,B=Yae(e);return p&&r?f.jsx("div",{className:tt.line,children:f.jsx(Ic,{request:n,onConfirm:r})}):f.jsxs("div",{className:tt.line,children:[f.jsxs("div",{className:`${tt.lineMain} ${j?tt.lineExpandable:""}`,title:j?a(l?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":j?l:void 0,role:j?"button":void 0,tabIndex:j?0:void 0,onClick:j?()=>{u.current=!0,c(P=>!P)}:void 0,onKeyDown:j?P=>{P.key!=="Enter"&&P.key!==" "||(P.preventDefault(),u.current=!0,c(J=>!J))}:void 0,children:[f.jsx(xl,{status:e.status}),f.jsx("span",{className:tt.lineName,children:w}),S&&O&&f.jsxs("span",{className:tt.todoProgress,children:[z,"/",T.length]}),f.jsx(f2,{info:{kind:_I(e),tool:e,displayName:w,description:S||N?"":g,elapsed:S?"":C,workspaceCwd:i}})]}),S&&O&&f.jsx(aoe,{tool:e,todos:T,expanded:l}),S&&!O&&y&&f.jsx("div",{className:tt.lineOutput,children:y}),N&&f.jsx("div",{className:tt.lineFullArg,children:g}),!S&&y&&(!l||!B)&&f.jsx("div",{className:tt.lineOutput,children:y}),!S&&l&&B&&f.jsxs("div",{className:tt.lineDetail,children:[Fl(E)&&f.jsx(roe,{tool:e,maxLines:s}),(E==="write_file"||E==="writefile")&&f.jsx(l8,{tool:e}),(E==="edit"||E==="write"||E==="editfile")&&f.jsx(l8,{tool:e}),(E==="read"||E==="read_file"||E==="readfile")&&f.jsx(ioe,{tool:e}),L0(e.toolName)&&f.jsx(loe,{tool:e})]})]})},moe),goe=v.memo(function({tools:e,pendingApproval:n,onConfirm:r,workspaceCwd:i,shellOutputMaxLines:s}){const a=v.useContext(dh),o=(n==null?void 0:n.toolCallId)&&e.find(u=>u.callId===n.toolCallId),l=(n==null?void 0:n.toolCallId)&&e.some(u=>$a(u,n.toolCallId)),c=a&&!l;return o&&e.length===1&&r?f.jsx(Ic,{request:n,onConfirm:r}):c?f.jsx(foe,{tools:e,workspaceCwd:i}):f.jsx("div",{className:tt.group,children:e.map(u=>f.jsx(SI,{tool:u,approval:n,onConfirm:r,workspaceCwd:i,shellOutputMaxLines:s},u.callId))})}),yoe="_message_19jij_1",boe="_header_19jij_6",voe="_chevron_19jij_20",xoe="_title_19jij_26",woe="_progress_19jij_35",Rh={message:yoe,header:boe,chevron:voe,title:xoe,progress:woe};function koe({id:t,todos:e}){var i;const r=((i=v.useContext(o5).get(t))==null?void 0:i.events)??[];return f.jsx(vI,{todos:e,events:r})}const _oe=v.memo(function({id:e,todos:n}){const{t:r}=dt(),[i,s]=v.useState(!1);if(n.length===0)return null;const a=n.length,o=n.filter(l=>l.status==="completed").length;return f.jsxs("div",{className:Rh.message,children:[f.jsxs("button",{type:"button",className:Rh.header,onClick:()=>s(l=>!l),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[f.jsx("span",{className:Rh.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),f.jsx("span",{className:Rh.title,children:r("plan.title")}),f.jsxs("span",{className:Rh.progress,children:[o,"/",a]})]}),i?f.jsx(xI,{todos:n,numbered:!0}):f.jsx(koe,{id:e,todos:n})]})}),Soe="_message_1ahub_1",Toe="_content_1ahub_11",Coe="_question_1ahub_17",Eoe="_prefix_1ahub_24",Aoe="_answer_1ahub_28",Moe="_pending_1ahub_32",Noe="_shortcuts_1ahub_36",pc={message:Soe,content:Toe,question:Coe,prefix:Eoe,answer:Aoe,pending:Moe,shortcuts:Noe},TI=v.memo(function({question:e,answer:n,isPending:r}){const{t:i}=dt();return f.jsxs("div",{className:pc.message,children:[f.jsxs("div",{className:pc.content,children:[f.jsxs("div",{className:pc.question,children:[f.jsx("span",{className:pc.prefix,children:"/btw "}),f.jsx("span",{children:e})]}),f.jsx("div",{className:pc.answer,children:r?f.jsx("span",{className:pc.pending,children:i("btw.answering")}):f.jsx(hd,{content:n})})]}),f.jsx("div",{className:pc.shortcuts,children:i(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),Doe="_message_102cm_1",Ioe="_compact_102cm_16",Roe="_header_102cm_21",Ooe="_status_102cm_30",joe="_name_102cm_35",Loe="_command_102cm_43",Boe="_output_102cm_52",zoe="_compactHint_102cm_63",lo={message:Doe,compact:Ioe,header:Roe,status:Ooe,name:joe,command:Loe,output:Boe,compactHint:zoe},Poe=v.memo(function({command:e,output:n}){const r=v.useContext(dh),{t:i}=dt();return f.jsxs("div",{className:r?`${lo.message} ${lo.compact}`:lo.message,children:[f.jsxs("div",{className:lo.header,children:[f.jsx("span",{className:lo.status,children:"✓"}),f.jsx("span",{className:lo.name,children:i("shell.command")}),e&&f.jsx("span",{className:lo.command,children:e})]}),r?f.jsx("div",{className:lo.compactHint,children:i("compact.hint")}):n&&f.jsx("pre",{className:lo.output,children:n})]})}),$oe="_progress_11zl8_1",Uoe="_spinner_11zl8_12",Hoe="_bar_11zl8_19",qoe="_stage_11zl8_25",Foe="_icon_11zl8_29",Voe="_done_11zl8_35",Goe="_error_11zl8_43",Woe="_detail_11zl8_51",Koe="_path_11zl8_56",Lr={progress:$oe,spinner:Uoe,bar:Hoe,stage:qoe,icon:Foe,done:Voe,error:Goe,detail:Woe,path:Koe},u8=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function Yoe({progress:t}){const{stage:e,progress:n,detail:r,isComplete:i,error:s}=t,[a,o]=v.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 v.useEffect(()=>{if(i||s)return;const h=setInterval(()=>{o(m=>(m+1)%u8.length)},120);return()=>clearInterval(h)},[i,s]),s?f.jsxs("div",{className:`${Lr.progress} ${Lr.error}`,children:[f.jsx("span",{className:Lr.icon,children:"✕"}),f.jsx("span",{className:Lr.stage,children:e}),f.jsx("div",{className:Lr.detail,children:s})]}):i?f.jsxs("div",{className:`${Lr.progress} ${Lr.done}`,children:[f.jsx("span",{className:Lr.icon,children:"✓"}),f.jsx("span",{className:Lr.stage,children:e})]}):f.jsxs("div",{className:Lr.progress,children:[f.jsx("span",{className:Lr.spinner,children:u8[a]}),f.jsx("span",{className:Lr.bar,children:d}),f.jsxs("span",{className:Lr.stage,children:[e,r?` (${r})`:""]})]})}function Xoe({path:t}){const{t:e}=dt();return f.jsxs("div",{className:`${Lr.progress} ${Lr.done}`,children:[f.jsx("span",{className:Lr.icon,children:"✓"}),f.jsx("span",{className:Lr.stage,children:e("insight.ready")}),f.jsx("span",{className:Lr.path,children:t})]})}const Qoe=v.memo(function({message:e,pendingApproval:n,onConfirm:r,onShowContextDetail:i,workspaceCwd:s,isLatest:a=!1,showRetryHint:o=!1,onRetryClick:l,shellOutputMaxLines:c,collapse:u,onToggleCollapse:d}){const h=(()=>{switch(e.role){case"user":return f.jsx(Kee,{content:e.content,images:e.images,collapse:u,onToggleCollapse:d});case"assistant":return f.jsx(ote,{content:e.content,thinking:e.thinking,isStreaming:e.isStreaming});case"tool_group":return f.jsx(goe,{tools:e.tools,pendingApproval:n,onConfirm:r,workspaceCwd:s,shellOutputMaxLines:c});case"plan":return f.jsx(_oe,{id:e.id,todos:e.todos});case"system":return f.jsx(Rie,{content:e.content,variant:e.variant,source:e.source,data:e.data,onShowContextDetail:i,isLatest:a,showRetryHint:o&&e.retryable===!0,onRetryClick:l});case"user_shell":return f.jsx(Poe,{command:e.command,output:e.output});case"btw":return f.jsx(TI,{question:e.question,answer:e.answer,isPending:e.isPending});case"insight_progress":return f.jsx(Yoe,{progress:{stage:e.stage,progress:e.progress,detail:e.detail}});case"insight_ready":return f.jsx(Xoe,{path:e.path});case"insight_error":return f.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:e.error});default:return null}})();return h===null?null:f.jsx(JA,{timestamp:e.timestamp,children:h})},Joe);function Joe(t,e){var n,r;return((n=t.pendingApproval)==null?void 0:n.id)!==((r=e.pendingApproval)==null?void 0:r.id)||t.onConfirm!==e.onConfirm||t.onShowContextDetail!==e.onShowContextDetail||t.workspaceCwd!==e.workspaceCwd||t.isLatest!==e.isLatest||t.showRetryHint!==e.showRetryHint||t.onRetryClick!==e.onRetryClick||t.shellOutputMaxLines!==e.shellOutputMaxLines||t.onToggleCollapse!==e.onToggleCollapse||!Zoe(t.collapse,e.collapse)?!1:ele(t.message,e.message)}function Zoe(t,e){return t===e?!0:!t||!e?!1:t.turnId===e.turnId&&t.collapsed===e.collapsed&&t.hiddenCount===e.hiddenCount&&t.elapsedMs===e.elapsedMs&&t.inputTokens===e.inputTokens&&t.outputTokens===e.outputTokens&&t.cachedTokens===e.cachedTokens&&t.toolCallCount===e.toolCallCount&&t.liveStartedAt===e.liveStartedAt}function ele(t,e){if(t===e)return!0;if(t.id!==e.id||t.role!==e.role||t.timestamp!==e.timestamp)return!1;switch(t.role){case"user":return e.role==="user"&&t.content===e.content&&rle(t.images,e.images);case"assistant":return e.role==="assistant"&&t.content===e.content&&t.thinking===e.thinking&&t.isStreaming===e.isStreaming;case"system":return e.role==="system"&&t.content===e.content&&t.variant===e.variant&&t.retryable===e.retryable&&t.source===e.source&&t.data===e.data;case"user_shell":return e.role==="user_shell"&&t.command===e.command&&t.output===e.output&&t.cwd===e.cwd;case"btw":return e.role==="btw"&&t.question===e.question&&t.answer===e.answer&&t.isPending===e.isPending;case"insight_progress":return e.role==="insight_progress"&&t.stage===e.stage&&t.progress===e.progress&&t.detail===e.detail;case"insight_ready":return e.role==="insight_ready"&&t.path===e.path;case"insight_error":return e.role==="insight_error"&&t.error===e.error;case"plan":return e.role==="plan"&&tle(t.todos,e.todos);case"tool_group":return e.role==="tool_group"&&t.tools.length===e.tools.length&&t.tools.every((n,r)=>CI(n,e.tools[r]));default:return!1}}function tle(t,e){return t.length===e.length&&t.every((n,r)=>{const i=e[r];return i&&n.id===i.id&&n.content===i.content&&n.status===i.status&&n.priority===i.priority})}function CI(t,e){return e?t.callId===e.callId&&t.toolName===e.toolName&&t.status===e.status&&t.title===e.title&&t.kind===e.kind&&t.startTime===e.startTime&&t.endTime===e.endTime&&t.subContent===e.subContent&&el(t.args)===el(e.args)&&el(t.rawOutput)===el(e.rawOutput)&&el(t.locations)===el(e.locations)&&el(t.content)===el(e.content)&&nle(t.subTools,e.subTools):!1}function nle(t,e){return!t&&!e?!0:!t||!e||t.length!==e.length?!1:t.every((n,r)=>CI(n,e[r]))}const d8=new WeakMap;function rle(t,e){return t===e?!0:!t||!e||t.length!==e.length?!1:t.every((n,r)=>n.data===e[r].data&&n.mimeType===e[r].mimeType)}function el(t){if(t===void 0)return"";if(t!==null&&typeof t=="object"){let e=d8.get(t);if(e!==void 0)return e;try{e=JSON.stringify(t)}catch{e=String(t)}return d8.set(t,e),e}try{return JSON.stringify(t)}catch{return String(t)}}const ile="_group_513hv_1",sle="_header_513hv_12",ale="_headerDot_513hv_22",ole="_headerCount_513hv_26",lle="_list_513hv_31",cle="_row_513hv_39",ule="_rowStats_513hv_53",dle="_rowDesc_513hv_61",hle="_rowTool_513hv_71",fle="_detail_513hv_75",ya={group:ile,header:sle,headerDot:ale,headerCount:ole,list:lle,row:cle,rowStats:ule,rowDesc:dle,rowTool:hle,detail:fle};function mle(t){const e=Math.round(t/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/60),r=e%60;return r>0?`${n}m ${r}s`:`${n}m`}function ple(t,e){const n=[],r=ey(t.rawOutput),i=r==null?void 0:r.executionSummary,s=i&&typeof i.totalDurationMs=="number"?mle(i.totalDurationMs):B0(t.startTime,t.endTime??(t.status==="in_progress"?e:void 0));s&&n.push(s);const a=r&&typeof r.tokenCount=="number"&&r.tokenCount>0?r.tokenCount:i&&typeof i.totalTokens=="number"&&i.totalTokens>0?i.totalTokens:0;a>0&&n.push(xk(a));const o=vk(t);return o&&n.push(Hr(o,80)),n.join(" · ")}function gle({agents:t,pendingApproval:e,onConfirm:n}){const{t:r}=dt(),[i,s]=v.useState(null),[a,o]=v.useState(()=>Date.now()),l=t.some(h=>h.status==="in_progress");v.useEffect(()=>{if(!l)return;const h=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(h)},[l]);const c=t.filter(h=>h.status==="completed"||h.status==="failed").length,u=t.length,d=e!=null&&e.toolCallId?t.find(h=>$a(h,e.toolCallId)):void 0;return f.jsxs("div",{className:ya.group,children:[f.jsxs("div",{className:ya.header,children:[f.jsx("span",{children:r("parallelAgents.title")}),f.jsx("span",{className:ya.headerDot,children:"·"}),f.jsx("span",{className:ya.headerCount,children:r("parallelAgents.done",{done:c,total:u})})]}),f.jsx("div",{className:ya.list,children:t.map(h=>{const m=wk(h),p=kk(h),b=uI(h,r),x=ple(h,a),g=ty(h),y=i===h.callId;return f.jsxs("div",{children:[f.jsxs("div",{className:ya.row,onClick:()=>s(y?null:h.callId),children:[f.jsx(xl,{status:g}),f.jsxs("span",{className:ya.rowDesc,children:[Hr(p||m,50),b&&f.jsx("span",{className:ya.rowTool,children:` (${b})`})]}),x&&f.jsx("span",{className:ya.rowStats,children:x})]}),y&&f.jsx("div",{className:ya.detail,children:f.jsx(_k,{tool:h,hideHeader:!0})})]},h.callId)})}),d&&e&&n&&f.jsx(Ic,{request:e,onConfirm:n})]})}const yle="_question_mx5aq_1",ble="_titleLine_mx5aq_9",vle="_icon_mx5aq_16",xle="_toolName_mx5aq_22",wle="_toolDesc_mx5aq_27",kle="_tabs_mx5aq_31",_le="_tab_mx5aq_31",Sle="_tabActive_mx5aq_51",Tle="_tabCheck_mx5aq_57",Cle="_header_mx5aq_65",Ele="_text_mx5aq_72",Ale="_multiHint_mx5aq_78",Mle="_options_mx5aq_83",Nle="_option_mx5aq_83",Dle="_optionActive_mx5aq_98",Ile="_optionLabel_mx5aq_98",Rle="_optionSelected_mx5aq_99",Ole="_pointer_mx5aq_107",jle="_checkbox_mx5aq_114",Lle="_optionNum_mx5aq_126",Ble="_optionContent_mx5aq_132",zle="_optionPlaceholder_mx5aq_142",Ple="_optionDesc_mx5aq_147",$le="_customInput_mx5aq_153",Ule="_submitTab_mx5aq_169",Hle="_summary_mx5aq_173",qle="_summaryRow_mx5aq_180",Fle="_summaryLabel_mx5aq_186",Vle="_summaryValue_mx5aq_191",Gle="_footer_mx5aq_226",mt={question:yle,titleLine:ble,icon:vle,toolName:xle,toolDesc:wle,tabs:kle,tab:_le,tabActive:Sle,tabCheck:Tle,header:Cle,text:Ele,multiHint:Ale,options:Mle,option:Nle,optionActive:Dle,optionLabel:Ile,optionSelected:Rle,pointer:Ole,checkbox:jle,optionNum:Lle,optionContent:Ble,optionPlaceholder:zle,optionDesc:Ple,customInput:$le,submitTab:Ule,summary:Hle,summaryRow:qle,summaryLabel:Fle,summaryValue:Vle,footer:Gle};function Wle({request:t,onConfirm:e}){const{t:n}=dt(),r=v.useMemo(()=>{var $;return Array.isArray(($=t.rawInput)==null?void 0:$.questions)?t.rawInput.questions:[]},[t.rawInput]),[i,s]=v.useState(0),[a,o]=v.useState(0),[l,c]=v.useState({}),[u,d]=v.useState({}),[h,m]=v.useState({}),[p,b]=v.useState(!1),x=v.useRef(!1),g=r.length+1,y=i===r.length;v.useEffect(()=>{x.current=!1,s(0),o(0),c({}),d({}),m({}),b(!1)},[t.id]);const w=y?void 0:r[i],C=(w==null?void 0:w.multiSelect)??!1,E=y?2:((w==null?void 0:w.options.length)??0)+1,S=(w==null?void 0:w.options.length)??0,T=v.useCallback(($,Z=l,M=u,X=h)=>{if($===r.length)return 0;const H=r[$];if(!H)return 0;const R=H.options.length;if(H.multiSelect){const ye=X[$]||[],Ae=H.options.findIndex(Fe=>ye.includes(Fe.label));return Ae>=0?Ae:M[$]?R:0}const ae=Z[$],xe=H.options.findIndex(ye=>ye.label===ae);return xe>=0?xe:M[$]||ae?R:0},[l,u,r,h]),O=v.useCallback(()=>{const $={};for(let Z=0;Z<r.length;Z++){const M=r[Z];if(M)if(M.multiSelect){const X=h[Z]||[],H=u[Z],R=H?[...X,H]:X;$[String(Z)]=R.join(", ")}else $[String(Z)]=l[Z]||u[Z]||""}return $},[r,h,u,l]),z=v.useCallback(()=>{if(x.current)return;const $=t.options.find(Z=>Z.kind==="allow_once");$&&(x.current=!0,e(t.id,$.id,O()))},[O,t,e]),I=v.useCallback(()=>{if(x.current)return;const $=t.options.find(Z=>Z.kind==="reject_once"||Z.kind==="reject_always");$&&(x.current=!0,e(t.id,$.id,void 0))},[t,e]),j=v.useCallback($=>{g<=1||s(Z=>{const M=(Z+$+g)%g;return o(T(M)),b(!1),M})},[T,g]),N=v.useCallback($=>{$!==void 0&&d(Z=>({...Z,[i]:$})),b(!0)},[i]),B=v.useCallback($=>{if(y){$===0?z():I();return}if(!w)return;if($===w.options.length){N();return}const M=w.options[$].label;if(C){const X=h[i]||[],H=X.includes(M)?X.filter(R=>R!==M):[...X,M];m({...h,[i]:H})}else{const X={...l,[i]:M};if(c(X),i<r.length-1){const H=i+1;s(H),o(T(H,X))}else s(r.length),o(T(r.length,X))}},[y,w,i,C,h,l,r,z,I,N,T]),P=v.useCallback($=>{if(y||!w||!C)return;if($===w.options.length){N();return}const Z=w.options[$].label,M=h[i]||[],X=M.includes(Z)?M.filter(H=>H!==Z):[...M,Z];m({...h,[i]:X})},[y,w,C,h,i,N]);v.useEffect(()=>{if(p)return;const $=M=>{M.preventDefault(),M.stopPropagation()},Z=M=>{if(!M.defaultPrevented)if(M.key==="ArrowDown"||M.key==="j")$(M),o(X=>Math.min(X+1,E-1));else if(M.key==="ArrowUp"||M.key==="k")$(M),o(X=>Math.max(X-1,0));else if(M.key==="ArrowRight")$(M),j(1);else if(M.key==="ArrowLeft")$(M),j(-1);else if(M.key===" ")$(M),C?P(a):B(a);else if(M.key==="Enter")if($(M),C)if(i<r.length-1){const X=i+1;s(X),o(T(X))}else s(r.length),o(T(r.length));else B(a);else if(M.key==="Escape")$(M),I();else if(M.key>="1"&&M.key<="9"){const X=parseInt(M.key)-1;X<E&&($(M),o(X),C?P(X):B(X))}else!y&&a===S&&M.key.length===1&&!M.metaKey&&!M.ctrlKey&&!M.altKey&&($(M),N(M.key))};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[p,E,a,S,C,y,i,r.length,B,P,I,j,N,T]);const J=$=>{if($.key==="Enter"){$.preventDefault(),$.stopPropagation();const Z=u[i];if(Z){if(!C){const M={...l,[i]:Z};if(c(M),i<r.length-1){const X=i+1;s(X),o(T(X,M)),b(!1);return}s(r.length),o(T(r.length,M)),b(!1);return}if(b(!1),i<r.length-1){const M=i+1;s(M),o(T(M))}else s(r.length),o(T(r.length))}}else $.key==="Escape"?($.preventDefault(),$.stopPropagation(),b(!1)):$.key==="ArrowDown"?($.preventDefault(),$.stopPropagation(),b(!1),o(Z=>Math.min(Z+1,E-1))):$.key==="ArrowUp"?($.preventDefault(),$.stopPropagation(),b(!1),o(Z=>Math.max(Z-1,0))):$.key==="Tab"&&($.preventDefault(),$.stopPropagation(),b(!1),j($.shiftKey?-1:1))};if(r.length===0)return null;const q=$=>{const Z=r[$];return Z?Z.multiSelect?(h[$]||[]).length>0||!!u[$]:!!l[$]||!!u[$]:!1},Y=$=>{const Z=r[$];if(!Z)return"";if(Z.multiSelect){const M=h[$]||[],X=u[$];return(X?[...M,X]:M).join(", ")}return l[$]||u[$]||""};return f.jsxs("div",{className:mt.question,children:[f.jsxs("div",{className:mt.titleLine,children:[f.jsx("span",{className:mt.icon,children:"?"}),f.jsx("span",{className:mt.toolName,children:pu("ask_user_question",n)}),f.jsx("span",{className:mt.toolDesc,children:n("askUser.title",{count:r.length})})]}),f.jsxs("div",{className:mt.tabs,children:[r.map(($,Z)=>f.jsxs("button",{className:`${mt.tab} ${Z===i?mt.tabActive:""}`,onClick:()=>{s(Z),o(T(Z)),b(!1)},children:[$.header,q(Z)&&f.jsx("span",{className:mt.tabCheck,children:" ✓"})]},Z)),f.jsx("button",{className:`${mt.tab} ${y?mt.tabActive:""}`,onClick:()=>{s(r.length),o(T(r.length)),b(!1)},children:n("askUser.submit")})]}),y?f.jsxs("div",{className:mt.submitTab,children:[f.jsx("div",{className:mt.header,children:n("askUser.confirmTitle")}),f.jsx("div",{className:mt.summary,children:r.map(($,Z)=>f.jsxs("div",{className:mt.summaryRow,children:[f.jsxs("span",{className:mt.summaryLabel,children:[$.header,":"]}),f.jsx("span",{className:mt.summaryValue,children:Y(Z)||"—"})]},Z))}),f.jsx("div",{className:mt.text,children:n("askUser.confirmPrompt")}),f.jsxs("div",{className:mt.options,children:[f.jsxs("div",{className:`${mt.option} ${a===0?mt.optionActive:""}`,onClick:z,onMouseEnter:()=>o(0),children:[f.jsx("span",{className:mt.pointer,children:a===0?"›":" "}),f.jsx("span",{className:mt.optionNum,children:"1."}),f.jsx("span",{className:mt.optionLabel,children:n("askUser.submitAnswers")})]}),f.jsxs("div",{className:`${mt.option} ${a===1?mt.optionActive:""}`,onClick:I,onMouseEnter:()=>o(1),children:[f.jsx("span",{className:mt.pointer,children:a===1?"›":" "}),f.jsx("span",{className:mt.optionNum,children:"2."}),f.jsx("span",{className:mt.optionLabel,children:n("askUser.cancel")})]})]})]}):w?f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:mt.text,children:[w.question,C&&f.jsxs("span",{className:mt.multiHint,children:[" ","(",n("askUser.multiHint"),")"]})]}),f.jsxs("div",{className:mt.options,children:[w.options.map(($,Z)=>{const M=Z===a,X=C?(h[i]||[]).includes($.label):l[i]===$.label;return f.jsxs("div",{className:`${mt.option} ${M?mt.optionActive:""} ${X?mt.optionSelected:""}`,onClick:()=>{o(Z),C?P(Z):B(Z)},onMouseEnter:()=>o(Z),children:[f.jsx("span",{className:mt.pointer,children:M?"›":" "}),C&&f.jsx("span",{className:mt.checkbox,children:X?"[✓]":"[ ]"}),f.jsxs("span",{className:mt.optionNum,children:[Z+1,"."]}),f.jsxs("span",{className:mt.optionContent,children:[f.jsx("span",{className:mt.optionLabel,children:$.label}),$.description&&f.jsx("span",{className:mt.optionDesc,children:$.description})]})]},$.label)}),(()=>{const $=a===w.options.length,Z=!!u[i];return f.jsxs("div",{className:`${mt.option} ${$?mt.optionActive:""} ${Z?mt.optionSelected:""}`,onClick:()=>{o(w.options.length),N()},onMouseEnter:()=>o(w.options.length),children:[f.jsx("span",{className:mt.pointer,children:$?"›":" "}),C&&f.jsx("span",{className:mt.checkbox,children:Z?"[✓]":"[ ]"}),f.jsxs("span",{className:mt.optionNum,children:[w.options.length+1,"."]}),p?f.jsx("input",{type:"text",className:mt.customInput,placeholder:n("askUser.typePlaceholder"),value:u[i]||"",onChange:M=>d({...u,[i]:M.target.value}),onKeyDown:J,onBlur:()=>b(!1),autoFocus:!0}):f.jsx("span",{className:`${mt.optionLabel} ${u[i]?"":mt.optionPlaceholder}`,children:u[i]||n("askUser.typePlaceholder")})]})})()]})]}):null,f.jsx("div",{className:mt.footer,children:n(C?"askUser.footerMulti":"askUser.footer")})]})}const Kle="_list_cbo0z_1",Yle="_rowFlash_cbo0z_23",h8={list:Kle,rowFlash:Yle};function f8(t){var e;return!!((e=t.rawInput)!=null&&e.questions)&&Array.isArray(t.rawInput.questions)}function Xle(t,e){if(!(e!=null&&e.toolCallId))return!1;for(const n of t)if(n.role==="tool_group"&&n.tools.some(r=>$a(r,e.toolCallId)))return!0;return!1}function Qle(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role==="user")return n.id}return null}function m8(t){return t.role==="tool_group"&&t.tools.length===1&&D1(t.tools[0])}function Iv(t){return t.role==="tool_group"&&t.tools.length===1&&XA(t.tools[0])}function p8(t){return t.role==="assistant"&&!!t.thinking&&!t.content}function g8(t,e){return t.role!=="tool_group"?!1:!!(e!=null&&e.toolCallId&&t.tools.some(n=>$a(n,e.toolCallId)))}function y8(t){return!!(t.role==="assistant"&&t.thinking&&!t.content)}function Jle(t,e){const n=[];let r=0;for(;r<t.length;){const i=t[r];if(i.role!=="tool_group"||g8(i,e)){y8(i)||n.push(i),r++;continue}const s=[i];let a=r,o=r+1;for(;o<t.length;){const c=t[o];if(y8(c)){o++;continue}if(c.role==="tool_group"&&!g8(c,e)){s.push(c),a=o,o++;continue}break}if(s.length===1){n.push(i),r++;continue}const l=s.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:s[0].id,role:"tool_group",tools:l}),r=a+1}return n}function Zle(t){const e=[];let n=0;for(;n<t.length;){if(Iv(t[n])){const r=[];let i=n;for(;i<t.length;){const s=t[i];if(Iv(s)){r.push(s),i++;continue}if(p8(s)){let a=i+1;for(;a<t.length&&p8(t[a]);)a++;if(a<t.length&&Iv(t[a])){i=a;continue}}break}if(r.length>=2){e.push({type:"parallel_agents",key:`par-${r[0].id}`,agents:r.map(s=>s.tools[0]),timestamp:r[0].timestamp}),n=i;continue}}if(m8(t[n])){const r=n;for(;n<t.length&&m8(t[n]);)n++;if(n-r>=2){const i=t.slice(r,n);e.push({type:"parallel_agents",key:`par-${i[0].id}`,agents:i.map(s=>s.tools[0]),timestamp:i[0].timestamp})}else e.push({type:"message",key:t[r].id,message:t[r]})}else e.push({type:"message",key:t[n].id,message:t[n]}),n++}return e}function ece(t){return t.type==="parallel_agents"?`group:${t.key}`:`msg:${t.key}`}function tce(t){return t.type==="message"&&t.message.role==="assistant"&&!!t.message.content&&t.message.content.trim().length>0}function b8(t,e){if(t.type==="parallel_agents")return!0;switch(t.message.role){case"tool_group":case"plan":return!0;case"assistant":return!e;case"user":case"system":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return t.message,!1}}function nce(t){return t.type==="parallel_agents"?!0:t.message.role==="tool_group"||t.message.role==="plan"}function rce(t){return t.type==="message"?t.message.timestamp:t.timestamp}function ice(t){return t.type==="message"&&t.message.role==="assistant"?t.message.usage:void 0}function sce(t){return t.type==="parallel_agents"?t.agents.length:t.message.role==="tool_group"?t.message.tools.length:0}function ace(t,e){for(let n=Math.min(e,t.length-1);n>=0;n--){const r=t[n];if(r.type==="message"&&r.message.role==="user")return r.message.id}return null}function oce(t,e,n,r){if(!r)return!1;for(let i=e;i<=n;i++){const s=t[i];if(s.type==="parallel_agents"){if(s.agents.some(a=>$a(a,r)))return!0}else if(s.message.role==="tool_group"&&s.message.tools.some(a=>$a(a,r)))return!0}return!1}function lce(t,{overrides:e,isResponding:n,pendingApprovalCallId:r,enabled:i}){if(!i||t.length===0)return t;const s=[];for(let o=0;o<t.length;o++){const l=t[o];l.type==="message"&&l.message.role==="user"&&s.push(o)}if(s.length===0)return t;const a=[];for(let o=0;o<s[0];o++)a.push(t[o]);for(let o=0;o<s.length;o++){const l=s[o],c=(o+1<s.length?s[o+1]:t.length)-1,u=t[l],d=u.message.id,h=o===s.length-1&&n,m=oce(t,l,c,r);let p=-1,b=l;for(let B=l+1;B<=c;B++)nce(t[B])&&(b=B);for(let B=c;B>b;B--)if(tce(t[B])){p=B;break}let x=0,g,y=0,w=0,C=0,E=0,S=!1;for(let B=l+1;B<=c;B++){const P=b8(t[B],B===p);P&&x++,E+=sce(t[B]);const J=P||B===p?rce(t[B]):void 0;J!==void 0&&(g=g===void 0?J:Math.max(g,J));const q=ice(t[B]);q&&(y+=q.inputTokens,w+=q.outputTokens,C+=q.cachedTokens??0,S=!0)}const T=u.message.timestamp,O=h?T??Date.now():void 0,z=T!==void 0&&g!==void 0&&g>=T?g-T:void 0;if(m||x===0&&!(S||z!==void 0||O!==void 0)){for(let B=l;B<=c;B++)a.push(t[B]);continue}const N=!(x===0?!0:e.has(d)?e.get(d):h);if(a.push({type:"message",key:u.key,message:u.message,collapse:{turnId:d,collapsed:N,hiddenCount:x,...z!==void 0?{elapsedMs:z}:{},...S?{inputTokens:y,outputTokens:w}:{},...C>0?{cachedTokens:C}:{},...E>0?{toolCallCount:E}:{},...O!==void 0?{liveStartedAt:O}:{}}}),!N){for(let B=l+1;B<=c;B++)a.push(t[B]);continue}for(let B=l+1;B<=c;B++){const P=t[B];B===p&&h||b8(P,B===p)||(B===p&&P.type==="message"&&P.message.role==="assistant"&&P.message.thinking?a.push({type:"message",key:P.key,message:{...P.message,thinking:void 0}}):a.push(P))}}return a}function Rv(t,e,n){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="message"){if(i.message.id===e||n&&i.message.role==="tool_group"&&i.message.tools.some(s=>$a(s,n)))return r}else if(n&&i.agents.some(s=>$a(s,n)))return r}return-1}const Ov=0,cce=120,uce=80,dce=200,hce=240,EI=200;function fce(t,e=EI){return t>e}const mce=v.forwardRef(function({messages:e,pendingApproval:n,onConfirm:r,onShowContextDetail:i,catchingUp:s,isResponding:a=!1,welcomeHeader:o,workspaceCwd:l,tailContent:c,tailKey:u="tail",virtualScrollThreshold:d=EI,shellOutputMaxLines:h,autoScrollTailIntoView:m=!1,showRetryHint:p=!1,onRetryClick:b},x){const g=v.useContext(dh),y=v.useMemo(()=>g?Jle(e,n):e,[g,e,n]),w=v.useMemo(()=>Zle(y),[y]),{collapseCompletedTurns:C}=du(),E=C??!0,[S,T]=v.useState(()=>new Map),O=v.useCallback(me=>{j.current=!1,T(rt=>{const oe=rt.get(me)??!1,Oe=new Map(rt);return Oe.set(me,!oe),Oe})},[]),z=v.useMemo(()=>lce(w,{overrides:S,isResponding:a,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:E}),[w,S,a,n==null?void 0:n.toolCallId,E]),I=v.useRef(null),j=v.useRef(!0),N=v.useRef(0),B=v.useRef(!1),P=v.useRef(0),J=v.useRef(null),q=v.useRef(s),Y=v.useRef(s),$=v.useRef(!1);Y.current=s;const Z=v.useMemo(()=>n?f8(n)?!0:!Xle(e,n):!1,[n,e]),M=c!=null,X=!!o,H=X?1:0,R=H+z.length,ae=R+(Z?1:0),xe=ae+(M?1:0),ye=fce(xe,d),Ae=v.useCallback(me=>{if(X&&me===Ov)return"slot:header";if(Z&&me===R)return n?`slot:approval:${n.id}`:"slot:approval";if(M&&me===ae)return`slot:tail:${u}`;const rt=z[me-H];return rt?ece(rt):`slot:row:${me}`},[X,Z,R,n,M,ae,u,z,H]),Fe=v.useCallback(()=>{const me=I.current;if(!me||me.scrollHeight<=me.clientHeight)return;P.current+=1;const rt=P.current;B.current=!0,me.scrollTop=me.scrollHeight,N.current=me.scrollTop,requestAnimationFrame(()=>{P.current===rt&&(B.current=!1)})},[]),vt=zU({count:xe,enabled:ye,getScrollElement:()=>I.current,getItemKey:Ae,estimateSize:me=>X&&me===Ov?cce:Z&&me===R?dce:M&&me===ae?hce:uce,overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),[Nt,pt]=v.useState(null);v.useEffect(()=>{if(!Nt)return;const me=setTimeout(()=>pt(null),1600);return()=>clearTimeout(me)},[Nt]);const Qe=v.useCallback(me=>{var Oe,Re;j.current=!1,P.current+=1;const rt=P.current;B.current=!0,ye?vt.scrollToIndex(me,{align:"center"}):(Re=(Oe=I.current)==null?void 0:Oe.querySelector(`[data-index="${me}"]`))==null||Re.scrollIntoView({block:"center"}),setTimeout(()=>{P.current===rt&&(B.current=!1)},150);const oe=Ae(me);pt(null),requestAnimationFrame(()=>pt(oe))},[ye,vt,Ae]),Ge=v.useRef(null),$t=v.useCallback((me,rt)=>{const oe=Rv(z,me,rt);if(oe>=0)return Ge.current=null,Qe(oe+H),!0;const Oe=Rv(w,me,rt);if(Oe<0)return!1;const Re=ace(w,Oe);return Re?(Ge.current={messageId:me,callId:rt},T($e=>{if($e.get(Re)===!0)return $e;const ne=new Map($e);return ne.set(Re,!0),ne}),!0):!1},[z,w,H,Qe]);v.useImperativeHandle(x,()=>({scrollToMessage:$t}),[$t]),v.useEffect(()=>{const me=Ge.current;if(!me)return;const rt=Rv(z,me.messageId,me.callId);rt<0||(Ge.current=null,Qe(rt+H))},[z,H,Qe]);const Je=v.useCallback(()=>{const me=I.current;if(!me)return;if(B.current){N.current=me.scrollTop;return}const rt=N.current,oe=me.scrollTop;N.current=oe;const Oe=me.scrollHeight-oe-me.clientHeight;oe<rt-1&&(j.current=!1),Oe<30&&(j.current=!0)},[]);v.useEffect(()=>{e.length===0&&(j.current=!0,Ge.current=null,T(me=>me.size?new Map:me))},[e.length]),v.useEffect(()=>{const me=I.current;if(!me)return;const rt=new ResizeObserver(()=>{Y.current||j.current&&requestAnimationFrame(()=>{!Y.current&&j.current&&Fe()})});return rt.observe(me),()=>rt.disconnect()},[Fe]),v.useEffect(()=>{const me=Qle(e);if(s){J.current=me;return}me&&me!==J.current&&(j.current=!0,Ge.current=null,requestAnimationFrame(Fe)),J.current=me},[e,s,Fe]),v.useEffect(()=>{q.current&&!s&&(j.current=!0,requestAnimationFrame(Fe)),q.current=s},[s,Fe]),v.useEffect(()=>{m&&M&&!$.current&&(j.current=!0,requestAnimationFrame(()=>{j.current&&Fe()})),$.current=M},[m,M,Fe]);const re=v.useCallback(me=>{if(X&&me===Ov)return o;if(Z&&me===R)return n&&f8(n)?f.jsx(Wle,{request:n,onConfirm:r}):n?f.jsx(Ic,{request:n,onConfirm:r}):null;if(M&&me===ae)return c;const rt=me-H,oe=z[rt];return oe?oe.type==="parallel_agents"?f.jsx(JA,{timestamp:oe.timestamp,children:f.jsx(gle,{agents:oe.agents,pendingApproval:n,onConfirm:r})}):f.jsx(Qoe,{message:oe.message,pendingApproval:n,onConfirm:r,onShowContextDetail:i,workspaceCwd:l,isLatest:rt===z.length-1,showRetryHint:p,onRetryClick:b,shellOutputMaxLines:h,collapse:oe.collapse,onToggleCollapse:O}):null},[X,o,M,c,ae,Z,R,n,r,i,H,z,l,p,b,h,O]),ce=vt.getVirtualItems(),Ie=vt.getTotalSize(),We=v.useCallback(me=>Nt===me?h8.rowFlash:void 0,[Nt]);return v.useLayoutEffect(()=>{s||j.current&&Fe()},[Ie,e,xe,s,Fe]),f.jsx("div",{ref:I,className:h8.list,onScroll:Je,children:ye?f.jsx("div",{style:{height:Ie,width:"100%",position:"relative"},children:ce.map(me=>f.jsx("div",{"data-index":me.index,ref:vt.measureElement,className:We(String(me.key)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${me.start}px)`},children:re(me.index)},me.key))}):Array.from({length:xe},(me,rt)=>{const oe=Ae(rt);return f.jsx("div",{"data-index":rt,className:We(oe),children:re(rt)},oe)})})});let m2=[],AI=[];(()=>{let t="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(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?AI:m2).push(n=n+t[e])})();function pce(t){if(t<768)return!1;for(let e=0,n=m2.length;;){let r=e+n>>1;if(t<m2[r])n=r;else if(t>=AI[r])e=r+1;else return!0;if(e==n)return!1}}function v8(t){return t>=127462&&t<=127487}const x8=8205;function gce(t,e,n=!0,r=!0){return(n?MI:yce)(t,e,r)}function MI(t,e,n){if(e==t.length)return e;e&&NI(t.charCodeAt(e))&&DI(t.charCodeAt(e-1))&&e--;let r=jv(t,e);for(e+=w8(r);e<t.length;){let i=jv(t,e);if(r==x8||i==x8||n&&pce(i))e+=w8(i),r=i;else if(v8(i)){let s=0,a=e-2;for(;a>=0&&v8(jv(t,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function yce(t,e,n){for(;e>0;){let r=MI(t,e-2,n);if(r<e)return r;e--}return 0}function jv(t,e){let n=t.charCodeAt(e);if(!DI(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return NI(r)?(n-55296<<10)+(r-56320)+65536:n}function NI(t){return t>=56320&&t<57344}function DI(t){return t>=55296&&t<56320}function w8(t){return t<65536?1:2}class en{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Bd(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Aa.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Bd(this,e,n);let r=[];return this.decompose(e,n,r,0),Aa.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new _f(this),s=new _f(e);for(let a=n,o=n;;){if(i.next(a),s.next(a),a=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(o+=i.value.length,i.done||o>=r)return!0}}iter(e=1){return new _f(this,e)}iterRange(e,n=this.length){return new II(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new RI(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?en.empty:e.length<=32?new ir(e):Aa.from(ir.split(e,[]))}}class ir extends en{constructor(e,n=bce(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let a=this.text[s],o=i+a.length;if((n?r:o)>=e)return new vce(i,o,r,a);i=o+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new ir(k8(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let a=r.pop(),o=Ap(s.text,a.text.slice(),0,s.length);if(o.length<=32)r.push(new ir(o,a.length+s.length));else{let l=o.length>>1;r.push(new ir(o.slice(0,l)),new ir(o.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof ir))return super.replace(e,n,r);[e,n]=Bd(this,e,n);let i=Ap(this.text,Ap(r.text,k8(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new ir(i,s):Aa.from(ir.split(i,[]),s)}sliceString(e,n=this.length,r=`
`){[e,n]=Bd(this,e,n);let i="";for(let s=0,a=0;s<=n&&a<this.text.length;a++){let o=this.text[a],l=s+o.length;s>e&&a&&(i+=r),e<l&&n>s&&(i+=o.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new ir(r,i)),r=[],i=-1);return i>-1&&n.push(new ir(r,i)),n}}class Aa extends en{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let a=this.children[s],o=i+a.length,l=r+a.lines-1;if((n?l:o)>=e)return a.lineInner(e,n,r,i);i=o+1,r=l+1}}decompose(e,n,r,i){for(let s=0,a=0;a<=n&&s<this.children.length;s++){let o=this.children[s],l=a+o.length;if(e<=l&&n>=a){let c=i&((a<=e?1:0)|(l>=n?2:0));a>=e&&l<=n&&!c?r.push(o):o.decompose(e-a,n-a,r,c)}a=l+1}}replace(e,n,r){if([e,n]=Bd(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let a=this.children[i],o=s+a.length;if(e>=s&&n<=o){let l=a.replace(e-s,n-s,r),c=this.lines-a.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[i]=l,new Aa(u,this.length-(n-e)+r.length)}return super.replace(s,o,l)}s=o+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
`){[e,n]=Bd(this,e,n);let i="";for(let s=0,a=0;s<this.children.length&&a<=n;s++){let o=this.children[s],l=a+o.length;a>e&&s&&(i+=r),e<l&&n>a&&(i+=o.sliceString(e-a,n-a,r)),a=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Aa))return 0;let r=0,[i,s,a,o]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==a||s==o)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let m of e)r+=m.lines;if(r<32){let m=[];for(let p of e)p.flatten(m);return new ir(m,n)}let i=Math.max(32,r>>5),s=i<<1,a=i>>1,o=[],l=0,c=-1,u=[];function d(m){let p;if(m.lines>s&&m instanceof Aa)for(let b of m.children)d(b);else m.lines>a&&(l>a||!l)?(h(),o.push(m)):m instanceof ir&&l&&(p=u[u.length-1])instanceof ir&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new ir(p.text.concat(m.text),p.length+1+m.length)):(l+m.lines>i&&h(),l+=m.lines,c+=m.length+1,u.push(m))}function h(){l!=0&&(o.push(u.length==1?u[0]:Aa.from(u,c)),c=-1,l=u.length=0)}for(let m of e)d(m);return h(),o.length==1?o[0]:new Aa(o,n)}}en.empty=new ir([""],0);function bce(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Ap(t,e,n=0,r=1e9){for(let i=0,s=0,a=!0;s<t.length&&i<=r;s++){let o=t[s],l=i+o.length;l>=n&&(l>r&&(o=o.slice(0,r-i)),i<n&&(o=o.slice(n-i)),a?(e[e.length-1]+=o,a=!1):e.push(o)),i=l+1}return e}function k8(t,e,n){return Ap(t,[""],e,n)}class _f{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof ir?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],a=s>>1,o=i instanceof ir?i.text.length:i.children.length;if(a==(n>0?o:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(i instanceof ir){let l=i.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[a+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof ir?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class II{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new _f(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=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;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class RI{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);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=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(en.prototype[Symbol.iterator]=function(){return this.iter()},_f.prototype[Symbol.iterator]=II.prototype[Symbol.iterator]=RI.prototype[Symbol.iterator]=function(){return this});class vce{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Bd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function ni(t,e,n=!0,r=!0){return gce(t,e,n,r)}function xce(t){return t>=56320&&t<57344}function wce(t){return t>=55296&&t<56320}function sl(t,e){let n=t.charCodeAt(e);if(!wce(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return xce(r)?(n-55296<<10)+(r-56320)+65536:n}function kce(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Lu(t){return t<65536?1:2}const p2=/\r\n?|\n/;var es=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(es||(es={}));class Pa{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],a=this.sections[n++];a<0?(e(r,i,s),i+=s):i+=a,r+=s}}iterChangedRanges(e,n=!1){g2(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new Pa(e)}composeDesc(e){return this.empty?e:e.empty?this:OI(this,e)}mapDesc(e,n=!1){return e.empty?this:y2(this,e,n)}mapPos(e,n=-1,r=es.Simple){let i=0,s=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],l=this.sections[a++],c=i+o;if(l<0){if(c>e)return s+(e-i);s+=o}else{if(r!=es.Simple&&c>=e&&(r==es.TrackDel&&i<e&&c>e||r==es.TrackBefore&&i<e||r==es.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!o)return e==i||n<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],a=this.sections[r++],o=i+s;if(a>=0&&i<=n&&o>=e)return i<e&&o>n?"cover":!0;i=o}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Pa(e)}static create(e){return new Pa(e)}}class Er extends Pa{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return g2(this,(n,r,i,s,a)=>e=e.replace(i,i+(r-n),a),!1),e}mapDesc(e,n=!1){return y2(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let a=n[i],o=n[i+1];if(o>=0){n[i]=o,n[i+1]=a;let l=i>>1;for(;r.length<l;)r.push(en.empty);r.push(a?e.slice(s,s+a):en.empty)}s+=a}return new Er(n,r)}compose(e){return this.empty?e:e.empty?this:OI(this,e,!0)}map(e,n=!1){return e.empty?this:y2(this,e,n,!0)}iterChanges(e,n=!1){g2(this,e,n)}get desc(){return Pa.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new t0(this);e:for(let a=0,o=0;;){let l=a==e.length?1e9:e[a++];for(;o<l||o==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-o);ei(i,u,-1);let d=s.ins==-1?-1:s.off==0?s.ins:0;ei(n,u,d),d>0&&wl(r,n,s.text),s.forward(u),o+=u}let c=e[a++];for(;o<c;){if(s.done)break e;let u=Math.min(s.len,c-o);ei(n,u,-1),ei(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),o+=u}}return{changes:new Er(n,r),filtered:Pa.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],a=0,o=null;function l(u=!1){if(!u&&!i.length)return;a<n&&ei(i,n-a,-1);let d=new Er(i,s);o=o?o.compose(d.map(o)):d,i=[],s=[],a=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof Er){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),o=o?o.compose(u.map(o)):u}else{let{from:d,to:h=d,insert:m}=u;if(d>h||d<0||h>n)throw new RangeError(`Invalid change range ${d} to ${h} (in doc of length ${n})`);let p=m?typeof m=="string"?en.of(m.split(r||p2)):m:en.empty,b=p.length;if(d==h&&b==0)return;d<a&&l(),d>a&&ei(i,d-a,-1),ei(i,h-d,b),wl(s,i,p),a=h}}return c(e),l(!o),o}static empty(e){return new Er(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,o)=>o&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(en.empty);r[i]=en.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new Er(n,r)}static createSet(e,n){return new Er(e,n)}}function ei(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function wl(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(en.empty);t.push(n)}}function g2(t,e,n){let r=t.inserted;for(let i=0,s=0,a=0;a<t.sections.length;){let o=t.sections[a++],l=t.sections[a++];if(l<0)i+=o,s+=o;else{let c=i,u=s,d=en.empty;for(;c+=o,u+=l,l&&r&&(d=d.append(r[a-2>>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)o=t.sections[a++],l=t.sections[a++];e(i,c,s,u,d),i=c,s=u}}}function y2(t,e,n,r=!1){let i=[],s=r?[]:null,a=new t0(t),o=new t0(e);for(let l=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let c=Math.min(a.len,o.len);ei(i,c,-1),a.forward(c),o.forward(c)}else if(o.ins>=0&&(a.ins<0||l==a.i||a.off==0&&(o.len<a.len||o.len==a.len&&!n))){let c=o.len;for(ei(i,o.ins,-1);c;){let u=Math.min(a.len,c);a.ins>=0&&l<a.i&&a.len<=u&&(ei(i,0,a.ins),s&&wl(s,i,a.text),l=a.i),a.forward(u),c-=u}o.next()}else if(a.ins>=0){let c=0,u=a.len;for(;u;)if(o.ins==-1){let d=Math.min(u,o.len);c+=d,u-=d,o.forward(d)}else if(o.ins==0&&o.len<u)u-=o.len,o.next();else break;ei(i,c,l<a.i?a.ins:0),s&&l<a.i&&wl(s,i,a.text),l=a.i,a.forward(a.len-u)}else{if(a.done&&o.done)return s?Er.createSet(i,s):Pa.create(i);throw new Error("Mismatched change set lengths")}}}function OI(t,e,n=!1){let r=[],i=n?[]:null,s=new t0(t),a=new t0(e);for(let o=!1;;){if(s.done&&a.done)return i?Er.createSet(r,i):Pa.create(r);if(s.ins==0)ei(r,s.len,0,o),s.next();else if(a.len==0&&!a.done)ei(r,0,a.ins,o),i&&wl(i,r,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,a.len),c=r.length;if(s.ins==-1){let u=a.ins==-1?-1:a.off?0:a.ins;ei(r,l,u,o),i&&u&&wl(i,r,a.text)}else a.ins==-1?(ei(r,s.off?0:s.len,l,o),i&&wl(i,r,s.textBit(l))):(ei(r,s.off?0:s.len,a.off?0:a.ins,o),i&&!a.off&&wl(i,r,a.text));o=(s.ins>l||a.ins>=0&&a.len>l)&&(o||r.length>c),s.forward2(l),a.forward(l)}}}}class t0{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[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:e}=this.set,n=this.i-2>>1;return n>=e.length?en.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?en.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Rc{constructor(e,n,r){this.from=e,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 e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Rc(r,i,this.flags)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return we.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return we.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return we.range(e.anchor,e.head)}static create(e,n,r){return new Rc(e,n,r)}}class we{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:we.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new we([this.main],0)}addRange(e,n=!0){return we.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,we.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new we(e.ranges.map(n=>Rc.fromJSON(n)),e.main)}static single(e,n=e){return new we([we.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return we.normalized(e.slice(),n);r=s.to}return new we(e,n)}static cursor(e,n=0,r,i){return Rc.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i,s){let a=(r??16777215)<<6|(i==null?7:Math.min(6,i));return!s&&e!=n&&(s=n<e?1:-1),n<e?Rc.create(n,e,48|a):Rc.create(e,n,(s?s<0?8:16:0)|a)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],a=e[i-1];if(s.empty?s.from<=a.to:s.from<a.to){let o=a.from,l=Math.max(s.to,a.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?we.range(l,o):we.range(o,l))}}return new we(e,n)}}function jI(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Ek=0;class ut{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Ek++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new ut(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Ak),!!e.static,e.enables)}of(e){return new Mp([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mp(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mp(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Ak(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Mp{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=Ek++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,a=e[s]>>1,o=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=e[d.id])!==null&&n!==void 0?n:1)&1||u.push(e[d.id]);return{create(d){return d.values[a]=r(d),1},update(d,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||b2(d,u)){let m=r(d);if(o?!_8(m,d.values[a],i):!i(m,d.values[a]))return d.values[a]=m,1}return 0},reconfigure:(d,h)=>{let m,p=h.config.address[s];if(p!=null){let b=Vg(h,p);if(this.dependencies.every(x=>x instanceof ut?h.facet(x)===d.facet(x):x instanceof Ka?h.field(x,!1)==d.field(x,!1):!0)||(o?_8(m=r(d),b,i):i(m=r(d),b)))return d.values[a]=b,0}else m=r(d);return d.values[a]=m,1}}}}function _8(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function b2(t,e){let n=!1;for(let r of e)Sf(t,r)&1&&(n=!0);return n}function _ce(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),a=t[e.id]>>1;function o(l){let c=[];for(let u=0;u<r.length;u++){let d=Vg(l,r[u]);if(i[u]==2)for(let h of d)c.push(h);else c.push(d)}return e.combine(c)}return{create(l){for(let c of r)Sf(l,c);return l.values[a]=o(l),1},update(l,c){if(!b2(l,s))return 0;let u=o(l);return e.compare(u,l.values[a])?0:(l.values[a]=u,1)},reconfigure(l,c){let u=b2(l,r),d=c.config.facets[e.id],h=c.facet(e);if(d&&!u&&Ak(n,d))return l.values[a]=h,0;let m=o(l);return e.compare(m,h)?(l.values[a]=h,0):(l.values[a]=m,1)}}}const Bm=ut.define({static:!0});class Ka{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new Ka(Ek++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Bm).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],a=this.updateF(s,i);return this.compareF(s,a)?0:(r.values[n]=a,1)},reconfigure:(r,i)=>{let s=r.facet(Bm),a=i.facet(Bm),o;return(o=s.find(l=>l.field==this))&&o!=a.find(l=>l.field==this)?(r.values[n]=o.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Bm.of({field:this,create:e})]}get extension(){return this}}const Ac={lowest:4,low:3,default:2,high:1,highest:0};function Oh(t){return e=>new LI(e,t)}const gu={highest:Oh(Ac.highest),high:Oh(Ac.high),default:Oh(Ac.default),low:Oh(Ac.low),lowest:Oh(Ac.lowest)};class LI{constructor(e,n){this.inner=e,this.prec=n}}class ch{of(e){return new v2(this,e)}reconfigure(e){return ch.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class v2{constructor(e,n){this.compartment=e,this.inner=n}}class Fg{constructor(e,n,r,i,s,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),a=new Map;for(let h of Sce(e,n,a))h instanceof Ka?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let o=Object.create(null),l=[],c=[];for(let h of i)o[h.id]=c.length<<1,c.push(m=>h.slot(m));let u=r==null?void 0:r.config.facets;for(let h in s){let m=s[h],p=m[0].facet,b=u&&u[h]||[];if(m.every(x=>x.type==0))if(o[p.id]=l.length<<1|1,Ak(b,m))l.push(r.facet(p));else{let x=p.combine(m.map(g=>g.value));l.push(r&&p.compare(x,r.facet(p))?r.facet(p):x)}else{for(let x of m)x.type==0?(o[x.id]=l.length<<1|1,l.push(x.value)):(o[x.id]=c.length<<1,c.push(g=>x.dynamicSlot(g)));o[p.id]=c.length<<1,c.push(x=>_ce(x,p,m))}}let d=c.map(h=>h(o));return new Fg(e,a,d,o,l,s)}}function Sce(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(a,o){let l=i.get(a);if(l!=null){if(l<=o)return;let c=r[l].indexOf(a);c>-1&&r[l].splice(c,1),a instanceof v2&&n.delete(a.compartment)}if(i.set(a,o),Array.isArray(a))for(let c of a)s(c,o);else if(a instanceof v2){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(a.compartment)||a.inner;n.set(a.compartment,c),s(c,o)}else if(a instanceof LI)s(a.inner,a.prec);else if(a instanceof Ka)r[o].push(a),a.provides&&s(a.provides,o);else if(a instanceof Mp)r[o].push(a),a.facet.extensions&&s(a.facet.extensions,Ac.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,o)}}return s(t,Ac.default),r.reduce((a,o)=>a.concat(o))}function Sf(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Vg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const BI=ut.define(),x2=ut.define({combine:t=>t.some(e=>e),static:!0}),zI=ut.define({combine:t=>t.length?t[0]:void 0,static:!0}),PI=ut.define(),$I=ut.define(),UI=ut.define(),HI=ut.define({combine:t=>t.length?t[0]:!1});class Fo{constructor(e,n){this.type=e,this.value=n}static define(){return new Tce}}class Tce{of(e){return new Fo(this,e)}}class Cce{constructor(e){this.map=e}of(e){return new xn(this,e)}}class xn{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new xn(this.type,n)}is(e){return this.type==e}static define(e={}){return new Cce(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}xn.reconfigure=xn.define();xn.appendConfig=xn.define();class Mr{constructor(e,n,r,i,s,a){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,r&&jI(r,n.newLength),s.some(o=>o.type==Mr.time)||(this.annotations=s.concat(Mr.time.of(Date.now())))}static create(e,n,r,i,s,a){return new Mr(e,n,r,i,s,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Mr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Mr.time=Fo.define();Mr.userEvent=Fo.define();Mr.addToHistory=Fo.define();Mr.remote=Fo.define();function Ece(t,e){let n=[];for(let r=0,i=0;;){let s,a;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],a=t[r++];else if(i<e.length)s=e[i++],a=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,a):n[n.length-1]<a&&(n[n.length-1]=a)}}function qI(t,e,n){var r;let i,s,a;return n?(i=e.changes,s=Er.empty(e.changes.length),a=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(i)),{changes:a,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:xn.mapEffects(t.effects,i).concat(xn.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function w2(t,e,n){let r=e.selection,i=fd(e.annotations);return e.userEvent&&(i=i.concat(Mr.userEvent.of(e.userEvent))),{changes:e.changes instanceof Er?e.changes:Er.of(e.changes||[],n,t.facet(zI)),selection:r&&(r instanceof we?r:we.single(r.anchor,r.head)),effects:fd(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function FI(t,e,n){let r=w2(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let a=!!e[s].sequential;r=qI(r,w2(t,e[s],a?r.changes.newLength:t.doc.length),a)}let i=Mr.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Mce(n?Ace(i):i)}function Ace(t){let e=t.startState,n=!0;for(let i of e.facet(PI)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:Ece(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=Er.empty(e.doc.length);else{let a=t.changes.filter(n);i=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}t=Mr.create(e,i,t.selection&&t.selection.map(s),xn.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet($I);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof Mr?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mr?t=s[0]:t=FI(e,fd(s),!1)}return t}function Mce(t){let e=t.startState,n=e.facet(UI),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=qI(r,w2(e,s,t.changes.newLength),!0))}return r==t?t:Mr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Nce=[];function fd(t){return t==null?Nce:Array.isArray(t)?t:[t]}var So=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(So||(So={}));const Dce=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let k2;try{k2=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ice(t){if(k2)return k2.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Dce.test(n)))return!0}return!1}function Rce(t){return e=>{if(!/\S/.test(e))return So.Space;if(Ice(e))return So.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return So.Word;return So.Other}}class mn{constructor(e,n,r,i,s,a){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Sf(this,o<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return Sf(this,r),Vg(this,r)}update(...e){return FI(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let o of e.effects)o.is(ch.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(o.value.compartment,o.value.extension)):o.is(xn.reconfigure)?(n=null,r=o.value):o.is(xn.appendConfig)&&(n=null,r=fd(r).concat(o.value));let s;n?s=e.startState.values.slice():(n=Fg.resolve(r,i,this),s=new mn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let a=e.startState.facet(x2)?e.newSelection:e.newSelection.asSingle();new mn(n,e.newDoc,a,s,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:we.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],a=fd(r.effects);for(let o=1;o<n.ranges.length;o++){let l=e(n.ranges[o]),c=this.changes(l.changes),u=c.map(i);for(let h=0;h<o;h++)s[h]=s[h].map(u);let d=i.mapDesc(c,!0);s.push(l.range.map(d)),i=i.compose(u),a=xn.mapEffects(a,u).concat(xn.mapEffects(fd(l.effects),d))}return{changes:i,selection:we.create(s,n.mainIndex),effects:a}}changes(e=[]){return e instanceof Er?e:Er.of(e,this.doc.length,this.facet(mn.lineSeparator))}toText(e){return en.of(e.split(this.facet(mn.lineSeparator)||p2))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(Sf(this,n),Vg(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Ka&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let a=r[s],o=e[s];i.push(a.init(l=>a.spec.fromJSON(o,l)))}}return mn.create({doc:e.doc,selection:we.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=Fg.resolve(e.extensions||[],new Map),r=e.doc instanceof en?e.doc:en.of((e.doc||"").split(n.staticFacet(mn.lineSeparator)||p2)),i=e.selection?e.selection instanceof we?e.selection:we.single(e.selection.anchor,e.selection.head):we.single(0);return jI(i,r.length),n.staticFacet(x2)||(i=i.asSingle()),new mn(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(mn.tabSize)}get lineBreak(){return this.facet(mn.lineSeparator)||`
`}get readOnly(){return this.facet(HI)}phrase(e,...n){for(let r of this.facet(mn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(BI))for(let a of s(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&i.push(a[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return Rce(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),a=e-r,o=e-r;for(;a>0;){let l=ni(n,a,!1);if(s(n.slice(l,a))!=So.Word)break;a=l}for(;o<i;){let l=ni(n,o);if(s(n.slice(o,l))!=So.Word)break;o=l}return a==o?null:we.range(a+r,o+r)}}mn.allowMultipleSelections=x2;mn.tabSize=ut.define({combine:t=>t.length?t[0]:4});mn.lineSeparator=zI;mn.readOnly=HI;mn.phrases=ut.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});mn.languageData=BI;mn.changeFilter=PI;mn.transactionFilter=$I;mn.transactionExtender=UI;ch.reconfigure=xn.define();function iy(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let a=i[s],o=r[s];if(o===void 0)r[s]=a;else if(!(o===a||a===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](o,a);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Vl{eq(e){return this==e}range(e,n=e){return _2.create(e,n,this)}}Vl.prototype.startSide=Vl.prototype.endSide=0;Vl.prototype.point=!1;Vl.prototype.mapMode=es.TrackDel;function Mk(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let _2=class VI{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new VI(e,n,r)}};function S2(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Nk{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let a=i,o=s.length;;){if(a==o)return a;let l=a+o>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==a)return c>=0?a:o;c>=0?o=l:a=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,s);s<a;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,n){let r=[],i=[],s=[],a=-1,o=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,d=this.to[l]+e,h,m;if(u==d){let p=n.mapPos(u,c.startSide,c.mapMode);if(p==null||(h=m=p,c.startSide!=c.endSide&&(m=n.mapPos(u,c.endSide),m<h)))continue}else if(h=n.mapPos(u,c.startSide),m=n.mapPos(d,c.endSide),h>m||h==m&&c.startSide>0&&c.endSide<=0)continue;(m-h||c.endSide-c.startSide)<0||(a<0&&(a=h),c.point&&(o=Math.max(o,m-h)),r.push(c),i.push(h-a),s.push(m-a))}return{mapped:r.length?new Nk(i,s,r,o):null,pos:a}}}class gn{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new gn(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(S2)),this.isEmpty)return n.length?gn.of(n):this;let o=new GI(this,null,-1).goto(0),l=0,c=[],u=new Zc;for(;o.value||l<n.length;)if(l<n.length&&(o.from-n[l].from||o.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else o.rangeIndex==1&&o.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(o.chunkIndex)<n[l].from)&&(!a||i>this.chunkEnd(o.chunkIndex)||s<this.chunkPos[o.chunkIndex])&&u.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!a||i>o.to||s<o.from||a(o.from,o.to,o.value))&&(u.addInner(o.from,o.to,o.value)||c.push(_2.create(o.from,o.to,o.value))),o.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?gn.empty:this.nextLayer.update({add:c,filter:a,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let a=0;a<this.chunk.length;a++){let o=this.chunkPos[a],l=this.chunk[a],c=e.touchesRange(o,o+l.length);if(c===!1)i=Math.max(i,l.maxPoint),n.push(l),r.push(e.mapPos(o));else if(c===!0){let{mapped:u,pos:d}=l.map(o,e);u&&(i=Math.max(i,u.maxPoint),n.push(u),r.push(d))}}let s=this.nextLayer.map(e);return n.length==0?s:new gn(r,n,s||gn.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],a=this.chunk[i];if(n>=s&&e<=s+a.length&&a.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return n0.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return n0.from(e).goto(n)}static compare(e,n,r,i,s=-1){let a=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),o=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),l=S8(a,o,r),c=new jh(a,l,s),u=new jh(o,l,s);r.iterGaps((d,h,m)=>T8(c,d,u,h,m,i)),r.empty&&r.length==0&&T8(c,0,u,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(u=>!u.isEmpty&&n.indexOf(u)<0),a=n.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let o=S8(s,a),l=new jh(s,o,0).goto(r),c=new jh(a,o,0).goto(r);for(;;){if(l.to!=c.to||!T2(l.active,c.active)||l.point&&(!c.point||!Mk(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,n,r,i,s=-1){let a=new jh(e,null,s).goto(n),o=n,l=a.openStart;for(;;){let c=Math.min(a.to,r);if(a.point){let u=a.activeForPoint(a.to),d=a.pointFrom<n?u.length+1:a.point.startSide<0?u.length:Math.min(u.length,l);i.point(o,c,a.point,u,d,a.pointRank),l=Math.min(a.openEnd(c),u.length)}else c>o&&(i.span(o,c,a.active,l),l=a.openEnd(c));if(a.to>r)return l+(a.point&&a.to>r?1:0);o=a.to,a.next()}}static of(e,n=!1){let r=new Zc;for(let i of e instanceof _2?[e]:n?Oce(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return gn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=gn.empty;i=i.nextLayer)n=new gn(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}gn.empty=new gn([],[],null,-1);function Oce(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(S2(e,r)>0)return t.slice().sort(S2);e=r}return t}gn.empty.nextLayer=gn.empty;class Zc{finishChunk(e){this.chunks.push(new Nk(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,e&&(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(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new Zc)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-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(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(gn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=gn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function S8(t,e,n){let r=new Map;for(let s of t)for(let a=0;a<s.chunk.length;a++)s.chunk[a].maxPoint<=0&&r.set(s.chunk[a],s.chunkPos[a]);let i=new Set;for(let s of e)for(let a=0;a<s.chunk.length;a++){let o=r.get(s.chunk[a]);o!=null&&(n?n.mapPos(o):o)==s.chunkPos[a]&&!(n!=null&&n.touchesRange(o,o+s.chunk[a].length))&&i.add(s.chunk[a])}return i}class GI{constructor(e,n,r,i=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+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(e){if(e==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=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class n0{constructor(e){this.heap=e}static from(e,n=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let a=e[s];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new GI(a,n,r,s));return i.length==1?i[0]:new n0(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Lv(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Lv(this.heap,r);(this.to-e||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 e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Lv(this.heap,0)}}}function Lv(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class jh{constructor(e,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=n0.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){zm(this.active,e),zm(this.activeTo,e),zm(this.activeRank,e),this.minActive=C8(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;Pm(this.active,n,r),Pm(this.activeTo,n,i),Pm(this.activeRank,n,s),e&&Pm(e,n,this.cursor.from),this.minActive=C8(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&zm(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.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=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.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 i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){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]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function T8(t,e,n,r,i,s){t.goto(e),n.goto(r);let a=r+i,o=r,l=r-e,c=!!s.boundChange;for(let u=!1;;){let d=t.to+l-n.to,h=d||t.endSide-n.endSide,m=h<0?t.to+l:n.to,p=Math.min(m,a);if(t.point||n.point?(t.point&&n.point&&Mk(t.point,n.point)&&T2(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(o,p,t.point,n.point),u=!1):(u&&s.boundChange(o),p>o&&!T2(t.active,n.active)&&s.compareRange(o,p,t.active,n.active),c&&p<a&&(d||t.openEnd(m)!=n.openEnd(m))&&(u=!0)),m>a)break;o=m,h<=0&&t.next(),h>=0&&n.next()}}function T2(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Mk(t[n],e[n]))return!1;return!0}function zm(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Pm(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function C8(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function z0(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=ni(t,i));return r}function jce(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=ni(t,i)}return t.length}const C2="ͼ",E8=typeof Symbol>"u"?"__"+C2:Symbol.for(C2),E2=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),A8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gl{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,o,l,c){let u=[],d=/^@(\w+)\b/.exec(a[0]),h=d&&d[1]=="keyframes";if(d&&o==null)return l.push(a[0]+";");for(let m in o){let p=o[m];if(/&/.test(m))s(m.split(/,\s*/).map(b=>a.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.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.");s(i(m),p,u,h)}else p!=null&&u.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+p+";")}(u.length||h)&&l.push((r&&!d&&!c?a.map(r):a).join(", ")+" {"+u.join(" ")+"}")}for(let a in e)s(i(a),e[a],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=A8[E8]||1;return A8[E8]=e+1,C2+e.toString(36)}static mount(e,n,r){let i=e[E2],s=r&&r.nonce;i?s&&i.setNonce(s):i=new Lce(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let M8=new Map;class Lce{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=M8.get(r);if(s)return e[E2]=s;this.sheet=new i.CSSStyleSheet,M8.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[E2]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),r)for(let c=0;c<o.rules.length;c++)r.insertRule(o.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=o.rules.length,s++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
`;this.styleTag.textContent=a;let o=n.head||n;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Wl={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:"'"},r0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Bce=typeof navigator<"u"&&/Mac/.test(navigator.platform),zce=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wr=0;Wr<10;Wr++)Wl[48+Wr]=Wl[96+Wr]=String(Wr);for(var Wr=1;Wr<=24;Wr++)Wl[Wr+111]="F"+Wr;for(var Wr=65;Wr<=90;Wr++)Wl[Wr]=String.fromCharCode(Wr+32),r0[Wr]=String.fromCharCode(Wr);for(var Bv in Wl)r0.hasOwnProperty(Bv)||(r0[Bv]=Wl[Bv]);function Pce(t){var e=Bce&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||zce&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?r0:Wl)[t.keyCode]||t.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 pi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},A2=typeof document<"u"?document:{documentElement:{style:{}}};const M2=/Edge\/(\d+)/.exec(pi.userAgent),WI=/MSIE \d/.test(pi.userAgent),N2=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pi.userAgent),sy=!!(WI||N2||M2),N8=!sy&&/gecko\/(\d+)/i.test(pi.userAgent),zv=!sy&&/Chrome\/(\d+)/.exec(pi.userAgent),D8="webkitFontSmoothing"in A2.documentElement.style,D2=!sy&&/Apple Computer/.test(pi.vendor),I8=D2&&(/Mobile\/\w+/.test(pi.userAgent)||pi.maxTouchPoints>2);var qe={mac:I8||/Mac/.test(pi.platform),windows:/Win/.test(pi.platform),linux:/Linux|X11/.test(pi.platform),ie:sy,ie_version:WI?A2.documentMode||6:N2?+N2[1]:M2?+M2[1]:0,gecko:N8,gecko_version:N8?+(/Firefox\/(\d+)/.exec(pi.userAgent)||[0,0])[1]:0,chrome:!!zv,chrome_version:zv?+zv[1]:0,ios:I8,android:/Android\b/.test(pi.userAgent),webkit:D8,webkit_version:D8?+(/\bAppleWebKit\/(\d+)/.exec(pi.userAgent)||[0,0])[1]:0,safari:D2,safari_version:D2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(pi.userAgent)||[0,0])[1]:0,tabSize:A2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Dk(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const Gg=Object.create(null);function Ik(t,e,n){if(t==e)return!0;t||(t=Gg),e||(e=Gg);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function $ce(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function R8(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function Uce(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class Vo{eq(e){return!1}updateDOM(e,n,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var wi=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(wi||(wi={}));class rn extends Vl{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new P0(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new eu(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:a}=KI(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(a?n?2e8:1:-6e8)+1}return new eu(e,r,i,n,e.widget||null,!0)}static line(e){return new $0(e)}static set(e,n=!1){return gn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}rn.none=gn.empty;class P0 extends rn{constructor(e){let{start:n,end:r}=KI(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Dk(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Gg}eq(e){return this==e||e instanceof P0&&this.tagName==e.tagName&&Ik(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}P0.prototype.point=!1;class $0 extends rn{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof $0&&this.spec.class==e.spec.class&&Ik(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}$0.prototype.mapMode=es.TrackBefore;$0.prototype.point=!0;class eu extends rn{constructor(e,n,r,i,s,a){super(n,r,s,e),this.block=i,this.isReplace=a,this.mapMode=i?n<=0?es.TrackBefore:es.TrackAfter:es.TrackDel}get type(){return this.startSide!=this.endSide?wi.WidgetRange:this.startSide<=0?wi.WidgetBefore:wi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof eu&&Hce(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}eu.prototype.point=!0;function KI(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function Hce(t,e){return t==e||!!(t&&e&&t.compare(e))}function md(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class i0 extends Vl{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof i0&&this.tagName==e.tagName&&Ik(this.attributes,e.attributes)}static create(e){return new i0(e.tagName,e.attributes||Gg,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return gn.of(e,n)}}i0.prototype.startSide=i0.prototype.endSide=-1;function s0(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function I2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Tf(t,e){if(!e.anchorNode)return!1;try{return I2(t,e.anchorNode)}catch{return!1}}function Cf(t){return t.nodeType==3?o0(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ef(t,e,n,r){return n?O8(t,e,n,r,-1)||O8(t,e,n,r,1):!1}function Kl(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Wg(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function O8(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:zo(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Kl(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?zo(t):0}else return!1}}function zo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function a0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function qce(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function YI(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Fce(t,e,n,r,i,s,a,o){let l=t.ownerDocument,c=l.defaultView||window;for(let u=t,d=!1;u&&!d;)if(u.nodeType==1){let h,m=u==l.body,p=1,b=1;if(m)h=qce(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 y=u.getBoundingClientRect();({scaleX:p,scaleY:b}=YI(u,y)),h={left:y.left,right:y.left+u.clientWidth*p,top:y.top,bottom:y.top+u.clientHeight*b}}let x=0,g=0;if(i=="nearest")e.top<h.top+a?(g=e.top-(h.top+a),n>0&&e.bottom>h.bottom+g&&(g=e.bottom-h.bottom+a)):e.bottom>h.bottom-a&&(g=e.bottom-h.bottom+a,n<0&&e.top-g<h.top&&(g=e.top-(h.top+a)));else{let y=e.bottom-e.top,w=h.bottom-h.top;g=(i=="center"&&y<=w?e.top+y/2-w/2:i=="start"||i=="center"&&n<0?e.top-a:e.bottom-w+a)-h.top}if(r=="nearest"?e.left<h.left+s?(x=e.left-(h.left+s),n>0&&e.right>h.right+x&&(x=e.right-h.right+s)):e.right>h.right-s&&(x=e.right-h.right+s,n<0&&e.left<h.left+x&&(x=e.left-(h.left+s))):x=(r=="center"?e.left+(e.right-e.left)/2-(h.right-h.left)/2:r=="start"==o?e.left-s:e.right-(h.right-h.left)+s)-h.left,x||g)if(m)c.scrollBy(x,g);else{let y=0,w=0;if(g){let C=u.scrollTop;u.scrollTop+=g/b,w=(u.scrollTop-C)*b}if(x){let C=u.scrollLeft;u.scrollLeft+=x/p,y=(u.scrollLeft-C)*p}e={left:e.left-y,top:e.top-w,right:e.right-y,bottom:e.bottom-w},y&&Math.abs(y-x)<1&&(r="nearest"),w&&Math.abs(w-g)<1&&(i="nearest")}if(m)break;(e.top<h.top||e.bottom>h.bottom||e.left<h.left||e.right>h.right)&&(e={left:Math.max(e.left,h.left),right:Math.min(e.right,h.right),top:Math.max(e.top,h.top),bottom:Math.min(e.bottom,h.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function XI(t,e=!0){let n=t.ownerDocument,r=null,i=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class Vce{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?zo(n):0),r,Math.min(e.focusOffset,r?zo(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let wc=null;qe.safari&&qe.safari_version>=26&&(wc=!1);function QI(t){if(t.setActive)return t.setActive();if(wc)return t.focus(wc);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(wc==null?{get preventScroll(){return wc={preventScroll:!0},!0}}:void 0),!wc){wc=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let j8;function o0(t,e,n=e){let r=j8||(j8=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function pd(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let a=new KeyboardEvent("keyup",i);return a.synthetic=!0,t.dispatchEvent(a),s.defaultPrevented||a.defaultPrevented}function Gce(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Wce(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,zo(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=zo(n))}else{if(n==t)return!0;r=Kl(n),n=n.parentNode}}function JI(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function ZI(t,e){for(let n=t,r=e;;){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=zo(n)}else if(n.parentNode&&!Wg(n))r=Kl(n),n=n.parentNode;else return null}}function eR(t,e){for(let n=t,r=e;;){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&&!Wg(n))r=Kl(n)+1,n=n.parentNode;else return null}}class ra{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new ra(e.parentNode,Kl(e),n)}static after(e,n){return new ra(e.parentNode,Kl(e)+1,n)}}var Ln=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Ln||(Ln={}));const tu=Ln.LTR,Rk=Ln.RTL;function tR(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const Kce=tR("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Yce=tR("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),R2=Object.create(null),ba=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);R2[e]=n,R2[n]=-e}function nR(t){return t<=247?Kce[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Yce[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const Xce=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Oa{get dir(){return this.level%2?Rk:tu}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=n&&o.to>=n){if(o.level==r)return a;(s<0||(i!=0?i<0?o.from<n:o.to>n:e[s].level>o.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function rR(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!rR(r.inner,i.inner))return!1}return!0}const _n=[];function Qce(t,e,n,r,i){for(let s=0;s<=r.length;s++){let a=s?r[s-1].to:e,o=s<r.length?r[s].from:n,l=s?256:i;for(let c=a,u=l,d=l;c<o;c++){let h=nR(t.charCodeAt(c));h==512?h=u:h==8&&d==4&&(h=16),_n[c]=h==4?2:h,h&7&&(d=h),u=h}for(let c=a,u=l,d=l;c<o;c++){let h=_n[c];if(h==128)c<o-1&&u==_n[c+1]&&u&24?h=_n[c]=u:_n[c]=256;else if(h==64){let m=c+1;for(;m<o&&_n[m]==64;)m++;let p=c&&u==8||m<n&&_n[m]==8?d==1?1:8:256;for(let b=c;b<m;b++)_n[b]=p;c=m-1}else h==8&&d==1&&(_n[c]=1);u=h,h&7&&(d=h)}}}function Jce(t,e,n,r,i){let s=i==1?2:1;for(let a=0,o=0,l=0;a<=r.length;a++){let c=a?r[a-1].to:e,u=a<r.length?r[a].from:n;for(let d=c,h,m,p;d<u;d++)if(m=R2[h=t.charCodeAt(d)])if(m<0){for(let b=o-3;b>=0;b-=3)if(ba[b+1]==-m){let x=ba[b+2],g=x&2?i:x&4?x&1?s:i:0;g&&(_n[d]=_n[ba[b]]=g),o=b;break}}else{if(ba.length==189)break;ba[o++]=d,ba[o++]=h,ba[o++]=l}else if((p=_n[d])==2||p==1){let b=p==i;l=b?0:1;for(let x=o-3;x>=0;x-=3){let g=ba[x+2];if(g&2)break;if(b)ba[x+2]|=2;else{if(g&4)break;ba[x+2]|=4}}}}}function Zce(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let a=i?n[i-1].to:t,o=i<n.length?n[i].from:e;for(let l=a;l<o;){let c=_n[l];if(c==256){let u=l+1;for(;;)if(u==o){if(i==n.length)break;u=n[i++].to,o=i<n.length?n[i].from:e}else if(_n[u]==256)u++;else break;let d=s==1,h=(u<e?_n[u]:r)==1,m=d==h?d?1:2:r;for(let p=u,b=i,x=b?n[b-1].to:t;p>l;)p==x&&(p=n[--b].from,x=b?n[b-1].to:t),_n[--p]=m;l=u}else s=c,l++}}}function O2(t,e,n,r,i,s,a){let o=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<n;){let u=!0,d=!1;if(c==s.length||l<s[c].from){let b=_n[l];b!=o&&(u=!1,d=b==16)}let h=!u&&o==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c<s.length&&p==s[c].from){if(d)break e;let b=s[c];if(!u)for(let x=b.to,g=c+1;;){if(x==n)break e;if(g<s.length&&s[g].from==x)x=s[g++].to;else{if(_n[x]==o)break e;break}}if(c++,h)h.push(b);else{b.from>l&&a.push(new Oa(l,b.from,m));let x=b.direction==tu!=!(m%2);j2(t,x?r+1:r,i,b.inner,b.from,b.to,a),l=b.to}p=b.to}else{if(p==n||(u?_n[p]!=o:_n[p]==o))break;p++}h?O2(t,l,p,r+1,i,h,a):l<p&&a.push(new Oa(l,p,m)),l=p}else for(let l=n,c=s.length;l>e;){let u=!0,d=!1;if(!c||l>s[c-1].to){let b=_n[l-1];b!=o&&(u=!1,d=b==16)}let h=!u&&o==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c&&p==s[c-1].to){if(d)break e;let b=s[--c];if(!u)for(let x=b.from,g=c;;){if(x==e)break e;if(g&&s[g-1].to==x)x=s[--g].from;else{if(_n[x-1]==o)break e;break}}if(h)h.push(b);else{b.to<l&&a.push(new Oa(b.to,l,m));let x=b.direction==tu!=!(m%2);j2(t,x?r+1:r,i,b.inner,b.from,b.to,a),l=b.from}p=b.from}else{if(p==e||(u?_n[p-1]!=o:_n[p-1]==o))break;p--}h?O2(t,p,l,r+1,i,h,a):p<l&&a.push(new Oa(p,l,m)),l=p}}function j2(t,e,n,r,i,s,a){let o=e%2?2:1;Qce(t,i,s,r,o),Jce(t,i,s,r,o),Zce(i,s,r,o),O2(t,i,s,e,n,r,a)}function eue(t,e,n){if(!t)return[new Oa(0,0,e==Rk?1:0)];if(e==tu&&!n.length&&!Xce.test(t))return iR(t.length);if(n.length)for(;t.length>_n.length;)_n[_n.length]=256;let r=[],i=e==tu?0:1;return j2(t,i,i,n,0,t.length,r),r}function iR(t){return[new Oa(0,t,0)]}let sR="";function tue(t,e,n,r,i){var s;let a=r.head-t.from,o=Oa.find(e,a,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[o],c=l.side(i,n);if(a==c){let h=o+=i?1:-1;if(h<0||h>=e.length)return null;l=e[o=h],a=l.side(!i,n),c=l.side(i,n)}let u=ni(t.text,a,l.forward(i,n));(u<l.from||u>l.to)&&(u=c),sR=t.text.slice(Math.min(a,u),Math.max(a,u));let d=o==(i?e.length-1:0)?null:e[o+(i?1:-1)];return d&&u==c&&d.level+(i?0:1)<l.level?we.cursor(d.side(!i,n)+t.from,d.forward(i,n)?1:-1,d.level):we.cursor(u+t.from,l.forward(i,n)?-1:1,l.level)}function nue(t,e,n){for(let r=e;r<n;r++){let i=nR(t.charCodeAt(r));if(i==1)return tu;if(i==2||i==4)return Rk}return tu}const aR=ut.define(),oR=ut.define(),lR=ut.define(),cR=ut.define(),L2=ut.define(),uR=ut.define(),dR=ut.define(),Ok=ut.define(),jk=ut.define(),hR=ut.define({combine:t=>t.some(e=>e)}),fR=ut.define({combine:t=>t.some(e=>e)}),mR=ut.define();class gd{constructor(e,n,r,i,s,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=a}map(e){return e.empty?this:new gd(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new gd(we.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const $m=xn.define({map:(t,e)=>t.map(e)}),pR=xn.define();function ns(t,e,n){let r=t.facet(cR);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const go=ut.define({combine:t=>t.length?t[0]:!0});let rue=0;const Zu=ut.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class hs{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Zu.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Zu.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:a}=n||{};return new hs(rue++,e,r,i,o=>{let l=[];return a&&l.push(ay.of(c=>{let u=c.plugin(o);return u?a(u):rn.none})),s&&l.push(s(o)),l})}static fromClass(e,n){return hs.define((r,i)=>new e(r,i),n)}}class Pv{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){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(ns(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(e,this.spec.arg)}catch(n){ns(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){ns(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const gR=ut.define(),Lk=ut.define(),ay=ut.define(),yR=ut.define(),Bk=ut.define(),U0=ut.define(),bR=ut.define();function L8(t,e){let n=t.state.facet(bR);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return gn.spans(r,e.from,e.to,{point(){},span(s,a,o,l){let c=s-e.from,u=a-e.from,d=i;for(let h=o.length-1;h>=0;h--,l--){let m=o[h].spec.bidiIsolate,p;if(m==null&&(m=nue(e.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 b={from:c,to:u,direction:m,inner:[]};d.push(b),d=b.inner}}}}),i}const vR=ut.define();function zk(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(vR)){let a=s(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(i=Math.max(i,a.bottom)))}return{left:e,right:n,top:r,bottom:i}}const Yh=ut.define();class Os{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Os(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,a=0;;){let o=i<e.length?e[i].fromB:1e9,l=s<n.length?n[s]:1e9,c=Math.min(o,l);if(c==1e9)break;let u=c+a,d=c,h=u;for(;;)if(s<n.length&&n[s]<=d){let m=n[s+1];s+=2,d=Math.max(d,m);for(let p=i;p<e.length&&e[p].fromB<=d;p++)a=e[p].toA-e[p].toB;h=Math.max(h,m+a)}else if(i<e.length&&e[i].fromB<=d){let m=e[i++];d=Math.max(d,m.toB),h=Math.max(h,m.toA),a=m.toA-m.toB}else break;r.push(new Os(u,h,c,d))}return r}}class Kg{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Er.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,a,o,l)=>i.push(new Os(s,a,o,l))),this.changedRanges=i}static create(e,n,r){return new Kg(e,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(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const iue=[];class tr{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return iue}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&$ce(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n){return null}domPosFor(e,n){let r=Kl(this.dom),i=this.length?e>0:n>0;return new ra(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof ly)return e;return null}static get(e){return e.cmTile}}class oy extends tr{constructor(e){super(e,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(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=(e==null?void 0:e.node)==n?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=o.dom&&(s.written=!0),o.dom.parentNode==n)for(;i&&i!=o.dom;)i=B8(i);else n.insertBefore(o.dom,i);r=o.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=B8(i);this.length=a}}function B8(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ly extends oy{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=tr.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let a=r.children[i++];if(a instanceof No)n.push(i),r=a,i=0;else{let o=s+a.length,l=e(a,s);if(l!==void 0)return l;s=o+a.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,a=-1;if(this.blockTiles((o,l)=>{let c=l+o.length;if(e>=l&&e<=c){if(o.isWidget()&&n>=-1&&n<=1){if(o.flags&32)return!0;o.flags&16&&(r=void 0)}(l<e||e==c&&(n<-1?o.length:o.covers(1)))&&(!r||!o.isWidget()&&r.isWidget())&&(r=o,i=e-l),(c>e||e==l&&(n>1?o.length:o.covers(-1)))&&(!s||!o.isWidget()&&s.isWidget())&&(s=o,a=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:a}}}class No extends oy{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new No(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class zd extends oy{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new zd(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,a=null,o=-1;function l(u,d){for(let h=0,m=0;h<u.children.length&&m<=d;h++){let p=u.children[h],b=m+p.length;b>=d&&(p.isComposite()?l(p,d-m):(!a||a.isHidden&&(n>0||r&&aue(a,p)))&&(b>d||p.flags&32)?(a=p,o=d-m):(m<d||p.flags&16&&!p.isHidden)&&(i=p,s=d-m)),m=b}}l(this,e);let c=(n<0?i:a)||i||a;return c?{tile:c,offset:c==i?s:o}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):sue(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new ra(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let a=r.tile.parent,o=!1;for(let l of a.children){if(o)return new ra(l.dom,0);l==r.tile&&(o=!0)}}return new ra(this.dom,0)}}function sue(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Cf(e);return n[n.length-1]||null}function aue(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Ri extends oy{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new Ri(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Oc extends tr{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,a=0;e==0&&n<0||e==r&&n>=0?qe.chrome||qe.gecko||(e?(i--,a=1):s<r&&(s++,a=-1)):n<0?i--:s<r&&s++;let o=o0(this.dom,i,s).getClientRects();if(!o.length)return null;let l=o[(a?a<0:n>=0)?0:o.length-1];return qe.safari&&!a&&l.width==0&&(l=Array.prototype.find.call(o,c=>c.width)||l),a?a0(l,a<0):l||null}static of(e,n){let r=new Oc(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class nu extends tr{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return a0(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),a=null;if(!s.length)return null;let o=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=o?s.length-1:0;a=s[l],!(e>0?l==0:l==s.length-1||a.top<a.bottom);l+=o?-1:1);return a0(a,!o)}}get overrideDOMText(){if(!this.length)return en.empty;let{root:e}=this;if(!e)return en.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,i,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new nu(s,r,e,i)}}class Yg extends tr{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!0}get overrideDOMText(){return en.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class oue{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:a,parents:o}=this;for(;e||n>0;)if(i.isComposite())if(a){if(!e)break;r&&r.break(),e--,a=!1}else if(s==i.children.length){if(!e&&!o.length)break;r&&r.leave(i),a=!!i.breakAfter,{tile:i,index:s}=o.pop(),s++}else{let l=i.children[s],c=l.breakAfter;(n>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(a=!!c,s++,e-=l.length):(o.push({tile:i,index:s}),i=l,s=0,r&&l.isComposite()&&r.enter(l))}else if(s==i.length)a=!!i.breakAfter,{tile:i,index:s}=o.pop(),s++;else if(e){let l=Math.min(e,i.length-s);r&&r.skip(i,s,s+l),e-=l,s+=l}else break;return this.tile=i,this.index=s,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class lue{constructor(e,n,r,i){this.from=e,this.to=n,this.wrapper=r,this.rank=i}}class cue{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,i){var s;this.flushBuffer();let a=this.ensureMarks(n,r),o=a.lastChild;if(o&&o.isText()&&!(o.flags&8)&&o.length+e.length<512){this.cache.reused.set(o,2);let l=a.children[a.children.length-1]=new Oc(o.dom,o.text+e);l.parent=a}else a.append(i||Oc.of(e,(s=this.cache.find(Oc))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?$v(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let i=r;for(let o=n.marks.length-1;o>=0;o--){let l=n.marks[o],c=i.lastChild;if(c instanceof Ri&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM($v(l.dom)),i=c;else{if(this.cache.reused.get(l)){let d=tr.get(l.dom);d&&d.setDOM($v(l.dom))}let u=Ri.of(l.mark,l.dom);i.append(u),i=u}this.cache.reused.set(l,2)}let s=tr.get(e.text);s&&this.cache.reused.set(s,2);let a=new Oc(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,i.append(a)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=xR);let i=zd.start(e,n||((r=this.cache.find(zd))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let a=e[s],o;if(n>0&&(o=i.lastChild)&&o instanceof Ri&&o.mark.eq(a))i=o,n--;else{let l=Ri.of(a,(r=this.cache.find(Ri,c=>c.mark.eq(a)))===null||r===void 0?void 0:r.dom);i.append(l),i=l,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!z8(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(qe.ios&&z8(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Uv,0,32)||new nu(Uv.toDOM(),0,Uv,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=e.rank*102+e.value.rank,r=new lue(e.from,e.to,e.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.from<this.pos&&i instanceof No&&i.wrapper.eq(r.wrapper))n=i;else{let s=No.of(r.wrapper,(e=this.cache.find(No,a=>a.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(Yg,void 0,1);return r&&(r.flags=n),r||new Yg(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class uue{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=i;let o=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,o)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const Xg=[nu,zd,Oc,Ri,Yg,No,ly];for(let t=0;t<Xg.length;t++)Xg[t].bucket=t;class due{constructor(e){this.view=e,this.buckets=Xg.map(()=>[]),this.index=Xg.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],a=this.index[i];for(let o=s.length-1;o>=0;o--){let l=(o+a)%s.length,c=s[l];if((!n||n(c))&&!this.reused.has(c))return s.splice(l,1),l<a&&this.index[i]--,this.reused.set(c,r),c}return null}findWidget(e,n,r){let i=this.buckets[0];if(i.length)for(let s=0,a=0;;s++){if(s==i.length){if(a)return null;a=1,s=0}let o=i[s];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,o.widget==e&&o.length==n&&(o.flags&497)==r?(this.reused.set(o,1),o):(this.reused.set(o,2),new nu(o.dom,n,e,o.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class hue{constructor(e,n,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new due(e),this.text=new uue(e.state.doc),this.builder=new cue(this.cache,new ly(e,e.contentDOM),gn.iter(r)),this.cache.reused.set(n,2),this.old=new oue(n),this.reuseWalker={skip:(a,o,l)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,a=0;;){let o=a<e.length?e[a++]:null,l=o?o.fromA:this.old.root.length;if(l>i){let c=l-i;this.preserve(c,!a,!o),i=l,s+=c}if(!o)break;n&&o.fromA<=n.range.fromA&&o.toA>=n.range.toA?(this.forward(o.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(s,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,o.toA),this.emit(n.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(s,o.toB)),s=o.toB,i=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let i=pue(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(a,o,l)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(l-o);else{let c=l>0||o<a.length?nu.of(a.widget,this.view,l-o,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,s),s=i.length)}else if(a.isText())this.builder.ensureLine(null),!o&&l==a.length&&!this.cache.reused.has(a)?this.builder.addText(a.text,i,s,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(o,l),i,s)),s=i.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof Yg)this.cache.add(a);else if(a instanceof Ri)this.builder.ensureLine(null),this.builder.addMark(a,i,s),this.cache.reused.set(a,1),s=i.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Ri&&i.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?i.length&&(i.length=s=0):a instanceof Ri&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=0,a=gn.spans(this.decorations,e,n,{point:(o,l,c,u,d,h)=>{if(c instanceof eu){if(this.disallowBlockEffectsFor[h]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(o).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=u.length,d>u.length)i.continueWidget(l-o);else{let m=c.widget||(c.block?Pd.block:Pd.inline),p=fue(c),b=this.cache.findWidget(m,l-o,p)||nu.of(m,this.view,l-o,p);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,u,d))}r=null}else r=mue(r,c);l>o&&this.text.skip(l-o)},span:(o,l,c,u)=>{for(let d=o;d<l;){let h=this.text.next(Math.min(512,l-d));h==null?(i.addLineStartIfNotCovered(r),i.addBreak(),d++):(i.ensureLine(r),i.addText(h,c,d==o?u:c.length),d+=h.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=a>s,this.openMarks=a}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=tr.get(i);if(i==this.view.contentDOM)break;s instanceof Ri?n.push(s):s!=null&&s.isLine()?r=s:s instanceof No||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new zd(i,xR):r||n.push(Ri.of(new P0({tagName:i.nodeName.toLowerCase(),attributes:Uce(i)}),i)))}return{line:r,marks:n}}}function z8(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function fue(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const xR={class:"cm-line"};function mue(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Dk(n,t),r&&(t.class+=" "+r)),t}function pue(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof Ri&&e.push(r.mark)}return e}function $v(t){let e=tr.get(t);return e&&e.setDOM(t.cloneNode()),t}class Pd extends Vo{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Pd.inline=new Pd("span");Pd.block=new Pd("div");const Uv=new class extends Vo{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class P8{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=rn.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 ly(e,e.contentDOM),this.updateInner([new Os(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:d})=>d<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!Sue(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?yue(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new Os(u,d,e.changes.mapPos(u,-1),e.changes.mapPos(d,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(qe.ie||qe.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,o=this.blockWrappers;this.updateDeco();let l=xue(a,this.decorations,e.changes);l.length&&(r=Os.extendWithRanges(r,l));let c=kue(o,this.blockWrappers,e.changes);return c.length&&(r=Os.extendWithRanges(r,c)),s&&!r.some(u=>u.fromA<=s.range.fromA&&u.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let a=this.tile,o=new hue(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&tr.get(n.text)&&o.cache.reused.set(tr.get(n.text),2),this.tile=o.run(e,n),B2(a,o.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=qe.chrome||qe.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof Hv&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(pR)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,a=!s&&!(this.view.state.facet(go)||r.tabIndex>-1)&&Tf(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||a))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),qe.gecko&&l.empty&&!this.hasComposition&&gue(c)){let h=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(h,c.node.childNodes[c.offset]||null)),c=u=new ra(h,0),o=!0}let d=this.view.observer.selectionRange;(o||!d.focusNode||(!Ef(c.node,c.offset,d.anchorNode,d.anchorOffset)||!Ef(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{qe.android&&qe.chrome&&r.contains(d.focusNode)&&_ue(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=s0(this.view.root);if(h)if(l.empty){if(qe.gecko){let m=bue(c.node,c.offset);if(m&&m!=3){let p=(m==1?ZI:eR)(c.node,c.offset);p&&(c=new ra(p.node,p.offset))}}h.collapse(c.node,c.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(c.node,c.offset);try{h.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),h.removeAllRanges(),h.addRange(m)}a&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new ra(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new ra(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Ef(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=s0(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=this.lineAt(n.head,n.assoc);if(!a)return;let o=a.posAtStart;if(n.head==o||n.head==o+a.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let a=zo(e)==0?0:n==0?-1:1;for(;;){let o=e.parentNode;if(o==r.dom)break;a==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?a=-1:a=1),e=o}a<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!tr.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let a=0,o=i;;a++){let l=r.children[a];if(l.dom==s)return o;o+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,a,o=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=e)return!0;c.flags&16&&(s=!0)}else{let d=u+c.length;if(u<=e&&(r=c,i=e-u,s=d<e),d>=e&&!a&&(a=c,o=e-u,l=u>e),u>e&&a)return!0}}),!r&&!a?this.domAtPos(e,n):(s&&a?r=null:l&&r&&(a=null),r&&n<0||!a?r.domIn(i,n):a.domIn(o,n))}coordsAt(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof Hv?null:r.coordsInWidget(i,n,!0):r.coordsIn(i,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,a){if(s.isComposite())for(let o of s.children){if(o.length>=a){let l=i(o,a);if(l)return l}if(a-=o.length,a<0)break}else if(s.isText()&&a<s.length){let o=ni(s.text,a);if(o==a)return null;let l=o0(s.dom,a,o).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return i(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,a=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Ln.LTR,c=0,u=(d,h,m)=>{for(let p=0;p<d.children.length&&!(h>i);p++){let b=d.children[p],x=h+b.length,g=b.dom.getBoundingClientRect(),{height:y}=g;if(m&&!p&&(c+=g.top-m.top),b instanceof No)x>r&&u(b,h,g);else if(h>=r&&(c>0&&n.push(-c),n.push(y+c),c=0,a)){let w=b.dom.lastChild,C=w?Cf(w):[];if(C.length){let E=C[C.length-1],S=l?E.right-g.left:g.right-E.left;S>o&&(o=S,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=x)}}m&&p==d.children.length-1&&(c+=m.bottom-g.bottom),h=x+b.breakAfter}};return u(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Ln.RTL:Ln.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let o=0,l;for(let c of a.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=Cf(c.dom);if(u.length!=1)return;o+=u[0].width,l=u[0].height}if(o)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:o/a.length,textHeight:l}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let a=Cf(n.firstChild)[0];r=n.getBoundingClientRect().height,i=a&&a.width?a.width/27:7,s=a&&a.height?a.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],a=s?s.from-1:this.view.state.doc.length;if(a>r){let o=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(rn.replace({widget:new Hv(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!s)break;r=s.to+1}return rn.set(e)}updateDeco(){let e=1,n=this.view.state.facet(ay).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Bk).map((s,a)=>{let o=typeof s=="function";return o&&(r=!0),o?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(gn.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(yR).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){var n;if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(mR))try{if(u(this.view,e.range,e))return!0}catch(d){ns(this.view.state,d,"scroll handler")}let{range:r}=e,i=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),s;if(!i)return;!r.empty&&(s=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let a=zk(this.view),o={left:i.left-a.left,top:i.top-a.top,right:i.right+a.right,bottom:i.bottom+a.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(Fce(this.view.scrollDOM,o,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==Ln.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(r.head,1);u&&u.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){B2(this.tile)}}function B2(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)B2(r,e)}}function gue(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function wR(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=ZI(n.focusNode,n.focusOffset),i=eR(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let o=tr.get(i.node);if(!o||o.isText()&&o.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let l=tr.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let a=e-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function yue(t,e,n){let r=wR(t,n);if(!r)return null;let{node:i,from:s,to:a}=r,o=i.nodeValue;if(/[\n\r]/.test(o)||t.state.doc.sliceString(r.from,r.to)!=o)return null;let l=e.invertedDesc;return{range:new Os(l.mapPos(s),l.mapPos(a),s,a),text:i}}function bue(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let vue=class{constructor(){this.changes=[]}compareRange(e,n){md(e,n,this.changes)}comparePoint(e,n){md(e,n,this.changes)}boundChange(e){md(e,e,this.changes)}};function xue(t,e,n){let r=new vue;return gn.compare(t,e,n,r),r.changes}class wue{constructor(){this.changes=[]}compareRange(e,n){md(e,n,this.changes)}comparePoint(){}boundChange(e){md(e,e,this.changes)}}function kue(t,e,n){let r=new wue;return gn.compare(t,e,n,r),r.changes}function _ue(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Sue(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}class Hv extends Vo{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Tue(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return we.cursor(e);s==0?n=1:s==i.length&&(n=-1);let a=s,o=s;n<0?a=ni(i.text,s,!1):o=ni(i.text,s);let l=r(i.text.slice(a,o));for(;a>0;){let c=ni(i.text,a,!1);if(r(i.text.slice(c,a))!=l)break;a=c}for(;o<i.length;){let c=ni(i.text,o);if(r(i.text.slice(o,c))!=l)break;o=c}return we.range(a+i.from,o+i.from)}function Cue(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let o=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-o)*.5)/o);s+=l*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+jce(a,s,t.state.tabSize)}function z2(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==wi.Text&&(i.type!=s.type||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function Eue(t,e,n,r){let i=z2(t,e.head,e.assoc||-1),s=!r||i.type!=wi.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let a=t.dom.getBoundingClientRect(),o=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(o==Ln.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(l!=null)return we.cursor(l,n?-1:1)}return we.cursor(n?i.to:i.from,n?-1:1)}function $8(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),a=t.textDirectionAt(i.from);for(let o=e,l=null;;){let c=tue(i,s,a,o,n),u=sR;if(!c){if(i.number==(n?t.state.doc.lines:1))return o;u=`
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(u))return o}else{if(!r)return c;l=r(u)}o=c}}function Aue(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let a=r(s);return i==So.Space&&(i=a),i==a}}function Mue(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return we.cursor(i,e.assoc);let a=e.goalColumn,o,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),u=t.documentTop;if(c)a==null&&(a=c.left-l.left),o=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);a==null&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),o=(s<0?p.top:p.bottom)+u}let d=l.left+a,h=t.viewState.heightOracle.textHeight>>1,m=r??h;for(let p=0;;p+=h){let b=o+(m+p)*s,x=P2(t,{x:d,y:b},!1,s);if(n?b>l.bottom:b<l.top)return we.cursor(x.pos,x.assoc);let g=t.coordsAtPos(x.pos,x.assoc),y=g?(g.top+g.bottom)/2:0;if(!g||(n?y>o:y<o))return we.cursor(x.pos,x.assoc,void 0,a)}}function Af(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,a,o)=>{if(e>s&&e<a){let l=r||n||(e-s<a-e?-1:1);e=l<0?s:a,r=l}});if(!r)return e}}function kR(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let a=Af(t,i.from,0);a!=i.from&&(s=we.cursor(a,-1))}else{let a=Af(t,i.from,-1),o=Af(t,i.to,1);(a!=i.from||o!=i.to)&&(s=we.range(i.from==i.anchor?a:o,i.from==i.head?a:o))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?we.create(n,e.mainIndex):e}function qv(t,e,n){let r=Af(t.state.facet(U0).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:we.cursor(r,r<n.from?1:-1)}class Ma{constructor(e,n){this.pos=e,this.assoc=n}}function P2(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:a,y:o}=e,l=o-s,c;for(;;){if(l<0)return new Ma(0,1);if(l>t.viewState.docHeight)return new Ma(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==wi.Text){if(r<0?c.to<t.viewport.from:c.from>t.viewport.to)break;let h=t.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(h&&(r<0?h.top<=l+s:h.bottom>=l+s))break}let d=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+d:c.top-d}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==wi.Text){let d=Cue(t,i,c,a,o);return new Ma(d,d==c.from?1:-1)}}if(c.type!=wi.Text)return l<(c.top+c.bottom)/2?new Ma(c.from,1):new Ma(c.to,-1);let u=t.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=t.docView.lineAt(c.from,-2)),new Nue(t,a,o,t.textDirectionAt(c.from)).scanTile(u,c.from)}class Nue{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Oa.find(i,e-r.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Oa.find(i,e-r.from,-1,n)].dir}bidiIn(e,n){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<n)}scan(e,n,r=!1){let i=0,s=e.length-1,a=new Set,o=this.bidiIn(e[0],e[s]),l,c,u=-1,d=1e9,h;e:for(;i<s;){let p=s-i,b=i+s>>1;t:if(a.has(b)){let g=i+Math.floor(Math.random()*p);for(let y=0;y<p;y++){if(!a.has(g)){b=g;break t}g++,g==s&&(g=i)}break e}a.add(b);let x=n(b);if(x)for(let g=0;g<x.length;g++){let y=x[g],w=0;if(!(y.width==0&&x.length>1)){if(y.bottom<this.y)(!l||l.bottom<y.bottom)&&(l=y),w=1;else if(y.top>this.y)(!c||c.top>y.top)&&(c=y),w=-1;else{let C=y.left>this.x?this.x-y.left:y.right<this.x?this.x-y.right:0,E=Math.abs(C);E<d&&(u=b,d=E,h=y),C&&(w=C<0==(this.baseDir==Ln.LTR)?-1:1)}w==-1&&(!o||this.baseDirAt(e[b],1))?s=b:w==1&&(!o||this.baseDirAt(e[b+1],-1))&&(i=b+1)}}}if(!h){if(!c&&!l)return{i:e[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(e,n,!0)}if(d&&!r){let{top:p,bottom:b}=h;if(l&&l.bottom>(p+p+b)/3)return this.y=l.bottom-1,this.scan(e,n,!0);if(c&&c.top<(p+b+b)/3)return this.y=c.top+1,this.scan(e,n,!0)}let m=(o?this.dirAt(e[u],1):this.baseDir)==Ln.LTR;return{i:u,after:this.x>(h.left+h.right)/2==m}}scanText(e,n){let r=[];for(let s=0;s<e.length;s=ni(e.text,s))r.push(n+s);r.push(n+e.length);let i=this.scan(r,s=>{let a=r[s]-n,o=r[s+1]-n;return o0(e.dom,a,o).getClientRects()});return i.after?new Ma(r[i.i+1],-1):new Ma(r[i.i],1)}scanTile(e,n){if(!e.length)return new Ma(n,1);if(e.children.length==1){let o=e.children[0];if(o.isText())return this.scanText(o,n);if(o.isComposite())return this.scanTile(o,n)}let r=[n];for(let o=0,l=n;o<e.children.length;o++)r.push(l+=e.children[o].length);let i=this.scan(r,o=>{let l=e.children[o];return l.flags&48?null:(l.dom.nodeType==1?l.dom:o0(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],a=r[i.i];return s.isText()?this.scanText(s,a):s.isComposite()?this.scanTile(s,a):i.after?new Ma(r[i.i+1],-1):new Ma(a,1)}}const Bu="";class Due{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(mn.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bu}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let a=tr.get(i),o=i.nextSibling;if(o==n){a!=null&&a.breakAfter&&!o&&r!=this.view.contentDOM&&this.lineBreak();break}let l=tr.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Wg(i))||Wg(o)&&(i.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>s)&&!Rue(o,n)&&this.lineBreak(),i=o}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,o;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(o=i.exec(n))&&(s=o.index,a=o[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),a>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=a-1);r=s+a}}readNode(e){let n=tr.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Iue(e,r.node,r.offset)?n:0))}}function Iue(t,e,n){for(;;){if(!e||n<zo(e))return!1;if(e==t)return!0;n=Kl(e)+1,e=e.parentNode}}function Rue(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=tr.get(t);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class U8{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class Oue{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=_R(e.docView.tile,n,r,0))){let l=s||a?[]:Lue(e),c=new Due(l,e);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Bue(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!I2(e.contentDOM,l.focusNode)?o.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!I2(e.contentDOM,l.anchorNode)?o.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=e.viewport;if((qe.ios||qe.chrome)&&o.main.empty&&c!=u&&(d.from>0||d.to<e.state.doc.length)){let h=Math.min(c,u),m=Math.max(c,u),p=d.from-h,b=d.to-m;(p==0||p==1||h==0)&&(b==0||b==-1||m==e.state.doc.length)&&(c=0,u=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(we.range(u,c));else if(e.lineWrapping&&u==c&&!(o.main.empty&&o.main.head==c)&&e.inputState.lastTouchTime>Date.now()-100){let h=e.coordsAtPos(c,-1),m=0;h&&(m=e.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=we.create([we.cursor(c,m)])}else this.newSel=we.single(u,c)}}}function _R(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,a=-1,o=-1;for(let l=0,c=r,u=r;l<t.children.length;l++){let d=t.children[l],h=c+d.length;if(c<e&&h>n)return _R(d,e,n,c);if(h>=e&&i==-1&&(i=l,s=c),c>n&&d.dom.parentNode==t.dom){a=l,o=u;break}u=h,c=h+d.breakAfter}return{from:s,to:o<0?r+t.length:o,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:a<t.children.length&&a>=0?t.children[a].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function SR(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,a=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,c=s.from,u=null;(a===8||qe.android&&e.text.length<l-o)&&(c=s.to,u="end");let d=i.doc.sliceString(o,l,Bu),h,m;!s.empty&&s.from>=o&&s.to<=l&&(e.typeOver||d!=e.text)&&d.slice(0,s.from-o)==e.text.slice(0,s.from-o)&&d.slice(s.to-o)==e.text.slice(h=e.text.length-(d.length-(s.to-o)))?n={from:s.from,to:s.to,insert:en.of(e.text.slice(s.from-o,h).split(Bu))}:(m=TR(d,e.text,c-o,u))&&(qe.chrome&&a==13&&m.toB==m.from+2&&e.text.slice(m.from,m.toB)==Bu+Bu&&m.toB--,n={from:o+m.from,to:o+m.toA,insert:en.of(e.text.slice(m.from,m.toB).split(Bu))})}else r&&(!t.hasFocus&&i.facet(go)||Qg(r,s))&&(r=null);if(!n&&!r)return!1;if((qe.mac||qe.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=we.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:en.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:qe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
 `&&t.lineWrapping&&(r&&(r=we.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:en.of([" "])}),n)return Pk(t,n,r,a);if(r&&!Qg(r,s)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=kR(i.facet(U0).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function Pk(t,e,n,r=-1){if(qe.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(qe.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&pd(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&pd(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&pd(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,o=()=>a||(a=jue(t,e,n));return t.state.facet(uR).some(l=>l(t,e.from,e.to,s,o))||t.dispatch(o()),!0}function jue(t,e,n){let r,i=t.state,s=i.selection.main,a=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,u=Af(i.facet(U0).map(d=>d(t)),c,l);e.from==u&&(a=u)}if(a>-1)r={changes:e,selection:we.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=i.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let u=t.state.sliceDoc(e.from,e.to),d,h=n&&wR(t,n.main.head);if(h){let p=e.insert.length-(e.to-e.from);d={from:h.from,to:h.to-p}}else d=t.state.doc.lineAt(s.head);let m=s.to-e.to;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:c||p.map(l)};let b=p.to-m,x=b-u.length;if(t.state.sliceDoc(x,b)!=u||b>=d.from&&x<=d.to)return{range:p};let g=i.changes({from:x,to:b,insert:e.insert}),y=p.to-s.to;return{changes:g,range:c?we.range(Math.max(0,c.anchor+y),Math.max(0,c.head+y)):p.map(g)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function TR(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let a=t.length,o=e.length;for(;a>0&&o>0&&t.charCodeAt(a-1)==e.charCodeAt(o-1);)a--,o--;if(r=="end"){let l=Math.max(0,s-Math.min(a,o));n-=a+l-s}if(a<s&&t.length<e.length){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}else if(o<s){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}return{from:s,toA:a,toB:o}}function Lue(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new U8(n,r)),(i!=n||s!=r)&&e.push(new U8(i,s))),e}function Bue(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?we.single(n+e,r+e):null}function Qg(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class zue{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,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=e.hasFocus,qe.safari&&e.contentDOM.addEventListener("input",()=>null),qe.gecko&&Zue(e.contentDOM.ownerDocument)}handleEvent(e){!Gue(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Pue(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let a=!n[s].handlers.length,o=r[s];o&&a!=!o.handlers.length&&(i.removeEventListener(s,this.handleEvent),o=null),o||i.addEventListener(s,this.handleEvent,{passive:a})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&ER.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),qe.android&&qe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return qe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((n=CR.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||$ue.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,pd(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:qe.safari&&!qe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function H8(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){ns(n.state,i)}}}function Pue(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,a=i&&i.plugin.domEventObservers;if(s)for(let o in s){let l=s[o];l&&n(o).handlers.push(H8(r.value,l))}if(a)for(let o in a){let l=a[o];l&&n(o).observers.push(H8(r.value,l))}}for(let r in sa)n(r).handlers.push(sa[r]);for(let r in Pi)n(r).observers.push(Pi[r]);return e}const CR=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],$ue="dthko",ER=[16,17,18,20,91,92,224,225],Um=6;function Hm(t){return Math.max(0,t)*.7+8}function Uue(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Hue{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=XI(e.contentDOM),this.atoms=e.state.facet(U0).map(a=>a(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(mn.allowMultipleSelections)&&que(e,n),this.dragging=Vue(e,n)&&NR(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Uue(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:o}=this.scrollParents.y.getBoundingClientRect());let l=zk(this.view);e.clientX-l.left<=i+Um?n=-Hm(i-e.clientX):e.clientX+l.right>=a-Um&&(n=Hm(e.clientX-a)),e.clientY-l.top<=s+Um?r=-Hm(s-e.clientY):e.clientY+l.bottom>=o-Um&&(r=Hm(e.clientY-o)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=kR(this.atoms,this.style.get(e,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(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function que(t,e){let n=t.state.facet(aR);return n.length?n[0](e):qe.mac?e.metaKey:e.ctrlKey}function Fue(t,e){let n=t.state.facet(oR);return n.length?n[0](e):qe.mac?!e.altKey:!e.ctrlKey}function Vue(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=s0(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let a=i[s];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Gue(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=tr.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const sa=Object.create(null),Pi=Object.create(null),AR=qe.ie&&qe.ie_version<15||qe.ios&&qe.webkit_version<604;function Wue(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),MR(t,n.value)},50)}function cy(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function MR(t,e){e=cy(t.state,Ok,e);let{state:n}=t,r,i=1,s=n.toText(e),a=s.lines==n.selection.ranges.length;if($2!=null&&n.selection.ranges.every(l=>l.empty)&&$2==s.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((a?s.line(i++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:d},range:we.cursor(c.from+d.length)}})}else a?r=n.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:we.cursor(l.from+c.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Pi.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Pi.wheel=Pi.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};sa.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Pi.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};Pi.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};sa.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(lR))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=Yue(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Hue(t,e,n,r)),r&&t.observer.ignore(()=>{QI(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function q8(t,e,n,r){if(r==1)return we.cursor(e,n);if(r==2)return Tue(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),a=i?i.posAtStart:s.from,o=i?i.posAtEnd:s.to;return o<t.state.doc.length&&o==s.to&&o++,we.range(a,o)}}const Kue=qe.ie&&qe.ie_version<=11;let F8=null,V8=0,G8=0;function NR(t){if(!Kue)return t.detail;let e=F8,n=G8;return F8=t,G8=Date.now(),V8=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(V8+1)%3:1}function Yue(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=NR(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,a,o){let l=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,u=q8(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!a){let d=q8(t,n.pos,n.assoc,r),h=Math.min(d.from,u.from),m=Math.max(d.to,u.to);u=h<u.from?we.range(h,m,u.assoc):we.range(m,h,u.assoc)}return a?i.replaceRange(i.main.extend(u.from,u.to,u.assoc)):o&&r==1&&i.ranges.length>1&&(c=Xue(i,l.pos))?c:o?i.addRange(u):we.create([u])}}}function Xue(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return we.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}sa.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,a=s+i.length;(s>=n.to||a<=n.from)&&(n=we.range(s,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",cy(t.state,jk,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};sa.dragend=t=>(t.inputState.draggedContent=null,!1);function W8(t,e,n,r){if(n=cy(t.state,Ok,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,a=r&&s&&Fue(t,e)?{from:s.from,to:s.to}:null,o={from:i,insert:n},l=t.state.changes(a?[a,o]:o);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}sa.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&W8(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a<n.length;a++){let o=new FileReader;o.onerror=s,o.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[a]=o.result),s()},o.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return W8(t,e,r,!0),!0}return!1};sa.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=AR?null:e.clipboardData;return n?(MR(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Wue(t),!1)};function Que(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function Jue(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let a=t.doc.lineAt(s);a.number>i&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),i=a.number}r=!0}return{text:cy(t,jk,e.join(t.lineBreak)),ranges:n,linewise:r}}let $2=null;sa.copy=sa.cut=(t,e)=>{if(!Tf(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Jue(t.state);if(!n&&!i)return!1;$2=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=AR?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(Que(t,n),!1)};const DR=Fo.define();function IR(t,e){let n=[];for(let r of t.facet(dR)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:DR.of(!0)}):null}function RR(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=IR(t.state,e);n?t.dispatch(n):t.update([])}},10)}Pi.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),RR(t)};Pi.blur=t=>{t.observer.clearSelectionRange(),RR(t)};Pi.compositionstart=Pi.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Pi.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,qe.chrome&&qe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Pi.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};sa.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(s&&a.length){let o=a[0],l=t.posAtDOM(o.startContainer,o.startOffset),c=t.posAtDOM(o.endContainer,o.endOffset);return Pk(t,{from:l,to:c,insert:t.state.toText(s)},null),!0}}let i;if(qe.chrome&&qe.android&&(i=CR.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return qe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),qe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Pi.compositionend(t,e),20),!1};const K8=new Set;function Zue(t){K8.has(t)||(K8.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Y8=["pre-wrap","normal","pre-line","break-spaces"];let $d=!1;function X8(){$d=!1}class ede{constructor(e){this.lineWrapping=e,this.doc=en.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Y8.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,a){let o=Y8.indexOf(e)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<a.length;c++){let u=a[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class tde{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class na{constructor(e,n,r,i,s){this.from=e,this.length=n,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?wi.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 eu?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new na(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Mn=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Mn||(Mn={}));const Np=.001;class ki{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Np&&($d=!0),this.height=e)}replace(e,n,r){return ki.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,a=r.doc;for(let o=i.length-1;o>=0;o--){let{fromA:l,toA:c,fromB:u,toB:d}=i[o],h=s.lineAt(l,Mn.ByPosNoHeight,r.setDoc(n),0,0),m=h.to>=c?h:s.lineAt(c,Mn.ByPosNoHeight,r,0,0);for(d+=m.to-c,c=m.to;o>0&&h.from<=i[o-1].toA;)l=i[o-1].fromA,u=i[o-1].fromB,o--,l<h.from&&(h=s.lineAt(l,Mn.ByPosNoHeight,r,0,0));u+=h.from-l,l=h.from;let p=$k.build(r.setDoc(a),e,u,d);s=Jg(s,s.replace(l,c,p))}return s.updateHeight(r,0)}static empty(){return new Yi(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let o=e[n-1];o.break?e.splice(--n,1,o.left,null,o.right):e.splice(--n,1,o.left,o.right),r+=1+o.break,i-=o.size}else if(s>i*2){let o=e[r];o.break?e.splice(r,1,o.left,null,o.right):e.splice(r,1,o.left,o.right),r+=2+o.break,s-=o.size}else break;else if(i<s){let o=e[n++];o&&(i+=o.size)}else{let o=e[--r];o&&(s+=o.size)}let a=0;return e[n-1]==null?(a=1,n--):e[n]==null&&(a=1,r++),new rde(ki.of(e.slice(0,n)),a,ki.of(e.slice(r)))}}function Jg(t,e){return t==e?t:(t.constructor!=e.constructor&&($d=!0),e)}ki.prototype.size=1;const nde=rn.replace({});class OR extends ki{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new na(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new na(i,0,r,this.spaceAbove,nde):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let a=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(a):a}forEachLine(e,n,r,i,s,a){e<=s+this.length&&n>=s&&a(this.lineAt(0,Mn.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Yi extends OR{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new na(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Yi||i instanceof Gr&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Gr?i=new Yi(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):ki.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Gr extends ki{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,a,o=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);a=l/s,this.length>s+1&&(o=(this.height-l)/(this.length-s-1))}else a=this.height/s;return{firstLine:r,lastLine:i,perLine:a,perChar:o}}blockAt(e,n,r,i){let{firstLine:s,lastLine:a,perLine:o,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=o+u.length*l,h=Math.max(r,e-d/2);return new na(u.from,u.length,h,d,0)}else{let c=Math.max(0,Math.min(a-s,Math.floor((e-r)/o))),{from:u,length:d}=n.doc.line(s+c);return new na(u,d,r+o*c,o,0)}}lineAt(e,n,r,i,s){if(n==Mn.ByHeight)return this.blockAt(e,r,i,s);if(n==Mn.ByPosNoHeight){let{from:m,to:p}=r.doc.lineAt(e);return new na(m,p-m,0,0,0)}let{firstLine:a,perLine:o,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),u=o+c.length*l,d=c.number-a,h=i+o*d+l*(c.from-s-d);return new na(c.from,c.length,Math.max(i,Math.min(h,i+this.height-u)),u,0)}forEachLine(e,n,r,i,s,a){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:o,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let u=e,d=i;u<=n;){let h=r.doc.lineAt(u);if(u==e){let p=h.number-o;d+=l*p+c*(e-s-p)}let m=l+c*h.length;a(new na(h.from,h.length,d,m,0)),d+=m,u=h.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof Gr?r[r.length-1]=new Gr(s.length+i):r.push(null,new Gr(i-1))}if(e>0){let s=r[0];s instanceof Gr?r[0]=new Gr(e+s.length):r.unshift(new Gr(e-1),null)}return ki.of(r)}decomposeLeft(e,n){n.push(new Gr(e-1),null)}decomposeRight(e,n){n.push(null,new Gr(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let a=[],o=Math.max(n,i.from),l=-1;for(i.from>n&&a.push(new Gr(i.from-n-1).updateHeight(e,n));o<=s&&i.more;){let u=e.doc.lineAt(o).length;a.length&&a.push(null);let d=i.heights[i.index++],h=0;d<0&&(h=-d,d=i.heights[i.index++]),l==-1?l=d:Math.abs(d-l)>=Np&&(l=-2);let m=new Yi(u,d,h);m.outdated=!1,a.push(m),o+=u+1}o<=s&&a.push(null,new Gr(s-o).updateHeight(e,o));let c=ki.of(a);return(l<0||Math.abs(c.height-this.height)>=Np||Math.abs(l-this.heightMetrics(e,n).perLine)>=Np)&&($d=!0),Jg(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class rde extends ki{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let a=i+this.left.height,o=s+this.left.length+this.break,l=n==Mn.ByHeight?e<a:e<o,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,a,o);if(this.break||(l?c.to<o:c.from>o))return c;let u=n==Mn.ByPosNoHeight?Mn.ByPosNoHeight:Mn.ByPos;return l?c.join(this.right.lineAt(o,u,r,a,o)):this.left.lineAt(o,u,r,i,s).join(c)}forEachLine(e,n,r,i,s,a){let o=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,s,a),n>=l&&this.right.forEachLine(e,n,r,o,l,a);else{let c=this.lineAt(l,Mn.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,a),c.to>=e&&c.from<=n&&a(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,o,l,a)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let a=s.length;for(let o of r)s.push(o);if(e>0&&Q8(s,a-1),n<this.length){let o=s.length;this.decomposeRight(n,s),Q8(s,o)}return ki.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?ki.of(this.break?[e,null,n]:[e,n]):(this.left=Jg(this.left,e),this.right=Jg(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:a}=this,o=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=o+a.length&&i.more?l=a=a.updateHeight(e,o,r,i):a.updateHeight(e,o,r),l?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Q8(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Gr&&(r=t[e+1])instanceof Gr&&t.splice(e-1,3,new Gr(n.length+1+r.length))}const ide=5;class $k{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Yi?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Yi(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let a=n-e;r.block?this.addBlock(new OR(a,i,r)):(a||s||i>=ide)&&this.addLineDeco(i,s,a)}else n>e&&this.span(e,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:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Yi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new Gr(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Yi)return e;let n=new Yi(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Yi)&&!this.isCovered?this.nodes.push(new Yi(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Yi&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new $k(r,e);return gn.spans(n,r,i,s,0),s.finish(r)}}function sde(t,e,n){let r=new ade;return gn.compare(t,e,n,r,0),r.changes}class ade{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&md(e,n,this.changes,5)}}function ode(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),a=Math.min(i.innerWidth,n.right),o=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.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 h=u.getBoundingClientRect();s=Math.max(s,h.left),a=Math.min(a,h.right),o=Math.max(o,h.top),l=Math.min(c==t.parentNode?i.innerHeight:l,h.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-n.left,right:Math.max(s,a)-n.left,top:o-(n.top+e),bottom:Math.max(o,l)-(n.top+e)}}function lde(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function cde(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Fv{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return rn.replace({widget:new ude(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class ude extends Vo{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class J8{constructor(e,n){this.view=e,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=Z8,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ln.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(Lk).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new ede(r),this.stateDeco=eT(n),this.heightMap=ki.empty().applyChanges(this.stateDeco,en.empty,this.heightOracle.setDoc(n.doc),[new Os(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=rn.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:a})=>i>=s&&i<=a)){let{from:s,to:a}=this.lineBlockAt(i);e.push(new qm(s,a))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Z8:new Uk(this.heightOracle,this.heightMap,this.viewports),e.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,e=>{this.viewportLines.push(Xh(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=eT(this.state);let i=e.changedRanges,s=Os.extendWithRanges(i,sde(r,this.stateDeco,e?e.changes:Er.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);X8(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||$d)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let l=s.length?this.mapViewport(this.viewport,e.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,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fR)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ln.RTL:Ln.LTR;let a=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",o=n.getBoundingClientRect(),l=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,u=0;if(o.width&&o.height){let{scaleX:E,scaleY:S}=YI(n,o);(E>.005&&Math.abs(this.scaleX-E)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=E,this.scaleY=S,c|=16,a=l=!0)}let d=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=h)&&(this.paddingTop=d,this.paddingBottom=h,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let m=XI(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=JI(this.scrollParent||e.win);let b=(this.printing?cde:ode)(n,this.paddingTop),x=b.top-this.pixelViewport.top,g=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!lde(e.dom))return 0;let w=o.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let E=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(E)&&(a=!0),a||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:S,charWidth:T,textHeight:O}=e.docView.measureTextSize();a=S>0&&i.refresh(s,S,T,O,Math.max(5,w/T),E),a&&(e.docView.minWidth=0,c|=16)}x>0&&g>0?u=Math.max(x,g):x<0&&g<0&&(u=Math.min(x,g)),X8();for(let S of this.viewports){let T=S.from==this.viewport.from?E:e.docView.measureVisibleLineHeights(S);this.heightMap=(a?ki.empty().applyChanges(this.stateDeco,en.empty,this.heightOracle,[new Os(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new tde(S.from,T))}$d&&(c|=2)}let C=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return C&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,l=new qm(i.lineAt(a-r*1e3,Mn.ByHeight,s,0,0).from,i.lineAt(o+(1-r)*1e3,Mn.ByHeight,s,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=i.lineAt(c,Mn.ByPos,s,0,0),h;n.y=="center"?h=(d.top+d.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?h=d.top:h=d.bottom-u,l=new qm(i.lineAt(h-1e3/2,Mn.ByHeight,s,0,0).from,i.lineAt(h+u+1e3/2,Mn.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new qm(this.heightMap.lineAt(r,Mn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Mn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Mn.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Mn.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||i<=a-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=o+Math.max(10,Math.min(r,250)))&&i>a-2*1e3&&s<o+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new Fv(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,a=i<<1;if(this.defaultTextDirection!=Ln.LTR&&!r)return[];let o=[],l=(u,d,h,m)=>{if(d-u<s)return;let p=this.state.selection.main,b=[p.from];p.empty||b.push(p.to);for(let g of b)if(g>u&&g<d){l(u,g-10,h,m),l(g+10,d,h,m);return}let x=hde(e,g=>g.from>=h.from&&g.to<=h.to&&Math.abs(g.from-u)<s&&Math.abs(g.to-d)<s&&!b.some(y=>g.from<y&&g.to>y));if(!x){if(d<h.to&&n&&r&&n.visibleRanges.some(w=>w.from<=d&&w.to>=d)){let w=n.moveToLineBoundary(we.cursor(d),!1,!0).head;w>u&&(d=w)}let g=this.gapSize(h,u,d,m),y=r||g<2e6?g:2e6;x=new Fv(u,d,g,y)}o.push(x)},c=u=>{if(u.length<a||u.type!=wi.Text)return;let d=dde(u.from,u.to,this.stateDeco);if(d.total<a)return;let h=this.scrollTarget?this.scrollTarget.range.head:null,m,p;if(r){let b=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,g;if(h!=null){let y=Vm(d,h),w=((this.visibleBottom-this.visibleTop)/2+b)/u.height;x=y-w,g=y+w}else x=(this.visibleTop-u.top-b)/u.height,g=(this.visibleBottom-u.top+b)/u.height;m=Fm(d,x),p=Fm(d,g)}else{let b=d.total*this.heightOracle.charWidth,x=i*this.heightOracle.charWidth,g=0;if(b>2e6)for(let S of e)S.from>=u.from&&S.from<u.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+g<this.pixelViewport.left&&(g=S.size-S.displaySize);let y=this.pixelViewport.left+g,w=this.pixelViewport.right+g,C,E;if(h!=null){let S=Vm(d,h),T=((w-y)/2+x)/b;C=S-T,E=S+T}else C=(y-x)/b,E=(w+x)/b;m=Fm(d,C),p=Fm(d,E)}m>u.from&&l(u.from,m,u,d),p<u.to&&l(p,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return o}gapSize(e,n,r,i){let s=Vm(i,r)-Vm(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){Fv.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=rn.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];gn.spans(n,this.viewport.from,this.viewport.to,{span(s,a){r.push({from:s,to:a})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let a=this.visibleRanges[s],o=r[s];(a.from!=o.from||a.to!=o.to)&&(i|=4,e&&e.mapPos(a.from,-1)==o.from&&e.mapPos(a.to,1)==o.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Xh(this.heightMap.lineAt(e,Mn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||Xh(this.heightMap.lineAt(this.scaler.fromDOM(e),Mn.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(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Xh(this.heightMap.blockAt(this.scaler.fromDOM(e),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 qm{constructor(e,n){this.from=e,this.to=n}}function dde(t,e,n){let r=[],i=t,s=0;return gn.spans(n,t,e,{span(){},point(a,o){a>i&&(r.push({from:i,to:a}),s+=a-i),i=o}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function Fm({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:a}=e[i],o=a-s;if(r<=o)return s+r;r-=o}}function Vm(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function hde(t,e){for(let n of t)if(e(n))return n}const Z8={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function eT(t){let e=t.facet(ay).filter(r=>typeof r!="function"),n=t.facet(Bk).filter(r=>typeof r!="function");return n.length&&e.push(gn.join(n)),e}class Uk{constructor(e,n,r){let i=0,s=0,a=0;this.viewports=r.map(({from:o,to:l})=>{let c=n.lineAt(o,Mn.ByPos,e,0,0).top,u=n.lineAt(l,Mn.ByPos,e,0,0).bottom;return i+=u-c,{from:o,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let o of this.viewports)o.domTop=a+(o.top-s)*this.scale,a=o.domBottom=o.domTop+(o.bottom-o.top),s=o.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof Uk?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Xh(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new na(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>Xh(i,e)):t._content)}const Gm=ut.define({combine:t=>t.join(" ")}),U2=ut.define({combine:t=>t.indexOf(!0)>-1}),H2=Gl.newName(),jR=Gl.newName(),LR=Gl.newName(),BR={"&light":"."+jR,"&dark":"."+LR};function q2(t,e,n){return new Gl(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const fde=q2("."+H2,{"&":{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"}},BR),mde={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Vv=qe.ie&&qe.ie_version<=11;class pde{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Vce,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=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(qe.ie&&qe.ie_version<=11||qe.ios&&e.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&&qe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(qe.chrome&&qe.chrome_version<126)&&(this.editContext=new yde(e),e.state.facet(go)&&(e.contentDOM.editContext=this.editContext.editContext)),Vv&&(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(e.scrollDOM)),this.addWindowListeners(this.win=e.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(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(go)?r.root.activeElement!=this.dom:!Tf(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(qe.ie&&qe.ie_version<=11||qe.android&&qe.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Ef(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=s0(e.root);if(!n)return!1;let r=qe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&gde(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Tf(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Wce(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),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(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,mde),Vv&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Vv&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&pd(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,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 e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let a=this.readMutation(s);a&&(a.typeOver&&(i=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Tf(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Oue(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=SR(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!Qg(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=tT(n,e.previousSibling||e.target.previousSibling,-1),i=tT(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(go)!=e.state.facet(go)&&(e.view.contentDOM.editContext=e.state.facet(go)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.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 tT(t,e,n){for(;e;){let r=tr.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function nT(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor,1);return Ef(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function gde(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return nT(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?nT(t,n):null}class yde{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:a}=i,o=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let c=l-o>r.text.length;o==this.from&&s<this.from?o=s:l==this.to&&s>this.to&&(l=s);let u=TR(e.state.sliceDoc(o,l),r.text,(c?i.from:i.to)-o,c?"end":null);if(!u){let h=we.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Qg(h,i)||e.dispatch({selection:h,userEvent:"select"});return}let d={from:u.from+o,to:u.toA+o,insert:en.of(r.text.slice(u.from,u.toB).split(`
`))};if((qe.mac||qe.android)&&d.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:o,to:l,insert:en.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let h=this.to-this.from+(d.to-d.from+d.insert.length);Pk(e,d,we.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),d.from<d.to&&!d.insert.length&&e.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 i=[],s=null;for(let a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a<o;a++){let l=e.coordsForChar(a);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let a=s.underlineStyle,o=s.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(o)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(o)?1:2}px`;i.push(rn.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:pR.of(rn.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=s0(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,a,o,l,c)=>{if(r)return;let u=c.length-(a-s);if(i&&a>=i.to)if(i.from==s&&i.to==a&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(s+=n,a+=n,a<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||a>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),c.toString()),this.to+=u}n+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ze{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(e={}){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),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Gce(e.parent)||document,this.viewState=new J8(this,e.state||mn.create(e)),e.scrollTo&&e.scrollTo.is($m)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Zu).map(i=>new Pv(i));for(let i of this.plugins)i.update(this);this.observer=new pde(this),this.inputState=new zue(this),this.inputState.ensureHandlers(this.plugins),this.docView=new P8(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(...e){let n=e.length==1&&e[0]instanceof Mr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){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,i,s=this.state;for(let h of e){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,o=0,l=null;e.some(h=>h.annotation(DR))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,l=IR(s,a),l||(o=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(mn.phrases)!=this.state.facet(mn.phrases))return this.setState(s);i=Kg.create(this,s,e),i.flags|=o;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(d&&(d=d.map(h.changes)),h.scrollIntoView){let{main:m}=h.state.selection,{x:p,y:b}=this.state.facet(Ze.cursorScrollMargin);d=new gd(m.empty?m:we.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",b,p)}for(let m of h.effects)m.is($m)&&(d=m.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Zg.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Yh)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Gm)!=i.state.facet(Gm)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(L2))try{h(i)}catch(m){ns(this.state,m,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!SR(this,u)&&c.force&&pd(this.contentDOM,c.key,c.keyCode)})}setState(e){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=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new J8(this,e),this.plugins=e.facet(Zu).map(r=>new Pv(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new P8(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Zu),r=e.state.facet(Zu);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new Pv(s));else{let o=this.plugins[a];o.mustUpdate=e,i.push(o)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){ns(this.state,r,"doc view update listener")}}}measure(e=!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,e&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(JI(r||this.win))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(i);s=m.from,a=m.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(m=>{try{return m.read(this)}catch(p){return ns(this.state,p),rT}}),d=Kg.create(this,this.state,[]),h=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),h=this.docView.update(d),h&&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){ns(this.state,p)}if(h&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let p=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a)/this.scaleY;if((p>1||p<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+p,r?r.scrollTop+=p:this.win.scrollBy(0,p),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(L2))o(n)}get themeClasses(){return H2+" "+(this.state.facet(U2)?LR:jR)+" "+this.state.facet(Gm)}updateAttrs(){let e=iT(this,gR,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(go)?"true":"false",class:"cm-content",style:`${qe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),iT(this,Lk,n);let r=this.observer.ignore(()=>{let i=R8(this.contentDOM,this.contentAttrs,n),s=R8(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(Ze.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Yh);let e=this.state.facet(Ze.cspNonce);Gl.mount(this.root,this.styleModules.concat(fde).reverse(),e?{nonce:e}: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(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||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(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return qv(this,e,$8(this,e,n,r))}moveByGroup(e,n){return qv(this,e,$8(this,e,n,r=>Aue(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return we.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Eue(this,e,n,r)}moveVertically(e,n,r){return qv(this,e,Mue(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=P2(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),P2(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),a=s[Oa.find(s,e-i.from,-1,n)];return a0(r,a.dir==Ln.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(hR)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>bde)return iR(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||rR(s.isolates,r=L8(this,e))))return s.order;r||(r=L8(this,e));let i=eue(e.text,n,r);return this.bidiCache.push(new Zg(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||qe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{QI(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.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(e,n={}){var r,i,s,a;return $m.of(new gd(typeof e=="number"?we.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(a=n.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return $m.of(new gd(we.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return hs.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return hs.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Gl.newName(),i=[Gm.of(r),Yh.of(q2(`.${r}`,e))];return n&&n.dark&&i.push(U2.of(!0)),i}static baseTheme(e){return gu.lowest(Yh.of(q2("."+H2,e,BR)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&tr.get(r)||tr.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}Ze.styleModule=Yh;Ze.inputHandler=uR;Ze.clipboardInputFilter=Ok;Ze.clipboardOutputFilter=jk;Ze.scrollHandler=mR;Ze.focusChangeEffect=dR;Ze.perLineTextDirection=hR;Ze.exceptionSink=cR;Ze.updateListener=L2;Ze.editable=go;Ze.mouseSelectionStyle=lR;Ze.dragMovesSelection=oR;Ze.clickAddsSelectionRange=aR;Ze.decorations=ay;Ze.blockWrappers=yR;Ze.outerDecorations=Bk;Ze.atomicRanges=U0;Ze.bidiIsolatedRanges=bR;Ze.cursorScrollMargin=ut.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});Ze.scrollMargins=vR;Ze.darkTheme=U2;Ze.cspNonce=ut.define({combine:t=>t.length?t[0]:""});Ze.contentAttributes=Lk;Ze.editorAttributes=gR;Ze.lineWrapping=Ze.contentAttributes.of({class:"cm-lineWrapping"});Ze.announce=xn.define();const bde=4096,rT={};class Zg{constructor(e,n,r,i,s,a){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=a}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Ln.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let a=e[s];a.dir==i&&!n.touchesRange(a.from,a.to)&&r.push(new Zg(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function iT(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],a=typeof s=="function"?s(t):s;a&&Dk(a,n)}return n}const vde=qe.mac?"mac":qe.windows?"win":qe.linux?"linux":"key";function xde(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,a,o;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))a=!0;else if(/^mod$/i.test(c))e=="mac"?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),o&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function Wm(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const wde=gu.default(Ze.domEventHandlers({keydown(t,e){return Tde(kde(e.state),t,e,"editor")}})),l0=ut.define({enables:wde}),sT=new WeakMap;function kde(t){let e=t.facet(l0),n=sT.get(e);return n||sT.set(e,n=Sde(e.reduce((r,i)=>r.concat(i),[]))),n}let hl=null;const _de=4e3;function Sde(t,e=vde){let n=Object.create(null),r=Object.create(null),i=(a,o)=>{let l=r[a];if(l==null)r[a]=o;else if(l!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},s=(a,o,l,c,u)=>{var d,h;let m=n[a]||(n[a]=Object.create(null)),p=o.split(/ (?!$)/).map(g=>xde(g,e));for(let g=1;g<p.length;g++){let y=p.slice(0,g).join(" ");i(y,!0),m[y]||(m[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let C=hl={view:w,prefix:y,scope:a};return setTimeout(()=>{hl==C&&(hl=null)},_de),!0}]})}let b=p.join(" ");i(b,!1);let x=m[b]||(m[b]={preventDefault:!1,stopPropagation:!1,run:((h=(d=m._any)===null||d===void 0?void 0:d.run)===null||h===void 0?void 0:h.slice())||[]});l&&x.run.push(l),c&&(x.preventDefault=!0),u&&(x.stopPropagation=!0)};for(let a of t){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let c of o){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=a;for(let h in u)u[h].run.push(m=>d(m,F2))}let l=a[e]||a.key;if(l)for(let c of o)s(c,l,a.run,a.preventDefault,a.stopPropagation),a.shift&&s(c,"Shift-"+l,a.shift,a.preventDefault,a.stopPropagation)}return n}let F2=null;function Tde(t,e,n,r){F2=e;let i=Pce(e),s=sl(i,0),a=Lu(s)==i.length&&i!=" ",o="",l=!1,c=!1,u=!1;hl&&hl.view==n&&hl.scope==r&&(o=hl.prefix+" ",ER.indexOf(e.keyCode)<0&&(c=!0,hl=null));let d=new Set,h=x=>{if(x){for(let g of x.run)if(!d.has(g)&&(d.add(g),g(n)))return x.stopPropagation&&(u=!0),!0;x.preventDefault&&(x.stopPropagation&&(u=!0),c=!0)}return!1},m=t[r],p,b;return m&&(h(m[o+Wm(i,e,!a)])?l=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(qe.windows&&e.ctrlKey&&e.altKey)&&!(qe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Wl[e.keyCode])&&p!=i?(h(m[o+Wm(p,e,!0)])||e.shiftKey&&(b=r0[e.keyCode])!=i&&b!=p&&h(m[o+Wm(b,e,!1)]))&&(l=!0):a&&e.shiftKey&&h(m[o+Wm(i,e,!0)])&&(l=!0),!l&&h(m._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),F2=null,l}class Fc{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=zR(e);return[new Fc(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Cde(e,n,r)}}function zR(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ln.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function aT(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),a=(i.top+i.bottom)/2,o=t.posAtCoords({x:s.left+1,y:a}),l=t.posAtCoords({x:s.right-1,y:a});return o==null||l==null?r:{from:Math.max(r.from,Math.min(o,l)),to:Math.min(r.to,Math.max(o,l))}}function Cde(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Ln.LTR,a=t.contentDOM,o=a.getBoundingClientRect(),l=zR(t),c=a.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=o.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=o.right-(u?parseInt(u.paddingRight):0),m=z2(t,r,1),p=z2(t,i,-1),b=m.type==wi.Text?m:null,x=p.type==wi.Text?p:null;if(b&&(t.lineWrapping||m.widgetLineBreaks)&&(b=aT(t,r,1,b)),x&&(t.lineWrapping||p.widgetLineBreaks)&&(x=aT(t,i,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return y(w(n.from,n.to,b));{let E=b?w(n.from,null,b):C(m,!1),S=x?w(null,n.to,x):C(p,!0),T=[];return(b||m).to<(x||p).from-(b&&x?1:0)||m.widgetLineBreaks>1&&E.bottom+t.defaultLineHeight/2<S.top?T.push(g(d,E.bottom,h,S.top)):E.bottom<S.top&&t.elementAtHeight((E.bottom+S.top)/2).type==wi.Text&&(E.bottom=S.top=(E.bottom+S.top)/2),y(E).concat(T).concat(y(S))}function g(E,S,T,O){return new Fc(e,E-l.left,S-l.top,Math.max(0,T-E),O-S)}function y({top:E,bottom:S,horizontal:T}){let O=[];for(let z=0;z<T.length;z+=2)O.push(g(T[z],E,T[z+1],S));return O}function w(E,S,T){let O=1e9,z=-1e9,I=[];function j(P,J,q,Y,$){let Z=t.coordsAtPos(P,P==T.to?-2:2),M=t.coordsAtPos(q,q==T.from?2:-2);!Z||!M||(O=Math.min(Z.top,M.top,O),z=Math.max(Z.bottom,M.bottom,z),$==Ln.LTR?I.push(s&&J?d:Z.left,s&&Y?h:M.right):I.push(!s&&Y?d:M.left,!s&&J?h:Z.right))}let N=E??T.from,B=S??T.to;for(let P of t.visibleRanges)if(P.to>N&&P.from<B)for(let J=Math.max(P.from,N),q=Math.min(P.to,B);;){let Y=t.state.doc.lineAt(J);for(let $ of t.bidiSpans(Y)){let Z=$.from+Y.from,M=$.to+Y.from;if(Z>=q)break;M>J&&j(Math.max(Z,J),E==null&&Z<=N,Math.min(M,q),S==null&&M>=B,$.dir)}if(J=Y.to+1,J>=q)break}return I.length==0&&j(N,E==null,B,S==null,t.textDirection),{top:O,bottom:z,horizontal:I}}function C(E,S){let T=o.top+(S?E.top:E.bottom);return{top:T,bottom:T,horizontal:[]}}}function Ede(t,e){return t.constructor==e.constructor&&t.eq(e)}class Ade{constructor(e,n){this.view=e,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=e.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(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Dp)!=e.state.facet(Dp)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Dp);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:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Ede(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e,qe.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Dp=ut.define();function PR(t){return[hs.define(e=>new Ade(e,t)),Dp.of(t)]}const Ud=ut.define({combine(t){return iy(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Mde(t={}){return[Ud.of(t),Nde,Dde,Ide,fR.of(!0)]}function $R(t){return t.startState.facet(Ud)!=t.state.facet(Ud)}const Nde=PR({above:!0,markers(t){let{state:e}=t,n=e.facet(Ud),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&qe.ios&&n.iosSelectionHandles)){let a=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=i.empty?i:we.cursor(i.head,i.assoc);for(let l of Fc.forRange(t,a,o))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=$R(t);return n&&oT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){oT(e.state,t)},class:"cm-cursorLayer"});function oT(t,e){e.style.animationDuration=t.facet(Ud).cursorBlinkRate+"ms"}const Dde=PR({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let i of r)if(!i.empty)for(let s of Fc.forRange(t,"cm-selectionBackground",i))e.push(s);if(qe.ios&&!n.empty&&t.state.facet(Ud).iosSelectionHandles){for(let i of Fc.forRange(t,"cm-selectionHandle cm-selectionHandle-start",we.cursor(n.from,1)))e.push(i);for(let i of Fc.forRange(t,"cm-selectionHandle cm-selectionHandle-end",we.cursor(n.to,1)))e.push(i)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||$R(t)},class:"cm-selectionLayer"}),Ide=gu.highest(Ze.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 lT(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),a=n,o;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=e.exec(s.value);)i(a+o.index,o)}function Rde(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Ode{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(o,l,c,u)=>i(u,c,c+o[0].length,o,l);else if(typeof r=="function")this.addMatch=(o,l,c,u)=>{let d=r(o,l,c);d&&u(c,c+o[0].length,d)};else if(r)this.addMatch=(o,l,c,u)=>u(c,c+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=a}createDeco(e){let n=new Zc,r=n.add.bind(n);for(let{from:i,to:s}of Rde(e,this.maxLength))lT(e.state.doc,this.regexp,i,s,(a,o)=>this.addMatch(o,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,a,o,l)=>{l>=e.view.viewport.from&&o<=e.view.viewport.to&&(r=Math.min(o,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let a=Math.max(s.from,r),o=Math.min(s.to,i);if(o>=a){let l=e.state.doc.lineAt(a),c=l.to<o?e.state.doc.lineAt(o):l,u=Math.max(s.from,l.from),d=Math.min(s.to,c.to);if(this.boundary){for(;a>l.from;a--)if(this.boundary.test(l.text[a-1-l.from])){u=a;break}for(;o<c.to;o++)if(this.boundary.test(c.text[o-c.from])){d=o;break}}let h=[],m,p=(b,x,g)=>h.push(g.range(b,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,e,m.index+l.from,p);else lT(e.state.doc,this.regexp,u,d,(b,x)=>this.addMatch(x,e,b,p));n=n.update({filterFrom:u,filterTo:d,filter:(b,x)=>b<u||x>d,add:h})}}return n}}const V2=/x/.unicode!=null?"gu":"g",jde=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,V2),Lde={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 Gv=null;function Bde(){var t;if(Gv==null&&typeof document<"u"&&document.body){let e=document.body.style;Gv=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Gv||!1}const Ip=ut.define({combine(t){let e=iy(t,{render:null,specialChars:jde,addSpecialChars:null});return(e.replaceTabs=!Bde())&&(e.specialChars=new RegExp("	|"+e.specialChars.source,V2)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,V2)),e}});function zde(t={}){return[Ip.of(t),Pde()]}let cT=null;function Pde(){return cT||(cT=hs.fromClass(class{constructor(t){this.view=t,this.decorations=rn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Ip)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Ode({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=sl(e[0],0);if(s==9){let a=i.lineAt(r),o=n.state.tabSize,l=z0(a.text,o,r-a.from);return rn.replace({widget:new qde((o-l%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=rn.replace({widget:new Hde(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Ip);t.startState.facet(Ip)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const $de="•";function Ude(t){return t>=32?$de:t==10?"␤":String.fromCharCode(9216+t)}class Hde extends Vo{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Ude(this.code),r=e.state.phrase("Control character")+" "+(Lde[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class qde extends Vo{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}class Fde extends Vo{constructor(e){super(),this.content=e}toDOM(e){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(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?Cf(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=a0(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function uT(t){let e=hs.fromClass(class{constructor(n){this.view=n,this.placeholder=t?rn.set([rn.widget({widget:new Fde(t),side:1}).range(0)]):rn.none}get decorations(){return this.view.state.doc.length?rn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ze.contentAttributes.of({"aria-placeholder":t})]:e}const Km="-10000px";class Vde{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let s=null;this.tooltipViews=this.tooltips.map(a=>s=r(a,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let a=[],o=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let h=this.tooltips[d];h&&h.create==c.create&&(u=d)}if(u<0)a[l]=this.createTooltipView(c,l?a[l-1]:null),o&&(o[l]=!!c.above);else{let d=a[l]=this.tooltipViews[u];o&&(o[l]=n[u]),d.update&&d.update(e)}}}for(let l of this.tooltipViews)a.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(o.forEach((l,c)=>n[c]=l),n.length=o.length),this.input=i,this.tooltips=s,this.tooltipViews=a,!0}}function Gde(t={}){return Rp.of(t)}function Wde(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Rp=ut.define({combine:t=>{var e,n,r;return{position:qe.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Wde}}}),dT=new WeakMap,UR=hs.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Rp);this.position=e.position,this.parent=e.parent,this.classes=t.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 Vde(t,HR,(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(),t.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 t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Rp);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.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 i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=Km,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 t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(qe.safari){let a=s.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=zk(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Rp).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let l=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:u}=c,d=t.pos[o],h=t.size[o];if(!d||l.clip!==!1&&(d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1)){u.style.top=Km;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,b=h.right-h.left,x=(e=dT.get(c))!==null&&e!==void 0?e:h.bottom-h.top,g=c.offset||Yde,y=this.view.textDirection==Ln.LTR,w=h.width>r.right-r.left?y?r.left:r.right-h.width:y?Math.max(r.left,Math.min(d.left-(m?14:0)+g.x,r.right-b)):Math.min(Math.max(r.left,d.left-b+(m?14:0)-g.x),r.right-b),C=this.above[o];!l.strictSide&&(C?d.top-x-p-g.y<r.top:d.bottom+x+p+g.y>r.bottom)&&C==r.bottom-d.bottom>d.top-r.top&&(C=this.above[o]=!C);let E=(C?d.top-r.top:r.bottom-d.bottom)-p;if(E<x&&c.resize!==!1){if(E<this.view.defaultLineHeight){u.style.top=Km;continue}dT.set(c,x),u.style.height=(x=E)/s+"px"}else u.style.height&&(u.style.height="");let S=C?d.top-x-p-g.y:d.bottom+p+g.y,T=w+b;if(c.overlap!==!0)for(let O of a)O.left<T&&O.right>w&&O.top<S+x&&O.bottom>S&&(S=C?O.top-x-2-p:O.bottom+p+2);if(this.position=="absolute"?(u.style.top=(S-t.parent.top)/s+"px",hT(u,(w-t.parent.left)/i)):(u.style.top=S/s+"px",hT(u,w/i)),m){let O=d.left+(y?g.x:-g.x)-(w+14-7);m.style.left=O/i+"px"}c.overlap!==!0&&a.push({left:w,top:S,right:T,bottom:S+x}),u.classList.toggle("cm-tooltip-above",C),u.classList.toggle("cm-tooltip-below",!C),c.positioned&&c.positioned(t.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 t of this.manager.tooltipViews)t.dom.style.top=Km}},{eventObservers:{scroll(){this.maybeMeasure()}}});function hT(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Kde=Ze.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"}}}),Yde={x:0,y:0},HR=ut.define({enables:[UR,Kde]});function qR(t,e){let n=t.plugin(UR);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}class Hd extends Vl{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Hd.prototype.elementClass="";Hd.prototype.toDOM=void 0;Hd.prototype.mapMode=es.TrackBefore;Hd.prototype.startSide=Hd.prototype.endSide=-1;Hd.prototype.point=!0;const Xde=1024;let Qde=0;class Wv{constructor(e,n){this.from=e,this.to=n}}class Zt{constructor(e={}){this.id=Qde++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=qs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Zt.closedBy=new Zt({deserialize:t=>t.split(" ")});Zt.openedBy=new Zt({deserialize:t=>t.split(" ")});Zt.group=new Zt({deserialize:t=>t.split(" ")});Zt.isolate=new Zt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Zt.contextHash=new Zt({perNode:!0});Zt.lookAhead=new Zt({perNode:!0});Zt.mounted=new Zt({perNode:!0});class Mf{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Zt.mounted.id]}}const Jde=Object.create(null);class qs{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):Jde,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new qs(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.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(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Zt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Zt.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}qs.none=new qs("",Object.create(null),0,8);const Ym=new WeakMap,fT=new WeakMap;var sr;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(sr||(sr={}));class Qr{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,o]of s)this.props[typeof a=="number"?a:a.id]=o}}toString(){let e=Mf.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}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(e=0){return new W2(this.topNode,e)}cursorAt(e,n=0,r=0){let i=Ym.get(this)||this.topNode,s=new W2(i);return s.moveTo(e,n),Ym.set(this,s._tree),s}get topNode(){return new Ps(this,0,0,null)}resolve(e,n=0){let r=c0(Ym.get(this)||this.topNode,e,n,!1);return Ym.set(this,r),r}resolveInner(e,n=0){let r=c0(fT.get(this)||this.topNode,e,n,!0);return fT.set(this,r),r}resolveStack(e,n=0){return the(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,a=e.mode||0,o=(a&sr.IncludeAnonymous)>0;for(let l=this.cursor(a|sr.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!o&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(o||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Fk(qs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Qr(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Qr(qs.none,n,r,i)))}static build(e){return nhe(e)}}Qr.empty=new Qr(qs.none,[],[],0);class Hk{constructor(e,n){this.buffer=e,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 Hk(this.buffer,this.index)}}class Yl{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return qs.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let a=[];for(;e<r;)a.push(this.childString(e)),e=this.buffer[e+3];return s+"("+a.join(",")+")"}findChild(e,n,r,i,s){let{buffer:a}=this,o=-1;for(let l=e;l!=n&&!(FR(s,i,a[l+1],a[l+2])&&(o=l,r>0));l=a[l+3]);return o}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),a=0;for(let o=e,l=0;o<n;){s[l++]=i[o++],s[l++]=i[o++]-r;let c=s[l++]=i[o++]-r;s[l++]=i[o++]-e,a=Math.max(a,c)}return new Yl(s,a,this.set)}}function FR(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function c0(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let a=!r&&t instanceof Ps&&t.index<0?null:t.parent;if(!a)return t;t=a}let s=r?0:sr.IgnoreOverlays;if(r)for(let a=t,o=a.parent;o;a=o,o=a.parent)a instanceof Ps&&a.index<0&&((i=o.enter(e,n,s))===null||i===void 0?void 0:i.from)!=a.from&&(t=o);for(;;){let a=t.enter(e,n,s);if(!a)return t;t=a}}class VR{cursor(e=0){return new W2(this,e)}getChild(e,n=null,r=null){let i=mT(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return mT(this,e,n,r)}resolve(e,n=0){return c0(this,e,n,!1)}resolveInner(e,n=0){return c0(this,e,n,!0)}matchContext(e){return G2(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class Ps extends VR{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let a=this;;){for(let{children:o,positions:l}=a._tree,c=n>0?o.length:-1;e!=c;e+=n){let u=o[e],d=l[e]+a.from,h;if(!(!(s&sr.EnterBracketed&&u instanceof Qr&&(h=Mf.get(u))&&!h.overlay&&h.bracketed&&r>=d&&r<=d+u.length)&&!FR(i,r,d,d+u.length))){if(u instanceof Yl){if(s&sr.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,n,r-d,i);if(m>-1)return new kl(new Zde(a,u,e,d),null,m)}else if(s&sr.IncludeAnonymous||!u.type.isAnonymous||qk(u)){let m;if(!(s&sr.IgnoreMounts)&&(m=Mf.get(u))&&!m.overlay)return new Ps(m.tree,d,e,a);let p=new Ps(u,d,e,a);return s&sr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&sr.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&sr.IgnoreOverlays)&&(i=Mf.get(this._tree))&&i.overlay){let s=e-this.from,a=r&sr.EnterBracketed&&i.bracketed;for(let{from:o,to:l}of i.overlay)if((n>0||a?o<=s:o<s)&&(n<0||a?l>=s:l>s))return new Ps(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 mT(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function G2(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Zde{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class kl extends VR{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(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new kl(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&sr.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new kl(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new kl(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new kl(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let a=r.buffer[this.index+1];e.push(r.slice(i,s,a)),n.push(0)}return new Qr(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function GR(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let a=t[s];(a.from>n.from||a.to<n.to)&&(n=a,e=s)}let r=n instanceof Ps&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new ehe(i,n)}class ehe{constructor(e,n){this.heads=e,this.node=n}get next(){return GR(this.heads)}}function the(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof Ps?r:r.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(i||(i=[r])).push(a.resolve(e,n)),s=a}else{let a=Mf.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let o=new Ps(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(c0(o,e,n,!1))}}return i?GR(i):r}class W2{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~sr.EnterBracketed,e instanceof Ps)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Ps?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&sr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&sr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&sr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,a=e<0?-1:r._tree.children.length;s!=a;s+=e){let o=r._tree.children[s];if(this.mode&sr.IncludeAnonymous||o instanceof Yl||!o.type.isAnonymous||qk(o))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let a=e;a;a=a._parent)if(a.index==i){if(i==this.index)return a;n=a,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new kl(this.buffer,n,this.stack[i]);return this.bufferNode=new kl(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return G2(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return G2(this._tree,e,i);let a=r[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(e[i]&&e[i]!=a.name)return!1;i--}}return!0}}function qk(t){return t.children.some(e=>e instanceof Yl||!e.type.isAnonymous||qk(e))}function nhe(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=Xde,reused:s=[],minRepeatType:a=r.types.length}=t,o=Array.isArray(n)?new Hk(n,n.length):n,l=r.types,c=0,u=0;function d(E,S,T,O,z,I){let{id:j,start:N,end:B,size:P}=o,J=u,q=c;if(P<0)if(o.next(),P==-1){let X=s[j];T.push(X),O.push(N-E);return}else if(P==-3){c=j;return}else if(P==-4){u=j;return}else throw new RangeError(`Unrecognized record size: ${P}`);let Y=l[j],$,Z,M=N-E;if(B-N<=i&&(Z=x(o.pos-S,z))){let X=new Uint16Array(Z.size-Z.skip),H=o.pos-Z.size,R=X.length;for(;o.pos>H;)R=g(Z.start,X,R);$=new Yl(X,B-Z.start,r),M=Z.start-E}else{let X=o.pos-P;o.next();let H=[],R=[],ae=j>=a?j:-1,xe=0,ye=B;for(;o.pos>X;)ae>=0&&o.id==ae&&o.size>=0?(o.end<=ye-i&&(p(H,R,N,xe,o.end,ye,ae,J,q),xe=H.length,ye=o.end),o.next()):I>2500?h(N,X,H,R):d(N,X,H,R,ae,I+1);if(ae>=0&&xe>0&&xe<H.length&&p(H,R,N,xe,N,ye,ae,J,q),H.reverse(),R.reverse(),ae>-1&&xe>0){let Ae=m(Y,q);$=Fk(Y,H,R,0,H.length,0,B-N,Ae,Ae)}else $=b(Y,H,R,B-N,J-B,q)}T.push($),O.push(M)}function h(E,S,T,O){let z=[],I=0,j=-1;for(;o.pos>S;){let{id:N,start:B,end:P,size:J}=o;if(J>4)o.next();else{if(j>-1&&B<j)break;j<0&&(j=P-i),z.push(N,B,P),I++,o.next()}}if(I){let N=new Uint16Array(I*4),B=z[z.length-2];for(let P=z.length-3,J=0;P>=0;P-=3)N[J++]=z[P],N[J++]=z[P+1]-B,N[J++]=z[P+2]-B,N[J++]=J;T.push(new Yl(N,z[2]-B,r)),O.push(B-E)}}function m(E,S){return(T,O,z)=>{let I=0,j=T.length-1,N,B;if(j>=0&&(N=T[j])instanceof Qr){if(!j&&N.type==E&&N.length==z)return N;(B=N.prop(Zt.lookAhead))&&(I=O[j]+N.length+B)}return b(E,T,O,z,I,S)}}function p(E,S,T,O,z,I,j,N,B){let P=[],J=[];for(;E.length>O;)P.push(E.pop()),J.push(S.pop()+T-z);E.push(b(r.types[j],P,J,I-z,N-I,B)),S.push(z-T)}function b(E,S,T,O,z,I,j){if(I){let N=[Zt.contextHash,I];j=j?[N].concat(j):[N]}if(z>25){let N=[Zt.lookAhead,z];j=j?[N].concat(j):[N]}return new Qr(E,S,T,O,j)}function x(E,S){let T=o.fork(),O=0,z=0,I=0,j=T.end-i,N={size:0,start:0,skip:0};e:for(let B=T.pos-E;T.pos>B;){let P=T.size;if(T.id==S&&P>=0){N.size=O,N.start=z,N.skip=I,I+=4,O+=4,T.next();continue}let J=T.pos-P;if(P<0||J<B||T.start<j)break;let q=T.id>=a?4:0,Y=T.start;for(T.next();T.pos>J;){if(T.size<0)if(T.size==-3||T.size==-4)q+=4;else break e;else T.id>=a&&(q+=4);T.next()}z=Y,O+=P,I+=q}return(S<0||O==E)&&(N.size=O,N.start=z,N.skip=I),N.size>4?N:void 0}function g(E,S,T){let{id:O,start:z,end:I,size:j}=o;if(o.next(),j>=0&&O<a){let N=T;if(j>4){let B=o.pos-(j-4);for(;o.pos>B;)T=g(E,S,T)}S[--T]=N,S[--T]=I-E,S[--T]=z-E,S[--T]=O}else j==-3?c=O:j==-4&&(u=O);return T}let y=[],w=[];for(;o.pos>0;)d(t.start||0,t.bufferStart||0,y,w,-1,0);let C=(e=t.length)!==null&&e!==void 0?e:y.length?w[0]+y[0].length:0;return new Qr(l[t.topID],y.reverse(),w.reverse(),C)}const pT=new WeakMap;function Op(t,e){if(!t.isAnonymous||e instanceof Yl||e.type!=t)return 1;let n=pT.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Qr)){n=1;break}n+=Op(t,r)}pT.set(e,n)}return n}function Fk(t,e,n,r,i,s,a,o,l){let c=0;for(let p=r;p<i;p++)c+=Op(t,e[p]);let u=Math.ceil(c*1.5/8),d=[],h=[];function m(p,b,x,g,y){for(let w=x;w<g;){let C=w,E=b[w],S=Op(t,p[w]);for(w++;w<g;w++){let T=Op(t,p[w]);if(S+T>=u)break;S+=T}if(w==C+1){if(S>u){let T=p[C];m(T.children,T.positions,0,T.children.length,b[C]+y);continue}d.push(p[C])}else{let T=b[w-1]+p[w-1].length-E;d.push(Fk(t,p,b,C,w,E,T,null,l))}h.push(E+y-s)}}return m(e,n,r,i,0),(o||l)(d,h,a)}class Vc{constructor(e,n,r,i,s=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Vc(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,a=e.length?e[0]:null;for(let o=0,l=0,c=0;;o++){let u=o<n.length?n[o]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;a&&a.from<d;){let h=a;if(l>=h.from||d<=h.to||c){let m=Math.max(h.from,l)-c,p=Math.min(h.to,d)-c;h=m>=p?null:new Vc(m,p,h.tree,h.offset+c,o>0,!!u)}if(h&&i.push(h),a.to>d)break;a=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class rhe{startParse(e,n,r){return typeof e=="string"&&(e=new ihe(e)),r=r?r.length?r.map(i=>new Wv(i.from,i.to)):[new Wv(0,0)]:[new Wv(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class ihe{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Zt({perNode:!0});let she=0;class Es{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=she++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Es&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Es(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new e1(e);return r=>r.modified.indexOf(n)>-1?r:e1.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let ahe=0;class e1{constructor(e){this.name=e,this.instances=[],this.id=ahe++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(o=>o.base==e&&ohe(n,o.modified));if(r)return r;let i=[],s=new Es(e.name,i,e,n);for(let o of n)o.instances.push(s);let a=lhe(n);for(let o of e.set)if(!o.modified.length)for(let l of a)i.push(e1.get(o,l));return s}}function ohe(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function lhe(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function che(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],a=2,o=i;for(let d=0;;){if(o=="..."&&d>0&&d+3==i.length){a=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),d+=h[0].length,d==i.length)break;let m=i[d++];if(d==i.length&&m=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+i);o=i.slice(d)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new u0(r,a,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return WR.add(e)}const WR=new Zt({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new u0(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class u0{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}u0.empty=new u0([],2,null);function KR(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let a of s.tag)n[a.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let a=i;for(let o of s)for(let l of o.set){let c=n[l.id];if(c){a=a?a+" "+c:c;break}}return a},scope:r}}function uhe(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function dhe(t,e,n,r=0,i=t.length){let s=new hhe(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class hhe{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:a,from:o,to:l}=e;if(o>=r||l<=n)return;a.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(a)));let c=i,u=fhe(e)||u0.empty,d=uhe(s,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(n,o),c),u.opaque)return;let h=e.tree&&e.tree.prop(Zt.mounted);if(h&&h.overlay){let m=e.node.enter(h.overlay[0].from+o,1),p=this.highlighters.filter(x=>!x.scope||x.scope(h.tree.type)),b=e.firstChild();for(let x=0,g=o;;x++){let y=x<h.overlay.length?h.overlay[x]:null,w=y?y.from+o:l,C=Math.max(n,g),E=Math.min(r,w);if(C<E&&b)for(;e.from<E&&(this.highlightRange(e,C,E,i,s),this.startSpan(Math.min(E,e.to),c),!(e.to>=w||!e.nextSibling())););if(!y||w>r)break;g=y.to+o,g>n&&(this.highlightRange(m.cursor(),Math.max(n,y.from+o),Math.min(r,g),"",p),this.startSpan(Math.min(r,g),c))}b&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function fhe(t){let e=t.type.prop(WR);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const je=Es.define,Xm=je(),al=je(),gT=je(al),yT=je(al),ol=je(),Qm=je(ol),Kv=je(ol),Sa=je(),gc=je(Sa),va=je(),xa=je(),K2=je(),Lh=je(K2),Jm=je(),Le={comment:Xm,lineComment:je(Xm),blockComment:je(Xm),docComment:je(Xm),name:al,variableName:je(al),typeName:gT,tagName:je(gT),propertyName:yT,attributeName:je(yT),className:je(al),labelName:je(al),namespace:je(al),macroName:je(al),literal:ol,string:Qm,docString:je(Qm),character:je(Qm),attributeValue:je(Qm),number:Kv,integer:je(Kv),float:je(Kv),bool:je(ol),regexp:je(ol),escape:je(ol),color:je(ol),url:je(ol),keyword:va,self:je(va),null:je(va),atom:je(va),unit:je(va),modifier:je(va),operatorKeyword:je(va),controlKeyword:je(va),definitionKeyword:je(va),moduleKeyword:je(va),operator:xa,derefOperator:je(xa),arithmeticOperator:je(xa),logicOperator:je(xa),bitwiseOperator:je(xa),compareOperator:je(xa),updateOperator:je(xa),definitionOperator:je(xa),typeOperator:je(xa),controlOperator:je(xa),punctuation:K2,separator:je(K2),bracket:Lh,angleBracket:je(Lh),squareBracket:je(Lh),paren:je(Lh),brace:je(Lh),content:Sa,heading:gc,heading1:je(gc),heading2:je(gc),heading3:je(gc),heading4:je(gc),heading5:je(gc),heading6:je(gc),contentSeparator:je(Sa),list:je(Sa),quote:je(Sa),emphasis:je(Sa),strong:je(Sa),link:je(Sa),monospace:je(Sa),strikethrough:je(Sa),inserted:je(),deleted:je(),changed:je(),invalid:je(),meta:Jm,documentMeta:je(Jm),annotation:je(Jm),processingInstruction:je(Jm),definition:Es.defineModifier("definition"),constant:Es.defineModifier("constant"),function:Es.defineModifier("function"),standard:Es.defineModifier("standard"),local:Es.defineModifier("local"),special:Es.defineModifier("special")};for(let t in Le){let e=Le[t];e instanceof Es&&(e.name=t)}KR([{tag:Le.link,class:"tok-link"},{tag:Le.heading,class:"tok-heading"},{tag:Le.emphasis,class:"tok-emphasis"},{tag:Le.strong,class:"tok-strong"},{tag:Le.keyword,class:"tok-keyword"},{tag:Le.atom,class:"tok-atom"},{tag:Le.bool,class:"tok-bool"},{tag:Le.url,class:"tok-url"},{tag:Le.labelName,class:"tok-labelName"},{tag:Le.inserted,class:"tok-inserted"},{tag:Le.deleted,class:"tok-deleted"},{tag:Le.literal,class:"tok-literal"},{tag:Le.string,class:"tok-string"},{tag:Le.number,class:"tok-number"},{tag:[Le.regexp,Le.escape,Le.special(Le.string)],class:"tok-string2"},{tag:Le.variableName,class:"tok-variableName"},{tag:Le.local(Le.variableName),class:"tok-variableName tok-local"},{tag:Le.definition(Le.variableName),class:"tok-variableName tok-definition"},{tag:Le.special(Le.variableName),class:"tok-variableName2"},{tag:Le.definition(Le.propertyName),class:"tok-propertyName tok-definition"},{tag:Le.typeName,class:"tok-typeName"},{tag:Le.namespace,class:"tok-namespace"},{tag:Le.className,class:"tok-className"},{tag:Le.macroName,class:"tok-macroName"},{tag:Le.propertyName,class:"tok-propertyName"},{tag:Le.operator,class:"tok-operator"},{tag:Le.comment,class:"tok-comment"},{tag:Le.meta,class:"tok-meta"},{tag:Le.invalid,class:"tok-invalid"},{tag:Le.punctuation,class:"tok-punctuation"}]);var Yv;const Qh=new Zt,mhe=new Zt;class ja{constructor(e,n,r=[],i=""){this.data=e,this.name=i,mn.prototype.hasOwnProperty("tree")||Object.defineProperty(mn.prototype,"tree",{get(){return aa(this)}}),this.parser=n,this.extension=[Fd.of(this),mn.languageData.of((s,a,o)=>{let l=bT(s,a,o),c=l.type.prop(Qh);if(!c)return[];let u=s.facet(c),d=l.type.prop(mhe);if(d){let h=l.resolve(a-l.from,o);for(let m of d)if(m.test(h,s)){let p=s.facet(m.facet);return m.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return bT(e,n,r).type.prop(Qh)==this.data}findRegions(e){let n=e.facet(Fd);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,a)=>{if(s.prop(Qh)==this.data){r.push({from:a,to:a+s.length});return}let o=s.prop(Zt.mounted);if(o){if(o.tree.prop(Qh)==this.data){if(o.overlay)for(let l of o.overlay)r.push({from:l.from+a,to:l.to+a});else r.push({from:a,to:a+s.length});return}else if(o.overlay){let l=r.length;if(i(o.tree,o.overlay[0].from+a),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof Qr&&i(c,s.positions[l]+a)}};return i(aa(e),0),r}get allowsNesting(){return!0}}ja.setState=xn.define();function bT(t,e,n){let r=t.facet(Fd),i=aa(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,sr.ExcludeBuffers|sr.EnterBracketed))s.type.isTop&&(i=s);return i}function aa(t){let e=t.field(ja.state,!1);return e?e.tree:Qr.empty}class phe{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Bh=null;class t1{constructor(e,n,r=[],i,s,a,o,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=a,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new t1(e,n,[],Qr.empty,0,r,[],null)}startParse(){return this.parser.startParse(new phe(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Qr.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}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 i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Vc.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Vc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Bh;Bh=this;try{return e()}finally{Bh=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=vT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:a,skipped:o}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,d,h)=>l.push({fromA:c,toA:u,fromB:d,toB:h})),r=Vc.applyChanges(r,l),i=Qr.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){o=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),d=e.mapPos(c.to,-1);u<d&&o.push({from:u,to:d})}}}return new t1(this.parser,n,r,i,s,a,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=vT(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends rhe{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let l=Bh;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=a,new Qr(qs.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Bh}}function vT(t,e,n){return Vc.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class qd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new qd(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=t1.create(e.facet(Fd).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new qd(r)}}ja.state=Ka.define({create:qd.init,update(t,e){for(let n of e.effects)if(n.is(ja.setState))return n.value;return e.startState.facet(Fd)!=e.state.facet(Fd)?qd.init(e.state):t.apply(e)}});let YR=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(YR=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Xv=typeof navigator<"u"&&(!((Yv=navigator.scheduling)===null||Yv===void 0)&&Yv.isInputPending)?()=>navigator.scheduling.isInputPending():null,ghe=hs.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(ja.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(ja.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=YR(this.work))}work(e){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:i}}=this.view,s=r.field(ja.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!Xv?Math.max(25,e.timeRemaining()-5):1e9),o=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>Xv&&Xv()||Date.now()>a,i+(o?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ja.setState.of(new qd(s.context))})),this.chunkBudget>0&&!(l&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>ns(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Fd=ut.define({combine(t){return t.length?t[0]:null},enables:t=>[ja.state,ghe,Ze.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]}),yhe=ut.define(),Vk=ut.define({combine:t=>{if(!t.length)return"  ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function n1(t){let e=t.facet(Vk);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function r1(t,e){let n="",r=t.tabSize,i=t.facet(Vk)[0];if(i=="	"){for(;e>=r;)n+="	",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function XR(t,e){t instanceof mn&&(t=new uy(t));for(let r of t.state.facet(yhe)){let i=r(t,e);if(i!==void 0)return i}let n=aa(t.state);return n.length>=e?vhe(t,n,e):null}class uy{constructor(e,n={}){this.state=e,this.options=n,this.unit=n1(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.countColumn(r,e-i),a=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return a>-1&&(s+=a-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return z0(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let a=s(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const bhe=new Zt;function vhe(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let a=i;a&&!(a.from<r.node.from||a.to>r.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)s.push(a);for(let a=s.length-1;a>=0;a--)r={node:s[a],next:r}}return QR(r,t,n)}function QR(t,e,n){for(let r=t;r;r=r.next){let i=whe(r.node);if(i)return i(Gk.create(e,n,r))}return 0}function xhe(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function whe(t){let e=t.type.prop(bhe);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Zt.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>The(a,!0,1,void 0,s&&!xhe(a)?i.from:void 0)}return t.parent==null?khe:null}function khe(){return 0}class Gk extends uy{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Gk(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(_he(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return QR(this.context.next,this.base,this.pos)}}function _he(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function She(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),a=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let o=n.to;;){let l=e.childAfter(o);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=a)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}o=l.to}}function The(t,e,n,r,i){let s=t.textAfter,a=s.match(/^\s*/)[0].length,o=r&&s.slice(a,a+r.length)==r||i==t.pos+a,l=She(t);return l?o?t.column(l.from):t.column(l.to):t.baseIndent+(o?0:t.unit*n)}class dy{constructor(e,n){this.specs=e;let r;function i(o){let l=Gl.newName();return(r||(r=Object.create(null)))["."+l]=o,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,a=n.scope;this.scope=a instanceof ja?o=>o.prop(Qh)==a.data:a?o=>o==a:void 0,this.style=KR(e.map(o=>({tag:o.tag,class:o.class||i(Object.assign({},o,{tag:null}))})),{all:s}).style,this.module=r?new Gl(r):null,this.themeType=n.themeType}static define(e,n){return new dy(e,n||{})}}const Y2=ut.define(),JR=ut.define({combine(t){return t.length?[t[0]]:null}});function Qv(t){let e=t.facet(Y2);return e.length?e:t.facet(JR)}function Che(t,e){let n=[Ahe],r;return t instanceof dy&&(t.module&&n.push(Ze.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(JR.of(t)):r?n.push(Y2.computeN([Ze.darkTheme],i=>i.facet(Ze.darkTheme)==(r=="dark")?[t]:[])):n.push(Y2.of(t)),n}class Ehe{constructor(e){this.markCache=Object.create(null),this.tree=aa(e.state),this.decorations=this.buildDeco(e,Qv(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=aa(e.state),r=Qv(e.state),i=r!=Qv(e.startState),{viewport:s}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&a>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return rn.none;let r=new Zc;for(let{from:i,to:s}of e.visibleRanges)dhe(this.tree,n,(a,o,l)=>{r.add(a,o,this.markCache[l]||(this.markCache[l]=rn.mark({class:l})))},i,s);return r.finish()}}const Ahe=gu.high(hs.fromClass(Ehe,{decorations:t=>t.decorations})),Mhe=dy.define([{tag:Le.meta,color:"#404740"},{tag:Le.link,textDecoration:"underline"},{tag:Le.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Le.emphasis,fontStyle:"italic"},{tag:Le.strong,fontWeight:"bold"},{tag:Le.strikethrough,textDecoration:"line-through"},{tag:Le.keyword,color:"#708"},{tag:[Le.atom,Le.bool,Le.url,Le.contentSeparator,Le.labelName],color:"#219"},{tag:[Le.literal,Le.inserted],color:"#164"},{tag:[Le.string,Le.deleted],color:"#a11"},{tag:[Le.regexp,Le.escape,Le.special(Le.string)],color:"#e40"},{tag:Le.definition(Le.variableName),color:"#00f"},{tag:Le.local(Le.variableName),color:"#30a"},{tag:[Le.typeName,Le.namespace],color:"#085"},{tag:Le.className,color:"#167"},{tag:[Le.special(Le.variableName),Le.macroName],color:"#256"},{tag:Le.definition(Le.propertyName),color:"#00c"},{tag:Le.comment,color:"#940"},{tag:Le.invalid,color:"#f00"}]),Nhe=1e4,Dhe="()[]{}",Ihe=new Zt;function X2(t,e,n){let r=t.prop(e<0?Zt.openedBy:Zt.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Q2(t){let e=t.type.prop(Ihe);return e?e(t.node):t}function ed(t,e,n,r={}){let i=r.maxScanDistance||Nhe,s=r.brackets||Dhe,a=aa(t),o=a.resolveInner(e,n);for(let l=o;l;l=l.parent){let c=X2(l.type,n,s);if(c&&l.from<l.to){let u=Q2(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return Rhe(t,e,n,l,u,c,s)}}return Ohe(t,e,n,a,o.type,i,s)}function Rhe(t,e,n,r,i,s,a){let o=r.parent,l={from:i.from,to:i.to},c=0,u=o==null?void 0:o.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let d=Q2(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(X2(u.type,n,a))c++;else if(X2(u.type,-n,a)){if(c==0){let d=Q2(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 Ohe(t,e,n,r,i,s,a){if(n<0?!e:e==t.doc.length)return null;let o=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=a.indexOf(o);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),d=0;for(let h=0;!u.next().done&&h<=s;){let m=u.value;n<0&&(h+=m.length);let p=e+h*n;for(let b=n>0?0:m.length-1,x=n>0?m.length:-1;b!=x;b+=n){let g=a.indexOf(m[b]);if(!(g<0||r.resolveInner(p+b,1).type!=i))if(g%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+b,to:p+b+1},matched:g>>1==l>>1};d--}}n>0&&(h+=m.length)}return u.done?{start:c,matched:!1}:null}const jhe=Object.create(null),xT=[qs.none],wT=[],kT=Object.create(null),Lhe=Object.create(null);for(let[t,e]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"]])Lhe[t]=Bhe(jhe,e);function Jv(t,e){wT.indexOf(t)>-1||(wT.push(t),console.warn(e))}function Bhe(t,e){let n=[];for(let o of e.split(" ")){let l=[];for(let c of o.split(".")){let u=t[c]||Le[c];u?typeof u=="function"?l.length?l=l.map(u):Jv(c,`Modifier ${c} used at start of tag`):l.length?Jv(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:Jv(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(o=>o.id),s=kT[i];if(s)return s.id;let a=kT[i]=qs.define({id:xT.length,name:r,props:[che({[r]:n})]});return xT.push(a),a.id}Ln.RTL,Ln.LTR;const zhe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Kk(t.state,n.from);return r.line?Phe(t):r.block?Uhe(t):!1};function Wk(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const Phe=Wk(Fhe,0),$he=Wk(ZR,0),Uhe=Wk((t,e)=>ZR(t,e,qhe(e)),0);function Kk(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const zh=50;function Hhe(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-zh,r),a=t.sliceDoc(i,i+zh),o=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(a)[0].length,c=s.length-o;if(s.slice(c-e.length,c)==e&&a.slice(l,l+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:i+l,margin:l&&1}};let u,d;i-r<=2*zh?u=d=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+zh),d=t.sliceDoc(i-zh,i));let h=/^\s*/.exec(u)[0].length,m=/\s*$/.exec(d)[0].length,p=d.length-m-n.length;return u.slice(h,h+e.length)==e&&d.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:i-m-n.length,margin:/\s/.test(d.charAt(p-1))?1:0}}:null}function qhe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function ZR(t,e,n=e.selection.ranges){let r=n.map(s=>Kk(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,a)=>Hhe(e,r[a],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,a)=>i[a]?[]:[{from:s.from,insert:r[a].open+" "},{from:s.to,insert:" "+r[a].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let a=0,o;a<i.length;a++)if(o=i[a]){let l=r[a],{open:c,close:u}=o;s.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:s}}return null}function Fhe(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:a}of n){let o=r.length,l=1e9,c;for(let u=s;u<=a;){let d=e.doc.lineAt(u);if(c==null&&(c=Kk(e,d.from).line,!c))continue e;if(d.from>i&&(s==a||a>d.from)){i=d.from;let h=/^\s*/.exec(d.text)[0].length,m=h==d.length,p=d.text.slice(h,h+c.length)==c?h:-1;h<d.text.length&&h<l&&(l=h),r.push({line:d,comment:p,token:c,indent:h,empty:m,single:!1})}u=d.to+1}if(l<1e9)for(let u=o;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==o+1&&(r[o].single=!0)}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:o,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&s.push({from:o.from+c,insert:l+" "});let a=e.changes(s);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:a,comment:o,token:l}of r)if(o>=0){let c=a.from+o,u=c+l.length;a.text[u-a.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const J2=Fo.define(),Vhe=Fo.define(),Ghe=ut.define(),eO=ut.define({combine(t){return iy(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),tO=Ka.define({create(){return La.empty},update(t,e){let n=e.state.facet(eO),r=e.annotation(J2);if(r){let l=ji.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=i1(u,u.length,n.minDepth,l):u=sO(u,e.startState.selection),new La(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(Vhe);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Mr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=ji.fromTransaction(e),a=e.annotation(Mr.time),o=e.annotation(Mr.userEvent);return s?t=t.addChanges(s,a,o,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,o,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new La(t.done.map(ji.fromJSON),t.undone.map(ji.fromJSON))}});function nO(t={}){return[tO,eO.of(t),Ze.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?rO:e.inputType=="historyRedo"?Z2:null;return r?(e.preventDefault(),r(n)):!1}})]}function hy(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(tO,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const rO=hy(0,!1),Z2=hy(1,!1),Whe=hy(0,!0),Khe=hy(1,!0);class ji{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new ji(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.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(i=>i.toJSON())}}static fromJSON(e){return new ji(e.changes&&Er.fromJSON(e.changes),[],e.mapped&&Pa.fromJSON(e.mapped),e.startSelection&&we.fromJSON(e.startSelection),e.selectionsAfter.map(we.fromJSON))}static fromTransaction(e,n){let r=js;for(let i of e.startState.facet(Ghe)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new ji(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,js)}static selection(e){return new ji(void 0,js,void 0,void 0,e)}}function i1(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Yhe(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,a,o)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];o>=c&&a<=u&&(r=!0)}}),r}function Xhe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function iO(t,e){return t.length?e.length?t.concat(e):t:e}const js=[],Qhe=200;function sO(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Qhe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),i1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ji.selection([e])]}function Jhe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Zv(t,e){if(!t.length)return t;let n=t.length,r=js;for(;n;){let i=Zhe(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[ji.selection(r)]:js}function Zhe(t,e,n){let r=iO(t.selectionsAfter.length?t.selectionsAfter.map(o=>o.map(e)):js,n);if(!t.changes)return ji.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(s):s;return new ji(i,xn.mapEffects(t.effects,e),a,t.startSelection.map(s),r)}const efe=/^(input\.type|delete)($|\.)/;class La{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new La(this.done,this.undone):this}addChanges(e,n,r,i,s){let a=this.done,o=a[a.length-1];return o&&o.changes&&!o.changes.empty&&e.changes&&(!r||efe.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,Yhe(o.changes,e.changes))||r=="input.type.compose")?a=i1(a,a.length-1,i.minDepth,new ji(e.changes.compose(o.changes),iO(xn.mapEffects(e.effects,o.changes),o.effects),o.mapped,o.startSelection,js)):a=i1(a,a.length,i.minDepth,e),new La(a,js,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:js;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Xhe(s[s.length-1],e)?this:new La(sO(this.done,e),this.undone,n,r)}addMapping(e){return new La(Zv(this.done,e),Zv(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],a=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):n.selection);if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:J2.of({side:e,rest:Jhe(i),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=i.length==1?js:i.slice(0,i.length-1);return s.mapped&&(o=Zv(o,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:J2.of({side:e,rest:o,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}La.empty=new La(js,js);const aO=[{key:"Mod-z",run:rO,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Z2,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Z2,preventDefault:!0},{key:"Mod-u",run:Whe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Khe,preventDefault:!0}];function uh(t,e){return we.create(t.ranges.map(e),t.mainIndex)}function la(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ca({state:t,dispatch:e},n){let r=uh(t.selection,n);return r.eq(t.selection,!0)?!1:(e(la(t,r)),!0)}function fy(t,e){return we.cursor(e?t.to:t.from)}function oO(t,e){return ca(t,n=>n.empty?t.moveByChar(n,e):fy(n,e))}function ai(t){return t.textDirectionAt(t.state.selection.main.head)==Ln.LTR}const lO=t=>oO(t,!ai(t)),cO=t=>oO(t,ai(t));function uO(t,e){return ca(t,n=>n.empty?t.moveByGroup(n,e):fy(n,e))}const tfe=t=>uO(t,!ai(t)),nfe=t=>uO(t,ai(t));function rfe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function my(t,e,n){let r=aa(t).resolveInner(e.head),i=n?Zt.closedBy:Zt.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;rfe(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),a,o;return s&&(a=n?ed(t,r.from,1):ed(t,r.to,-1))&&a.matched?o=n?a.end.to:a.end.from:o=n?r.to:r.from,we.cursor(o,n?-1:1)}const ife=t=>ca(t,e=>my(t.state,e,!ai(t))),sfe=t=>ca(t,e=>my(t.state,e,ai(t)));function dO(t,e){return ca(t,n=>{if(!n.empty)return fy(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const hO=t=>dO(t,!1),fO=t=>dO(t,!0);function mO(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(Ze.scrollMargins)){let a=s(t);a!=null&&a.top&&(n=Math.max(a==null?void 0:a.top,n)),a!=null&&a.bottom&&(r=Math.max(a==null?void 0:a.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function pO(t,e){let n=mO(t),{state:r}=t,i=uh(r.selection,a=>a.empty?t.moveVertically(a,e,n.height):fy(a,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,c=o.bottom-n.marginBottom;a&&a.top>l&&a.bottom<c&&(s=Ze.scrollIntoView(i.main.head,{y:"start",yMargin:a.top-l}))}return t.dispatch(la(r,i),{effects:s}),!0}const _T=t=>pO(t,!1),ew=t=>pO(t,!0);function nc(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=we.cursor(r.from+s))}return i}const afe=t=>ca(t,e=>nc(t,e,!0)),ofe=t=>ca(t,e=>nc(t,e,!1)),lfe=t=>ca(t,e=>nc(t,e,!ai(t))),cfe=t=>ca(t,e=>nc(t,e,ai(t))),ufe=t=>ca(t,e=>we.cursor(t.lineBlockAt(e.head).from,1)),dfe=t=>ca(t,e=>we.cursor(t.lineBlockAt(e.head).to,-1));function hfe(t,e,n){let r=!1,i=uh(t.selection,s=>{let a=ed(t,s.head,-1)||ed(t,s.head,1)||s.head>0&&ed(t,s.head-1,1)||s.head<t.doc.length&&ed(t,s.head+1,-1);if(!a||!a.end)return s;r=!0;let o=a.start.from==s.head?a.end.to:a.end.from;return we.cursor(o)});return r?(e(la(t,i)),!0):!1}const ffe=({state:t,dispatch:e})=>hfe(t,e);function Fs(t,e){let n=uh(t.state.selection,r=>{let i=e(r);return we.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return n.eq(t.state.selection)?!1:(t.dispatch(la(t.state,n)),!0)}function gO(t,e){return Fs(t,n=>t.moveByChar(n,e))}const yO=t=>gO(t,!ai(t)),bO=t=>gO(t,ai(t));function vO(t,e){return Fs(t,n=>t.moveByGroup(n,e))}const mfe=t=>vO(t,!ai(t)),pfe=t=>vO(t,ai(t)),gfe=t=>Fs(t,e=>my(t.state,e,!ai(t))),yfe=t=>Fs(t,e=>my(t.state,e,ai(t)));function xO(t,e){return Fs(t,n=>t.moveVertically(n,e))}const wO=t=>xO(t,!1),kO=t=>xO(t,!0);function _O(t,e){return Fs(t,n=>t.moveVertically(n,e,mO(t).height))}const ST=t=>_O(t,!1),TT=t=>_O(t,!0),bfe=t=>Fs(t,e=>nc(t,e,!0)),vfe=t=>Fs(t,e=>nc(t,e,!1)),xfe=t=>Fs(t,e=>nc(t,e,!ai(t))),wfe=t=>Fs(t,e=>nc(t,e,ai(t))),kfe=t=>Fs(t,e=>we.cursor(t.lineBlockAt(e.head).from)),_fe=t=>Fs(t,e=>we.cursor(t.lineBlockAt(e.head).to)),CT=({state:t,dispatch:e})=>(e(la(t,{anchor:0})),!0),ET=({state:t,dispatch:e})=>(e(la(t,{anchor:t.doc.length})),!0),AT=({state:t,dispatch:e})=>(e(la(t,{anchor:t.selection.main.anchor,head:0})),!0),MT=({state:t,dispatch:e})=>(e(la(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Sfe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Tfe=({state:t,dispatch:e})=>{let n=py(t).map(({from:r,to:i})=>we.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:we.create(n),userEvent:"select"})),!0},Cfe=({state:t,dispatch:e})=>{let n=uh(t.selection,r=>{let i=aa(t),s=i.resolveStack(r.from,1);if(r.empty){let a=i.resolveStack(r.from,-1);a.node.from>=s.node.from&&a.node.to<=s.node.to&&(s=a)}for(let a=s;a;a=a.next){let{node:o}=a;if((o.from<r.from&&o.to>=r.to||o.to>r.to&&o.from<=r.from)&&a.next)return we.range(o.to,o.from)}return r});return n.eq(t.selection)?!1:(e(la(t,n)),!0)};function SO(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let a=n.doc.lineAt(s.head);if(e?a.to<t.state.doc.length:a.from>0)for(let o=s;;){let l=t.moveVertically(o,e);if(l.head<a.from||l.head>a.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==o.head)break;o=l}}}return i.length==r.ranges.length?!1:(t.dispatch(la(n,we.create(i,i.length-1))),!0)}const Efe=t=>SO(t,!1),Afe=t=>SO(t,!0),Mfe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=we.create([n.main]):n.main.empty||(r=we.create([we.cursor(n.main.head)])),r?(e(la(t,r)),!0):!1};function H0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:a,to:o}=s;if(a==o){let l=e(s);l<a?(n="delete.backward",l=Zm(t,l,!1)):l>a&&(n="delete.forward",l=Zm(t,l,!0)),a=Math.min(a,l),o=Math.max(o,l)}else a=Zm(t,a,!1),o=Zm(t,o,!0);return a==o?{range:s}:{changes:{from:a,to:o},range:we.cursor(a,a<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Ze.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Zm(t,e,n){if(t instanceof Ze)for(let r of t.state.facet(Ze.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const TO=(t,e,n)=>H0(t,r=>{let i=r.from,{state:s}=t,a=s.doc.lineAt(i),o,l;if(n&&!e&&i>a.from&&i<a.from+200&&!/[^ \t]/.test(o=a.text.slice(0,i-a.from))){if(o[o.length-1]=="	")return i-1;let c=z0(o,s.tabSize),u=c%n1(s)||n1(s);for(let d=0;d<u&&o[o.length-1-d]==" ";d++)i--;l=i}else l=ni(a.text,i-a.from,e,e)+a.from,l==i&&a.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(l-a.from,i-a.from))&&(l=ni(a.text,l-a.from,!1,!1)+a.from);return l}),tw=t=>TO(t,!1,!0),CO=t=>TO(t,!0,!1),EO=(t,e)=>H0(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),a=i.charCategorizer(r);for(let o=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=ni(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),u=a(c);if(o!=null&&u!=o)break;(c!=" "||r!=n.head)&&(o=u),r=l}return r}),AO=t=>EO(t,!1),Nfe=t=>EO(t,!0),Dfe=t=>H0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Ife=t=>H0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Rfe=t=>H0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Ofe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:en.of(["",""])},range:we.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},jfe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),a=i==s.from?i-1:ni(s.text,i-s.from,!1)+s.from,o=i==s.to?i+1:ni(s.text,i-s.from,!0)+s.from;return{changes:{from:a,to:o,insert:t.doc.slice(i,o).append(t.doc.slice(a,i))},range:we.cursor(o)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function py(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let a=e[e.length-1];a.to=s.to,a.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function MO(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of py(t)){if(n?s.to==t.doc.length:s.from==0)continue;let a=t.doc.lineAt(n?s.to+1:s.from-1),o=a.length+1;if(n){r.push({from:s.to,to:a.to},{from:s.from,insert:a.text+t.lineBreak});for(let l of s.ranges)i.push(we.range(Math.min(t.doc.length,l.anchor+o),Math.min(t.doc.length,l.head+o)))}else{r.push({from:a.from,to:s.from},{from:s.to,insert:t.lineBreak+a.text});for(let l of s.ranges)i.push(we.range(l.anchor-o,l.head-o))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:we.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Lfe=({state:t,dispatch:e})=>MO(t,e,!1),Bfe=({state:t,dispatch:e})=>MO(t,e,!0);function NO(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of py(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const zfe=({state:t,dispatch:e})=>NO(t,e,!1),Pfe=({state:t,dispatch:e})=>NO(t,e,!0),$fe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(py(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=uh(e.selection,i=>{let s;if(t.lineWrapping){let a=t.lineBlockAt(i.head),o=t.coordsAtPos(i.head,i.assoc||1);o&&(s=a.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Ufe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=aa(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Zt.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const NT=DO(!1),Hfe=DO(!0);function DO(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:a}=i,o=e.doc.lineAt(s),l=!t&&s==a&&Ufe(e,s);t&&(s=a=(a<=o.to?o:e.doc.lineAt(a)).to);let c=new uy(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=XR(c,s);for(u==null&&(u=z0(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));a<o.to&&/\s/.test(o.text[a-o.from]);)a++;l?{from:s,to:a}=l:s>o.from&&s<o.from+100&&!/\S/.test(o.text.slice(0,s))&&(s=o.from);let d=["",r1(e,u)];return l&&d.push(r1(e,c.lineIndent(o.from,-1))),{changes:{from:s,to:a,insert:en.of(d)},range:we.cursor(s+1+d[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Yk(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=t.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(e(o,i,r),n=o.number),a=o.to+1}let s=t.changes(i);return{changes:i,range:we.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const qfe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new uy(t,{overrideIndentation:s=>{let a=n[s];return a??-1}}),i=Yk(t,(s,a,o)=>{let l=XR(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=r1(t,l);(c!=u||o.from<s.from+c.length)&&(n[s.from]=l,a.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},Ffe=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Yk(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Vk)})}),{userEvent:"input.indent"})),!0),Vfe=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Yk(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=z0(i,t.tabSize),a=0,o=r1(t,Math.max(0,s-n1(t)));for(;a<i.length&&a<o.length&&i.charCodeAt(a)==o.charCodeAt(a);)a++;r.push({from:n.from+a,to:n.from+i.length,insert:o.slice(a)})}),{userEvent:"delete.dedent"})),!0),Gfe=t=>(t.setTabFocusMode(),!0),Wfe=[{key:"Ctrl-b",run:lO,shift:yO,preventDefault:!0},{key:"Ctrl-f",run:cO,shift:bO},{key:"Ctrl-p",run:hO,shift:wO},{key:"Ctrl-n",run:fO,shift:kO},{key:"Ctrl-a",run:ufe,shift:kfe},{key:"Ctrl-e",run:dfe,shift:_fe},{key:"Ctrl-d",run:CO},{key:"Ctrl-h",run:tw},{key:"Ctrl-k",run:Dfe},{key:"Ctrl-Alt-h",run:AO},{key:"Ctrl-o",run:Ofe},{key:"Ctrl-t",run:jfe},{key:"Ctrl-v",run:ew}],Kfe=[{key:"ArrowLeft",run:lO,shift:yO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:tfe,shift:mfe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:lfe,shift:xfe,preventDefault:!0},{key:"ArrowRight",run:cO,shift:bO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:nfe,shift:pfe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:cfe,shift:wfe,preventDefault:!0},{key:"ArrowUp",run:hO,shift:wO,preventDefault:!0},{mac:"Cmd-ArrowUp",run:CT,shift:AT},{mac:"Ctrl-ArrowUp",run:_T,shift:ST},{key:"ArrowDown",run:fO,shift:kO,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ET,shift:MT},{mac:"Ctrl-ArrowDown",run:ew,shift:TT},{key:"PageUp",run:_T,shift:ST},{key:"PageDown",run:ew,shift:TT},{key:"Home",run:ofe,shift:vfe,preventDefault:!0},{key:"Mod-Home",run:CT,shift:AT},{key:"End",run:afe,shift:bfe,preventDefault:!0},{key:"Mod-End",run:ET,shift:MT},{key:"Enter",run:NT,shift:NT},{key:"Mod-a",run:Sfe},{key:"Backspace",run:tw,shift:tw,preventDefault:!0},{key:"Delete",run:CO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:AO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Nfe,preventDefault:!0},{mac:"Mod-Backspace",run:Ife,preventDefault:!0},{mac:"Mod-Delete",run:Rfe,preventDefault:!0}].concat(Wfe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),IO=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ife,shift:gfe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:sfe,shift:yfe},{key:"Alt-ArrowUp",run:Lfe},{key:"Shift-Alt-ArrowUp",run:zfe},{key:"Alt-ArrowDown",run:Bfe},{key:"Shift-Alt-ArrowDown",run:Pfe},{key:"Mod-Alt-ArrowUp",run:Efe},{key:"Mod-Alt-ArrowDown",run:Afe},{key:"Escape",run:Mfe},{key:"Mod-Enter",run:Hfe},{key:"Alt-l",mac:"Ctrl-l",run:Tfe},{key:"Mod-i",run:Cfe,preventDefault:!0},{key:"Mod-[",run:Vfe},{key:"Mod-]",run:Ffe},{key:"Mod-Alt-\\",run:qfe},{key:"Shift-Mod-k",run:$fe},{key:"Shift-Mod-\\",run:ffe},{key:"Mod-/",run:zhe},{key:"Alt-A",run:$he},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Gfe}].concat(Kfe);class RO{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=aa(this.state).resolveInner(this.pos,-1);for(;n&&e.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(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(OO(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function DT(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Yfe(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=DT(e)+DT(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Xfe(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Yfe(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}class IT{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function Gc(t){return t.selection.main.from}function OO(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const jO=Fo.define();function Qfe(t,e,n,r){let{main:i}=t.selection,s=n-i.from,a=r-i.from;return{...t.changeByRange(o=>{if(o!=i&&n!=r&&t.sliceDoc(o.from+s,o.from+a)!=t.sliceDoc(n,r))return{range:o};let l=t.toText(e);return{changes:{from:o.from+s,to:r==i.from?o.to:o.from+a,insert:l},range:we.cursor(o.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const RT=new WeakMap;function Jfe(t){if(!Array.isArray(t))return t;let e=RT.get(t);return e||RT.set(t,e=Xfe(t)),e}const s1=xn.define(),d0=xn.define();class Zfe{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=sl(e,n),i=Lu(r);this.chars.push(r);let s=e.slice(n,n+i),a=s.toUpperCase();this.folded.push(sl(a==s?s.toLowerCase():a,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:a}=this;if(n.length==1){let y=sl(e,0),w=Lu(y),C=w==e.length?0:-100;if(y!=n[0])if(y==r[0])C+=-200;else return null;return this.ret(C,[0,w])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(o<0){for(let y=0,w=Math.min(e.length,200);y<w&&c<l;){let C=sl(e,y);(C==n[c]||C==r[c])&&(i[c++]=y),y+=Lu(C)}if(c<l)return null}let u=0,d=0,h=!1,m=0,p=-1,b=-1,x=/[a-z]/.test(e),g=!0;for(let y=0,w=Math.min(e.length,200),C=0;y<w&&d<l;){let E=sl(e,y);o<0&&(u<l&&E==n[u]&&(s[u++]=y),m<l&&(E==n[m]||E==r[m]?(m==0&&(p=y),b=y+1,m++):m=0));let S,T=E<255?E>=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(S=kce(E))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!y||T==1&&x||C==0&&T!=0)&&(n[d]==E||r[d]==E&&(h=!0)?a[d++]=y:a.length&&(g=!1)),C=T,y+=Lu(E)}return d==l&&a[0]==0&&g?this.result(-100+(h?-200:0),a,e):m==l&&p==0?this.ret(-200-e.length+(b==e.length?0:-100),[0,b]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):m==l?this.ret(-900-e.length,[p,b]):d==l?this.result(-100+(h?-200:0)+-700+(g?0:-1100),a,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let a of n){let o=a+(this.astral?Lu(sl(r,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(e-r.length,i)}}class e0e{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.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+(e.length==this.pattern.length?0:-100),this)}}const Ur=ut.define({combine(t){return iy(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:t0e,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>OT(e(r),n(r)),optionClass:(e,n)=>r=>OT(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function OT(t,e){return t?e?t+" "+e:t:e}function t0e(t,e,n,r,i,s){let a=t.textDirection==Ln.RTL,o=a,l=!1,c="top",u,d,h=e.left-i.left,m=i.right-e.right,p=r.right-r.left,b=r.bottom-r.top;if(o&&h<Math.min(p,m)?o=!1:!o&&m<Math.min(p,h)&&(o=!0),p<=(o?h:m))u=Math.max(i.top,Math.min(n.top,i.bottom-b))-e.top,d=Math.min(400,o?h:m);else{l=!0,d=Math.min(400,(a?e.right:i.right-e.left)-30);let y=i.bottom-e.bottom;y>=b||y>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let x=(e.bottom-e.top)/s.offsetHeight,g=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/x}px; max-width: ${d/g}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}const Xk=xn.define();function n0e(t){let e=t.addToOptions.slice();return t.icons&&e.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(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let u=s[c++],d=s[c++];u>l&&a.appendChild(document.createTextNode(o.slice(l,u)));let h=a.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(u,d))),h.className="cm-completionMatchedText",l=d}return l<o.length&&a.appendChild(document.createTextNode(o.slice(l))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function e4(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.ceil((t-e)/n);return{from:t-r*n,to:t-(r-1)*n}}class r0e{constructor(e,n,r){this.view=e,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 i=e.state.field(n),{options:s,selected:a}=i.open,o=e.state.facet(Ur);this.optionContent=n0e(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=e4(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.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(e,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&&(e.dispatch({effects:Xk.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Ur).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:d0.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:a,disabled:o}=r.open;(!i.open||i.open.options!=s)&&(this.range=e4(s.length,a,e.state.facet(Ur).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),o!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let n=this.tooltipClass(e);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(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=e4(n.options.length,n.selected,this.view.state.facet(Ur).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>ns(this.view.state,o,"completion info")):(this.addInfoPane(a,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,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),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?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&&s0e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Ur).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",a=>{a.target==i&&a.preventDefault()});let s=null;for(let a=r.from;a<r.to;a++){let{completion:o,match:l}=e[a],{section:c}=o;if(c){let h=typeof c=="string"?c:c.name;if(h!=s&&(a>r.from||r.from==0))if(s=h,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let m=i.appendChild(document.createElement("completion-section"));m.textContent=h}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+a,u.setAttribute("role","option");let d=this.optionClass(o);d&&(u.className=d);for(let h of this.optionContent){let m=h(o,this.view.state,this.view,l);m&&u.appendChild(m)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function i0e(t,e){return n=>new r0e(n,t,e)}function s0e(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function jT(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function a0e(t,e){let n=[],r=null,i=null,s=u=>{n.push(u);let{section:d}=u.completion;if(d){r||(r=[]);let h=typeof d=="string"?d:d.name;r.some(m=>m.name==h)||r.push(typeof d=="string"?{name:h}:d)}},a=e.facet(Ur);for(let u of t)if(u.hasResult()){let d=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)s(new IT(h,u.source,d?d(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),m,p=a.filterStrict?new e0e(h):new Zfe(h);for(let b of u.result.options)if(m=p.match(b.label)){let x=b.displayLabel?d?d(b,m.matched):[]:m.matched,g=m.score+(b.boost||0);if(s(new IT(b,u.source,x,g)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:y}=b.section;i||(i=Object.create(null)),i[y]=Math.max(g,i[y]||-1e9)}}}}if(r){let u=Object.create(null),d=0,h=(m,p)=>(m.rank==="dynamic"&&p.rank==="dynamic"?i[p.name]-i[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(h))d-=1e5,u[m.name]=d;for(let m of n){let{section:p}=m.completion;p&&(m.score+=u[typeof p=="string"?p:p.name])}}let o=[],l=null,c=a.compareCompletions;for(let u of n.sort((d,h)=>h.score-d.score||c(d.completion,h.completion))){let d=u.completion;!l||l.label!=d.label||l.detail!=d.detail||l.type!=null&&d.type!=null&&l.type!=d.type||l.apply!=d.apply||l.boost!=d.boost?o.push(u):jT(u.completion)>jT(l)&&(o[o.length-1]=u),l=u.completion}return o}class td{constructor(e,n,r,i,s,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new td(this.options,LT(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,a){if(i&&!a&&e.some(c=>c.isPending))return i.setDisabled();let o=a0e(e,n);if(!o.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Ur).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<o.length;u++)if(o[u].completion==c){l=u;break}}return new td(o,LT(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:h0e,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new td(this.options,this.attrs,{...this.tooltip,pos:e.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 a1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new a1(u0e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Ur),s=(r.override||n.languageDataAt("autocomplete",Gc(n)).map(Jfe)).map(l=>(this.active.find(u=>u.source==l)||new Ls(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let a=this.open,o=e.effects.some(l=>l.is(Qk));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!o0e(s,this.active)||o?a=td.build(s,n,this.id,a,r,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new Ls(l.source,0):l));for(let l of e.effects)l.is(Xk)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new a1(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?l0e:c0e}}function o0e(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const l0e={"aria-autocomplete":"list"},c0e={};function LT(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const u0e=[];function LO(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(jO);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ls{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=LO(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new Ls(i.source,0)),r&4&&i.state==0&&(i=new Ls(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(s1))i=new Ls(i.source,1,s.value);else if(s.is(d0))i=new Ls(i.source,0);else if(s.is(Qk))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Gc(e.state))}}class yd extends Ls{constructor(e,n,r,i,s,a){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=Gc(e.state);if(o>a||!i||n&2&&(Gc(e.startState)==this.from||o<this.limit))return new Ls(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return d0e(i.validFor,e.state,s,a)?new yd(this.source,this.explicit,l,i,s,a):i.update&&(i=i.update(i,s,a,new RO(e.state,o,!1)))?new yd(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:Gc(e.state)):new Ls(this.source,1,this.explicit)}map(e){if(e.empty)return this;let n=this.result.map?this.result.map(this.result,e):this.result;return n?new yd(this.source,this.explicit,e.mapPos(this.limit),n,e.mapPos(this.from),e.mapPos(this.to,1)):new Ls(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function d0e(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):OO(t,!0).test(i)}const Qk=xn.define({map(t,e){return t.map(n=>n.map(e))}}),yi=Ka.define({create(){return a1.start()},update(t,e){return t.update(e)},provide:t=>[HR.from(t,e=>e.tooltip),Ze.contentAttributes.from(t,e=>e.attrs)]});function Jk(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(yi).active.find(i=>i.source==e.source);return r instanceof yd?(typeof n=="string"?t.dispatch({...Qfe(t.state,n,r.from,r.to),annotations:jO.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const h0e=i0e(yi,Jk);function _l(t,e="option"){return n=>{let r=n.state.field(yi,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Ur).interactionDelay)return!1;let i=1,s;e=="page"&&(s=qR(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,o=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),n.dispatch({effects:Xk.of(o)}),!0}}const BO=t=>{let e=t.state.field(yi,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Ur).interactionDelay?!1:Jk(t,e.open.options[e.open.selected])},jc=t=>t.state.field(yi,!1)?(t.dispatch({effects:s1.of(!0)}),!0):!1,jp=t=>{let e=t.state.field(yi,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:d0.of(null)}),!0)};class f0e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const m0e=50,p0e=1e3,g0e=hs.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(yi).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(yi),n=t.state.facet(Ur);if(!t.selectionSet&&!t.docChanged&&t.startState.field(yi)==e)return;let r=t.transactions.some(s=>{let a=LO(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;s<this.running.length;s++){let a=this.running[s];if(r||a.context.abortOnDocChange&&t.docChanged||a.updates.length+t.transactions.length>m0e&&Date.now()-a.time>p0e){for(let o of a.context.abortListeners)try{o()}catch(l){ns(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(a=>a.is(s1)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(yi);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ur).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Gc(e),r=new RO(e,n,t.explicit,this.view),i=new f0e(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:d0.of(null)}),ns(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Ur).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Ur),r=this.view.state.field(yi);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let o=Gc(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(o,s.done.from+(s.active.explicit?0:1)),c=new yd(s.active.source,s.active.explicit,l,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:o);for(let u of s.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let a=r.active.find(o=>o.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new Ls(s.active.source,0);for(let l of s.updates)o=o.update(l,n);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Qk.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(yi,!1);if(e&&e.tooltip&&this.view.state.facet(Ur).closeOnBlur){let n=e.open&&qR(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:d0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:s1.of(!1)}),20),this.composing=0}}}),y0e=typeof navigator=="object"&&/Win/.test(navigator.platform),b0e=gu.highest(Ze.domEventHandlers({keydown(t,e){let n=e.state.field(yi,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(y0e&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&Jk(e,r),!1}})),v0e=Ze.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 Vl{};zO.startSide=1;zO.endSide=-1;function x0e(t={}){return[b0e,yi,Ur.of(t),g0e,k0e,v0e]}const w0e=[{key:"Ctrl-Space",run:jc},{mac:"Alt-`",run:jc},{mac:"Alt-i",run:jc},{key:"Escape",run:jp},{key:"ArrowDown",run:_l(!0)},{key:"ArrowUp",run:_l(!1)},{key:"PageDown",run:_l(!0,"page")},{key:"PageUp",run:_l(!1,"page")},{key:"Enter",run:BO}],k0e=gu.highest(l0.computeN([Ur],t=>t.facet(Ur).defaultKeymap?[w0e]:[]));function Ei(t){let e=t.field(yi,!1);return e&&e.active.some(n=>n.isPending)?"pending":e&&e.active.some(n=>n.state!=0)?"active":null}const _0e=[zde(),nO(),Mde(),Che(Mhe,{fallback:!0}),l0.of([...IO,...aO])],h0=["custom","skill","system"];function o1(t){return t.displayCategory?t.displayCategory:t.source==="builtin-command"?"system":t.source==="bundled-skill"||t.source==="skill"?"skill":"custom"}function S0e(t,e,n=h0){return nw(o1(t),n)-nw(o1(e),n)}function nw(t,e=h0){const n=e.indexOf(t);return n>=0?n:e.length+h0.indexOf(t)}const Zk=String.raw`([^\s/]+)`,gy={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:"安装扩展"}]},yy={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"}]},by={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 文件列表"}]},vy={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 T0e(t,e,n,r){if(t==="skills"&&e.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let s=(r==="zh-CN"?gy:yy)[t];if(s||(s=(r==="zh-CN"?by:vy)[t]),!s)return null;for(const a of e){const o=s.find(l=>l.name===a);if(!(o!=null&&o.children))return null;s=o.children}return s}function PO(t,e,n){const r=t.toLowerCase(),i=e.toLowerCase(),s=r.startsWith(n),a=i.startsWith(n);return s!==a?s?-1:1:t.localeCompare(e)}function C0e(t,e,n,r){const i=S0e(t,e,r);return i!==0?i:n?PO(t.name,e.name,n):0}const E0e={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function A0e(t){const e=document.createElement("completion-section");return e.className="cm-command-section-header",e.setAttribute("aria-label",t.name),e}function M0e(t,e,n){const r=o1(t);return{name:e(E0e[r]),rank:nw(r,n),header:A0e}}function N0e(t,e){if(!t||t.includes(" ")||/^[/@!?]/.test(t))return null;const n=t.toLowerCase(),r=e.find(i=>i.name.toLowerCase().startsWith(n));return r?`/${r.name} `:null}function D0e(t,e,n){var c;const r=t.match(new RegExp(`^/${Zk}\\s+$`));if(!r)return null;const i=r[1],s=e.find(u=>u.name===i),a=n==="zh-CN"?gy:yy;if((c=s==null?void 0:s.subcommands)!=null&&c.length||a[i]||i==="skills")return null;const l=(n==="zh-CN"?by:vy)[i];return!l||l.length===0?null:`/${i} ${l[0].name} `}function I0e(t,e,n){var u,d;const r=t.match(new RegExp(`^/${Zk}(\\s*)$`));if(!r)return null;const i=r[1],s=e.find(h=>h.name===i);if(!s)return null;const a=(u=s.argumentHint)==null?void 0:u.trim();if(a)return a;const o=n==="zh-CN"?gy:yy;if((d=s.subcommands)!=null&&d.length||o[i]||i==="skills")return null;const c=(n==="zh-CN"?by:vy)[i];return!c||c.length===0?null:`[${c.map(h=>h.name).join("|")}]`}function R0e(t,e=()=>[],n=()=>"en",r=s=>s,i=()=>h0){return s=>{var x,g;const a=s.state.doc.lineAt(s.pos),l=a.text.slice(0,s.pos-a.from).match(new RegExp(`^/${Zk}\\s+(.*)$`));if(l){const[,y,w]=l,E=t().find(X=>X.name===y),S=n(),T=S==="zh-CN"?gy:yy,O=S==="zh-CN"?by:vy,z=!!T[y]||y==="skills",I=!!O[y];if(!((x=E==null?void 0:E.subcommands)!=null&&x.length)&&!z&&!I)return null;const j=w.split(/\s+/),N=j.pop()||"",B=j;if(!((g=E==null?void 0:E.subcommands)!=null&&g.length)&&!z&&I&&!N)return null;const P=T0e(y,B,e(),S);if(!P)return null;const J=N.toLowerCase(),q=`/${y} ${B.length>0?B.join(" ")+" ":""}`,Y=P.filter(X=>!N||X.name.toLowerCase().includes(J)).sort((X,H)=>N?PO(X.name,H.name,J):0),$=y==="skills"&&B.length===0,Z=$?Math.max(...Y.map(X=>X.name.length),0):0,M=Y.map(X=>{const H=`${q}${X.name}`,R=Math.max(Z-X.name.length,0);return{label:X.name,...$?{displayLabel:`${X.name}${" ".repeat(R)}`,type:"skill"}:{},detail:X.description||void 0,...$&&X.description?{info:`/${X.name}

${X.description}`}:{},apply:`${H} `}});return M.length===0?null:{from:a.from,options:M,filter:!1}}const c=a.text.match(/^\/([^\s/]*)$/);if(!c)return null;const u=c[1],d=t(),h=i()??h0,m=u.toLowerCase(),b=d.filter(y=>u?y.name.toLowerCase().includes(m):!0).sort((y,w)=>C0e(y,w,m,h)).map(y=>{const w=`/${y.name}`,C=o1(y),E=C==="custom"||C==="skill";return{label:w,detail:y.description||void 0,...E&&y.description?{info:`${w}

${y.description}`}:{},apply:`${w} `,section:M0e(y,r,h)}});return b.length===0?null:{from:a.from,to:a.to,options:b,filter:!1}}}function O0e(t){return e=>j0e(e,t)}function j0e(t,e){const n=t.state.doc.lineAt(t.pos),i=n.text.slice(0,t.pos-n.from).match(/@([\w./-]*)$/);if(!i)return null;const s=e();if(!s)return null;const a=i[1],o=t.pos-i[0].length;return L0e(a,s).then(l=>l.length===0?null:{from:o,options:l.map(c=>({label:`@${c}`,apply:`@${c} `,type:"file"})),filter:!1})}async function L0e(t,e){try{const n=t?`${t}*`:"**/*";return(await e(n,{maxResults:50})).matches.filter(i=>i!==".")}catch{return[]}}const B0e="qwen-web-shell-history",$O=100;function z0e(t){try{const e=localStorage.getItem(t);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch{return[]}}function P0e(t,e){try{localStorage.setItem(t,JSON.stringify(e.slice(-$O)))}catch{}}function BT(t=B0e){const e=v.useRef(t);e.current=t;const n=v.useRef(z0e(t)),r=v.useRef(-1),i=v.useRef(""),s=v.useRef(-1),[a,o]=v.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=v.useCallback(()=>{const y=n.current,w=r.current;o({canUp:y.length>0&&(w===-1||w>0),canDown:w!==-1})},[]),c=v.useCallback(y=>{const w=n.current;w[w.length-1]!==y&&(w.push(y),w.length>$O&&w.shift(),P0e(e.current,w),r.current=-1,l())},[l]),u=v.useCallback(y=>{const w=n.current;if(w.length===0)return null;if(r.current===-1)i.current=y,r.current=w.length-1;else if(r.current>0)r.current--;else return null;return l(),w[r.current]},[l]),d=v.useCallback(()=>{const y=n.current;return r.current===-1?null:r.current<y.length-1?(r.current++,l(),y[r.current]):(r.current=-1,l(),i.current)},[l]),h=v.useCallback(()=>r.current!==-1,[]),m=v.useCallback(()=>{r.current=-1,s.current=-1,l()},[l]),p=v.useCallback(y=>{const w=n.current;if(w.length===0||!y)return null;const C=s.current===-1?w.length-1:s.current-1;if(C<0)return s.current=-1,null;const E=y.toLowerCase();for(let S=C;S>=0;S--)if(w[S].toLowerCase().includes(E))return s.current=S,w[S];return s.current=-1,null},[]),b=v.useCallback(y=>{const w=y.trim().toLowerCase();return n.current.slice().reverse().filter(C=>!w||C.toLowerCase().includes(w))},[]),x=v.useCallback(y=>{const w=n.current;if(!y)return w.length>0?w[w.length-1]:null;for(let C=w.length-1;C>=0;C--)if(y(w[C]))return w[C];return null},[]),g=v.useCallback(()=>{s.current=-1},[]);return{push:c,navigateUp:u,navigateDown:d,isNavigating:h,reset:m,searchReverse:p,getReverseMatches:b,getLastEntry:x,resetSearch:g,nav:a}}const $0e=rn.mark({class:"cm-input-slash"}),U0e=rn.mark({class:"cm-input-at"}),H0e=rn.mark({class:"cm-input-code"});class q0e extends Vo{constructor(e){super(),this.text=e}eq(e){return e.text===this.text}toDOM(){const e=document.createElement("span");return e.className="cm-input-slash-argument-hint",e.textContent=this.text,e}ignoreEvent(){return!0}}function zT(t,e,n){const r=new Zc,i=t.state.doc,s=[];for(let a=1;a<=i.lines;a++){const o=i.line(a),l=o.text,c=o.from;if(l.startsWith("/")){const p=l.indexOf(" "),b=p===-1?l.length:p;s.push({from:c,to:c+b,deco:$0e})}const u=I0e(l,e(),n());if(u){const p=l.endsWith(" ")?"":" ";s.push({from:c+l.length,to:c+l.length,deco:rn.widget({widget:new q0e(`${p}${u}`),side:1})})}const d=/@[^\s]+/g;let h;for(;(h=d.exec(l))!==null;)s.push({from:c+h.index,to:c+h.index+h[0].length,deco:U0e});const m=/`[^`]+`/g;for(;(h=m.exec(l))!==null;)s.push({from:c+h.index,to:c+h.index+h[0].length,deco:H0e})}s.sort((a,o)=>a.from-o.from||a.to-o.to);for(const{from:a,to:o,deco:l}of s)r.add(a,o,l);return r.finish()}function F0e(t=()=>[],e=()=>"en"){return hs.fromClass(class{constructor(n){ie(this,"decorations");this.decorations=zT(n,t,e)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=zT(n.view,t,e))}},{decorations:n=>n.decorations})}const V0e=Ze.baseTheme({".cm-input-slash":{color:"var(--accent-color, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--text-secondary, #a0aec0)"},".cm-input-slash-argument-hint":{color:"var(--text-tertiary, rgba(160, 174, 192, 0.55))",pointerEvents:"none"}}),G0e="_container_1b7lf_1",W0e="_borderTop_1b7lf_5",K0e="_borderBottom_1b7lf_6",Y0e="_borderTopLabel_1b7lf_15",X0e="_line_1b7lf_31",Q0e="_prefix_1b7lf_37",J0e="_prefixShell_1b7lf_46",Z0e="_prefixAutoEdit_1b7lf_50",eme="_prefixYolo_1b7lf_54",tme="_shellMode_1b7lf_58",nme="_modePlan_1b7lf_64",rme="_modeAutoEdit_1b7lf_69",ime="_modeYolo_1b7lf_74",sme="_wrapper_1b7lf_79",ame="_hints_1b7lf_84",ome="_hintItem_1b7lf_95",lme="_hintKey_1b7lf_112",cme="_hintSep_1b7lf_126",ume="_searchBar_1b7lf_130",dme="_searchLabel_1b7lf_138",hme="_searchInput_1b7lf_143",fme="_searchHint_1b7lf_157",mme="_searchResults_1b7lf_163",pme="_searchResult_1b7lf_163",gme="_searchResultActive_1b7lf_190",yme="_searchResultMarker_1b7lf_195",bme="_searchResultText_1b7lf_200",vme="_searchEmpty_1b7lf_207",xme="_images_1b7lf_213",wme="_tags_1b7lf_220",kme="_tag_1b7lf_220",_me="_inlineTag_1b7lf_241",Sme="_tagLabel_1b7lf_257",Tme="_tagValue_1b7lf_258",Cme="_tagRemove_1b7lf_276",Eme="_imageThumb_1b7lf_295",Ame="_imageRemove_1b7lf_310",bt={container:G0e,borderTop:W0e,borderBottom:K0e,borderTopLabel:Y0e,line:X0e,prefix:Q0e,prefixShell:J0e,prefixAutoEdit:Z0e,prefixYolo:eme,shellMode:tme,modePlan:nme,modeAutoEdit:rme,modeYolo:ime,wrapper:sme,hints:ame,hintItem:ome,hintKey:lme,hintSep:cme,searchBar:ume,searchLabel:dme,searchInput:hme,searchHint:fme,searchResults:mme,searchResult:pme,searchResultActive:gme,searchResultMarker:yme,searchResultText:bme,searchEmpty:vme,images:xme,tags:wme,tag:kme,inlineTag:_me,tagLabel:Sme,tagValue:Tme,tagRemove:Cme,imageThumb:Eme,imageRemove:Ame},PT=new ch,$T=new ch,Mme=1e3,Nme=10;function Dme(t){return t.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function Ime(t){return[...t].length>Mme||t.split(`
`).length>Nme}function Rme(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ome(t,e,n){const i=`[Pasted Content ${[...n].length} chars]`,s=e===1?i:`${i} #${e}`;return t.set(s,n),{placeholderText:s,nextPasteId:e+1}}function jme(t,e){for(const n of t.keys())e.includes(n)||t.delete(n);return t.size===0?1:null}function Lme(t,e){if(t.size===0)return e;const n=[...t.keys()].sort((i,s)=>s.length-i.length),r=new RegExp(n.map(Rme).join("|"),"g");return e.replace(r,i=>t.get(i)??i)}function Bme(t,e){if(e)return"";switch(t){case"plan":return bt.modePlan;case"auto-edit":return bt.modeAutoEdit;case"yolo":return bt.modeYolo;default:return""}}function Lp(t){var e,n;return((e=t.value)==null?void 0:e.trim())||((n=t.label)==null?void 0:n.trim())||t.id}function zme(t){return t.map(Lp).join(`
`)}function e5(t){var e;return((e=t.label)==null?void 0:e.trim())??""}function t5(t){var e;return((e=t.value)==null?void 0:e.trim())??""}function UO(t){return t5(t)||e5(t)||t.id}function t4(t,e){const n=zme(e);return n?t?`${n}

${t}`:n:t}const rw=xn.define({map:t=>t}),n5=xn.define(),kc=xn.define();class Pme extends Vo{constructor(e){super(),this.tag=e}eq(e){return this.tag.id===e.tag.id&&this.tag.label===e.tag.label&&this.tag.value===e.tag.value&&this.tag.removable===e.tag.removable}toDOM(e){const n=document.createElement("span");n.className=bt.inlineTag;const r=e5(this.tag),i=t5(this.tag);if(r){const s=document.createElement("span");s.className=bt.tagLabel,s.textContent=r,n.appendChild(s)}if(i){const s=document.createElement("span");s.className=bt.tagValue,s.textContent=i,n.appendChild(s)}else if(!r){const s=document.createElement("span");s.className=bt.tagLabel,s.textContent=this.tag.id,n.appendChild(s)}if(this.tag.removable!==!1){const s=document.createElement("button");s.type="button",s.className=bt.tagRemove,s.setAttribute("aria-label",`Remove ${UO(this.tag)}`),s.textContent="×",s.addEventListener("mousedown",a=>a.preventDefault()),s.addEventListener("click",a=>{a.stopPropagation();const o=[];e.state.field(nd).between(0,e.state.doc.length,(l,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:l,to:c,insert:""})}),o.length!==0&&(e.dispatch({changes:o,effects:n5.of({predicate:l=>l.id===this.tag.id}),scrollIntoView:!0}),e.focus())}),n.appendChild(s)}return n}ignoreEvent(){return!1}}function $me(t){const e={widget:new Pme(t.tag),inclusive:!1,tag:t.tag};return rn.replace(e).range(t.from,t.to)}const nd=Ka.define({create(){return rn.none},update(t,e){let n=t.map(e.changes);for(const r of e.effects)r.is(rw)?n=n.update({add:[$me(r.value)]}):r.is(n5)?n=n.update({filter:(i,s,a)=>{const o=a.spec.tag;return o&&r.value.predicate?!r.value.predicate(o):!0}}):r.is(kc)&&(n=rn.none);return n},provide:t=>[Ze.decorations.from(t),Ze.atomicRanges.of(e=>e.state.field(t))]});function Ume(t){const e=[];return t.state.field(nd).between(0,t.state.doc.length,(n,r,i)=>{const s=i.spec.tag;s&&e.push(s)}),e}const Hme=v.forwardRef(function({onSubmit:e,onCycleMode:n,onToggleShortcuts:r,disabled:i=!1,placeholderText:s="Type a message...",commands:a,skills:o=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:u,onClearQueuedMessages:d,currentMode:h="default",draftText:m,draftVersion:p,onFocusFooter:b,dialogOpen:x=!1,followupState:g,onAcceptFollowup:y,onDismissFollowup:w,sessionName:C,composerInput:E,composerInputVersion:S},T){const O=BA(),{language:z,t:I}=dt(),j=v.useRef(null),N=v.useRef(null),B=v.useRef(e);B.current=e;const P=v.useRef(n);P.current=n;const J=v.useRef(r);J.current=r;const q=v.useRef(i);q.current=i;const Y=v.useRef(a);Y.current=a;const $=v.useRef(o);$.current=o;const Z=v.useRef(l);Z.current=l;const M=v.useRef(I);M.current=I;const X=v.useRef(c);X.current=c;const H=v.useRef(u);H.current=u;const R=v.useRef(d);R.current=d;const ae=v.useRef(g);ae.current=g;const xe=v.useRef(y);xe.current=y;const ye=v.useRef(w);ye.current=w;const Ae=v.useRef(b);Ae.current=b;const Fe=v.useRef(z);Fe.current=z;const vt=v.useRef(O==null?void 0:O.actions);vt.current=O==null?void 0:O.actions;const[Nt,pt]=v.useState(!1),Qe=v.useRef(Nt);Qe.current=Nt;const[Ge,$t]=v.useState(!1),[Je,re]=v.useState(""),[ce,Ie]=v.useState([]),[We,me]=v.useState(0),rt=v.useRef(null),oe=v.useRef(null),Oe=v.useRef(""),[Re,$e]=v.useState([]),ne=v.useRef([]),ge=v.useRef(new Map),ke=v.useRef(1),[ze,ot]=v.useState([]),Ut=v.useRef([]);Ut.current=ze;const Xt=v.useRef(E);Xt.current=E;const En=v.useRef(()=>!0),Dn=v.useRef(null),Yn=BT(),wn=BT("qwen-web-shell-command-history"),{push:nr,navigateUp:fe,navigateDown:G,isNavigating:te,reset:Ue,getReverseMatches:Gt,getLastEntry:xt,resetSearch:zt}=Yn,Tt=v.useRef({push:nr,navigateUp:fe,navigateDown:G,isNavigating:te,reset:Ue,getReverseMatches:Gt,getLastEntry:xt,resetSearch:zt});Tt.current={push:nr,navigateUp:fe,navigateDown:G,isNavigating:te,reset:Ue,getReverseMatches:Gt,getLastEntry:xt,resetSearch:zt};const sn=v.useRef(wn);sn.current=wn,ne.current=Re;const Vn=v.useCallback(()=>{if(q.current)return;const W=N.current;if(!W)return;const se=W.state.doc.toString();Oe.current=se,$t(!0),re(se);const le=Qe.current?sn.current:Tt.current;Ie(le.getReverseMatches(se)),me(0),le.resetSearch(),setTimeout(()=>{var Pe;return(Pe=rt.current)==null?void 0:Pe.focus()},0)},[]),Hi=v.useRef(Vn);Hi.current=Vn;const qi=v.useCallback(()=>{if(q.current)return;const W=N.current;if(!W)return;if(Ei(W.state)==="active"){_l(!1)(W),W.focus();return}if(W.state.doc.lines>1){W.focus();return}const se=Qe.current?sn.current:Tt.current,le=W.state.doc.toString(),Pe=se.navigateUp(le);Pe!==null&&W.dispatch({changes:{from:0,to:W.state.doc.length,insert:Pe},selection:{anchor:Pe.length}}),W.focus()},[]),ps=v.useCallback(()=>{if(q.current)return;const W=N.current;if(!W)return;if(Ei(W.state)==="active"){_l(!0)(W),W.focus();return}if(W.state.doc.lines>1){W.focus();return}const le=(Qe.current?sn.current:Tt.current).navigateDown();le!==null&&W.dispatch({changes:{from:0,to:W.state.doc.length,insert:le},selection:{anchor:le.length}}),W.focus()},[]);v.useEffect(()=>{var ur,hh;if(!j.current)return;const W=document.createElement("div");W.setAttribute("data-web-shell-tooltip-portal",""),W.style.position="fixed",W.style.inset="0",W.style.zIndex="var(--web-shell-tooltip-z-index)",W.style.pointerEvents="none";const se=/\b\S*theme(?:Dark|Light)\S*/gi,le=()=>{var wt,Pt;let be=j.current,it=null;if(j.current){const ft=getComputedStyle(j.current);for(let Rt=0;Rt<ft.length;Rt+=1){const Qt=ft[Rt];Qt.startsWith("--")&&W.style.setProperty(Qt,ft.getPropertyValue(Qt))}ft.getPropertyValue("--web-shell-tooltip-z-index").trim()||W.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;be;){const ft=(Pt=(wt=be.className)==null?void 0:wt.match)==null?void 0:Pt.call(wt,se);if(ft){it=ft[0];break}be=be.parentElement}it&&(W.className=it)};le(),document.body.appendChild(W);const Pe=new MutationObserver(le);let St=j.current;for(;St&&(Pe.observe(St,{attributes:!0,attributeFilter:["class","style"]}),!((hh=(ur=St.className)==null?void 0:ur.match)!=null&&hh.call(ur,se)));)St=St.parentElement;const ct=(be,it,wt)=>{var Ys;const Pt=(it??be.state.doc.toString()).trim(),ft=wt??Ut.current;if(!Pt&&ft.length===0)return!0;const Rt=Lme(ge.current,Pt),Qt=t4(Rt,ft),An=ne.current,bs=Qe.current;return B.current(bs?`!${Qt}`:Qt,An.length>0?[...An]:void 0)===!1||((Ys=ye.current)==null||Ys.call(ye),ge.current.clear(),ke.current=1,bs?(sn.current.push(Rt),sn.current.reset()):(Tt.current.push(Rt),Tt.current.reset()),ot([]),$e([]),be.dispatch({changes:{from:0,to:be.state.doc.length,insert:""},effects:kc.of()})),!0};En.current=ct;const Ct=[R0e(()=>Y.current,()=>$.current,()=>Fe.current,be=>M.current(be),()=>Z.current),O0e(()=>{var be;return(be=vt.current)==null?void 0:be.globWorkspace})],Xn=be=>(be.dispatch(be.state.replaceSelection(`
`)),!0),tn=l0.of([{key:"Backspace",run:be=>{var ft;const it=be.state.selection.main;if(!it.empty||it.from!==0)return!1;let wt=!1;if(be.state.field(nd).between(0,1,Rt=>{Rt===0&&(wt=!0)}),wt)return!1;let Pt=-1;for(let Rt=Ut.current.length-1;Rt>=0;Rt-=1)if(((ft=Ut.current[Rt])==null?void 0:ft.removable)!==!1){Pt=Rt;break}return Pt<0?!1:(ot(Rt=>Rt.filter((Qt,An)=>An!==Pt)),!0)}},{key:"Delete",run:be=>{const it=be.state.selection.main;if(!it.empty||it.from!==0)return!1;let wt=!1;if(be.state.field(nd).between(0,1,ft=>{ft===0&&(wt=!0)}),wt)return!1;const Pt=Ut.current.findIndex(ft=>ft.removable!==!1);return Pt<0?!1:(ot(ft=>ft.filter((Rt,Qt)=>Qt!==Pt)),!0)}},{key:"Enter",run:be=>{var wt;if(Ei(be.state)==="active")return!1;const it=ae.current;return be.state.doc.toString().length===0&&(it!=null&&it.isVisible)&&it.suggestion?((wt=xe.current)==null||wt.call(xe,"enter",{skipOnAccept:!0}),ct(be,it.suggestion)):ct(be)}},{key:"Shift-Enter",run:Xn},{key:"Ctrl-j",run:Xn},{key:"Mod-Enter",run:Xn},{key:"Alt-Enter",run:Xn},{key:"Escape",run:()=>{var be;return Qe.current?(pt(!1),!0):X.current.length===0?!1:((be=R.current)==null?void 0:be.call(R))??!1}},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:be=>{var Rt;const it=Qe.current?sn.current:Tt.current,wt=it.isNavigating();if(Ei(be.state)==="active"&&!wt)return _l(!1)(be);if(wt&&jp(be),be.state.doc.lines>1)return!1;if(Qe.current){const Qt=be.state.doc.toString(),An=it.navigateUp(Qt);return An===null||be.dispatch({changes:{from:0,to:be.state.doc.length,insert:An},selection:{anchor:An.length}}),!0}if(X.current.length>0){const Qt=(Rt=H.current)==null?void 0:Rt.call(H);if(Qt){const An=be.state.doc.toString(),bs=An.trim()?`${Qt}
${An}`:Qt;return be.dispatch({changes:{from:0,to:be.state.doc.length,insert:bs},selection:{anchor:bs.length}}),!0}}const Pt=be.state.doc.toString(),ft=it.navigateUp(Pt);return ft===null?!1:(be.dispatch({changes:{from:0,to:be.state.doc.length,insert:ft},selection:{anchor:ft.length}}),!0)}},{key:"ArrowDown",run:be=>{var ft;const it=Qe.current?sn.current:Tt.current,wt=it.isNavigating();if(Ei(be.state)==="active"&&!wt)return _l(!0)(be);if(wt&&jp(be),be.state.doc.lines>1)return!1;if(Qe.current){const Rt=it.navigateDown();return Rt===null||be.dispatch({changes:{from:0,to:be.state.doc.length,insert:Rt},selection:{anchor:Rt.length}}),!0}const Pt=it.navigateDown();return Pt===null?((ft=Ae.current)==null?void 0:ft.call(Ae))??!1:(be.dispatch({changes:{from:0,to:be.state.doc.length,insert:Pt},selection:{anchor:Pt.length}}),!0)}},{key:"Ctrl-r",run:()=>(Hi.current(),!0)},{key:"Tab",run:be=>{var Rt;if(Ei(be.state)==="active")return BO(be);const it=be.state.doc.toString(),wt=D0e(it,Y.current,Fe.current);if(wt)return be.dispatch({changes:{from:0,to:be.state.doc.length,insert:wt},selection:{anchor:wt.length}}),!0;const Pt=N0e(it,Y.current);if(Pt)return be.dispatch({changes:{from:0,to:be.state.doc.length,insert:Pt},selection:{anchor:Pt.length}}),!0;const ft=ae.current;return it.length===0&&(ft!=null&&ft.isVisible)&&ft.suggestion&&((Rt=xe.current)==null||Rt.call(xe,"tab")),!0}},{key:"ArrowRight",run:be=>{var wt;const it=ae.current;return Ei(be.state)!=="active"&&be.state.doc.toString().length===0&&(it!=null&&it.isVisible)&&it.suggestion?((wt=xe.current)==null||wt.call(xe,"right"),!0):!1}},{key:"Shift-Tab",run:()=>{var be;return(be=P.current)==null||be.call(P),!0}}]),Or=Ze.updateListener.of(be=>{if(!be.docChanged&&!be.selectionSet)return;if(be.docChanged&&ge.current.size>0){const ft=jme(ge.current,be.state.doc.toString());ft!==null&&(ke.current=ft)}const it=be.state.selection.main;if(!it.empty)return;const wt=be.state.doc.lineAt(it.head);wt.from===0&&wt.text.startsWith("/")&&window.setTimeout(()=>{const ft=N.current;if(!ft||Ei(ft.state)==="active")return;const Rt=ft.state.selection.main;if(!Rt.empty)return;const Qt=ft.state.doc.lineAt(Rt.head);Qt.from===0&&Qt.text.startsWith("/")&&jc(ft)},0)});let ac=!1;const wy=Ze.updateListener.of(be=>{const it=Dn.current,wt=Ei(be.state)==="active";if(it){const Pt=be.state.doc;if(!(Pt.length===it.from+it.text.length&&Pt.sliceString(it.from)===it.text))Dn.current=null;else if(ac&&!wt){Dn.current=null;const{view:Rt}=be,{from:Qt}=it;window.setTimeout(()=>{if(N.current!==Rt)return;const An=Rt.state.doc;An.length===Qt+it.text.length&&An.sliceString(Qt)===it.text&&Rt.dispatch({changes:{from:Qt,to:An.length,insert:""}})},0)}}ac=wt}),ky=mn.create({doc:"",extensions:[gu.highest(tn),_0e,nO(),l0.of([...IO,...aO]),x0e({override:Ct,activateOnTyping:!0,icons:!1,optionClass:be=>be.type==="file"?"cm-file-completion":be.info?"cm-command-info-completion":"",aboveCursor:!0,positionInfo:(be,it,wt,Pt,ft)=>{const Rt=Pt.bottom-Pt.top,Qt=ft.bottom-it.bottom,An=Qt>=Rt||Qt>it.top,bs=An?"top":"bottom",eo=An?wt.bottom-it.top:it.bottom-wt.top;return{style:`${bs}: ${eo}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:be=>typeof be.apply=="string"&&be.apply.endsWith(" ")}),Gde({parent:W}),$T.of(uT("")),Ze.lineWrapping,PT.of(Ze.editable.of(!0)),F0e(()=>Y.current,()=>Fe.current),V0e,nd,Or,wy,Ze.inputHandler.of((be,it,wt,Pt)=>{var ft,Rt,Qt;return Pt.length>0&&be.state.doc.toString()===""&&((ft=ae.current)!=null&&ft.isVisible)&&((Rt=ye.current)==null||Rt.call(ye)),Pt==="!"&&be.state.doc.toString()===""&&Ei(be.state)!=="active"?(pt(An=>!An),!0):Pt==="?"&&be.state.doc.toString()===""&&Ei(be.state)!=="active"?((Qt=J.current)==null||Qt.call(J),!0):!1}),Ze.domEventHandlers({paste(be){var An,bs,eo,Ys;const it=(An=be.clipboardData)==null?void 0:An.items;if(!it)return!1;let wt=!1;for(const Vi of it)if(Vi.type.startsWith("image/")){wt=!0;const q0=Vi.getAsFile();if(!q0)continue;const to=Vi.type,Ko=new FileReader;Ko.onload=()=>{const _y=Ko.result.split(",")[1];$e(Sy=>[...Sy,{data:_y,media_type:to}])},Ko.readAsDataURL(q0)}if(wt)return be.preventDefault(),!0;const Pt=Dme(((bs=be.clipboardData)==null?void 0:bs.getData("text/plain"))??"");if(!Pt||!Ime(Pt))return!1;be.preventDefault(),Wo.state.doc.toString()===""&&((eo=ae.current)!=null&&eo.isVisible)&&((Ys=ye.current)==null||Ys.call(ye));const{placeholderText:ft,nextPasteId:Rt}=Ome(ge.current,ke.current,Pt);ke.current=Rt;const Qt=Wo.state.selection.main;return Wo.dispatch({changes:{from:Qt.from,to:Qt.to,insert:ft},selection:{anchor:Qt.from+ft.length},scrollIntoView:!0}),!0}}),Ze.theme({"&":{fontSize:"14px",background:"transparent",border:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{overflow:"visible"},".cm-content":{padding:"0",fontFamily:'var(--font-mono, "SF Mono", "Fira Code", monospace)',color:"var(--text-primary, #e0e0e0)",caretColor:"var(--accent-color, #4a9eff)"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--text-dimmed, #666)"},".cm-cursor":{borderLeftColor:"var(--accent-color, #4a9eff)",borderLeftWidth:"2px"}})]}),Wo=new Ze({state:ky,parent:j.current});return N.current=Wo,Wo.focus(),()=>{Wo.destroy(),N.current=null,Pe.disconnect(),W.remove()}},[]),v.useEffect(()=>{const W=N.current;W&&(W.dispatch({effects:PT.reconfigure(Ze.editable.of(!i))}),i||W.focus())},[i]),v.useEffect(()=>{const W=N.current;if(!W)return;const le=(g!=null&&g.isVisible&&g.suggestion?g.suggestion:null)??s;W.dispatch({effects:$T.reconfigure(uT(le))})},[s,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]),v.useEffect(()=>{const W=N.current;!W||m===void 0||(W.dispatch({changes:{from:0,to:W.state.doc.length,insert:m},selection:{anchor:m.length}}),W.focus())},[m,p]),v.useEffect(()=>{const W=N.current;!W||Ei(W.state)!=="active"||(jp(W),window.setTimeout(()=>{N.current===W&&jc(W)},0))},[z]),v.useEffect(()=>{const W=N.current;W&&(x?W.contentDOM.blur():W.focus())},[x]),v.useEffect(()=>{const W=se=>{var ct,Ct,Xn,tn;if(q.current||Ge||x||se.defaultPrevented)return;const le=N.current,Pe=ae.current;if(le&&!le.hasFocus&&(Pe!=null&&Pe.isVisible)&&Pe.suggestion&&le.state.doc.toString().length===0&&!Ug(se.target)){if(se.key==="Tab"&&!se.shiftKey&&!se.metaKey&&!se.ctrlKey&&!se.altKey&&Ei(le.state)!=="active"){se.preventDefault(),(ct=xe.current)==null||ct.call(xe,"tab");return}if(se.key==="ArrowRight"&&!se.shiftKey&&!se.metaKey&&!se.ctrlKey&&!se.altKey&&Ei(le.state)!=="active"){se.preventDefault(),(Ct=xe.current)==null||Ct.call(xe,"right");return}}if(se.metaKey||se.ctrlKey||se.altKey||se.key.length!==1||Ug(se.target)||!le||le.hasFocus)return;if(se.preventDefault(),se.key==="!"&&le.state.doc.toString()===""){(Xn=ae.current)!=null&&Xn.isVisible&&((tn=ye.current)==null||tn.call(ye)),pt(Or=>!Or),le.focus();return}const St=le.state.selection.main;le.dispatch({changes:{from:St.from,to:St.to,insert:se.key},selection:{anchor:St.from+se.key.length},scrollIntoView:!0}),le.focus(),(se.key==="/"||se.key==="@")&&window.setTimeout(()=>{const Or=N.current;Or&&Or.hasFocus&&jc(Or)},0)};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[Ge,x]);const lt=v.useCallback(()=>{var W;(W=N.current)==null||W.focus()},[]),an=v.useCallback((W,se)=>{const le=N.current;if(!le||!W){le==null||le.focus();return}if((se==null?void 0:se.mode)==="replace"){le.dispatch({changes:{from:0,to:le.state.doc.length,insert:W},effects:kc.of(),selection:{anchor:W.length},scrollIntoView:!0}),le.focus();return}const Pe=le.state.selection.main;let St=W,ct=!1,Ct=null,Xn=W==="/"||W==="@";if(W==="/")le.state.doc.lineAt(Pe.head).text.startsWith("/")?ct=!0:le.state.doc.length>0&&(ct=!0,Xn=!1);else if(W==="@"){const tn=Pe.from>0?le.state.doc.sliceString(Pe.from-1,Pe.from):"";le.state.doc.sliceString(Pe.from,Pe.from+1)==="@"?(ct=!0,Ct=Pe.from+1):tn==="@"?ct=!0:tn&&!/\s/.test(tn)&&(St=" @")}ct?Ct!==null&&le.dispatch({selection:{anchor:Ct},scrollIntoView:!0}):(le.dispatch({changes:{from:Pe.from,to:Pe.to,insert:St},selection:{anchor:Pe.from+St.length},scrollIntoView:!0}),Xn&&(Dn.current={text:St,from:Pe.from})),le.focus(),Xn&&window.setTimeout(()=>{const tn=N.current;tn&&tn.hasFocus&&jc(tn)},0)},[]),cr=v.useCallback(()=>{var W;return((W=N.current)==null?void 0:W.state.doc.toString())??""},[]),Vs=v.useCallback(W=>{const se=N.current;se&&(se.dispatch({changes:{from:0,to:se.state.doc.length,insert:W},effects:kc.of(),selection:{anchor:W.length},scrollIntoView:!0}),se.focus())},[]),ua=v.useCallback(W=>{const se=N.current;if(!se)return;const le=[];se.state.field(nd).between(0,se.state.doc.length,(Pe,St,ct)=>{const Ct=ct.spec.tag;Ct&&(!W||W(Ct))&&le.push({from:Pe,to:St,insert:""})}),se.dispatch({...le.length>0?{changes:le}:{},effects:n5.of({predicate:W}),scrollIntoView:!0})},[]),Gs=v.useCallback(W=>{const se=(W==null?void 0:W.text)??!0,le=(W==null?void 0:W.tags)??!0,Pe=N.current;se&&Pe&&Pe.state.doc.length>0&&Pe.dispatch({changes:{from:0,to:Pe.state.doc.length,insert:""},effects:kc.of()}),se&&($e([]),ge.current.clear(),ke.current=1),le&&(ot([]),se||ua())},[ua]),Ya=v.useCallback(()=>{Gs({text:!0,tags:!1})},[Gs]),Xa=v.useCallback((W,se)=>{if(W.length!==0){if((se==null?void 0:se.placement)==="inline"){const le=N.current;if(!le)return;const Pe=le.state.selection.main;let St=Pe.from;const ct=[],Ct=W.map(tn=>{const Or=Lp(tn);return ct.push({from:St,to:St+Or.length,tag:tn}),St+=Or.length+1,Or}).join(" "),Xn=Ct?`${Ct} `:"";le.dispatch({changes:{from:Pe.from,to:Pe.to,insert:Xn},effects:ct.length>0?ct.map(tn=>rw.of(tn)):void 0,selection:{anchor:Pe.from+Xn.length},scrollIntoView:!0}),le.focus();return}ot(le=>{const Pe=[...le];for(const St of W){const ct=Pe.findIndex(Ct=>Ct.id===St.id);ct>=0?Pe[ct]=St:Pe.push(St)}return Pe})}},[]),da=v.useCallback(W=>{ot(se=>se.filter(le=>le.id!==W||le.removable===!1)),ua(se=>se.id===W&&se.removable!==!1)},[ua]),rc=v.useCallback(()=>{var W;return(((W=N.current)==null?void 0:W.state.doc.toString().trim().length)??0)>0||Ut.current.length>0||ne.current.length>0},[]),Rr=v.useCallback(W=>{const se=N.current;if(!se)return;const le=Ume(se);if((W==null?void 0:W.tagPlacement)==="inline"){En.current(se,t4(W.text??"",W.tags??le),[]);return}if((W==null?void 0:W.text)!==void 0&&W.tags===void 0&&le.length>0){En.current(se,t4(W.text,le),[]);return}En.current(se,W==null?void 0:W.text,W?W.tags??[]:void 0)},[]),ic=v.useCallback(()=>{const W=Tt.current.getLastEntry(le=>!le.startsWith("/")&&!le.startsWith("!"));!W||B.current(W)===!1||$e([])},[]);v.useImperativeHandle(T,()=>({clearText:Ya,clear:Gs,focus:lt,getText:cr,hasInput:rc,setText:Vs,addTags:Xa,removeTag:da,insertText:an,retryLast:ic,submit:Rr}),[Xa,Gs,Ya,lt,cr,rc,an,da,ic,Vs,Rr]),v.useEffect(()=>{const W=Xt.current;if(!W)return;const se=N.current;if(!se)return;const le=W.tagPlacement??"top";if(W.tags!==void 0&&le==="top"&&ot([...W.tags]),W.text!==void 0||le==="inline"){const St=le==="inline"?[...W.tags??[]]:[],ct=St.map(Lp).join(" "),Ct=le==="inline"?ct&&W.text?`${ct} ${W.text}`:ct||(W.text??""):W.text??"",Xn=[kc.of()];if(St.length>0){let tn=0;for(const Or of St){const ac=Lp(Or);Xn.push(rw.of({from:tn,to:tn+ac.length,tag:Or})),tn+=ac.length+1}}se.dispatch({changes:{from:0,to:se.state.doc.length,insert:Ct},effects:Xn,selection:{anchor:Ct.length},scrollIntoView:!0})}else se.dispatch({effects:kc.of()});(W.text!==void 0||W.submit)&&se.focus();let Pe=null;return W.submit&&(Pe=window.setTimeout(()=>{N.current&&Rr(W)},0)),()=>{Pe!==null&&window.clearTimeout(Pe)}},[S,Rr]);const gs=v.useCallback(W=>{const se=N.current;se&&se.dispatch({changes:{from:0,to:se.state.doc.length,insert:W},selection:{anchor:W.length},scrollIntoView:!0})},[]),wr=v.useCallback((W,se=!0)=>{var Pe;W&&gs(Oe.current),$t(!1),re(""),Ie([]),me(0),(Qe.current?sn.current:Tt.current).resetSearch(),se&&((Pe=N.current)==null||Pe.focus())},[gs]);v.useEffect(()=>{if(!Ge)return;const W=se=>{if(se instanceof MouseEvent&&se.button!==0||se.defaultPrevented)return;const le=oe.current,Pe=se.target;le&&Pe instanceof Node&&!le.contains(Pe)&&wr(!0,!1)};return window.addEventListener("mousedown",W),window.addEventListener("touchstart",W),()=>{window.removeEventListener("mousedown",W),window.removeEventListener("touchstart",W)}},[Ge,wr]);const Ws=v.useCallback(W=>{var Ct;if(!N.current)return;wr(!1);const le=W.trim();if(!le)return;const Pe=ne.current,St=Qe.current;if(B.current(St?`!${le}`:le,Pe.length>0?[...Pe]:void 0)===!1){gs(W);return}(Ct=ye.current)==null||Ct.call(ye),St?(sn.current.push(le),sn.current.reset()):(Tt.current.push(le),Tt.current.reset()),$e([]),gs("")},[wr,gs]),ys=W=>{if(W.key==="Escape")W.preventDefault(),wr(!0);else if(W.key==="Tab"){W.preventDefault();const se=ce[We];se&&gs(se),wr(!1)}else if(W.key==="Enter"){W.preventDefault();const se=ce[We];se?Ws(se):wr(!1)}else W.key==="r"&&W.ctrlKey?(W.preventDefault(),ce.length>0&&me(se=>(se+1)%ce.length)):W.key==="ArrowDown"?(W.preventDefault(),ce.length>0&&me(se=>(se+1)%ce.length)):W.key==="ArrowUp"&&(W.preventDefault(),ce.length>0&&me(se=>(se-1+ce.length)%ce.length))},Go=W=>{const se=W.target.value;re(se);const le=Qe.current?sn.current:Tt.current;Ie(le.getReverseMatches(se)),me(0),le.resetSearch()},yu=Bme(h,Nt),Ks=[bt.container,Nt?bt.shellMode:"",yu].filter(Boolean).join(" "),Qa=Math.max(0,Math.min(We-2,ce.length-6)),sc=ce.slice(Qa,Qa+6),Fi=[bt.prefix,Nt?bt.prefixShell:h==="yolo"?bt.prefixYolo:h==="auto-edit"?bt.prefixAutoEdit:""].filter(Boolean).join(" "),Ja=Nt?"!":h==="yolo"?"*":f.jsx(ZA,{}),It=!Nt&&!Ge&&!(g!=null&&g.isVisible)&&!i&&!x,In=(Nt?wn:Yn).nav,kr=(W,se)=>({type:"button",className:bt.hintItem,...se?{"aria-haspopup":se}:{},onMouseDown:le=>le.preventDefault(),onClick:le=>{le.stopPropagation(),W()}}),Za=W=>{const se=e5(W),le=t5(W);return!se&&!le?f.jsx("span",{className:bt.tagLabel,children:W.id}):f.jsxs(f.Fragment,{children:[se&&f.jsx("span",{className:bt.tagLabel,children:se}),le&&f.jsx("span",{className:bt.tagValue,children:le})]})};return f.jsxs("div",{className:Ks,onClick:lt,children:[f.jsx("div",{className:bt.borderTop,children:C&&f.jsx("span",{className:bt.borderTopLabel,children:C})}),Ge&&f.jsxs("div",{ref:oe,children:[f.jsxs("div",{className:bt.searchBar,children:[f.jsx("span",{className:bt.searchLabel,children:I("editor.searchLabel")}),f.jsx("input",{ref:rt,className:bt.searchInput,value:Je,onChange:Go,onKeyDown:ys,placeholder:I("editor.searchPlaceholder")}),f.jsx("span",{className:bt.searchHint,children:I("editor.searchHint")})]}),ce.length>0&&f.jsx("div",{className:bt.searchResults,children:sc.map((W,se)=>{const le=Qa+se;return f.jsxs("button",{type:"button",className:`${bt.searchResult} ${le===We?bt.searchResultActive:""}`,onMouseDown:Pe=>{Pe.preventDefault(),gs(W),wr(!1)},children:[f.jsx("span",{className:bt.searchResultMarker,children:le===We?"›":""}),f.jsx("span",{className:bt.searchResultText,children:W})]},`${W}-${le}`)})}),ce.length===0&&f.jsx("div",{className:bt.searchEmpty,children:I("editor.noHistory")})]}),Re.length>0&&f.jsx("div",{className:bt.images,children:Re.map((W,se)=>f.jsxs("div",{className:bt.imageThumb,children:[f.jsx("img",{src:`data:${W.media_type};base64,${W.data}`,alt:""}),f.jsx("button",{className:bt.imageRemove,onClick:le=>{le.stopPropagation(),$e(Pe=>Pe.filter((St,ct)=>ct!==se))},children:"×"})]},se))}),ze.length>0&&f.jsx("div",{className:bt.tags,children:ze.map(W=>f.jsxs("span",{className:bt.tag,children:[Za(W),W.removable!==!1&&f.jsx("button",{type:"button",className:bt.tagRemove,"aria-label":`Remove ${UO(W)}`,onMouseDown:se=>se.preventDefault(),onClick:se=>{var le;se.stopPropagation(),da(W.id),(le=N.current)==null||le.focus()},onKeyDown:se=>{var le;se.key!=="Backspace"&&se.key!=="Delete"||(se.preventDefault(),da(W.id),(le=N.current)==null||le.focus())},children:"×"})]},W.id))}),f.jsxs("div",{className:bt.line,children:[f.jsx("span",{className:Fi,children:Ja}),f.jsx("div",{ref:j,className:bt.wrapper})]}),It&&f.jsxs("div",{className:bt.hints,children:[f.jsxs("button",{...kr(qi),disabled:!In.canUp,children:[f.jsx("span",{className:bt.hintKey,children:"↑"}),I("editor.hintPrev")]}),f.jsx("span",{className:bt.hintSep,children:"·"}),f.jsxs("button",{...kr(ps),disabled:!In.canDown,children:[f.jsx("span",{className:bt.hintKey,children:"↓"}),I("editor.hintNext")]}),f.jsx("span",{className:bt.hintSep,children:"·"}),f.jsxs("button",{...kr(Vn,"dialog"),children:[f.jsx("span",{className:bt.hintKey,children:"ctrl+r"}),I("editor.hintSearch")]}),f.jsx("span",{className:bt.hintSep,children:"·"}),f.jsxs("button",{...kr(()=>an("/"),"listbox"),children:[f.jsx("span",{className:bt.hintKey,children:"/"}),I("editor.hintCommands")]}),f.jsx("span",{className:bt.hintSep,children:"·"}),f.jsxs("button",{...kr(()=>an("@"),"listbox"),children:[f.jsx("span",{className:bt.hintKey,children:"@"}),I("editor.hintFiles")]})]}),f.jsx("div",{className:bt.borderBottom})]})}),qme="_bar_14ys9_1",Fme="_left_14ys9_11",Vme="_right_14ys9_12",Gme="_settingsButton_14ys9_22",Wme="_modeButton_14ys9_48",Kme="_modeHint_14ys9_61",Yme="_modeLabel_14ys9_66",Xme="_modeDefault_14ys9_70",Qme="_modePlan_14ys9_74",Jme="_modeAutoEdit_14ys9_78",Zme="_modeAuto_14ys9_78",epe="_modeYolo_14ys9_86",tpe="_shortcutsButton_14ys9_95",npe="_modelButton_14ys9_113",rpe="_model_14ys9_113",ipe="_escapeHint_14ys9_132",spe="_disconnected_14ys9_142",ape="_contextButton_14ys9_146",ope="_context_14ys9_146",lpe="_goal_14ys9_169",cpe="_separator_14ys9_175",upe="_taskPill_14ys9_179",Zn={bar:qme,left:Fme,right:Vme,settingsButton:Gme,modeButton:Wme,modeHint:Kme,modeLabel:Yme,modeDefault:Xme,modePlan:Qme,modeAutoEdit:Jme,modeAuto:Zme,modeYolo:epe,shortcutsButton:tpe,modelButton:npe,model:rpe,escapeHint:ipe,disconnected:spe,contextButton:ape,context:ope,goal:lpe,separator:cpe,taskPill:upe},dpe=1e3;function hpe(t,e){switch(t){case"default":return{label:e("mode.default"),className:Zn.modeDefault};case"plan":return{label:e("mode.plan"),className:Zn.modePlan};case"auto-edit":return{label:e("mode.auto-edit"),className:Zn.modeAutoEdit};case"auto":return{label:e("mode.auto"),className:Zn.modeAuto};case"yolo":return{label:e("mode.yolo"),className:Zn.modeYolo};default:return null}}function fpe(){return f.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:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function n4(t,e,n,r){return r(t===1?e:n,{count:t})}function mpe(t,e){if(t.length===0)return"";const n=t.filter(i=>i.status==="running");if(n.length>0){const i={agent:0,shell:0,monitor:0};for(const a of n)i[a.kind]++;const s=[];return i.shell>0&&s.push(n4(i.shell,"tasks.pill.shell","tasks.pill.shells",e)),i.agent>0&&s.push(n4(i.agent,"tasks.pill.agent","tasks.pill.agents",e)),i.monitor>0&&s.push(n4(i.monitor,"tasks.pill.monitor","tasks.pill.monitors",e)),s.join(", ")}const r=t.filter(i=>i.kind==="agent"&&i.status==="paused");return r.length>0?e(r.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:r.length}):e(t.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:t.length})}function ppe(t){if(t<1e3)return"";const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}const gpe=v.forwardRef(function({escapeHint:e,onSelectMode:n,onSelectModel:r,onShowContext:i,onOpenSettings:s,onOpenTasks:a,onReturnToInput:o,tasks:l,activeGoal:c,hideSettings:u,onToggleShortcuts:d},h){const m=uu(),p=m.status==="connected",b=m.currentModel??"",x=m.currentMode??"",g=m.tokenCount??0,y=m.contextWindow??0,{t:w}=dt(),E=(y>0?g/y*100:0).toFixed(1),S=hpe(x,w),[,T]=v.useState(0),O=v.useRef(null);v.useEffect(()=>{if(!c)return;const B=setInterval(()=>T(P=>(P+1)%1e6),dpe);return()=>clearInterval(B)},[c]);const z=v.useMemo(()=>mpe(l,w),[l,w]),I=c?ppe(Date.now()-c.setAt):"",j=c?`◎ ${w("goal.statusActive")}${I?` (${I})`:""}`:"";v.useImperativeHandle(h,()=>({focusTaskPill(){var B;return z?((B=O.current)==null||B.focus({preventScroll:!0}),!0):!1}}),[z]);const N=B=>{if(B.key==="Enter"||B.key==="ArrowDown"||B.key==="n"&&B.ctrlKey){B.preventDefault(),B.stopPropagation(),a==null||a();return}if(B.key==="ArrowUp"||B.key==="Escape"||B.key==="p"&&B.ctrlKey){B.preventDefault(),B.stopPropagation(),o==null||o();return}B.key.length===1&&!B.metaKey&&!B.ctrlKey&&!B.altKey&&(B.preventDefault(),B.stopPropagation(),o==null||o(B.key))};return f.jsxs("div",{className:Zn.bar,children:[f.jsxs("div",{className:Zn.left,children:[p&&!u&&f.jsx("button",{type:"button",className:Zn.settingsButton,onClick:s,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),title:w("settings.title"),"aria-label":w("settings.title"),"aria-haspopup":"dialog",children:f.jsx(fpe,{})}),e?f.jsx("span",{className:Zn.escapeHint,children:w("editor.escClearHint")}):f.jsxs(f.Fragment,{children:[S&&f.jsxs("button",{type:"button",className:Zn.modeButton,onClick:n,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),title:w("mode.select"),"aria-haspopup":"listbox",children:[f.jsx("span",{className:`${Zn.modeLabel} ${S.className}`,children:S.label}),f.jsx("span",{className:Zn.modeHint,children:w("status.modeHint")})]}),d?f.jsx("button",{type:"button",className:Zn.shortcutsButton,onClick:d,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),"aria-haspopup":"dialog","aria-label":w("status.shortcuts"),children:w("status.shortcuts")}):f.jsx("span",{children:w("status.shortcuts")})]}),z&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:Zn.separator,children:"·"}),f.jsx("button",{ref:O,type:"button",className:Zn.taskPill,onClick:a,onKeyDown:N,disabled:!a,children:z})]})]}),f.jsxs("div",{className:Zn.right,children:[!p&&f.jsx("span",{className:Zn.disconnected,children:w("status.disconnected")}),b&&f.jsx("button",{type:"button",className:Zn.modelButton,onClick:r,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),title:w("model.select"),"aria-haspopup":"listbox",children:f.jsx("span",{className:Zn.model,children:b})}),y>0&&g>0&&f.jsx("button",{type:"button",className:Zn.contextButton,onClick:i,title:w("contextUsage.title"),children:f.jsx("span",{className:Zn.context,children:w("status.contextUsed",{pct:E})})}),j&&f.jsx("span",{className:Zn.goal,title:c==null?void 0:c.condition,children:j})]})]})}),ype="_panel_9g5lg_1",bpe="_column_9g5lg_8",vpe="_item_9g5lg_14",xpe="_key_9g5lg_20",wpe="_desc_9g5lg_25",co={panel:ype,column:bpe,item:vpe,key:xpe,desc:wpe};function HO(){if(typeof navigator>"u")return!1;const t=navigator.userAgentData,e=(t==null?void 0:t.platform)||navigator.platform||"";return/mac|iphone|ipad|ipod/i.test(e)}function kpe(){return HO()?"cmd+v":"ctrl+v"}function _pe(){return HO()?"shift+enter / ctrl+j / opt+enter / cmd+enter":"shift+enter / ctrl+j / alt+enter / ctrl+enter"}const r4=[{key:"/",descriptionKey:"help.shortcut.commandMenu"},{key:"@",descriptionKey:"help.shortcut.addContext"},{key:"shift+tab",descriptionKey:"help.shortcut.approvals"},{key:"esc",descriptionKey:"help.shortcut.cancel"},{key:_pe(),descriptionKey:"help.shortcut.newline"},{key:"ctrl+l",descriptionKey:"help.shortcut.clear"},{key:"ctrl+y",descriptionKey:"help.shortcut.retry"},{key:"ctrl+o",descriptionKey:"help.shortcut.compact"},{key:"ctrl+r",descriptionKey:"help.shortcut.searchHistory"},{key:"↑ / ↓",descriptionKey:"help.shortcut.history"},{key:"?",descriptionKey:"help.shortcut.togglePanel"}];function Spe({onClose:t}){const{t:e}=dt(),n=v.useRef(null),r=v.useRef(t);r.current=t,v.useEffect(()=>{const l=u=>{var m;if(u instanceof MouseEvent&&u.button!==0||u.defaultPrevented)return;const d=n.current,h=u.target;d&&h instanceof Node&&!d.contains(h)&&((m=r.current)==null||m.call(r))},c=u=>{var d;u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),(d=r.current)==null||d.call(r))};return window.addEventListener("mousedown",l),window.addEventListener("touchstart",l),window.addEventListener("keydown",c,!0),()=>{window.removeEventListener("mousedown",l),window.removeEventListener("touchstart",l),window.removeEventListener("keydown",c,!0)}},[]);const i=[...r4.slice(0,-1),{key:kpe(),descriptionKey:"help.shortcut.pasteImages"},r4[r4.length-1]],s=Math.ceil(i.length/2),a=i.slice(0,s),o=i.slice(s);return f.jsxs("div",{ref:n,className:co.panel,children:[f.jsx("div",{className:co.column,children:a.map(l=>f.jsxs("div",{className:co.item,children:[f.jsx("span",{className:co.key,children:l.key}),f.jsx("span",{className:co.desc,children:e(l.descriptionKey)})]},l.key))}),f.jsx("div",{className:co.column,children:o.map(l=>f.jsxs("div",{className:co.item,children:[f.jsx("span",{className:co.key,children:l.key}),f.jsx("span",{className:co.desc,children:e(l.descriptionKey)})]},l.key))})]})}const Tpe=15e3,Cpe=["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."],Epe=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function UT(t){return(t??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?Epe:Cpe}function Ape(){const t=w3(),e=N1(),n=t!=="idle",r=v.useRef(0),i=v.useRef(0),[s,a]=v.useState({estimatedOutputTokens:0,isReceivingContent:!1}),o=v.useMemo(()=>{let c=0,u=0,d=!1;const h=new Set;let m=-1;for(let p=e.length-1;p>=0;p--)if(e[p].kind==="user"){m=p;break}for(let p=m+1;p<e.length;p++){const b=e[p];if(b.kind==="assistant"&&!b.parentToolCallId&&(c+=b.text.length,b.streaming&&(d=!0)),b.kind==="tool"&&!b.parentToolCallId){if(b.rawInput!==void 0)try{c+=JSON.stringify(b.rawInput).length}catch{}const x=Mpe(b.rawOutput);x!==void 0&&!h.has(b.toolCallId)&&(u+=x,h.add(b.toolCallId))}}return{chars:c,agentTokens:u,isReceiving:d}},[e]),l=v.useRef(o);return l.current=o,o.chars<i.current&&(r.current=o.chars),i.current=o.chars,v.useEffect(()=>{if(!n){r.current=0,a({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:u,agentTokens:d,isReceiving:h}=l.current;if(u<r.current){r.current=u,a({estimatedOutputTokens:d+Math.round(u/4),isReceivingContent:h});return}const m=u-r.current;if(m<=0){a(x=>{const g={estimatedOutputTokens:d+Math.round(r.current/4),isReceivingContent:h};return x.estimatedOutputTokens===g.estimatedOutputTokens&&x.isReceivingContent===g.isReceivingContent?x:g});return}let p;m<70?p=3:m<=200?p=Math.max(3,Math.round(m*.2)):p=50;const b=Math.min(r.current+p,u);r.current=b,a({estimatedOutputTokens:d+Math.round(b/4),isReceivingContent:h})},100);return()=>clearInterval(c)},[n]),s}function Mpe(t){if(typeof t!="object"||t===null||!("type"in t)||t.type!=="task_execution")return;const e=t,n=e.tokenCount;if(typeof n=="number"&&n>0)return n;const r=e.executionSummary;if(typeof r=="object"&&r!==null){const i=r.totalTokens;if(typeof i=="number"&&i>0)return i}}function Npe(t){return t<1e3?`${t}`:t<1e4?`${(t/1e3).toFixed(1)}k`:`${Math.floor(t/1e3)}k`}const Dpe="_status_14l8l_1",Ipe="_spinner_14l8l_12",Rpe="_label_14l8l_16",Ope="_meta_14l8l_20",ep={status:Dpe,spinner:Ipe,label:Rpe,meta:Ope};function jpe(){const t=w3(),{estimatedOutputTokens:e,isReceivingContent:n}=Ape(),{language:r,t:i}=dt(),[s,a]=v.useState(0),o=v.useRef(Date.now()),[l,c]=v.useState(0),[u,d]=v.useState(()=>UT(r)[0]??""),h=t!=="idle";if(v.useEffect(()=>{if(!h){a(0);return}o.current=Date.now(),a(0);const y=setInterval(()=>{a(Math.floor((Date.now()-o.current)/1e3))},1e3);return()=>clearInterval(y)},[h]),v.useEffect(()=>{const y=UT(r);if(t==="idle"||y.length===0){d(y[0]??"");return}const w=()=>{const E=Math.floor(Math.random()*y.length);d(y[E]??"")};w();const C=setInterval(w,Tpe);return()=>clearInterval(C)},[r,t]),v.useEffect(()=>{if(t==="idle")return;const y=setInterval(()=>{c(w=>(w+1)%4)},250);return()=>clearInterval(y)},[t]),t==="idle")return null;const m=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],p=m[l%m.length],b=n?"↓":"↑",x=s<60?`${s}s`:Lpe(s*1e3),g=e>0?` · ${b} ${i("stream.tokens",{count:Npe(e)})}`:"";return f.jsxs("div",{className:ep.status,children:[f.jsx("span",{className:ep.spinner,children:p}),u&&f.jsx("span",{className:ep.label,children:u}),f.jsxs("span",{className:ep.meta,children:["(",x,g," · ",i("stream.cancel"),")"]})]})}function Lpe(t){if(t<=0)return"0s";const e=Math.floor(t/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60,s=[];return n>0&&s.push(`${n}h`),r>0&&s.push(`${r}m`),i>0&&s.push(`${i}s`),s.length>0?s.join(" "):"0s"}const Bpe="_host_1k5oc_1",zpe="_toast_1k5oc_13",Ppe="_message_1k5oc_32",$pe="_close_1k5oc_40",Upe="_info_1k5oc_59",Hpe="_success_1k5oc_67",qpe="_warning_1k5oc_75",Fpe="_error_1k5oc_83",Jh={host:Bpe,toast:zpe,message:Ppe,close:$pe,info:Upe,success:Hpe,warning:qpe,error:Fpe};function Vpe({toasts:t,onDismiss:e,autoDismissMs:n=5e3}){return t.length===0?null:f.jsx("div",{className:Jh.host,role:"status","aria-live":"polite",children:t.map(r=>f.jsx(Gpe,{toast:r,onDismiss:e,autoDismissMs:n},r.id))})}function Gpe({toast:t,onDismiss:e,autoDismissMs:n}){const{t:r}=dt();return v.useEffect(()=>{const i=window.setTimeout(()=>e(t.id),n);return()=>window.clearTimeout(i)},[n,e,t.id]),f.jsxs("div",{className:`${Jh.toast} ${Jh[t.tone]}`,children:[f.jsx("div",{className:Jh.message,children:t.message}),f.jsx("button",{type:"button",className:Jh.close,onClick:()=>e(t.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const Wpe="_panel_hf9dp_1",Kpe="_header_hf9dp_11",Ype="_toggle_hf9dp_18",Xpe="_chevron_hf9dp_34",Qpe="_title_hf9dp_40",Jpe="_progress_hf9dp_47",Zpe="_collapsedCurrent_hf9dp_54",ege="_locate_hf9dp_64",tge="_list_hf9dp_81",nge="_item_hf9dp_91",rge="_num_hf9dp_101",ige="_icon_hf9dp_107",sge="_pending_hf9dp_112",age="_content_hf9dp_116",oge="_inProgress_hf9dp_120",lge="_completed_hf9dp_128",cge="_moreLine_hf9dp_145",uge="_moreText_hf9dp_162",dge="_allDone_hf9dp_174",fn={panel:Wpe,header:Kpe,toggle:Ype,chevron:Xpe,title:Qpe,progress:Jpe,collapsedCurrent:Zpe,locate:ege,list:tge,item:nge,num:rge,icon:ige,pending:sge,content:age,inProgress:oge,completed:lge,moreLine:cge,moreText:uge,allDone:dge},HT=5,qO="web-shell:todo-panel-collapsed";function hge(){try{return window.localStorage.getItem(qO)==="true"}catch{return!1}}function fge(t){try{window.localStorage.setItem(qO,t?"true":"false")}catch{}}function qT(t){switch(t){case"completed":return fn.completed;case"in_progress":return fn.inProgress;case"pending":return fn.pending}}const mge=v.memo(function({todos:e,title:n,onLocateSource:r}){const{t:i}=dt(),[s,a]=v.useState(hge),[o,l]=v.useState(!1);if(e.length===0)return null;const c=e.length,u=e.filter(T=>T.status==="completed").length,d=u===c,h=e.findIndex(T=>T.status==="in_progress"),m=h>=0?h:e.findIndex(T=>T.status==="pending"),p=m>=0?e[m]:void 0,{start:b,end:x}=o?{start:0,end:c}:bae(e,HT),g=e.slice(b,x),y=b,w=c-x,C=e.slice(0,b).every(T=>T.status==="completed"),E=()=>{a(T=>{const O=!T;return fge(O),O})},S=`${String(c).length+1}ch`;return f.jsxs("section",{className:fn.panel,"aria-label":n??i("todo.title"),children:[f.jsxs("div",{className:fn.header,children:[f.jsxs("button",{type:"button",className:fn.toggle,onClick:E,"aria-expanded":!s,title:i(s?"todo.expand":"todo.collapse"),children:[f.jsx("span",{className:fn.chevron,"aria-hidden":"true",children:s?"▸":"▾"}),f.jsx("span",{className:fn.title,children:n??i("todo.title")}),f.jsxs("span",{className:fn.progress,children:[u,"/",c]}),s&&(d?f.jsxs("span",{className:`${fn.collapsedCurrent} ${fn.allDone}`,children:["✓ ",i("todo.allDone")]}):p?f.jsxs("span",{className:`${fn.collapsedCurrent} ${qT(p.status)}`,children:[f.jsx("span",{className:fn.icon,"aria-hidden":"true",children:e0(p.status)}),f.jsx("span",{className:fn.content,title:p.content,children:p.content})]}):null)]}),r&&f.jsx("button",{type:"button",className:fn.locate,onClick:r,title:i("todo.locate"),"aria-label":i("todo.locate"),children:"↗"})]}),!s&&f.jsx("div",{className:fn.list,children:d?f.jsxs("div",{className:fn.allDone,children:["✓ ",i("todo.allDone")]}):f.jsxs(f.Fragment,{children:[y>0&&f.jsxs("button",{type:"button",className:fn.moreLine,onClick:()=>l(!0),children:[f.jsx("span",{className:fn.num,style:{width:S}}),f.jsx("span",{className:fn.moreText,children:C?i("todo.completedAbove",{count:y}):i("todo.moreAbove",{count:y})})]}),g.map((T,O)=>f.jsxs("div",{className:`${fn.item} ${qT(T.status)}`,children:[f.jsxs("span",{className:fn.num,style:{width:S},children:[b+O+1,"."]}),f.jsx("span",{className:fn.icon,"aria-hidden":"true",children:e0(T.status)}),f.jsx("span",{className:fn.content,title:T.content,children:T.content})]},T.id||b+O)),w>0&&f.jsxs("button",{type:"button",className:fn.moreLine,onClick:()=>l(!0),children:[f.jsx("span",{className:fn.num,style:{width:S}}),f.jsx("span",{className:fn.moreText,children:i("todo.more",{count:w})})]}),o&&c>HT&&f.jsxs("button",{type:"button",className:fn.moreLine,onClick:()=>l(!1),children:[f.jsx("span",{className:fn.num,style:{width:S}}),f.jsx("span",{className:fn.moreText,children:i("todo.showLess")})]})]})})]})}),pge="_header_niipg_1",gge="_banner_niipg_8",yge="_logo_niipg_15",bge="_panel_niipg_29",vge="_titleRow_niipg_41",xge="_title_niipg_41",wge="_version_niipg_54",kge="_subtitle_niipg_59",_ge="_metaLine_niipg_63",Sge="_sep_niipg_76",Tge="_terminalLabel_niipg_80",Cge="_model_niipg_85",Ege="_modelHint_niipg_93",Age="_cwd_niipg_99",Mge="_tip_niipg_108",Nge="_tipLabel_niipg_116",Dge="_tipText_niipg_120",_r={header:pge,banner:gge,logo:yge,panel:bge,titleRow:vge,title:xge,version:wge,subtitle:kge,metaLine:_ge,sep:Sge,terminalLabel:Tge,model:Cge,modelHint:Ege,cwd:Age,tip:Mge,tipLabel:Nge,tipText:Dge},Ige=["Type / to open commands; Tab completes slash commands and saved prompts.","Add a QWEN.md file to give Qwen Code durable project context.","Use ! to run shell commands through Qwen Code, for example !ls.","When a chat gets long, use /compress to free context.","Use Shift+Tab or /approval-mode to switch approval modes quickly.","Use /clear or /new to start fresh; previous sessions stay resumable."],Rge=["输入 / 打开命令弹窗；Tab 可以补全斜杠命令和已保存的 prompt。","添加 QWEN.md 文件，为 Qwen Code 提供持久的项目上下文。","可以使用 ! 从 Qwen Code 运行 shell 命令，例如 !ls。","对话变长时，使用 /compress 压缩历史并释放上下文。","使用 Shift+Tab 或 /approval-mode 快速切换权限模式。","使用 /clear 或 /new 开始新想法；之前的会话仍可从历史恢复。"],Oge=`
 ▄▄▄▄▄▄  ▄▄     ▄▄ ▄▄▄▄▄▄▄ ▄▄▄    ▄▄
██╔═══██╗██║    ██║██╔════╝████╗  ██║
██║   ██║██║ █╗ ██║█████╗  ██╔██╗ ██║
██║▄▄ ██║██║███╗██║██╔══╝  ██║╚██╗██║
╚██████╔╝╚███╔███╔╝███████╗██║ ╚████║
 ╚══▀▀═╝  ╚══╝╚══╝ ╚══════╝╚═╝  ╚═══╝
`.trim();function jge(t){const e=t==="zh-CN"?Rge:Ige;return e[Math.floor(Math.random()*e.length)]}function Lge(t,e=72){if(!t||t.length<=e)return t;const n=Math.max(12,Math.floor((e-3)*.38)),r=Math.max(18,e-n-3);return`${t.slice(0,n)}...${t.slice(-r)}`}function Bge(t,e){switch(t){case"plan":return e("mode.plan");case"auto-edit":return e("mode.auto-edit");case"yolo":return e("mode.yolo");case"default":return e("mode.default");default:return t||e("mode.unknown")}}function zge({version:t,cwd:e,currentModel:n,currentMode:r,hideTips:i=!1}){const{language:s,t:a}=dt(),o=v.useMemo(()=>jge(s),[s]),l=v.useMemo(()=>Lge(e),[e]),c=n||a("welcome.defaultModel"),u=Bge(r,a);return f.jsxs("div",{className:_r.header,children:[f.jsxs("div",{className:_r.banner,children:[f.jsx("pre",{className:_r.logo,"aria-hidden":"true",children:Oge}),f.jsxs("div",{className:_r.panel,children:[f.jsxs("div",{className:_r.titleRow,children:[f.jsx("span",{className:_r.title,children:">_ Qwen Code"}),t&&f.jsxs("span",{className:_r.version,children:["(v",t,")"]})]}),f.jsx("div",{className:_r.subtitle,"aria-hidden":"true",children:" "}),f.jsxs("div",{className:_r.metaLine,children:[f.jsx("span",{className:_r.terminalLabel,children:"Web terminal"}),f.jsx("span",{className:_r.sep,children:"|"}),f.jsx("span",{className:_r.model,children:c}),f.jsx("span",{className:_r.modelHint,children:a("welcome.changeModel")})]}),f.jsxs("div",{className:_r.metaLine,children:[f.jsx("span",{children:u}),f.jsx("span",{className:_r.modelHint,children:a("welcome.modeHint")})]}),l&&f.jsx("div",{className:_r.cwd,title:e,children:l})]})]}),!i&&f.jsxs("div",{className:_r.tip,children:[f.jsx("span",{className:_r.tipLabel,children:a("welcome.tipLabel")}),f.jsx("span",{className:_r.tipText,children:o})]})]})}const Pge="_panel_t3qdz_1",$ge="_header_t3qdz_17",Uge="_title_t3qdz_23",Hge="_list_t3qdz_27",qge="_row_t3qdz_35",Fge="_selected_t3qdz_43",Vge="_label_t3qdz_43",Gge="_pointer_t3qdz_47",Wge="_number_t3qdz_55",Kge="_footer_t3qdz_66",wa={panel:Pge,header:$ge,title:Uge,list:Hge,row:qge,selected:Fge,label:Vge,pointer:Gge,number:Wge,footer:Kge},FO="web-shell:approval-mode-panel-active";function Yge({currentMode:t,onSelect:e,onClose:n}){const{t:r}=dt(),i=v.useRef(`approval-mode-${Math.random().toString(36).slice(2)}`),s=v.useRef(null),a=v.useRef(null),o=v.useRef(n);v.useEffect(()=>{o.current=n},[n]);const l=u3.map(m=>({id:m,name:r(`mode.name.${m}`),description:r(`mode.desc.${m}`)})),[c,u]=v.useState(()=>{const m=l.findIndex(p=>p.id===t);return m>=0?m:0}),d=v.useCallback(m=>{window.dispatchEvent(new CustomEvent(FO,{detail:{id:i.current,active:m}}))},[]);v.useEffect(()=>(d(!0),()=>d(!1)),[d]),v.useEffect(()=>{const m=p=>{if(p instanceof MouseEvent&&p.button!==0||p.defaultPrevented)return;const b=a.current,x=p.target;b&&x instanceof Node&&!b.contains(x)&&o.current()};return window.addEventListener("mousedown",m),window.addEventListener("touchstart",m),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("touchstart",m)}},[]),v.useEffect(()=>{c>=l.length&&l.length>0&&u(l.length-1)},[l.length,c]),v.useEffect(()=>{var p;const m=(p=s.current)==null?void 0:p.children[c];m==null||m.scrollIntoView({block:"nearest"})},[c]);const h=v.useCallback(()=>{const m=l[c];m&&(e(m.id),n())},[l,n,e,c]);return si(m=>{if(m.defaultPrevented)return;const p=()=>{m.preventDefault(),m.stopPropagation()};if(m.key==="Escape"){p(),n();return}if(m.key==="ArrowDown"||m.key==="j"){p(),u(b=>l.length>0?(b+1)%l.length:0);return}if(m.key==="ArrowUp"||m.key==="k"){p(),u(b=>l.length>0?(b-1+l.length)%l.length:0);return}if(m.key==="Enter"){p(),h();return}},[l.length,h,n]),f.jsxs("div",{ref:a,className:wa.panel,children:[f.jsx("div",{className:wa.header,children:f.jsx("span",{className:wa.title,children:r("mode.select")})}),f.jsx("div",{className:wa.list,ref:s,role:"listbox","aria-label":r("mode.select"),children:l.map((m,p)=>{const b=p===c;return f.jsxs("div",{role:"option","aria-selected":b,className:`${wa.row} ${b?wa.selected:""}`,onClick:()=>{e(m.id),n()},onMouseEnter:()=>u(p),children:[f.jsx("span",{className:wa.pointer,children:b?"›":" "}),f.jsxs("span",{className:wa.number,children:[p+1,"."]}),f.jsxs("span",{className:wa.label,children:[m.name," - ",m.description]})]},m.id)})}),f.jsx("div",{className:wa.footer,children:r("mode.footer")})]})}const Xge="_selected_13bnm_115",Qge="_disabled_13bnm_131",Jge={"resume-picker":"_resume-picker_13bnm_4","resume-picker-header":"_resume-picker-header_13bnm_14","resume-picker-close":"_resume-picker-close_13bnm_21","resume-picker-title":"_resume-picker-title_13bnm_42","resume-picker-count":"_resume-picker-count_13bnm_48","resume-picker-search":"_resume-picker-search_13bnm_53","resume-picker-search-label":"_resume-picker-search-label_13bnm_62","resume-picker-search-input":"_resume-picker-search-input_13bnm_66","resume-picker-search-value":"_resume-picker-search-value_13bnm_76","resume-picker-search-hint":"_resume-picker-search-hint_13bnm_80","resume-picker-sep":"_resume-picker-sep_13bnm_84","resume-picker-list":"_resume-picker-list_13bnm_89","resume-picker-empty":"_resume-picker-empty_13bnm_95","resume-picker-item":"_resume-picker-item_13bnm_101","resume-picker-session-item":"_resume-picker-session-item_13bnm_108",selected:Xge,"resume-picker-keyboard-only":"_resume-picker-keyboard-only_13bnm_123",disabled:Qge,"resume-picker-item-row":"_resume-picker-item-row_13bnm_136","resume-picker-item-prefix":"_resume-picker-item-prefix_13bnm_145","resume-picker-item-title":"_resume-picker-item-title_13bnm_155","resume-picker-item-checkbox":"_resume-picker-item-checkbox_13bnm_168","resume-picker-item-number":"_resume-picker-item-number_13bnm_180","resume-picker-item-provider":"_resume-picker-item-provider_13bnm_188","resume-picker-item-meta":"_resume-picker-item-meta_13bnm_201","resume-picker-item-detail":"_resume-picker-item-detail_13bnm_210","resume-picker-item-check":"_resume-picker-item-check_13bnm_168","resume-picker-item-badge":"_resume-picker-item-badge_13bnm_226","mcp-status":"_mcp-status_13bnm_235","mcp-status-connected":"_mcp-status-connected_13bnm_239","mcp-status-connecting":"_mcp-status-connecting_13bnm_243","mcp-status-disconnected":"_mcp-status-disconnected_13bnm_247","mcp-status-disabled":"_mcp-status-disabled_13bnm_251","mcp-status-unknown":"_mcp-status-unknown_13bnm_252","resume-picker-item-current":"_resume-picker-item-current_13bnm_256","resume-picker-footer":"_resume-picker-footer_13bnm_261","resume-picker-detail-panel":"_resume-picker-detail-panel_13bnm_267","resume-picker-detail-row":"_resume-picker-detail-row_13bnm_277","resume-picker-detail-label":"_resume-picker-detail-label_13bnm_284","resume-picker-detail-value":"_resume-picker-detail-value_13bnm_289","dialog-inline-button":"_dialog-inline-button_13bnm_294","dialog-primary-button":"_dialog-primary-button_13bnm_295","dialog-danger-button":"_dialog-danger-button_13bnm_296","dialog-inline-actions":"_dialog-inline-actions_13bnm_319","dialog-form":"_dialog-form_13bnm_335","dialog-form-row":"_dialog-form-row_13bnm_363","dialog-textarea":"_dialog-textarea_13bnm_369","dialog-split":"_dialog-split_13bnm_374","dialog-split-list":"_dialog-split-list_13bnm_381","tools-desc-expanded":"_tools-desc-expanded_13bnm_385","tools-desc-body":"_tools-desc-body_13bnm_397","dialog-detail":"_dialog-detail_13bnm_404","dialog-detail-title":"_dialog-detail-title_13bnm_412","dialog-detail-shortcut":"_dialog-detail-shortcut_13bnm_420","dialog-detail-meta":"_dialog-detail-meta_13bnm_427","dialog-detail-body":"_dialog-detail-body_13bnm_432"};function ee(...t){return t.filter(e=>!!e).map(e=>Jge[e]).filter(Boolean).join(" ")}function r5(t,e){const n=Date.now()-new Date(t).getTime(),r=Math.floor(n/6e4);if(r<1)return e("time.justNow");if(r<60)return e("time.minutesAgo",{count:r});const i=Math.floor(r/60);if(i<24)return e("time.hoursAgo",{count:i});const s=Math.floor(i/24);return s<7?e("time.daysAgo",{count:s}):new Date(t).toLocaleDateString()}function Zge({onSelect:t,onClose:e}){const{t:n}=dt(),r=uu(),{sessions:i,loading:s,error:a}=_3({autoLoad:!0}),o=r.sessionId,[l,c]=v.useState(0),[u,d]=v.useState(!1),[h,m]=v.useState(""),p=v.useRef(null),b=h?i.filter(g=>{const y=h.toLowerCase();return(g.displayName||"").toLowerCase().includes(y)||g.sessionId.toLowerCase().includes(y)}):i;v.useEffect(()=>{l>=b.length&&b.length>0&&c(b.length-1)},[b.length,l]),v.useEffect(()=>{var y;const g=(y=p.current)==null?void 0:y.children[l];g==null||g.scrollIntoView({block:"nearest"})},[l]);const x=v.useCallback(()=>{const g=b[l];g&&(t(g.sessionId),e())},[b,l,t,e]);return si(g=>{if(u){if(g.key==="Escape"){g.preventDefault(),h?m(""):d(!1);return}if(g.key==="Enter"){g.preventDefault(),b.length>0&&d(!1);return}if(g.key==="ArrowUp"||g.key==="ArrowDown"){g.preventDefault(),d(!1),g.key==="ArrowDown"&&c(y=>Math.min(y+1,b.length-1));return}return}if(g.key==="Escape"){g.preventDefault(),h?(m(""),c(0)):e();return}if(g.key==="ArrowDown"||g.key==="j"){g.preventDefault(),c(y=>Math.min(y+1,b.length-1));return}if(g.key==="ArrowUp"||g.key==="k"){g.preventDefault(),l===0?d(!0):c(y=>Math.max(y-1,0));return}if(g.key==="Enter"){g.preventDefault(),x();return}if(g.key==="/"){g.preventDefault(),d(!0);return}},[u,h,b,l,e,x]),f.jsxs("div",{className:ee("resume-picker","resume-picker-keyboard-only"),children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:n("resume.title")}),h&&f.jsxs("span",{className:ee("resume-picker-count"),children:["(",b.length," matches)"]}),f.jsx("button",{className:ee("resume-picker-close"),onClick:e,title:n("common.close"),children:"ESC"})]}),f.jsx("div",{className:ee("resume-picker-search"),children:u?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:ee("resume-picker-search-label"),children:[n("resume.search"),":"," "]}),f.jsx("input",{className:ee("resume-picker-search-input"),value:h,onChange:g=>{m(g.target.value),c(0)},autoFocus:!0,placeholder:""})]}):h?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:ee("resume-picker-search-label"),children:[n("resume.filter"),":"," "]}),f.jsx("span",{className:ee("resume-picker-search-value"),children:h})]}):f.jsx("span",{className:ee("resume-picker-search-hint"),children:n("resume.pressSearch")})}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsxs("div",{className:ee("resume-picker-list"),ref:p,children:[s&&f.jsx("div",{className:ee("resume-picker-empty"),children:n("common.loading")}),!s&&a&&f.jsx("div",{className:ee("resume-picker-empty"),children:a.message||"Failed to load sessions"}),!s&&!a&&b.length===0&&f.jsx("div",{className:ee("resume-picker-empty"),children:h?n("resume.noMatch",{query:h}):n("resume.none")}),!s&&b.map((g,y)=>{const w=g.sessionId===o;return f.jsxs("div",{className:ee("resume-picker-item","resume-picker-session-item",y===l&&!u?"selected":void 0,w?"resume-picker-item-current":void 0),onClick:()=>{t(g.sessionId),e()},children:[f.jsxs("div",{className:ee("resume-picker-item-row"),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:y===l&&!u?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:g.displayName||g.sessionId.slice(0,8)}),w&&f.jsx("span",{className:ee("resume-picker-item-badge"),children:n("resume.current")})]}),f.jsxs("div",{className:ee("resume-picker-item-meta"),children:[f.jsx("span",{children:(g.updatedAt||g.createdAt)&&r5(g.updatedAt||g.createdAt||"",n)}),f.jsx("span",{className:ee("resume-picker-item-detail"),children:n("common.clients",{count:g.clientCount??0})}),g.hasActivePrompt&&f.jsx("span",{className:ee("resume-picker-item-detail"),children:n("resume.activePrompt")})]})]},g.sessionId)})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-footer"),children:n(u?"dialog.footer.search":"dialog.footer.navSelectCancel")})]})}const e1e="_panel_lkmzh_1",t1e="_titleLine_lkmzh_14",n1e="_icon_lkmzh_21",r1e="_title_lkmzh_14",i1e="_subtitle_lkmzh_33",s1e="_stepHeader_lkmzh_38",a1e="_text_lkmzh_45",o1e="_options_lkmzh_51",l1e="_option_lkmzh_51",c1e="_optionActive_lkmzh_66",u1e="_optionLabel_lkmzh_66",d1e="_pointer_lkmzh_71",h1e="_optionContent_lkmzh_82",f1e="_optionDesc_lkmzh_92",m1e="_badge_lkmzh_98",p1e="_colorDot_lkmzh_107",g1e="_colorPreview_lkmzh_116",y1e="_toolDetail_lkmzh_149",b1e="_toolDetailTitle_lkmzh_154",v1e="_toolDetailBody_lkmzh_159",x1e="_toolList_lkmzh_160",w1e="_textInput_lkmzh_172",k1e="_textArea_lkmzh_190",_1e="_summary_lkmzh_210",S1e="_summaryRow_lkmzh_217",T1e="_summaryLabel_lkmzh_223",C1e="_summaryValue_lkmzh_229",E1e="_summaryBlockTitle_lkmzh_234",A1e="_summaryBlock_lkmzh_234",M1e="_hiddenAction_lkmzh_248",N1e="_groupLabel_lkmzh_260",D1e="_footer_lkmzh_273",I1e="_agentCount_lkmzh_281",R1e="_viewer_lkmzh_286",O1e="_viewerRow_lkmzh_310",j1e="_viewerLabel_lkmzh_317",L1e="_viewerSectionTitle_lkmzh_322",B1e="_viewerBlock_lkmzh_327",z1e="_closed_lkmzh_334",P1e="_closedText_lkmzh_338",$1e="_loading_lkmzh_344",U1e="_error_lkmzh_349",de={panel:e1e,titleLine:t1e,icon:n1e,title:r1e,subtitle:i1e,stepHeader:s1e,text:a1e,options:o1e,option:l1e,optionActive:c1e,optionLabel:u1e,pointer:d1e,optionContent:h1e,optionDesc:f1e,badge:m1e,colorDot:p1e,colorPreview:g1e,toolDetail:y1e,toolDetailTitle:b1e,toolDetailBody:v1e,toolList:x1e,textInput:w1e,textArea:k1e,summary:_1e,summaryRow:S1e,summaryLabel:T1e,summaryValue:C1e,summaryBlockTitle:E1e,summaryBlock:A1e,hiddenAction:M1e,groupLabel:N1e,footer:D1e,agentCount:I1e,viewer:R1e,viewerRow:O1e,viewerLabel:j1e,viewerSectionTitle:L1e,viewerBlock:B1e,closed:z1e,closedText:P1e,loading:$1e,error:U1e},VO="web-shell:agents-panel-active",yo=[{id:"auto",name:"Automatic Color",value:"auto"},{id:"blue",name:"Blue",value:"#3b82f6"},{id:"green",name:"Green",value:"#10b981"},{id:"purple",name:"Purple",value:"#8b5cf6"},{id:"orange",name:"Orange",value:"#f59e0b"},{id:"red",name:"Red",value:"#ef4444"},{id:"cyan",name:"Cyan",value:"#06b6d4"}];function i4(t,e){window.dispatchEvent(new CustomEvent(VO,{detail:{id:t,active:e}}))}function Bp(t){if(t==="project")return"workspace";if(t==="user")return"global"}function Zh(t){return Bp(t.level)!==void 0&&!t.isBuiltin&&t.level!=="extension"}function GO(t){return t&&t!=="auto"?t:void 0}function H1e(t){return t.displayName||t.name}function i5(t){const e=t.toLowerCase();return["read","grep","glob","ls","list","search","fetch","webfetch","web_fetch","websearch","web_search","think","todo","context"].some(n=>e.includes(n))}function s5(t){const e=t.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>e.includes(n))}function a5(t){const e=t.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>e.includes(n))}function FT(t,e){if(!e||e.length===0)return 0;const n=new Set(e),r=t.findIndex(i=>i.id==="all"||i.tools.length!==n.size?!1:i.tools.every(s=>n.has(s)));return r>=0?r:0}function q1e({mode:t,onMessage:e,onClose:n}){var fe;const{t:r}=dt(),{agents:i,loading:s,reload:a,getAgent:o,createAgent:l,generateAgent:c,deleteAgent:u,updateAgent:d}=cU({autoLoad:!0}),{tools:h}=WA({autoLoad:!0}),[m,p]=v.useState(!1),b=v.useRef(`agents-${Math.random().toString(36).slice(2)}`),[x,g]=v.useState(()=>t==="manage"?"manage":t==="create"||t==="create-user"||t==="create-project"?"create":"menu"),[y,w]=v.useState(0),[C,E]=v.useState(["agent-selection"]),[S,T]=v.useState(0),[O,z]=v.useState(null),[I,j]=v.useState(0),[N,B]=v.useState(!1),[P,J]=v.useState(null),[q,Y]=v.useState(1),[$,Z]=v.useState(()=>t==="create-user"?"global":"workspace"),[M,X]=v.useState("manual"),[H,R]=v.useState(""),[ae,xe]=v.useState(""),[ye,Ae]=v.useState(""),[Fe,vt]=v.useState("auto"),[Nt,pt]=v.useState([]),[Qe,Ge]=v.useState(0),[$t,Je]=v.useState(!1),[re,ce]=v.useState(!1),Ie=v.useRef(0),We=C[C.length-1],me=v.useCallback(()=>{p(!0),i4(b.current,!1),n()},[n]);v.useEffect(()=>{if(m)return;const G=b.current;return i4(G,!0),()=>i4(G,!1)},[m]);const rt=v.useMemo(()=>{const G=i.filter(xt=>xt.level==="project"),te=i.filter(xt=>xt.level==="user"),Ue=i.filter(xt=>xt.level==="builtin"),Gt=i.filter(xt=>xt.level==="extension");return{project:G,user:te,builtin:Ue,extension:Gt}},[i]),oe=v.useMemo(()=>[...rt.project,...rt.user,...rt.builtin,...rt.extension],[rt]),Oe=v.useMemo(()=>{const G=h.filter(xt=>xt.enabled).map(H1e).sort((xt,zt)=>xt.localeCompare(zt)),te=G.filter(i5),Ue=G.filter(s5),Gt=G.filter(a5);return[{id:"all",label:r("agent.create.tools.all"),tools:[]},{id:"read",label:r("agent.create.tools.readOnly"),tools:te},{id:"edit",label:r("agent.create.tools.readEdit"),tools:[...new Set([...te,...Ue])]},{id:"execute",label:r("agent.create.tools.readEditExecute"),tools:[...new Set([...te,...Ue,...Gt])]}]},[r,h]);v.useEffect(()=>{if(x!=="manage")return;const G=oe[S];G&&(We==="action-selection"||We==="agent-viewer"||We==="edit-options"||We==="edit-tools"||We==="edit-color"||We==="delete-confirmation")&&o(G.name).then(z).catch(te=>J(te instanceof Error?te.message:String(te)))},[x,oe,S,We,o]),v.useEffect(()=>{S>=oe.length&&oe.length>0&&T(oe.length-1)},[oe.length,S]);const Re=v.useCallback(G=>{E(te=>[...te,G]),j(0)},[]),$e=v.useCallback(()=>{E(G=>G.length<=1?G:G.slice(0,-1)),j(0)},[]),ne=v.useCallback(()=>{const G=oe[S];if(!G||!Zh(G))return;const te=Bp(G.level);te&&(B(!0),u(G.name,te).then(()=>{e(r("agent.deleted",{name:G.name})),z(null),E(["agent-selection"]),T(0),a()}).catch(Ue=>J(Ue instanceof Error?Ue.message:String(Ue))).finally(()=>B(!1)))},[oe,S,u,e,a,r]),ge=v.useCallback(G=>{const te=oe[S];if(!te||!Zh(te))return;const Ue=Bp(te.level);Ue&&(B(!0),d(te.name,{color:G},Ue).then(()=>{e(r("agent.colorUpdated",{name:te.name})),$e(),a()}).catch(Gt=>J(Gt instanceof Error?Gt.message:String(Gt))).finally(()=>B(!1)))},[oe,S,d,e,$e,a,r]),ke=v.useCallback(G=>{const te=oe[S];if(!te||!Zh(te))return;const Ue=Bp(te.level);Ue&&(B(!0),d(te.name,{tools:G},Ue).then(()=>{e(r("agent.toolsUpdated",{name:te.name})),$e(),a()}).catch(Gt=>J(Gt instanceof Error?Gt.message:String(Gt))).finally(()=>B(!1)))},[oe,S,d,e,$e,a,r]),ze=v.useCallback(()=>{if(!H.trim()||!ae.trim()||!ye.trim()){J(r("agent.create.required"));return}B(!0),l({name:H.trim(),description:ae.trim(),systemPrompt:ye.trim(),scope:$,tools:Nt,color:Fe!=="auto"?Fe:void 0}).then(G=>{e(r("agent.created",{name:G.agent.name})),me()}).catch(G=>J(G instanceof Error?G.message:String(G))).finally(()=>B(!1))},[H,ae,ye,$,Nt,Fe,l,e,me,r]),ot=M==="manual"?8:6,Ut=M==="manual"?6:4,Xt=M==="manual"?7:5;si(G=>{var Ue,Gt;if(m||re||G.defaultPrevented)return;const te=()=>{G.preventDefault(),G.stopPropagation()};if(x==="menu"){G.key==="ArrowDown"||G.key==="j"?(te(),w(xt=>Math.min(xt+1,1))):G.key==="ArrowUp"||G.key==="k"?(te(),w(xt=>Math.max(xt-1,0))):G.key==="Enter"||G.key===" "?(te(),g(y===0?"manage":"create")):G.key==="Escape"&&(te(),me());return}if(x==="manage"){if(G.key==="Escape"){te(),C.length<=1?t==="manage"?me():(g("menu"),w(0)):$e();return}if(We==="agent-selection"){const xt=oe.length;G.key==="ArrowDown"||G.key==="j"?(te(),T(zt=>Math.min(zt+1,xt-1))):G.key==="ArrowUp"||G.key==="k"?(te(),T(zt=>Math.max(zt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),xt>0&&Re("action-selection"));return}if(We==="action-selection"){const xt=oe[S],Tt=(xt?!Zh(xt):!0)?["view","back"]:["view","edit","delete","back"],sn=Tt.length;if(G.key==="ArrowDown"||G.key==="j")te(),j(Vn=>Math.min(Vn+1,sn-1));else if(G.key==="ArrowUp"||G.key==="k")te(),j(Vn=>Math.max(Vn-1,0));else if(G.key==="Enter"||G.key===" "){te();const Vn=Tt[I];Vn==="view"?Re("agent-viewer"):Vn==="edit"?Re("edit-options"):Vn==="delete"?Re("delete-confirmation"):Vn==="back"&&$e()}return}if(We==="agent-viewer")return;if(We==="edit-options"){const xt=["tools","color","back"],zt=xt.length;if(G.key==="ArrowDown"||G.key==="j")te(),j(Tt=>Math.min(Tt+1,zt-1));else if(G.key==="ArrowUp"||G.key==="k")te(),j(Tt=>Math.max(Tt-1,0));else if(G.key==="Enter"||G.key===" "){te();const Tt=xt[I];Tt==="tools"?(Re("edit-tools"),j(FT(Oe,O==null?void 0:O.tools))):Tt==="color"?Re("edit-color"):Tt==="back"&&$e()}return}if(We==="edit-tools"){const xt=Oe.length;G.key==="ArrowDown"||G.key==="j"?(te(),j(zt=>Math.min(zt+1,xt-1))):G.key==="ArrowUp"||G.key==="k"?(te(),j(zt=>Math.max(zt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),N||ke(((Ue=Oe[I])==null?void 0:Ue.tools)??[]));return}if(We==="edit-color"){const xt=yo.length;G.key==="ArrowDown"||G.key==="j"?(te(),j(zt=>Math.min(zt+1,xt-1))):G.key==="ArrowUp"||G.key==="k"?(te(),j(zt=>Math.max(zt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),N||ge(yo[I].value));return}if(We==="delete-confirmation"){G.key==="y"||G.key==="Enter"?(te(),N||ne()):G.key==="n"&&(te(),$e());return}return}if(x==="create"){if($t){G.key==="Escape"&&(te(),Ie.current+=1,Je(!1),ce(!0));return}if(G.key==="Escape"){te(),q<=1?t==="create"||t==="create-user"||t==="create-project"?me():(g("menu"),w(1)):(Y(zt=>zt-1),Ge(0));return}if(q===1){G.key==="ArrowDown"||G.key==="j"?(te(),Ge(zt=>Math.min(zt+1,1))):G.key==="ArrowUp"||G.key==="k"?(te(),Ge(zt=>Math.max(zt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),Z(Qe===0?"workspace":"global"),Y(2),Ge(0));return}if(q===2){G.key==="ArrowDown"||G.key==="j"?(te(),Ge(zt=>Math.min(zt+1,1))):G.key==="ArrowUp"||G.key==="k"?(te(),Ge(zt=>Math.max(zt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),X(Qe===0?"qwen":"manual"),Y(3),Ge(0),ce(!0));return}if(M==="manual"&&q>=3&&q<=5){ce(!0);return}if(M==="qwen"&&q===3){ce(!0);return}if(q===Ut){const zt=Oe.length;G.key==="ArrowDown"||G.key==="j"?(te(),Ge(Tt=>Math.min(Tt+1,zt-1))):G.key==="ArrowUp"||G.key==="k"?(te(),Ge(Tt=>Math.max(Tt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),pt(((Gt=Oe[Qe])==null?void 0:Gt.tools)??[]),Y(Tt=>Tt+1),Ge(0));return}if(q===Xt){const zt=yo.length;G.key==="ArrowDown"||G.key==="j"?(te(),Ge(Tt=>Math.min(Tt+1,zt-1))):G.key==="ArrowUp"||G.key==="k"?(te(),Ge(Tt=>Math.max(Tt-1,0))):(G.key==="Enter"||G.key===" ")&&(te(),vt(yo[Qe].value),Y(Tt=>Tt+1),Ge(0));return}if(M==="manual"&&q===ot||M==="qwen"&&q===ot){(G.key==="Enter"||G.key===" "||G.key==="s"||G.key==="e")&&(te(),N||ze());return}}},[m,re,x,t,y,C,We,oe,S,I,N,$t,q,Qe,M,$,ot,Ut,Xt,Oe,me,Re,$e,ne,ge,ke,ze,O==null?void 0:O.tools]);const En=v.useCallback(async()=>{const G=ae.trim();if(!G||$t)return;const te=Ie.current+1;Ie.current=te,Je(!0),ce(!1),J(null);try{const Ue=await c(G);if(Ie.current!==te)return;R(Ue.name),xe(Ue.description),Ae(Ue.systemPrompt),Y(M==="manual"?6:4),Ge(0)}catch(Ue){if(Ie.current!==te)return;J(r("agent.create.generateFailed",{error:Ue instanceof Error?Ue.message:String(Ue)})),ce(!0)}finally{Ie.current===te&&Je(!1)}},[ae,$t,M,c,r]),Dn=v.useCallback((G,te)=>{if(G.key==="Enter"&&!G.shiftKey){if(G.preventDefault(),G.stopPropagation(),te==="name"&&H.trim())Y(4),ce(!0);else if(te==="prompt"&&ye.trim())Y(5),ce(!0);else if(te==="desc"&&ae.trim()){if(M==="qwen"){En();return}Y(M==="manual"?6:4),Ge(0),ce(!1)}}else G.key==="Escape"&&(G.preventDefault(),G.stopPropagation(),ce(!1),Y(Ue=>Ue-1),Ge(0))},[H,ae,ye,M,En]);if(m)return f.jsx("div",{className:`${de.panel} ${de.closed}`,children:f.jsx("div",{className:de.closedText,children:r("agents.closed")})});if(s&&i.length===0)return f.jsxs("div",{className:de.panel,children:[f.jsxs("div",{className:de.titleLine,children:[f.jsx("span",{className:de.icon,children:"?"}),f.jsx("span",{className:de.title,children:r("agents.title")})]}),f.jsx("div",{className:de.loading,children:r("common.loading")})]});const Yn=((fe=oe[S])==null?void 0:fe.name)??"",wn=x==="manage"&&We==="agent-viewer"?GO(O==null?void 0:O.color):void 0,nr=x==="manage"?We==="agent-selection"?r("agents.title"):We==="action-selection"?r("agent.chooseActionTitle"):We==="agent-viewer"?Yn:We==="edit-options"?r("agent.editTitle",{name:Yn}):We==="edit-tools"?r("agent.edit.tools"):We==="edit-color"?r("agent.editColorTitle",{name:Yn}):r("agent.delete.title",{name:Yn}):r("agents.title");return f.jsxs("div",{className:de.panel,children:[x!=="create"&&f.jsxs("div",{className:de.titleLine,children:[f.jsx("span",{className:de.icon,children:"?"}),f.jsx("span",{className:de.title,style:{color:wn},children:nr}),f.jsx("span",{className:de.subtitle,children:r("agent.count",{count:i.length})})]}),P&&f.jsx("div",{className:de.error,children:P}),x==="menu"&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.text,children:r("agent.selectAction")}),f.jsxs("div",{className:de.options,children:[f.jsx(Qi,{idx:0,active:y===0,label:r("agent.manage"),desc:r("agent.manage.desc"),onClick:()=>{w(0),g("manage")},onHover:()=>w(0)}),f.jsx(Qi,{idx:1,active:y===1,label:r("agent.create"),desc:r("agent.create.desc"),onClick:()=>{w(1),g("create")},onHover:()=>w(1)})]}),f.jsx("div",{className:de.footer,children:r("agent.footer.nav")})]}),x==="manage"&&f.jsx(F1e,{step:We,agents:oe,agentGroups:rt,selectedAgentIdx:S,selectedAgent:O,selIdx:I,busy:N,toolCategories:Oe,onSelectAgent:G=>{T(G),Re("action-selection")},onHoverAgent:T,onSelectAction:G=>{G==="view"?Re("agent-viewer"):G==="edit"?Re("edit-options"):G==="delete"?Re("delete-confirmation"):G==="back"&&$e()},onHoverAction:j,onSelectEditOption:G=>{G==="tools"?(Re("edit-tools"),j(FT(Oe,O==null?void 0:O.tools))):G==="color"?Re("edit-color"):G==="back"&&$e()},onSelectTools:G=>{N||ke(G)},onSelectColor:G=>{N||ge(G)},onHoverColor:j,t:r}),x==="create"&&f.jsx(V1e,{step:q,totalSteps:ot,method:M,scope:$,name:H,desc:ae,prompt:ye,color:Fe,tools:Nt,toolCategories:Oe,selIdx:Qe,busy:N,generating:$t,inputFocused:re,onSetName:R,onSetDesc:xe,onSetPrompt:Ae,onInputKeyDown:Dn,onInputFocus:()=>ce(!0),onInputBlur:()=>ce(!1),onSelectLocation:G=>{Ge(G),Z(G===0?"workspace":"global"),Y(2),Ge(0)},onHoverLocation:Ge,onSelectMethod:G=>{Ge(G),X(G===0?"qwen":"manual"),Y(3),Ge(0),ce(!0)},onHoverMethod:Ge,onSelectTools:G=>{var te;pt(((te=Oe[G])==null?void 0:te.tools)??[]),Y(Ue=>Ue+1),Ge(0)},onHoverTools:Ge,onSelectColor:G=>{vt(yo[G].value),Y(te=>te+1),Ge(0)},onHoverColor:Ge,onSave:()=>{N||ze()},t:r})]})}function Qi({idx:t,active:e,label:n,desc:r,badge:i,colorDot:s,numbered:a=!1,onClick:o,onHover:l}){return f.jsxs("div",{className:`${de.option} ${e?de.optionActive:""}`,onClick:o,onMouseEnter:l,children:[f.jsx("span",{className:de.pointer,children:e?"›":" "}),f.jsxs("span",{className:de.optionContent,children:[f.jsxs("span",{className:de.optionLabel,children:[a?`${t+1}. `:"",s&&f.jsx("span",{className:de.colorDot,style:{backgroundColor:s==="auto"?"#888":s}}),n,i&&f.jsx("span",{className:de.badge,children:i})]}),r&&f.jsx("span",{className:de.optionDesc,children:r})]})]})}function F1e({step:t,agents:e,agentGroups:n,selectedAgentIdx:r,selectedAgent:i,selIdx:s,busy:a,toolCategories:o,onSelectAgent:l,onHoverAgent:c,onSelectAction:u,onHoverAction:d,onSelectEditOption:h,onSelectTools:m,onSelectColor:p,onHoverColor:b,t:x}){if(t==="agent-selection"){if(e.length===0)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.text,children:x("agent.empty")}),f.jsx("div",{className:de.text,children:x("agent.createFirstHint")}),f.jsx("div",{className:de.footer,children:x("agent.footer.close")})]});let g=0;const y=new Set(n.project.map(C=>C.name)),w=(C,E)=>{if(E.length===0)return null;const S=g;return g+=E.length,f.jsxs("div",{children:[f.jsx("div",{className:de.groupLabel,children:C}),f.jsx("div",{className:de.options,children:E.map((T,O)=>f.jsx(Qi,{idx:S+O,active:r===S+O,label:T.name,colorDot:GO(T.color),badge:T.isBuiltin?x("agent.builtInBadge"):T.level==="user"&&y.has(T.name)?x("agent.overriddenBadge"):void 0,onClick:()=>l(S+O),onHover:()=>c(S+O)},`${T.level}:${T.name}`))})]},C)};return f.jsxs(f.Fragment,{children:[w(x("agent.level.project"),n.project),w(x("agent.level.user"),n.user),w(x("agent.level.builtin"),n.builtin),w(x("agent.level.extension"),n.extension),f.jsx("div",{className:de.agentCount,children:x("agent.usingCount",{count:n.project.length+n.user.filter(C=>!y.has(C.name)).length+n.builtin.length+n.extension.length})}),f.jsx("div",{className:de.footer,children:x("agent.footer.cliSelect")})]})}if(t==="action-selection"){const g=e[r],w=(g?!Zh(g):!0)?[{id:"view",label:x("agent.action.view")},{id:"back",label:x("agent.back")}]:[{id:"view",label:x("agent.action.view")},{id:"edit",label:x("agent.action.edit")},{id:"delete",label:x("agent.action.delete")},{id:"back",label:x("agent.back")}];return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.options,children:w.map((C,E)=>f.jsx(Qi,{idx:E,active:s===E,label:C.label,onClick:()=>u(C.id),onHover:()=>d(E)},C.id))}),f.jsx("div",{className:de.footer,children:x("agent.footer.cliBack")})]})}if(t==="agent-viewer")return f.jsxs(f.Fragment,{children:[i?f.jsxs("div",{className:de.viewer,children:[f.jsxs("div",{className:de.viewerRow,children:[f.jsx("span",{className:de.viewerLabel,children:x("agent.filePathLabel")}),f.jsx("span",{children:i.filePath||""})]}),f.jsxs("div",{className:de.viewerRow,children:[f.jsx("span",{className:de.viewerLabel,children:x("agent.toolsLabel")}),f.jsx("span",{children:i.tools&&i.tools.length>0?i.tools.join(", "):"*"})]}),i.model&&f.jsxs("div",{className:de.viewerRow,children:[f.jsx("span",{className:de.viewerLabel,children:x("agent.modelLabel")}),f.jsx("span",{children:i.model})]}),i.color&&i.color!=="auto"&&f.jsxs("div",{className:de.viewerRow,children:[f.jsx("span",{className:de.viewerLabel,children:x("agent.colorLabel")}),f.jsx("span",{style:{color:i.color},children:i.color})]}),f.jsx("div",{className:de.viewerSectionTitle,children:x("agent.descriptionLabel")}),f.jsx("div",{className:de.viewerBlock,children:i.description}),f.jsx("div",{className:de.viewerSectionTitle,children:x("agent.systemPromptLabel")}),f.jsx("div",{className:de.viewerBlock,children:i.systemPrompt})]}):f.jsx("div",{className:de.loading,children:x("common.loading")}),f.jsx("div",{className:de.footer,children:x("agent.footer.viewerBack")})]});if(t==="edit-options"){const g=[{id:"tools",label:x("agent.edit.tools")},{id:"color",label:x("agent.edit.color")},{id:"back",label:x("agent.back")}];return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.options,children:g.map((y,w)=>f.jsx(Qi,{idx:w,active:s===w,label:y.label,onClick:()=>h(y.id),onHover:()=>d(w)},y.id))}),f.jsx("div",{className:de.footer,children:x("agent.footer.cliBack")})]})}if(t==="edit-tools"){const g=o[s]??o[0],y=(g==null?void 0:g.tools)??[],w=y.filter(i5),C=y.filter(s5),E=y.filter(a5);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.options,children:o.map((S,T)=>f.jsx(Qi,{idx:T,active:s===T,label:S.label,numbered:!0,onClick:()=>m(S.tools),onHover:()=>d(T)},S.id))}),f.jsx("div",{className:de.toolDetail,children:(g==null?void 0:g.id)==="all"?f.jsx("div",{className:de.toolDetailBody,children:x("agent.create.tools.allInfo")}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.toolDetailTitle,children:x("agent.create.tools.selected")}),f.jsx("div",{className:de.toolList,children:y.length===0?x("agent.create.tools.none"):f.jsxs(f.Fragment,{children:[w.length>0&&f.jsxs("div",{children:[x("agent.create.tools.readOnlyLabel")," ",w.join(", ")]}),C.length>0&&f.jsxs("div",{children:[x("agent.create.tools.editLabel")," ",C.join(", ")]}),E.length>0&&f.jsxs("div",{children:[x("agent.create.tools.executionLabel")," ",E.join(", ")]})]})})]})}),f.jsx("div",{className:de.footer,children:x("agent.footer.cliBack")})]})}if(t==="edit-color")return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.options,children:yo.map((g,y)=>f.jsx(Qi,{idx:y,active:s===y,label:g.name,colorDot:g.value,onClick:()=>p(g.value),onHover:()=>b(y)},g.id))}),f.jsx("div",{className:de.footer,children:x("agent.footer.cliBack")})]});if(t==="delete-confirmation"){const g=e[r];return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.text,children:a?x("agent.delete.loading"):x("agent.delete.confirm",{name:(g==null?void 0:g.name)??""})}),f.jsx("div",{className:de.footer,children:x("agent.footer.deleteConfirm")})]})}return null}function V1e({step:t,totalSteps:e,method:n,scope:r,name:i,desc:s,prompt:a,color:o,tools:l,toolCategories:c,selIdx:u,busy:d,generating:h,inputFocused:m,onSetName:p,onSetDesc:b,onSetPrompt:x,onInputKeyDown:g,onInputFocus:y,onInputBlur:w,onSelectLocation:C,onHoverLocation:E,onSelectMethod:S,onHoverMethod:T,onSelectTools:O,onHoverTools:z,onSelectColor:I,onHoverColor:j,onSave:N,t:B}){var M,X;const P=v.useRef(null),J=v.useRef(null),q=v.useRef(null);v.useEffect(()=>{var H,R,ae,xe;m&&(n==="manual"?t===3?(H=P.current)==null||H.focus():t===4?(R=q.current)==null||R.focus():t===5&&((ae=J.current)==null||ae.focus()):t===3&&((xe=J.current)==null||xe.focus()))},[t,n,m]);const Y=H=>`${B("agent.step",{n:t})}: ${H}`;if(t===1)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.location"))}),f.jsxs("div",{className:de.options,children:[f.jsx(Qi,{idx:0,active:u===0,label:B("agent.create.project.cli"),numbered:!0,onClick:()=>C(0),onHover:()=>E(0)}),f.jsx(Qi,{idx:1,active:u===1,label:B("agent.create.user.cli"),numbered:!0,onClick:()=>C(1),onHover:()=>E(1)})]}),f.jsx("div",{className:de.footer,children:B("agent.footer.createLocation")})]});if(t===2)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.method"))}),f.jsxs("div",{className:de.options,children:[f.jsx(Qi,{idx:0,active:u===0,label:B("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>S(0),onHover:()=>T(0)}),f.jsx(Qi,{idx:1,active:u===1,label:B("agent.create.method.manual"),numbered:!0,onClick:()=>S(1),onHover:()=>T(1)})]}),f.jsx("div",{className:de.footer,children:B("agent.footer.createContinue")})]});if(n==="manual"&&t===3)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.enterName"))}),f.jsx("div",{className:de.text,children:B("agent.create.nameHelp")}),f.jsx("input",{ref:P,className:de.textInput,value:i,onChange:H=>p(H.target.value),onKeyDown:H=>g(H,"name"),onFocus:y,onBlur:w,placeholder:B("agent.create.namePlaceholder"),autoFocus:!0}),f.jsx("div",{className:de.footer,children:B("agent.footer.enterNext")})]});if(n==="manual"&&t===4)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.enterPrompt"))}),f.jsx("div",{className:de.text,children:B("agent.create.promptHelp")}),f.jsx("textarea",{ref:q,className:de.textArea,value:a,onChange:H=>x(H.target.value),onKeyDown:H=>g(H,"prompt"),onFocus:y,onBlur:w,placeholder:B("agent.create.promptPlaceholder.cli"),autoFocus:!0}),f.jsx("div",{className:de.footer,children:B("agent.footer.enterNext")})]});if(n==="manual"&&t===5)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.enterDescription"))}),f.jsx("div",{className:de.text,children:B("agent.create.manualDescHelp")}),f.jsx("textarea",{ref:J,className:de.textArea,value:s,onChange:H=>b(H.target.value),onKeyDown:H=>g(H,"desc"),onFocus:y,onBlur:w,placeholder:B("agent.create.manualDescPlaceholder"),autoFocus:!0}),f.jsx("div",{className:de.footer,children:B("agent.footer.enterNext")})]});if(n==="qwen"&&t===3)return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.describeAgent"))}),f.jsx("div",{className:de.text,children:B("agent.create.qwenHint")}),h?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.text,children:B("agent.create.generatingConfig")}),f.jsx("div",{className:de.footer,children:B("agent.footer.generating")})]}):f.jsxs(f.Fragment,{children:[f.jsx("textarea",{ref:J,className:de.textArea,value:s,onChange:H=>b(H.target.value),onKeyDown:H=>g(H,"desc"),onFocus:y,onBlur:w,placeholder:B("agent.create.qwenPlaceholder"),autoFocus:!0}),f.jsx("div",{className:de.footer,children:B("agent.footer.enterNext")})]})]});if(t===(n==="manual"?6:4)){const H=c[u]??c[0],R=(H==null?void 0:H.tools)??[],ae=(H==null?void 0:H.id)==="all"?B("agent.create.tools.allInfo"):R.length>0?R.join(", "):B("agent.create.tools.none"),xe=R.filter(i5),ye=R.filter(s5),Ae=R.filter(a5);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.toolsSelection"))}),f.jsx("div",{className:de.options,children:c.map((Fe,vt)=>f.jsx(Qi,{idx:vt,active:u===vt,label:Fe.label,numbered:!0,onClick:()=>O(vt),onHover:()=>z(vt)},Fe.id))}),f.jsx("div",{className:de.toolDetail,children:(H==null?void 0:H.id)==="all"?f.jsx("div",{className:de.toolDetailBody,children:ae}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.toolDetailTitle,children:B("agent.create.tools.selected")}),f.jsx("div",{className:de.toolList,children:R.length===0?ae:f.jsxs(f.Fragment,{children:[xe.length>0&&f.jsxs("div",{children:[B("agent.create.tools.readOnlyLabel")," ",xe.join(", ")]}),ye.length>0&&f.jsxs("div",{children:[B("agent.create.tools.editLabel")," ",ye.join(", ")]}),Ae.length>0&&f.jsxs("div",{children:[B("agent.create.tools.executionLabel")," ",Ae.join(", ")]})]})})]})}),f.jsx("div",{className:de.footer,children:B("agent.footer.createContinue")})]})}if(t===(n==="manual"?7:5)){const H=((M=yo[u])==null?void 0:M.value)??"auto",R=i||B("agent.label");return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.colorSelection"))}),f.jsx("div",{className:de.options,children:yo.map((ae,xe)=>f.jsx(Qi,{idx:xe,active:u===xe,label:ae.name,colorDot:ae.value,numbered:!0,onClick:()=>I(xe),onHover:()=>j(xe)},ae.id))}),f.jsxs("div",{className:de.colorPreview,children:[f.jsxs("span",{children:[B("agent.create.preview"),":"]}),f.jsxs("span",{style:{color:H==="auto"?"var(--text-primary)":H},children:[" ",R," "]})]}),f.jsx("div",{className:de.footer,children:B("agent.footer.createContinue")})]})}if(t===e){const H=((X=yo.find(ae=>ae.value===o))==null?void 0:X.name)??o,R=l.length===0?"*":l.join(", ");return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:de.stepHeader,children:Y(B("agent.create.confirm"))}),f.jsxs("div",{className:de.summary,children:[f.jsxs("div",{className:de.summaryRow,children:[f.jsxs("span",{className:de.summaryLabel,children:[B("agent.create.name"),":"]}),f.jsx("span",{className:de.summaryValue,children:i||"—"})]}),f.jsxs("div",{className:de.summaryRow,children:[f.jsxs("span",{className:de.summaryLabel,children:[B("agent.location"),":"]}),f.jsx("span",{className:de.summaryValue,children:B(r==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),f.jsxs("div",{className:de.summaryRow,children:[f.jsx("span",{className:de.summaryLabel,children:B("agent.toolsLabel")}),f.jsx("span",{className:de.summaryValue,children:R})]}),o!=="auto"&&f.jsxs("div",{className:de.summaryRow,children:[f.jsxs("span",{className:de.summaryLabel,children:[B("agent.create.colorSelection"),":"]}),f.jsx("span",{className:de.summaryValue,children:H})]}),f.jsx("div",{className:de.summaryBlockTitle,children:B("agent.descriptionLabel")}),f.jsx("div",{className:de.summaryBlock,children:s||"—"}),f.jsx("div",{className:de.summaryBlockTitle,children:B("agent.systemPromptLabel")}),f.jsx("div",{className:de.summaryBlock,children:a||"—"})]}),f.jsx("button",{type:"button",className:de.hiddenAction,onClick:N,disabled:d,children:B(d?"agent.create.loading":"agent.create.save")}),f.jsx("div",{className:de.footer,children:B("agent.footer.final")})]})}return null}const G1e="_panel_asdx1_1",W1e="_title_asdx1_17",K1e="_row_asdx1_21",Y1e="_selected_asdx1_29",X1e="_disabled_asdx1_33",Q1e="_pointer_asdx1_42",J1e="_label_asdx1_53",Z1e="_secondary_asdx1_58",eye="_error_asdx1_62",tye="_toggles_asdx1_66",nye="_list_asdx1_67",rye="_description_asdx1_74",iye="_content_asdx1_79",sye="_shortcuts_asdx1_90",aye="_modalBackdrop_asdx1_96",oye="_modal_asdx1_96",lye="_modalHeader_asdx1_121",cye="_modalTitle_asdx1_129",uye="_modalFooter_asdx1_137",dye="_editor_asdx1_149",hye="_primaryButton_asdx1_163",fye="_closeButton_asdx1_179",Dt={panel:G1e,title:W1e,row:K1e,selected:Y1e,disabled:X1e,pointer:Q1e,label:J1e,secondary:Z1e,error:eye,toggles:tye,list:nye,description:rye,content:iye,shortcuts:sye,modalBackdrop:aye,modal:oye,modalHeader:lye,modalTitle:cye,modalFooter:uye,editor:dye,primaryButton:hye,closeButton:fye},WO="web-shell:memory-panel-active";function s4(t,e){return t.find(n=>n.scope===e)}function VT(t,e,n){const r=(t==null?void 0:t.path)??e;return n("memory.savedIn",{path:r})}function a4(t){return(t==null?void 0:t.value)==="managed"}function tp(t,e){return e(t==="global"?"memory.global":"memory.project")}function mye({refreshSignal:t=0,addSignal:e=0,addScope:n="workspace",portalHost:r,onMessage:i,onClose:s}){const{t:a}=dt(),o=v.useRef(`memory-${Math.random().toString(36).slice(2)}`),{files:l,loading:c,error:u,readFile:d,reload:h,writeMemory:m}=dU({autoLoad:!0}),p=v.useRef(null),[b,x]=v.useState("list"),[g,y]=v.useState(0),[w,C]=v.useState(!1),[E,S]=v.useState(null),[T,O]=v.useState(null),[z,I]=v.useState(""),[j,N]=v.useState(!1),[B,P]=v.useState(!1),[J,q]=v.useState(""),[Y,$]=v.useState("workspace"),[Z,M]=v.useState(!1),[X,H]=v.useState(!1),[R,ae]=v.useState(!1),xe=v.useCallback(oe=>{window.dispatchEvent(new CustomEvent(WO,{detail:{id:o.current,active:oe}}))},[]);v.useEffect(()=>(xe(!w),()=>xe(!1)),[w,xe]),v.useEffect(()=>{u&&S(u.message)},[u]),v.useEffect(()=>{t<=0||h().then(()=>S(a("memory.refreshed"))).catch(oe=>{S(oe instanceof Error?oe.message:String(oe))})},[t,h,a]),v.useEffect(()=>{e<=0||(x("list"),y(n==="global"?0:1),S(null),ae(!0))},[n,e]);const ye=s4(l,"global"),Ae=s4(l,"workspace"),Fe=v.useMemo(()=>[{label:a("memory.global"),value:"global",description:VT(ye,"~/.qwen/QWEN.md",a),file:ye},{label:a("memory.project"),value:"workspace",description:VT(Ae,"QWEN.md",a),file:Ae},{label:a("memory.autoFolder"),value:"managed"}],[ye,a,Ae]),vt=v.useCallback(()=>{C(!0),s()},[s]),Nt=v.useCallback((oe,Oe)=>{if(S(null),Oe==="managed"){const Re=a("memory.openFolderUnsupported");S(Re),i==null||i(Re,"status");return}if(!oe){const Re=a("memory.noFiles");S(Re);return}O(oe),I(""),x("detail"),N(!0),d(oe.path).then(Re=>{I(Re.content)}).catch(Re=>{const $e=Re instanceof Error?Re.message:String(Re);I($e)}).finally(()=>N(!1))},[i,d,a]),pt=v.useCallback(oe=>{const Oe=s4(l,oe);$(oe),q(""),S(null),ae(!1),P(!0),requestAnimationFrame(()=>{var Re;return(Re=p.current)==null?void 0:Re.focus()}),Oe&&(M(!0),d(Oe.path).then(Re=>{q(Re.content),Re.truncated&&S(a("memory.fileTruncated")),requestAnimationFrame(()=>{var $e;return($e=p.current)==null?void 0:$e.focus()})}).catch(Re=>{const $e=Re instanceof Error?Re.message:String(Re);S($e),i==null||i($e,"error")}).finally(()=>M(!1)))},[l,i,d,a]),Qe=v.useCallback((oe=g)=>{const Oe=Fe[oe];if(Oe&&!a4(Oe)){if(R){(Oe.value==="global"||Oe.value==="workspace")&&pt(Oe.value);return}Nt(Oe.file,Oe.value)}},[R,Fe,pt,Nt,g]),Ge=v.useCallback(()=>{P(!1),q(""),S(null),M(!1)},[]),$t=v.useCallback(()=>{const oe=J;if(!oe.trim()){S(a("memory.contentEmpty"));return}H(!0),S(null),m({scope:Y,mode:"replace",content:oe}).then(Oe=>{const Re=a("memory.saved",{scope:tp(Y,a),bytes:Oe.bytesWritten,path:Oe.filePath});P(!1),q(""),S(Re),i==null||i(Re,"status"),h().catch(()=>{})}).catch(Oe=>{const Re=Oe instanceof Error?Oe.message:String(Oe);S(Re),i==null||i(Re,"error")}).finally(()=>H(!1))},[J,Y,i,h,a,m]);if(si(oe=>{if(w||oe.defaultPrevented)return;const Oe=oe.target,Re=(Oe==null?void 0:Oe.tagName)==="TEXTAREA"||(Oe==null?void 0:Oe.tagName)==="INPUT",$e=()=>{oe.preventDefault(),oe.stopPropagation()};if(oe.key==="Escape"){$e(),B?Ge():b==="detail"?(x("list"),O(null),I(""),S(null)):vt();return}if(B){(oe.metaKey||oe.ctrlKey)&&oe.key==="Enter"&&($e(),X||$t());return}if(!Re){if(b==="autoMemory"){oe.key==="ArrowDown"||oe.key==="j"?($e(),x("autoDream")):oe.key==="Enter"&&$e();return}if(b==="autoDream"){oe.key==="ArrowUp"||oe.key==="k"?($e(),x("autoMemory")):oe.key==="ArrowDown"||oe.key==="j"?($e(),x("autoSkill")):oe.key==="Enter"&&$e();return}if(b==="autoSkill"){oe.key==="ArrowUp"||oe.key==="k"?($e(),x("autoDream")):oe.key==="ArrowDown"||oe.key==="j"?($e(),x("list"),y(0)):oe.key==="Enter"&&$e();return}if(b!=="detail"){if(oe.key==="ArrowUp"||oe.key==="k"){$e(),g===0?x("autoSkill"):y(ne=>Math.max(ne-1,0));return}if(oe.key==="ArrowDown"||oe.key==="j"){$e(),y(ne=>(ne+1)%Fe.length);return}if(oe.key==="Enter"){$e(),Qe();return}if(/^[1-9]$/.test(oe.key)){$e();const ne=Number(oe.key)-1;if(ne>=Fe.length)return;x("list"),y(ne),a4(Fe[ne])||Qe(ne)}}}},[w,b,vt,Ge,R,B,Fe.length,Fe,$t,X,g,Qe]),w)return f.jsx("div",{className:Dt.panel,children:f.jsx("div",{className:Dt.secondary,children:a("memory.closed")})});const Je=b==="autoMemory",re=b==="autoDream",ce=b==="autoSkill",Ie=E??(c?a("memory.loading"):null),We=a("memory.on"),me=()=>{x("list"),O(null),I(""),S(null)},rt=f.jsxs(f.Fragment,{children:[T?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:Dt.modalBackdrop,onClick:me}),f.jsxs("div",{className:Dt.modal,role:"dialog","aria-modal":"true","aria-label":T.path,children:[f.jsxs("div",{className:Dt.modalHeader,children:[f.jsx("span",{className:Dt.modalTitle,children:T.path}),f.jsx("button",{type:"button",className:Dt.closeButton,onClick:me,children:"ESC"})]}),f.jsx("pre",{className:Dt.content,children:j?a("memory.loadingFile"):z})]})]}):null,B?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:Dt.modalBackdrop,onClick:Ge}),f.jsxs("div",{className:Dt.modal,role:"dialog","aria-modal":"true","aria-label":tp(Y,a),children:[f.jsxs("div",{className:Dt.modalHeader,children:[f.jsx("span",{className:Dt.modalTitle,children:tp(Y,a)}),f.jsx("button",{type:"button",className:Dt.closeButton,onClick:Ge,children:"ESC"})]}),f.jsx("textarea",{ref:p,className:Dt.editor,value:J,onChange:oe=>q(oe.target.value),onKeyDown:oe=>{if(oe.key==="Escape"){oe.preventDefault(),oe.stopPropagation(),Ge();return}(oe.metaKey||oe.ctrlKey)&&oe.key==="Enter"&&(oe.preventDefault(),X||$t())},placeholder:a("memory.placeholder",{scope:tp(Y,a)})}),f.jsxs("div",{className:Dt.modalFooter,children:[f.jsx("span",{children:a(Z?"memory.loadingFile":"dialog.footer.saveClose")}),f.jsx("button",{type:"button",className:Dt.primaryButton,disabled:X||Z,onClick:$t,children:a(X?"memory.saving":"memory.save")})]})]})]}):null]});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Dt.panel,children:[f.jsx("div",{className:Dt.title,children:a("memory.menu")}),f.jsxs("div",{className:Dt.toggles,children:[f.jsxs("div",{className:`${Dt.row} ${Dt.disabled} ${Je?Dt.selected:""}`,onMouseEnter:()=>x("autoMemory"),children:[f.jsx("span",{className:Dt.pointer,children:Je?"›":" "}),f.jsx("span",{className:Dt.label,children:a("memory.autoMemory",{status:We})})]}),f.jsxs("div",{className:`${Dt.row} ${Dt.disabled} ${re?Dt.selected:""}`,onMouseEnter:()=>x("autoDream"),children:[f.jsx("span",{className:Dt.pointer,children:re?"›":" "}),f.jsx("span",{className:Dt.label,children:a("memory.autoDream",{status:We,lastDream:a("memory.lastDream")})})]}),f.jsxs("div",{className:`${Dt.row} ${Dt.disabled} ${ce?Dt.selected:""}`,onMouseEnter:()=>x("autoSkill"),children:[f.jsx("span",{className:Dt.pointer,children:ce?"›":" "}),f.jsx("span",{className:Dt.label,children:a("memory.autoSkill",{status:We})})]})]}),u&&f.jsx("div",{className:Dt.error,children:u.message}),Ie&&f.jsx("div",{className:Dt.secondary,children:Ie}),f.jsx("div",{className:Dt.list,children:Fe.map((oe,Oe)=>{const Re=b==="list"&&Oe===g,$e=a4(oe);return f.jsxs("div",{className:`${Dt.row} ${$e?Dt.disabled:""} ${Re?Dt.selected:""}`,onClick:()=>{$e||Qe(Oe)},onMouseEnter:()=>{x("list"),y(Oe)},children:[f.jsx("span",{className:Dt.pointer,children:Re?"›":" "}),f.jsxs("span",{className:Dt.label,children:[Oe+1,". ",oe.label]}),oe.description?f.jsx("span",{className:Dt.description,children:oe.description}):null]},oe.value)})}),f.jsx("div",{className:Dt.shortcuts,children:a(T?"memory.footer.back":"memory.footer")})]}),r?hw.createPortal(rt,r):null]})}const pye="_panel_mjusq_1",gye="_header_mjusq_17",yye="_title_mjusq_23",bye="_list_mjusq_31",vye="_row_mjusq_39",xye="_selected_mjusq_52",wye="_label_mjusq_52",kye="_pointer_mjusq_56",_ye="_number_mjusq_64",Sye="_provider_mjusq_70",Tye="_badge_mjusq_81",Cye="_detail_mjusq_86",Eye="_detailRow_mjusq_94",Aye="_detailLabel_mjusq_100",Mye="_detailValue_mjusq_106",Nye="_footer_mjusq_112",Dye="_empty_mjusq_118",Fr={panel:pye,header:gye,title:yye,list:bye,row:vye,selected:xye,label:wye,pointer:kye,number:_ye,provider:Sye,badge:Tye,detail:Cye,detailRow:Eye,detailLabel:Aye,detailValue:Mye,footer:Nye,empty:Dye},KO="web-shell:model-panel-active";function Iye(t,e){return t?`${t.toLocaleString()} ${e("contextUsage.tokens")}`:e("model.contextWindow.unknown")}function Rye(t,e){if(!t)return e("model.modality.textOnly");const n=[];return t.image&&n.push(e("model.modality.image")),t.pdf&&n.push(e("model.modality.pdf")),t.audio&&n.push(e("model.modality.audio")),t.video&&n.push(e("model.modality.video")),n.length===0?e("model.modality.textOnly"):`${e("model.modality.text")} · ${n.join(" · ")}`}function GT(t){if(t.authType)return t.authType;const e=t.id.match(/\(([^()]+)\)$/);return e==null?void 0:e[1]}function Oye(t){return t.label?t.label:t.baseModelId?t.baseModelId:t.id.replace(/\([^()]+\)$/,"")}function jye(t){return[t.authType??"",t.id,t.baseUrl??"",t.envKey??""].join("\0")}function WT(t,e){return e?t.baseModelId??t.id.replace(/\([^()]+\)$/,""):t.id}function np({label:t,value:e}){return f.jsxs("div",{className:Fr.detailRow,children:[f.jsxs("span",{className:Fr.detailLabel,children:[t,":"]}),f.jsx("span",{className:Fr.detailValue,children:e})]})}function Lye({mode:t="main",onSelect:e,onClose:n}){const r=uu(),i=r.currentModel??"",s=v.useMemo(()=>r.models??[],[r.models]),{t:a}=dt(),o=v.useRef(`model-${Math.random().toString(36).slice(2)}`),l=v.useRef(null),c=v.useRef(null),u=v.useRef(n);v.useEffect(()=>{u.current=n},[n]);const d=t==="fast",[h,m]=v.useState(()=>{const g=s.findIndex(y=>y.id===i);return g>=0?g:0}),p=s[h],b=v.useCallback(g=>{window.dispatchEvent(new CustomEvent(KO,{detail:{id:o.current,active:g}}))},[]);v.useEffect(()=>(b(!0),()=>b(!1)),[b]),v.useEffect(()=>{const g=y=>{if(y instanceof MouseEvent&&y.button!==0||y.defaultPrevented)return;const w=c.current,C=y.target;w&&C instanceof Node&&!w.contains(C)&&u.current()};return window.addEventListener("mousedown",g),window.addEventListener("touchstart",g),()=>{window.removeEventListener("mousedown",g),window.removeEventListener("touchstart",g)}},[]),v.useEffect(()=>{h>=s.length&&s.length>0&&m(s.length-1)},[s.length,h]),v.useEffect(()=>{var y;const g=(y=l.current)==null?void 0:y.children[h];g==null||g.scrollIntoView({block:"nearest"})},[h]);const x=v.useCallback(()=>{const g=s[h];g&&(e(WT(g,d)),n())},[s,d,n,e,h]);return si(g=>{if(g.defaultPrevented)return;const y=()=>{g.preventDefault(),g.stopPropagation()};if(g.key==="Escape"){y(),n();return}if(g.key==="ArrowDown"||g.key==="j"){y(),m(w=>s.length>0?(w+1)%s.length:0);return}if(g.key==="ArrowUp"||g.key==="k"){y(),m(w=>s.length>0?(w-1+s.length)%s.length:0);return}if(g.key==="Enter"){y(),x();return}},[s.length,x,n]),f.jsxs("div",{ref:c,className:Fr.panel,children:[f.jsx("div",{className:Fr.header,children:f.jsx("span",{className:Fr.title,children:a(d?"model.setFast":"model.select")})}),f.jsxs("div",{className:Fr.list,ref:l,role:"listbox","aria-label":a(d?"model.setFast":"model.select"),children:[s.length===0?f.jsx("div",{className:Fr.empty,children:a("model.none")}):null,s.map((g,y)=>{const w=y===h,C=GT(g);return f.jsxs("div",{role:"option","aria-selected":w,className:`${Fr.row} ${w?Fr.selected:""}`,onClick:()=>{e(WT(g,d)),n()},children:[f.jsx("span",{className:Fr.pointer,children:w?"›":" "}),f.jsxs("span",{className:Fr.number,children:[y+1,"."]}),C?f.jsxs("span",{className:Fr.provider,children:["[",C,"]"]}):null,f.jsx("span",{className:Fr.label,children:Oye(g)}),g.isRuntime?f.jsx("span",{className:Fr.badge,children:"Runtime"}):null]},jye(g))})]}),p?f.jsxs("div",{className:Fr.detail,children:[f.jsx(np,{label:a("model.modality"),value:Rye(p.modalities,a)}),f.jsx(np,{label:a("model.contextWindow"),value:Iye(p.contextWindow,a)}),GT(p)!=="qwen-oauth"?f.jsxs(f.Fragment,{children:[f.jsx(np,{label:a("model.baseUrl"),value:p.baseUrl??a("model.default")}),f.jsx(np,{label:a("model.apiKey"),value:p.envKey??a("model.notSet")})]}):null]}):null,f.jsx("div",{className:Fr.footer,children:a("model.footer")})]})}const Bye="_panel_1ocne_1",zye="_title_1ocne_13",Pye="_text_1ocne_18",$ye="_muted_1ocne_23",Uye="_options_1ocne_27",Hye="_option_1ocne_27",qye="_optionActive_1ocne_42",Fye="_label_1ocne_42",Vye="_pointer_1ocne_46",Gye="_description_1ocne_57",Wye="_input_1ocne_63",Kye="_preview_1ocne_79",Yye="_error_1ocne_91",Xye="_link_1ocne_96",Qye="_terms_1ocne_103",Jye="_footer_1ocne_110",zn={panel:Bye,title:zye,text:Pye,muted:$ye,options:Uye,option:Hye,optionActive:qye,label:Fye,pointer:Vye,description:Gye,input:Wye,preview:Kye,error:Yye,link:Xye,terms:Qye,footer:Jye},iw="web-shell:auth-panel-active",Zye=[{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 Ph(t){return t==="anthropic"?"https://api.anthropic.com/v1":t==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function KT(t){var e;return((e=t==null?void 0:t.models)==null?void 0:e.map(n=>n.id).join(", "))??""}function ebe(t,e,n){var r;return t==="protocol"?n("auth.step.protocol"):t==="baseUrl"?((r=e.uiLabels)==null?void 0:r.baseUrlStepTitle)??n("auth.step.baseUrl"):n(t==="apiKey"?"auth.step.apiKey":t==="models"?"auth.step.models":"auth.step.advanced")}function tbe(t){const e=t.trim();return e?e.length<=6?"***":`${e.slice(0,3)}...${e.slice(-4)}`:"(not set)"}function o4(t){return[...new Set(t.split(",").map(e=>e.trim()).filter(e=>e.length>0))]}function nbe({onMessage:t,onClose:e}){var Yn,wn,nr;const{t:n}=dt(),r=Zl(),[i,s]=v.useState("groups"),[a,o]=v.useState(0),[l,c]=v.useState(0),[u,d]=v.useState("providers"),[h,m]=v.useState(0),[p,b]=v.useState(),[x,g]=v.useState("alibaba"),[y,w]=v.useState(null),[C,E]=v.useState("openai"),[S,T]=v.useState(""),[O,z]=v.useState(""),[I,j]=v.useState(""),[N,B]=v.useState(!1),[P,J]=v.useState(!1),[q,Y]=v.useState(!0),[$,Z]=v.useState(!0),[M,X]=v.useState(!1),[H,R]=v.useState(!1),[ae,xe]=v.useState(""),[ye,Ae]=v.useState(!0),[Fe,vt]=v.useState(!1),[Nt,pt]=v.useState(null);v.useEffect(()=>{const fe=`auth-${Math.random().toString(36).slice(2)}`;return window.dispatchEvent(new CustomEvent(iw,{detail:{id:fe,active:!0}})),()=>{window.dispatchEvent(new CustomEvent(iw,{detail:{id:fe,active:!1}}))}},[]),v.useEffect(()=>{r.getAuthProviders().then(fe=>{b(fe),Ae(!1)}).catch(fe=>{pt(fe instanceof Error?fe.message:String(fe)),Ae(!1)})},[r]);const Qe=v.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),Ge=v.useMemo(()=>{var G;return(((G=Qe.find(te=>te.id===x))==null?void 0:G.providerIds)??[]).map(te=>p==null?void 0:p.providers.find(Ue=>Ue.id===te)).filter(te=>!!te)},[p,x,Qe]),$t=(y==null?void 0:y.steps)??[],Je=$t[h],re=(y==null?void 0:y.showAdvancedConfig)===!0,ce=v.useMemo(()=>P?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[P]),Ie=ce.indexOf("context"),We=ce.length,me=$t.length+(re?1:0),rt=Je==="apiKey"||Je==="models"||Je==="baseUrl"&&!Array.isArray(y==null?void 0:y.baseUrl),oe=i==="groups"?Qe.length:i==="providers"?Ge.length:Je==="protocol"?((y==null?void 0:y.protocolOptions)??[y==null?void 0:y.protocol]).length:Je==="baseUrl"&&Array.isArray(y==null?void 0:y.baseUrl)?y.baseUrl.length:Je==="advancedConfig"?We:0,[Oe,Re]=v.useState(0),$e=v.useCallback((fe,G="providers")=>{var Ue,Gt;w(fe),d(G);const te=((Ue=fe.protocolOptions)==null?void 0:Ue[0])??fe.protocol;E(te),typeof fe.baseUrl=="string"?T(fe.baseUrl):Array.isArray(fe.baseUrl)?T(((Gt=fe.baseUrl[0])==null?void 0:Gt.url)??""):T(Ph(te)),z(""),j(KT(fe)),B(!1),J(!1),Y(!0),Z(!0),X(!1),R(!1),xe(""),m(0),Re(0),pt(null),s(fe.steps.length>0?"step":"review")},[]),ne=v.useCallback(()=>{if(pt(null),i==="groups"){e();return}if(i==="providers"){s("groups");return}if(i==="review"){s("step"),m(Math.max(0,$t.length-1));return}if(h>0){m(fe=>fe-1),Re(0);return}s(u)},[e,u,h,$t.length,i]),ge=v.useCallback(()=>{if(!y||Fe)return;vt(!0),pt(null);const fe=Number(ae);r.installAuthProvider({providerId:y.id,protocol:C,baseUrl:S,apiKey:O,modelIds:o4(I),advancedConfig:N||P||Number.isFinite(fe)&&fe>0?{...N?{enableThinking:!0}:{},...P?{multimodal:{...q?{image:!0}:{},...$?{video:!0}:{},...M?{audio:!0}:{},...H?{pdf:!0}:{}}}:{},...Number.isFinite(fe)&&fe>0?{contextWindowSize:fe}:{}}:void 0}).then(G=>{t(G.message),e()}).catch(G=>{const te=G instanceof Error?G.message:String(G);pt(te),t(te,"error")}).finally(()=>vt(!1))},[O,S,ae,P,M,q,H,$,I,e,t,C,y,Fe,N,r]),ke=v.useCallback(()=>{if(y){if(Je==="baseUrl"){const fe=S.trim()||Ph(C);if(!fe){pt(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(fe)){pt(n("auth.baseUrlInvalid"));return}S.trim()||T(fe)}if(Je==="apiKey"&&O.trim().length===0){pt(n("auth.apiKeyRequired"));return}if(Je==="models"&&o4(I).length===0){pt(n("auth.modelsRequired"));return}pt(null),h>=$t.length-1?re?s("review"):ge():(m(fe=>fe+1),Re(0))}},[O,S,Je,I,C,y,ge,re,h,$t.length,n]),ze=v.useCallback(fe=>{switch(fe){case"thinking":B(G=>!G);return;case"modality":J(G=>!G);return;case"image":Y(G=>!G);return;case"video":Z(G=>!G);return;case"audio":X(G=>!G);return;case"pdf":R(G=>!G);return;case"context":ke();return;default:return}},[ke]),ot=v.useCallback(()=>{if(i==="groups"){const fe=Qe[a];if(!fe)return;if(fe.id==="custom"){const G=fe.providerIds.map(te=>p==null?void 0:p.providers.find(Ue=>Ue.id===te)).find(te=>!!te);G&&$e(G,"groups");return}g(fe.id),c(0),s("providers");return}if(i==="providers"){const fe=Ge[l];fe&&$e(fe,"providers");return}if(i==="review"){ge();return}if(!(!y||!Je)){if(Je==="protocol"){const fe=(y.protocolOptions??[y.protocol])[Oe];fe&&(E(fe),y.baseUrl||T(Ph(fe))),ke();return}if(Je==="baseUrl"&&Array.isArray(y.baseUrl)){const fe=y.baseUrl[Oe];fe&&T(fe.url),ke();return}if(Je==="advancedConfig"){ze(ce[Oe]);return}ke()}},[Je,p,ke,a,Qe,Oe,y,l,Ge,ge,$e,i,ze,ce]),Ut=v.useCallback(fe=>{if(i==="groups"){const G=Qe[fe];if(!G)return;if(G.id==="custom"){const te=G.providerIds.map(Ue=>p==null?void 0:p.providers.find(Gt=>Gt.id===Ue)).find(Ue=>!!Ue);te&&$e(te,"groups");return}g(G.id),c(0),s("providers");return}if(i==="providers"){const G=Ge[fe];G&&$e(G,"providers");return}if(!y||!Je){i==="review"&&ge();return}if(Je==="protocol"){const G=(y.protocolOptions??[y.protocol])[fe];G&&(E(G),y.baseUrl||T(Ph(G))),ke();return}if(Je==="baseUrl"&&Array.isArray(y.baseUrl)){const G=y.baseUrl[fe];G&&T(G.url),ke();return}Je==="advancedConfig"&&ze(ce[fe])},[Je,p,ke,Qe,ze,ce,y,Ge,ge,$e,i]);si(fe=>{if(fe.key==="Escape"){fe.preventDefault(),ne();return}if(fe.key==="Enter"){fe.preventDefault(),ot();return}if(fe.key===" "){Je==="advancedConfig"&&(fe.preventDefault(),ot());return}if(oe>0&&(fe.key==="ArrowUp"||fe.key==="ArrowDown")){fe.preventDefault();const G=fe.key==="ArrowUp"?-1:1,te=Ue=>(Ue+oe+G)%oe;i==="groups"?o(te):i==="providers"?c(te):Re(te)}},[ot,Je,ne,oe,i]);const Xt=(fe,G,te)=>f.jsx("div",{className:zn.options,children:fe.map((Ue,Gt)=>f.jsxs("div",{className:`${zn.option} ${G===Gt?zn.optionActive:""}`,onClick:()=>{te(Gt),Ut(Gt)},children:[f.jsx("span",{className:zn.pointer,children:G===Gt?"›":" "}),f.jsxs("div",{children:[f.jsxs("div",{className:zn.label,children:[Gt+1,". ",Ue.label]}),Ue.description&&f.jsx("div",{className:zn.description,children:Ue.description})]})]},Ue.value))}),En=()=>{if(!y||!Je)return null;if(Je==="protocol"){const te=y.protocolOptions??[y.protocol];return Xt(Zye.filter(Ue=>te.includes(Ue.value)),Oe,Re)}if(Je==="baseUrl")return Array.isArray(y.baseUrl)?Xt(y.baseUrl.map(te=>({value:te.url,label:te.label,description:te.url})),Oe,Re):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:zn.text,children:n("auth.baseUrlPrompt")}),f.jsx("input",{className:zn.input,value:S,placeholder:Ph(C),onChange:te=>{T(te.target.value),pt(null)},onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),te.stopPropagation(),ke())},autoFocus:!0}),y.documentationUrl&&f.jsx("a",{className:zn.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(Je==="apiKey")return f.jsxs(f.Fragment,{children:[y.documentationUrl&&f.jsxs("a",{className:zn.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",y.documentationUrl]}),f.jsx("input",{className:zn.input,type:"password",value:O,placeholder:y.apiKeyPlaceholder??"sk-...",onChange:te=>{z(te.target.value),pt(null)},onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),te.stopPropagation(),ke())},autoFocus:!0})]});if(Je==="models"){const te=KT(y);return f.jsxs(f.Fragment,{children:[te&&f.jsx("div",{className:zn.muted,children:n("auth.modelsPrompt",{modelIds:te})}),f.jsx("input",{className:zn.input,value:I,placeholder:te||"model-id-1, model-id-2",onChange:Ue=>{j(Ue.target.value),pt(null)},onKeyDown:Ue=>{Ue.key==="Enter"&&(Ue.preventDefault(),Ue.stopPropagation(),ke())},autoFocus:!0})]})}const fe=te=>te?"◉":"○",G=[{value:"thinking",label:`${fe(N)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${fe(P)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return P&&G.push({value:"image",label:`${fe(q)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${fe($)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${fe(M)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${fe(H)} ${n("auth.advanced.modalityPdf")}`}),G.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ae||"auto"}`,description:n("auth.advanced.contextDesc")}),f.jsxs(f.Fragment,{children:[f.jsx("div",{className:zn.text,children:n("auth.advanced.prompt")}),Xt(G,Oe,Re),f.jsx("input",{className:zn.input,value:ae,placeholder:"auto",onChange:te=>xe(te.target.value.replace(/[^0-9]/g,"")),onFocus:()=>Re(Ie),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),te.stopPropagation(),ke())}})]})},Dn=v.useMemo(()=>{if(!y)return"";const fe=y.envKey??`${C.toUpperCase()}_API_KEY`,G=o4(I),te={};if(N&&(te.extra_body={enable_thinking:!0}),P){const xt={};q&&(xt.image=!0),$&&(xt.video=!0),M&&(xt.audio=!0),H&&(xt.pdf=!0),Object.keys(xt).length>0&&(te.modalities=xt)}const Ue=Number(ae);Number.isFinite(Ue)&&Ue>0&&(te.contextWindowSize=Ue);const Gt=Object.keys(te).length>0;return JSON.stringify({env:{[fe]:tbe(O)},modelProviders:{[C]:G.map(xt=>({id:xt,name:xt,baseUrl:S.trim(),envKey:fe,...Gt?{generationConfig:te}:{}}))},security:{auth:{selectedType:C}},model:{name:G[0]}},null,2)},[O,S,ae,P,M,q,H,$,I,C,y,N]);return f.jsxs("div",{className:zn.panel,"data-keyboard-scope":!0,children:[f.jsx("div",{className:zn.title,children:i==="groups"?n("auth.title"):i==="providers"?n(((Yn=Qe.find(fe=>fe.id===x))==null?void 0:Yn.label)??""):y&&Je?`${n(((wn=y.uiLabels)==null?void 0:wn.flowTitle)??y.label)} · ${n("auth.stepCount",{step:h+1,total:me})} · ${ebe(Je,y,n)}`:y&&i==="review"?`${n(((nr=y.uiLabels)==null?void 0:nr.flowTitle)??y.label)} · ${n("auth.stepCount",{step:me,total:me})} · ${n("auth.review")}`:n("auth.review")}),ye&&f.jsx("div",{className:zn.muted,children:n("common.loading")}),i==="groups"&&!ye&&Xt(Qe.map(fe=>({value:fe.id,label:n(fe.label),description:n(fe.description)})),a,o),i==="providers"&&Xt(Ge.map(fe=>({value:fe.id,label:n(fe.label),description:n(fe.description)})),l,c),i==="step"&&En(),i==="review"&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:zn.text,children:n("auth.reviewText")}),f.jsx("div",{className:zn.preview,children:Dn})]}),Nt&&f.jsx("div",{className:zn.error,children:Nt}),i==="groups"&&!ye&&f.jsxs("div",{className:zn.terms,children:[f.jsxs("div",{children:[n("auth.termsTitle"),":"]}),f.jsx("a",{className:zn.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/"})]}),i!=="groups"&&f.jsx("div",{className:zn.footer,children:n(Je==="advancedConfig"?"auth.footer.advanced":i==="review"?Fe?"auth.saving":"auth.footer.save":rt?"auth.footer.input":"auth.footer.back")})]})}function YT(t){return t.displayName||t.name}function rbe({onClose:t}){const{t:e}=dt(),{status:n,tools:r,loading:i,error:s,reload:a,setEnabled:o}=WA({autoLoad:!0}),[l,c]=v.useState(0),[u,d]=v.useState(null),[h,m]=v.useState(null),[p,b]=v.useState(()=>new Set),x=v.useRef(null),g=r[l],y=g?p.has(g.name):!1;v.useEffect(()=>{var S,T;s?m(s.message):(T=(S=n==null?void 0:n.errors)==null?void 0:S[0])!=null&&T.error?m(n.errors[0].error):n&&m(null)},[n,s]);const w=v.useCallback(S=>{m(null),d(S.name),o(S.name,!S.enabled).then(()=>a()).catch(T=>{m(T instanceof Error?T.message:String(T))}).finally(()=>d(null))},[a,o]),C=v.useCallback(S=>{b(T=>{const O=new Set(T);return O.has(S.name)?O.delete(S.name):O.add(S.name),O})},[]);v.useEffect(()=>{l>=r.length&&r.length>0&&c(r.length-1)},[l,r.length]),v.useEffect(()=>{var T;const S=(T=x.current)==null?void 0:T.children[l];S==null||S.scrollIntoView({block:"nearest"})},[l]),si(S=>{if(S.key==="Escape"){S.preventDefault(),t();return}if(S.key==="ArrowDown"||S.key==="j"){S.preventDefault(),c(T=>Math.min(T+1,Math.max(r.length-1,0)));return}if(S.key==="ArrowUp"||S.key==="k"){S.preventDefault(),c(T=>Math.max(T-1,0));return}if(S.key==="r"){S.preventDefault(),a();return}if((S.key==="Enter"||S.key===" ")&&(g!=null&&g.description)){S.preventDefault(),C(g);return}S.key==="t"&&g&&(S.preventDefault(),w(g))},[w,t,a,g,C,r.length]);const E=v.useMemo(()=>{if(!n)return"";const S=r.filter(T=>T.enabled).length;return e("tools.summary",{enabled:S,total:r.length})},[n,r,e]);return f.jsxs("div",{className:ee("resume-picker","resume-picker-keyboard-only"),children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:e("tools.title")}),f.jsx("span",{className:ee("resume-picker-count"),children:E}),f.jsx("button",{className:ee("resume-picker-close"),onClick:t,title:e("common.close"),children:"ESC"})]}),(h||i)&&f.jsx("div",{className:ee("resume-picker-search"),children:f.jsx("span",{className:ee("resume-picker-search-hint"),children:h||e("tools.loading")})}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsxs("div",{className:ee("resume-picker-list"),ref:x,children:[!i&&r.length===0&&f.jsx("div",{className:ee("resume-picker-empty"),children:e("tools.empty")}),r.map((S,T)=>{const O=p.has(S.name),z=S.description??"",I=S.displayName&&S.displayName!==S.name?S.name:"",j=O?"":I||(z.length>80?`${z.slice(0,80)}...`:z);return f.jsxs("div",{className:ee("resume-picker-item","resume-picker-session-item",T===l?"selected":void 0),onClick:()=>{c(T),S.description&&C(S)},children:[f.jsxs("div",{className:ee("resume-picker-item-row"),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:T===l?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:YT(S)})]}),f.jsxs("div",{className:ee("resume-picker-item-meta"),children:[f.jsx("span",{children:u===S.name?"...":S.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),!O&&j&&f.jsx("span",{className:ee("resume-picker-item-detail"),children:j})]}),O&&z&&f.jsx("div",{className:ee("tools-desc-expanded"),children:f.jsx("div",{className:ee("tools-desc-body"),children:z})})]},S.name)})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-footer"),children:g?e("tools.footer",{name:YT(g),details:g!=null&&g.description?e(y?"tools.details.hide":"tools.details.show"):""}):e("tools.footer")})]})}const ibe="update available";function sw(t,e){return t.isActive?e("extensions.manage.status.enabled"):e("extensions.manage.status.disabled")}function XT(t,e){switch(t){case"update available":return e("extensions.manage.updateAvailable");case"up to date":return e("extensions.manage.upToDate");case"not updatable":return e("extensions.manage.notUpdatable");case"checking for updates":return e("extensions.manage.checkingUpdates");case"error":return e("extensions.manage.updateError");default:return e("extensions.manage.unknownUpdate")}}function Nu(t){return t&&t.length>0?t.join(", "):"-"}function sbe({onClose:t}){const{t:e}=dt(),n=uu(),r=Zl(),i=cu(),[s,a]=v.useState("list"),[o,l]=v.useState(0),[c,u]=v.useState(0),[d,h]=v.useState(0),[m,p]=v.useState("disable"),[b,x]=v.useState([]),[g,y]=v.useState({}),[w,C]=v.useState(!1),[E,S]=v.useState(!1),[T,O]=v.useState(null),[z,I]=v.useState(null),j=v.useRef(null),N=b[o],B=v.useCallback(()=>(C(!0),r.loadExtensionsStatus().then(X=>{var H,R;x(X.extensions??[]),I(((R=(H=X.errors)==null?void 0:H[0])==null?void 0:R.error)??null)}).catch(X=>{I(X instanceof Error?X.message:String(X))}).finally(()=>C(!1))),[r]),P=v.useCallback(()=>{const X=n.clientId;return X?(S(!0),r.checkExtensionUpdates(X).then(H=>y(H.states)).catch(H=>{I(H instanceof Error?H.message:String(H))}).finally(()=>S(!1))):(I(e("extensions.install.waitForSession")),Promise.resolve())},[r,n.clientId,e]),J=v.useCallback(()=>{const X=n.clientId;if(!X){I(e("extensions.install.waitForSession"));return}S(!0),r.refreshExtensions(X).then(async H=>{I(e("extensions.manage.refreshed",{refreshed:H.refreshed,failed:H.failed})),await B(),await P()}).catch(H=>{I(H instanceof Error?H.message:String(H))}).finally(()=>S(!1))},[r,P,n.clientId,B,e]);v.useEffect(()=>{B()},[B]),v.useEffect(()=>{b.length>0&&P()},[P,b.length]),v.useEffect(()=>{((i==null?void 0:i.extensionsVersion)??0)>0&&(y({}),B())},[B,i==null?void 0:i.extensionsVersion]),v.useEffect(()=>{o>=b.length&&b.length>0&&l(b.length-1)},[b.length,o]),v.useEffect(()=>{var R;const X=s==="actions"?c:s==="scope"?d:o,H=(R=j.current)==null?void 0:R.children[X];H==null||H.scrollIntoView({block:"nearest"})},[c,d,o,s]);const q=v.useCallback((X,H)=>{const R=n.clientId;if(!R){I(e("extensions.install.waitForSession"));return}O(H),I(null),X(R).then(()=>I(e("extensions.manage.queued",{name:H}))).catch(ae=>{I(ae instanceof Error?ae.message:String(ae))}).finally(()=>O(null))},[n.clientId,e]),Y=v.useMemo(()=>{if(!N)return[];const X=g[N.name]??N.updateState,H=[{label:e("extensions.manage.viewDetails"),run:()=>a("details")}];return H.push({label:e("extensions.manage.update"),hint:XT(X,e),disabled:X!==ibe||T===N.name,run:()=>q(R=>r.updateExtension(N.name,R),N.name)}),H.push({label:N.isActive?e("extensions.manage.disable"):e("extensions.manage.enable"),disabled:T===N.name,run:()=>{p(N.isActive?"disable":"enable"),h(0),a("scope")}}),H.push({label:e("extensions.manage.uninstallAction"),disabled:T===N.name,run:()=>a("uninstall")}),H},[r,T,q,N,e,g]);v.useEffect(()=>{c>=Y.length&&Y.length>0&&u(Y.length-1)},[c,Y.length]);const $=v.useCallback(X=>{N&&(q(H=>m==="enable"?r.enableExtension(N.name,{scope:X},H):r.disableExtension(N.name,{scope:X},H),N.name),a("actions"))},[r,q,m,N]);si(X=>{if(X.key==="Escape"){X.preventDefault(),s==="list"?t():s==="actions"?a("list"):(s==="details"||s==="scope"||s==="uninstall")&&a("actions");return}if(X.key==="ArrowDown"||X.key==="j"){X.preventDefault(),s==="list"?l(H=>Math.min(H+1,Math.max(b.length-1,0))):s==="actions"?u(H=>Math.min(H+1,Math.max(Y.length-1,0))):s==="scope"&&h(H=>Math.min(H+1,1));return}if(X.key==="ArrowUp"||X.key==="k"){X.preventDefault(),s==="list"?l(H=>Math.max(H-1,0)):s==="actions"?u(H=>Math.max(H-1,0)):s==="scope"&&h(H=>Math.max(H-1,0));return}if(X.key==="Enter"){if(X.preventDefault(),s==="list"&&N)a("actions"),u(0);else if(s==="actions"){const H=Y[c];H&&!H.disabled&&H.run()}else s==="scope"?$(d===0?"user":"workspace"):s==="uninstall"&&N&&(q(H=>r.uninstallExtension(N.name,H),N.name),a("list"));return}X.key==="r"&&(X.preventDefault(),s==="list"&&J())},[c,r,Y,P,b.length,B,t,J,q,d,$,N,s]);const Z=s==="list"?e("extensions.manage.title"):s==="details"?e("extensions.manage.detailsTitle"):(N==null?void 0:N.name)??e("extensions.manage.title"),M=e(s==="list"?"extensions.manage.footer.list":s==="details"?"extensions.manage.footer.back":s==="uninstall"?"extensions.manage.footer.confirm":"extensions.manage.footer.select");return f.jsxs("div",{className:ee("resume-picker"),children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:Z}),s==="list"&&f.jsx("span",{className:ee("resume-picker-count"),children:e("extensions.manage.count",{count:b.length})}),f.jsx("button",{className:ee("resume-picker-close"),onClick:t,title:e("common.close"),children:"ESC"})]}),f.jsx("div",{className:ee("resume-picker-search"),children:f.jsx("span",{className:ee("resume-picker-search-hint"),children:z||e(w?"extensions.manage.loading":E?"extensions.manage.checkingUpdates":"common.enterSelect")})}),f.jsx("div",{className:ee("resume-picker-sep")}),s==="list"&&f.jsxs("div",{className:ee("resume-picker-list"),ref:j,children:[!w&&b.length===0&&f.jsx("div",{className:ee("resume-picker-empty"),children:e("extensions.manage.empty")}),b.map((X,H)=>{const R=g[X.name]??X.updateState;return f.jsxs("div",{className:ee("resume-picker-item",H===o?"selected":void 0),onClick:()=>{l(H),a("actions"),u(0)},onMouseEnter:()=>l(H),children:[f.jsxs("div",{className:ee("resume-picker-item-row"),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:H===o?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:X.name}),f.jsxs("span",{className:ee("resume-picker-item-badge"),children:["v",X.version]}),f.jsx("span",{className:ee("resume-picker-item-badge"),children:sw(X,e)})]}),f.jsx("div",{className:ee("resume-picker-item-meta"),children:XT(R,e)})]},X.id||X.name)})]}),s==="actions"&&N&&f.jsxs("div",{className:ee("resume-picker-list"),ref:j,children:[f.jsxs("div",{className:ee("dialog-detail"),children:[f.jsxs("div",{children:[e("extensions.manage.version")," ",N.version]}),f.jsxs("div",{children:[e("extensions.manage.status")," ",sw(N,e)]}),f.jsxs("div",{children:[e("extensions.manage.source")," ",N.source??"-"]})]}),Y.map((X,H)=>f.jsxs("div",{className:ee("resume-picker-item",H===c?"selected":void 0,X.disabled?"disabled":void 0),onClick:()=>{X.disabled||X.run()},onMouseEnter:()=>u(H),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:H===c?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:X.label}),X.hint&&f.jsx("span",{className:ee("resume-picker-item-badge"),children:X.hint})]},X.label))]}),s==="details"&&N&&f.jsx(abe,{extension:N}),s==="scope"&&N&&f.jsx("div",{className:ee("resume-picker-list"),ref:j,children:["user","workspace"].map((X,H)=>f.jsxs("div",{className:ee("resume-picker-item",H===d?"selected":void 0),onClick:()=>$(X),onMouseEnter:()=>h(H),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:H===d?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:e(X==="user"?"settings.scope.user":"settings.scope.workspace")})]},X))}),s==="uninstall"&&N&&f.jsxs("div",{className:ee("dialog-detail"),children:[f.jsx("div",{children:e("extensions.manage.uninstallConfirm",{name:N.name})}),f.jsx("button",{className:ee("dialog-danger-button"),disabled:T===N.name,onClick:()=>{q(X=>r.uninstallExtension(N.name,X),N.name),a("list")},children:e("extensions.manage.uninstallAction")})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-footer"),children:M})]})}function abe({extension:t}){const{t:e}=dt(),n=t.details;return f.jsx("div",{className:ee("resume-picker-list"),children:f.jsxs("div",{className:ee("resume-picker-detail-panel"),children:[f.jsx(ea,{label:e("extensions.manage.name"),value:t.name}),f.jsx(ea,{label:e("extensions.manage.version"),value:t.version}),f.jsx(ea,{label:e("extensions.manage.status"),value:sw(t,e)}),f.jsx(ea,{label:e("extensions.manage.path"),value:t.path}),f.jsx(ea,{label:e("extensions.manage.source"),value:t.source??"-"}),f.jsx(ea,{label:e("extensions.manage.commands"),value:Nu(n==null?void 0:n.commands)}),f.jsx(ea,{label:e("extensions.manage.skills"),value:Nu(n==null?void 0:n.skills)}),f.jsx(ea,{label:e("extensions.manage.agents"),value:Nu(n==null?void 0:n.agents)}),f.jsx(ea,{label:e("extensions.manage.mcpServers"),value:Nu(n==null?void 0:n.mcpServers)}),f.jsx(ea,{label:e("extensions.manage.contextFiles"),value:Nu(n==null?void 0:n.contextFiles)}),f.jsx(ea,{label:e("extensions.manage.settings"),value:Nu(n==null?void 0:n.settings)})]})})}function ea({label:t,value:e}){return f.jsxs("div",{className:ee("resume-picker-detail-row"),children:[f.jsx("span",{className:ee("resume-picker-detail-label"),children:t}),f.jsx("span",{className:ee("resume-picker-detail-value"),children:e})]})}const obe="_panel_1xj4i_1",lbe="_header_1xj4i_16",cbe="_title_1xj4i_22",ube="_secondary_1xj4i_26",dbe="_hint_1xj4i_30",hbe="_list_1xj4i_34",fbe="_category_1xj4i_44",mbe="_item_1xj4i_54",pbe="_row_1xj4i_65",gbe="_pointer_1xj4i_72",ybe="_label_1xj4i_80",bbe="_selected_1xj4i_89",vbe="_scopeHint_1xj4i_96",xbe="_value_1xj4i_101",wbe="_editWrap_1xj4i_109",kbe="_editInput_1xj4i_113",_be="_detail_1xj4i_130",Sbe="_detailEllipsis_1xj4i_140",Tbe="_detailText_1xj4i_144",Cbe="_detailTextScrolling_1xj4i_148",Ebe="_footer_1xj4i_165",Abe="_empty_1xj4i_171",Wt={panel:obe,header:lbe,title:cbe,secondary:ube,hint:dbe,list:hbe,category:fbe,item:mbe,row:pbe,pointer:gbe,label:ybe,selected:bbe,scopeHint:vbe,value:xbe,editWrap:wbe,editInput:kbe,detail:_be,detailEllipsis:Sbe,detailText:Tbe,detailTextScrolling:Cbe,footer:Ebe,empty:Abe},YO="web-shell:settings-panel-active",QT=new Set(["fastModel"]);function xy(t,e,n){const r=t(e);return r===e?n:r}function Mbe(t,e){return xy(e,`settings.category.${t}`,t)}function Nbe(t,e){return xy(e,`settings.label.${t.key}`,t.label)}function Dbe(t,e){if(t.description)return xy(e,`settings.description.${t.key}`,t.description)}function Ibe(t,e,n,r){return xy(r,`settings.option.${t.key}.${String(e)}`,n)}function Rbe(t,e,n){const r=f0(t,e);if(r==null)return"";if(t.key===_c){const s=S3(r,Oi.Dark);return n(`theme.${s}`)}if(t.key===Qu){const s=yk(r);return s?bk(s):String(r)}if(t.type==="boolean")return n(r===!0?"settings.value.on":"settings.value.off");if(t.type==="enum"&&t.options){const s=t.options.find(a=>a.value===r);return s?Ibe(t,s.value,s.label,n):String(r)}const i=String(r);return i.length>24?i.slice(0,21)+"...":i}function XO(t,e){return(e==="user"?t.values.user:t.values.workspace)!==void 0}function Obe(t,e){if(e==="workspace"?t.values.user!==void 0:t.values.workspace!==void 0)return XO(t,e)?"settings.alsoModifiedIn":"settings.modifiedIn"}function f0(t,e){const n=e==="user"?t.values.user:t.values.workspace;return n!==void 0?n:t.values.effective}function jbe(t,e){return f0(t,e)!==!0}function Lbe(t,e){var s;if(!((s=t.options)!=null&&s.length))return f0(t,e);const n=f0(t,e),i=(t.options.findIndex(a=>a.value===n)+1)%t.options.length;return t.options[i].value}function Bbe(t,e){const n=new Map;for(const r of t){let i=n.get(r.category);i||(i=[],n.set(r.category,i)),i.push(r)}return Array.from(n.entries()).map(([r,i])=>({category:Mbe(r,e),items:i}))}function zbe(t){const e=[];for(const n of t){e.push({type:"header",category:n.category});for(const r of n.items)e.push({type:"setting",setting:r})}return e}function rp(t,e,n){const r=t.length;if(r===0)return e;let i=e;for(let s=0;s<r;s++)if(i=(i+n+r)%r,t[i].type==="setting")return i;return e}function Pbe({settingsState:t,onClose:e,onLanguageChange:n,onSubDialog:r,onThemeChange:i}){const{t:s}=dt(),{status:a,settings:o,loading:l,error:c,reload:u,setValue:d}=t,[h,m]=v.useState("workspace"),[p,b]=v.useState(0),[x,g]=v.useState(null),[y,w]=v.useState(null),[C,E]=v.useState(null),[S,T]=v.useState(null),[O,z]=v.useState(0),[I,j]=v.useState(0),N=v.useRef(`settings-${Math.random().toString(36).slice(2)}`),B=v.useRef(null),P=v.useRef(null),J=v.useRef(null),q=v.useRef(p),Y=v.useRef(e);v.useEffect(()=>{Y.current=e},[e]);const $=v.useMemo(()=>zbe(Bbe(o,s)),[o,s]),[Z,M]=v.useState(!1),X=$[p],H=(X==null?void 0:X.type)==="setting"&&X.setting?Dbe(X.setting,s):void 0,R=l&&!a,ae=o.find(re=>re.key===_c),xe=S3(ae==null?void 0:ae.values.effective),ye=o.find(re=>re.key===Qu),Ae=yk(ye==null?void 0:ye.values.effective),Fe=v.useRef(null),[vt,Nt]=v.useState(null);v.useLayoutEffect(()=>{const re=Fe.current;if(!re)return;const ce=()=>{const We=re.scrollWidth-re.clientWidth,me=window.matchMedia("(prefers-reduced-motion: reduce)").matches;We>1&&!me?Nt({distance:We,duration:Math.max(3,We/80/.7)}):Nt(null)};ce();const Ie=new ResizeObserver(ce);return Ie.observe(re),()=>Ie.disconnect()},[H]);const pt=v.useCallback(re=>{window.dispatchEvent(new CustomEvent(YO,{detail:{id:N.current,active:re}}))},[]);v.useEffect(()=>(pt(!0),()=>pt(!1)),[pt]),v.useEffect(()=>{const re=ce=>{if(ce instanceof MouseEvent&&ce.button!==0||ce.defaultPrevented)return;const Ie=B.current,We=ce.target;Ie&&We instanceof Node&&!Ie.contains(We)&&Y.current()};return window.addEventListener("mousedown",re),window.addEventListener("touchstart",re),()=>{window.removeEventListener("mousedown",re),window.removeEventListener("touchstart",re)}},[]),v.useEffect(()=>{var re;c?w(c.message):(re=a==null?void 0:a.warnings)!=null&&re.length?w(a.warnings.map(ce=>s("settings.corrupted",{recovered:ce.recovered?"true":"false"})).join("; ")):o.length>0&&!Z&&w(null)},[c,o,a,s,Z]),v.useEffect(()=>{var re;$.length!==0&&(p>=$.length?b(rp($,$.length,-1)):((re=$[p])==null?void 0:re.type)!=="setting"&&b(rp($,p-1,1)))},[p,$]),v.useEffect(()=>{q.current=p},[p]),v.useEffect(()=>{var ce;const re=(ce=P.current)==null?void 0:ce.children[p];re==null||re.scrollIntoView({block:"nearest"})},[p]),v.useEffect(()=>{var ce;if(S!=="theme")return;const re=(ce=P.current)==null?void 0:ce.children[O];re==null||re.scrollIntoView({block:"nearest"})},[O,S]),v.useEffect(()=>{var ce;if(S!=="language")return;const re=(ce=P.current)==null?void 0:ce.children[I];re==null||re.scrollIntoView({block:"nearest"})},[I,S]),v.useEffect(()=>{C&&setTimeout(()=>{var re;return(re=J.current)==null?void 0:re.focus()},0)},[C]),v.useEffect(()=>{if(S!=="theme")return;const re=xe?Gh.indexOf(xe):-1;z(re>=0?re:0)},[S,xe]),v.useEffect(()=>{if(S!=="language")return;const re=Ae?Im.indexOf(Ae):-1;j(re>=0?re:0)},[S,Ae]);const Qe=v.useCallback((re,ce)=>{Z||w(null),g(re),d("workspace",re,ce).then(async Ie=>{try{await u()}catch{}Ie!=null&&Ie.requiresRestart&&re!==Qu&&(M(!0),w(s("settings.requiresRestart")))}).catch(Ie=>{w(Ie instanceof Error?Ie.message:String(Ie))}).finally(()=>g(null))},[u,Z,d,s]),Ge=v.useCallback(re=>{if(!(C&&C.key===re.key)){if(E(null),h!=="workspace"){w(s("settings.readOnly"));return}if(re.key===_c){T("theme");return}if(re.key===Qu){T("language");return}if(QT.has(re.key)){r(re.key);return}if(re.type==="boolean"){Qe(re.key,jbe(re,h));return}if(re.type==="enum"){Qe(re.key,Lbe(re,h));return}(re.type==="string"||re.type==="number")&&E({key:re.key,draft:String(f0(re,h)??"")})}},[C,Qe,r,h,s]),$t=v.useCallback(()=>{if(!C)return;const re=$.find(We=>{var me;return We.type==="setting"&&((me=We.setting)==null?void 0:me.key)===C.key}),ce=re==null?void 0:re.setting;if(!ce){E(null);return}let Ie=C.draft;if(ce.type==="number"){const We=C.draft.trim();if(We===""||!Number.isFinite(Number(We))){w(s("settings.invalidNumber"));return}Ie=Number(We)}E(null),Qe(ce.key,Ie)},[C,$,Qe,s]);si(re=>{if(re.defaultPrevented)return;const ce=()=>{re.preventDefault(),re.stopPropagation()};if(C){if(re.key==="Escape"){ce(),E(null);return}if(re.key==="Enter"){ce(),$t();return}return}if(S==="theme"){if(re.key==="Escape"){ce(),T(null);return}if(re.key==="ArrowDown"||re.key==="j"){ce(),z(Ie=>Math.min(Ie+1,Gh.length-1));return}if(re.key==="ArrowUp"||re.key==="k"){ce(),z(Ie=>Math.max(Ie-1,0));return}if((re.key==="Enter"||re.key===" ")&&!x){ce();const Ie=Gh[O];Ie&&(T(null),i(Ie),Qe(_c,R_(Ie)));return}return}if(S==="language"){if(re.key==="Escape"){ce(),T(null);return}if(re.key==="ArrowDown"||re.key==="j"){ce(),j(Ie=>Math.min(Ie+1,Im.length-1));return}if(re.key==="ArrowUp"||re.key==="k"){ce(),j(Ie=>Math.max(Ie-1,0));return}if((re.key==="Enter"||re.key===" ")&&!x){ce();const Ie=Im[I];Ie&&(T(null),n(Ie),e());return}return}if(re.key==="Escape"){ce(),e();return}if(re.key==="ArrowDown"||re.key==="j"){ce(),b(Ie=>rp($,Ie,1));return}if(re.key==="ArrowUp"||re.key==="k"){ce(),b(Ie=>rp($,Ie,-1));return}if(re.key==="Tab"){ce(),m(Ie=>Ie==="workspace"?"user":"workspace");return}if(re.key==="r"&&!re.ctrlKey&&!re.metaKey&&!re.altKey){ce(),u();return}if((re.key==="Enter"||re.key===" ")&&!x){ce();const Ie=$[q.current];(Ie==null?void 0:Ie.type)==="setting"&&Ie.setting&&Ge(Ie.setting)}},[x,C,Ge,$t,Qe,S,e,n,u,$,I,O,i]);const Je=s(h==="workspace"?"settings.scope.workspace":"settings.scope.user");return f.jsxs("div",{ref:B,className:Wt.panel,"data-keyboard-scope":!0,children:[f.jsxs("div",{className:Wt.header,children:[f.jsx("span",{className:Wt.title,children:S==="theme"?`${s("settings.title")} / ${s("theme.title")}`:S==="language"?`${s("settings.title")} / ${s("language.set")}`:s("settings.title")}),f.jsx("span",{className:Wt.secondary,children:Je})]}),(y||R)&&f.jsx("div",{className:Wt.hint,children:y||s("settings.loading")}),f.jsx("div",{className:Wt.list,ref:P,role:"listbox",children:S==="theme"?Gh.map((re,ce)=>f.jsx("div",{role:"option","aria-selected":ce===O,className:`${Wt.item} ${ce===O?Wt.selected:""}`,onClick:()=>{x||(z(ce),T(null),i(re),Qe(_c,R_(re)))},children:f.jsxs("div",{className:Wt.row,children:[f.jsx("span",{className:Wt.pointer,children:ce===O?"›":" "}),f.jsx("span",{className:Wt.label,children:s(`theme.${re}`)}),f.jsx("span",{className:Wt.value,children:re===xe?"✓":""})]})},re)):S==="language"?Im.map((re,ce)=>f.jsx("div",{role:"option","aria-selected":ce===I,className:`${Wt.item} ${ce===I?Wt.selected:""}`,onClick:()=>{x||(j(ce),T(null),n(re),e())},children:f.jsxs("div",{className:Wt.row,children:[f.jsx("span",{className:Wt.pointer,children:ce===I?"›":" "}),f.jsx("span",{className:Wt.label,children:bk(re)}),f.jsx("span",{className:Wt.value,children:re===Ae?"✓":""})]})},re)):f.jsxs(f.Fragment,{children:[!l&&$.length===0&&f.jsx("div",{className:Wt.empty,children:s("settings.empty")}),$.map((re,ce)=>{if(re.type==="header")return f.jsx("div",{role:"presentation",className:Wt.category,children:re.category},`cat-${re.category}`);const Ie=re.setting,We=ce===p,me=(C==null?void 0:C.key)===Ie.key,rt=QT.has(Ie.key)||Ie.key===_c||Ie.key===Qu,oe=XO(Ie,h),Oe=Obe(Ie,h);return f.jsxs("div",{role:"option","aria-selected":We,className:`${Wt.item} ${We?Wt.selected:""}`,onClick:()=>{x||(b(ce),Ge(Ie))},children:[f.jsxs("div",{className:Wt.row,children:[f.jsx("span",{className:Wt.pointer,children:We?"›":" "}),f.jsxs("span",{className:Wt.label,children:[Nbe(Ie,s),Oe&&f.jsxs("span",{className:Wt.scopeHint,children:[" ",s(Oe,{scope:s(h==="workspace"?"settings.scope.user":"settings.scope.workspace")})]})]}),f.jsx("span",{className:Wt.value,children:x===Ie.key?"...":`${Rbe(Ie,h,s)}${oe?"*":""}${rt?" ▸":""}`})]}),me&&C&&f.jsx("div",{className:Wt.editWrap,children:f.jsx("input",{ref:J,className:Wt.editInput,type:Ie.type==="number"?"number":"text",value:C.draft,onChange:Re=>E({key:C.key,draft:Re.target.value}),onKeyDown:Re=>{Re.key==="Enter"&&(Re.preventDefault(),$t()),Re.key==="Escape"&&(Re.preventDefault(),E(null))}})})]},Ie.key)})]})}),f.jsx("div",{ref:Fe,className:vt?Wt.detail:`${Wt.detail} ${Wt.detailEllipsis}`,title:H||void 0,children:f.jsx("span",{className:vt?`${Wt.detailText} ${Wt.detailTextScrolling}`:Wt.detailText,style:vt?{"--marquee-distance":`${vt.distance}px`,"--marquee-duration":`${vt.duration}s`}:void 0,children:H||" "},p)}),f.jsx("div",{className:Wt.footer,children:s(C?"settings.footer.edit":S?"settings.footer.theme":"settings.footer")})]})}const $be="_dialog_gh65b_1",Ube="_body_gh65b_5",Hbe="_tabs_gh65b_14",qbe="_brand_gh65b_21",Fbe="_tab_gh65b_14",Vbe="_tabActive_gh65b_33",Gbe="_general_gh65b_38",Wbe="_intro_gh65b_45",Kbe="_sectionTitle_gh65b_50",Ybe="_shortcuts_gh65b_55",Xbe="_shortcut_gh65b_55",Qbe="_shortcutKey_gh65b_70",Jbe="_shortcutDesc_gh65b_77",Zbe="_commandList_gh65b_83",eve="_commandListIntro_gh65b_90",tve="_commandGroup_gh65b_95",nve="_commandGroupTitle_gh65b_102",rve="_command_gh65b_83",ive="_commandRow_gh65b_120",sve="_commandName_gh65b_127",ave="_commandMeta_gh65b_135",ove="_commandDescription_gh65b_144",lve="_commandSubcommands_gh65b_151",cve="_empty_gh65b_158",Hn={dialog:$be,body:Ube,tabs:Hbe,brand:qbe,tab:Fbe,tabActive:Vbe,general:Gbe,intro:Wbe,sectionTitle:Kbe,shortcuts:Ybe,shortcut:Xbe,shortcutKey:Qbe,shortcutDesc:Jbe,commandList:Zbe,commandListIntro:eve,commandGroup:tve,commandGroupTitle:nve,command:rve,commandRow:ive,commandName:sve,commandMeta:ave,commandDescription:ove,commandSubcommands:lve,empty:cve},ef=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],uve="https://qwenlm.github.io/qwen-code-docs/",aw=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"]),dve=[["@","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"],["Ctrl+O","help.shortcut.compact"],["Shift+Tab","help.shortcut.approvals"],["Alt+Left/Right","help.shortcut.altWords"],["Up/Down","help.shortcut.history"]];function hve(t){return[`/${t.name}`,t.argumentHint].filter(Boolean).join(" ")}function fve(t,e){var r;return[aw.has(t.name)?e("help.commandMeta.builtIn"):e("help.commandMeta.custom"),(r=t.subcommands)!=null&&r.length?e("help.commandMeta.subcommands",{count:t.subcommands.length}):void 0].filter(Boolean).join(" · ")}function mve(t,e,n){const r=t.filter(a=>a.name&&a.description!==void 0).sort((a,o)=>a.name.localeCompare(o.name)),i=r.filter(a=>aw.has(a.name)),s=r.filter(a=>!aw.has(a.name));return e?s.length?[{key:"custom",title:n("help.customGroup"),commands:s}]:[]:i.length?[{key:"built-in",title:n("help.builtIn"),commands:i}]:[]}function pve({activeTab:t}){const{t:e}=dt();return f.jsxs("div",{className:Hn.tabs,children:[f.jsx("span",{className:Hn.brand,children:"Qwen Code"}),ef.map(n=>f.jsx("span",{className:`${Hn.tab} ${n.id===t?Hn.tabActive:""}`,children:e(n.labelKey)},n.id))]})}function gve(){const{t}=dt();return f.jsxs("div",{className:Hn.general,children:[f.jsx("div",{className:Hn.intro,children:t("help.intro")}),f.jsx("div",{className:Hn.sectionTitle,children:t("help.section.shortcuts")}),f.jsx("div",{className:Hn.shortcuts,children:dve.map(([e,n])=>f.jsxs("div",{className:Hn.shortcut,children:[f.jsx("span",{className:Hn.shortcutKey,children:e}),f.jsx("span",{className:Hn.shortcutDesc,children:t(n)})]},e))})]})}function JT({commands:t,customOnly:e}){const{t:n}=dt(),r=v.useMemo(()=>mve(t,e,n),[t,e,n]),i=v.useRef(null);return si(s=>{const a=i.current;a&&(s.key==="ArrowDown"||s.key==="j"?(s.preventDefault(),a.scrollBy({top:32,behavior:"smooth"})):s.key==="ArrowUp"||s.key==="k"?(s.preventDefault(),a.scrollBy({top:-32,behavior:"smooth"})):s.key==="PageDown"?(s.preventDefault(),a.scrollBy({top:a.clientHeight,behavior:"smooth"})):s.key==="PageUp"?(s.preventDefault(),a.scrollBy({top:-a.clientHeight,behavior:"smooth"})):s.key==="Home"?(s.preventDefault(),a.scrollTo({top:0,behavior:"smooth"})):s.key==="End"&&(s.preventDefault(),a.scrollTo({top:a.scrollHeight,behavior:"smooth"})))},[]),v.useEffect(()=>{var s;(s=i.current)==null||s.scrollTo({top:0})},[e,t]),r.length===0?f.jsx("div",{className:Hn.empty,children:n(e?"help.emptyCustom":"help.empty")}):f.jsxs("div",{className:Hn.commandList,ref:i,children:[f.jsx("div",{className:Hn.commandListIntro,children:n(e?"help.customIntro":"help.commandsIntro")}),r.map(s=>f.jsxs("div",{className:Hn.commandGroup,children:[f.jsxs("div",{className:Hn.commandGroupTitle,children:[s.title,f.jsx("span",{children:s.commands.length})]}),s.commands.map(a=>{var o;return f.jsxs("div",{className:Hn.command,children:[f.jsxs("div",{className:Hn.commandRow,children:[f.jsx("span",{className:Hn.commandName,children:hve(a)}),f.jsx("span",{className:Hn.commandMeta,children:fve(a,n)})]}),a.description&&f.jsx("div",{className:Hn.commandDescription,children:a.description}),!!((o=a.subcommands)!=null&&o.length)&&f.jsxs("div",{className:Hn.commandSubcommands,children:[n("help.subcommands"),": ",a.subcommands.join(", ")]})]},a.name)})]},s.key))]})}function yve({commands:t,onClose:e}){const{t:n}=dt(),[r,i]=v.useState("general");return si(s=>{if(s.key==="Escape"){s.preventDefault(),e();return}if(s.key==="Tab"){s.preventDefault();const a=ef.findIndex(c=>c.id===r),o=s.shiftKey?-1:1,l=(a+o+ef.length)%ef.length;i(ef[l].id)}},[r,e]),f.jsxs("div",{className:`${ee("resume-picker")} ${Hn.dialog}`,children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:n("help.title")}),f.jsx("span",{className:ee("resume-picker-count"),children:n("help.commandCount",{count:t.length})}),f.jsx("button",{className:ee("resume-picker-close"),onClick:e,title:n("common.close"),children:"ESC"})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsxs("div",{className:Hn.body,children:[f.jsx(pve,{activeTab:r}),r==="general"&&f.jsx(gve,{}),r==="commands"&&f.jsx(JT,{commands:t,customOnly:!1}),r==="custom-commands"&&f.jsx(JT,{commands:t,customOnly:!0})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsxs("div",{className:ee("resume-picker-footer"),children:[n("help.footer")," · ",uve]})]})}function bve({currentTheme:t,onSelect:e,onClose:n}){const{t:r}=dt(),i=Gh.map(c=>({id:c,label:r(`theme.${c}`),description:r(`theme.${c}.desc`)})),[s,a]=v.useState(()=>{const c=i.findIndex(u=>u.id===t);return c>=0?c:0}),o=v.useRef(null);v.useEffect(()=>{var u;const c=(u=o.current)==null?void 0:u.children[s];c==null||c.scrollIntoView({block:"nearest"})},[s]);const l=v.useCallback(()=>{const c=i[s];c&&(e(c.id),n())},[n,e,s,i]);return si(c=>{if(c.key==="Escape"){c.preventDefault(),n();return}if(c.key==="ArrowDown"||c.key==="j"){c.preventDefault(),a(u=>Math.min(u+1,i.length-1));return}if(c.key==="ArrowUp"||c.key==="k"){c.preventDefault(),a(u=>Math.max(u-1,0));return}c.key==="Enter"&&(c.preventDefault(),l())},[l,n,i.length]),f.jsxs("div",{className:ee("resume-picker"),children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:r("theme.title")}),f.jsx("span",{className:ee("resume-picker-count"),children:r("theme.current",{theme:t})}),f.jsx("button",{className:ee("resume-picker-close"),onClick:n,title:r("common.close"),children:"ESC"})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-list"),ref:o,children:i.map((c,u)=>f.jsxs("div",{className:ee("resume-picker-item",u===s?"selected":void 0),onClick:()=>{e(c.id),n()},onMouseEnter:()=>a(u),children:[f.jsxs("div",{className:ee("resume-picker-item-row"),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:u===s?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:c.label}),c.id===t&&f.jsx("span",{className:ee("resume-picker-item-check"),children:" ✓"})]}),f.jsx("div",{className:ee("resume-picker-item-meta"),children:c.description})]},c.id))}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-footer"),children:r("dialog.footer.navSelectCancel")})]})}function vve({onDeleted:t,onError:e,onClose:n}){const{t:r}=dt(),i=uu(),{sessions:s,loading:a,error:o,deleteSession:l,deleteSessions:c}=_3({autoLoad:!0}),u=i.sessionId,[d,h]=v.useState(!1),[m,p]=v.useState(0),[b,x]=v.useState(new Set),[g,y]=v.useState(!1),[w,C]=v.useState(""),[E,S]=v.useState(null),T=v.useRef(null);v.useEffect(()=>{o&&S(o.message)},[o]);const O=v.useMemo(()=>w?s.filter(N=>{const B=w.toLowerCase();return(N.displayName||"").toLowerCase().includes(B)||N.sessionId.toLowerCase().includes(B)}):s,[s,w]);v.useEffect(()=>{if(w&&b.size>0){const N=new Set(O.map(B=>B.sessionId));x(B=>{const P=new Set([...B].filter(J=>N.has(J)));return P.size===B.size?B:P})}},[w,O,b.size]),v.useEffect(()=>{m>=O.length&&O.length>0&&p(O.length-1)},[O.length,m]),v.useEffect(()=>{var B;const N=(B=T.current)==null?void 0:B.children[m];N==null||N.scrollIntoView({block:"nearest"})},[m]);const z=v.useCallback(N=>{N!==u&&x(B=>{const P=new Set(B);return P.has(N)?P.delete(N):P.add(N),P})},[u]),I=v.useCallback(()=>{if(d)return;if(b.size>0){const B=new Set(O.map(J=>J.sessionId)),P=Array.from(b).filter(J=>B.has(J));if(P.length===0)return;h(!0),c(P).then(J=>{const q=J.removed.length+J.notFound.length,Y=J.errors.length;if(Y>0&&q>0){e(new Error(r("delete.partialFail",{removed:q,failed:Y,detail:J.errors[0].error}))),n();return}if(Y>0){S(r("delete.allFailed",{count:Y,reason:J.errors[0].error})),h(!1),x(new Set);return}if(q===0){S(r("delete.nonRemoved")),h(!1),x(new Set);return}t([...J.removed,...J.notFound]),n()}).catch(J=>{e(J),h(!1)});return}const N=O[m];if(N){if(N.sessionId===u){S(r("delete.cannotCurrent"));return}h(!0),l(N.sessionId).then(B=>{if(!B){S(r("delete.notFound")),h(!1);return}t([N.sessionId]),n()}).catch(B=>{e(B),h(!1)})}},[u,l,c,d,O,n,t,e,m,b,r]);si(N=>{if(!d){if(g){if(N.key==="Escape"){N.preventDefault(),w?C(""):y(!1);return}if(N.key==="Enter"){N.preventDefault(),O.length>0&&(y(!1),p(0));return}(N.key==="ArrowUp"||N.key==="ArrowDown")&&(N.preventDefault(),y(!1),N.key==="ArrowDown"&&p(B=>Math.min(B+1,O.length-1)));return}if(N.key==="Escape"){N.preventDefault(),w?(C(""),p(0)):n();return}if(N.key==="ArrowDown"||N.key==="j"){N.preventDefault(),p(B=>Math.min(B+1,O.length-1));return}if(N.key==="ArrowUp"||N.key==="k"){N.preventDefault(),m===0?y(!0):p(B=>Math.max(B-1,0));return}if(N.key===" "){N.preventDefault();const B=O[m];B&&z(B.sessionId);return}if(N.key==="Enter"){N.preventDefault(),I();return}N.key==="/"&&(N.preventDefault(),y(!0))}},[d,O,I,n,g,w,m,z]);const j=b.size>0;return f.jsxs("div",{className:ee("resume-picker","resume-picker-keyboard-only"),children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:r("delete.title")}),j&&f.jsxs("span",{className:ee("resume-picker-count"),children:["(",r("delete.selected",{count:b.size}),")"]}),!j&&w&&f.jsxs("span",{className:ee("resume-picker-count"),children:["(",r("delete.matches",{count:O.length}),")"]}),f.jsx("button",{className:ee("resume-picker-close"),onClick:n,title:r("common.close"),children:"ESC"})]}),f.jsx("div",{className:ee("resume-picker-search"),children:g?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:ee("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),f.jsx("input",{className:ee("resume-picker-search-input"),value:w,onChange:N=>{C(N.target.value),p(0)},autoFocus:!0,placeholder:""})]}):w?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:ee("resume-picker-search-label"),children:[r("resume.filter"),":"," "]}),f.jsx("span",{className:ee("resume-picker-search-value"),children:w})]}):f.jsx("span",{className:ee("resume-picker-search-hint"),children:E||r(d?"delete.deleting":a?"common.loading":"delete.pressSearch")})}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsxs("div",{className:ee("resume-picker-list"),ref:T,children:[a&&f.jsx("div",{className:ee("resume-picker-empty"),children:r("common.loading")}),!a&&o&&f.jsx("div",{className:ee("resume-picker-empty"),children:o.message}),!a&&!o&&O.length===0&&f.jsx("div",{className:ee("resume-picker-empty"),children:w?r("delete.noMatch",{query:w}):r("delete.none")}),!a&&O.map((N,B)=>{const P=N.sessionId===u,q=b.has(N.sessionId)?"[x] ":"[ ] ";return f.jsxs("div",{className:ee("resume-picker-item","resume-picker-session-item",B===m&&!g?"selected":void 0,P?"resume-picker-item-current":void 0,P?"disabled":void 0),onClick:()=>{p(B),P||z(N.sessionId)},children:[f.jsxs("div",{className:ee("resume-picker-item-row"),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:B===m&&!g?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-checkbox"),children:q}),f.jsx("span",{className:ee("resume-picker-item-title"),children:N.displayName||N.sessionId.slice(0,8)}),P&&f.jsx("span",{className:ee("resume-picker-item-badge"),children:r("resume.current")})]}),f.jsxs("div",{className:ee("resume-picker-item-meta"),children:[f.jsx("span",{children:(N.updatedAt||N.createdAt)&&r5(N.updatedAt||N.createdAt||"",r)}),f.jsx("span",{className:ee("resume-picker-item-detail"),children:r("common.clients",{count:N.clientCount??0})}),N.hasActivePrompt&&f.jsx("span",{className:ee("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},N.sessionId)})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-footer"),children:r(g?"dialog.footer.search":"delete.footer")})]})}function xve({onReleased:t,onError:e,onClose:n}){const{t:r}=dt(),i=uu(),{sessions:s,loading:a,error:o,releaseSession:l}=_3({autoLoad:!0}),c=i.sessionId,[u,d]=v.useState(!1),[h,m]=v.useState(0),[p,b]=v.useState(!1),[x,g]=v.useState(""),[y,w]=v.useState(null),C=v.useRef(null);v.useEffect(()=>{o&&w(o.message)},[o]);const E=x?s.filter(T=>{const O=x.toLowerCase();return(T.displayName||"").toLowerCase().includes(O)||T.sessionId.toLowerCase().includes(O)}):s;v.useEffect(()=>{h>=E.length&&E.length>0&&m(E.length-1)},[E.length,h]),v.useEffect(()=>{var O;const T=(O=C.current)==null?void 0:O.children[h];T==null||T.scrollIntoView({block:"nearest"})},[h]);const S=v.useCallback(T=>{const O=T??E[h];if(!O||u)return;if(!((O.clientCount??0)>0||O.hasActivePrompt===!0)){w(r("release.inactive"));return}if(O.sessionId===c){w(r("release.cannotCurrent"));return}l&&(d(!0),l(O.sessionId).then(()=>{t(O.sessionId),n()}).catch(I=>{e(I),d(!1)}))},[c,u,E,n,e,t,l,h,r]);return si(T=>{if(!u){if(p){if(T.key==="Escape"){T.preventDefault(),x?g(""):b(!1);return}if(T.key==="Enter"){T.preventDefault(),E.length>0&&b(!1);return}(T.key==="ArrowUp"||T.key==="ArrowDown")&&(T.preventDefault(),b(!1),T.key==="ArrowDown"&&m(O=>Math.min(O+1,E.length-1)));return}if(T.key==="Escape"){T.preventDefault(),x?(g(""),m(0)):n();return}if(T.key==="ArrowDown"||T.key==="j"){T.preventDefault(),m(O=>Math.min(O+1,E.length-1));return}if(T.key==="ArrowUp"||T.key==="k"){T.preventDefault(),h===0?b(!0):m(O=>Math.max(O-1,0));return}if(T.key==="Enter"){T.preventDefault(),S();return}T.key==="/"&&(T.preventDefault(),b(!0))}},[u,E.length,S,n,p,x,h]),f.jsxs("div",{className:ee("resume-picker","resume-picker-keyboard-only"),children:[f.jsxs("div",{className:ee("resume-picker-header"),children:[f.jsx("span",{className:ee("resume-picker-title"),children:r("release.title")}),x&&f.jsxs("span",{className:ee("resume-picker-count"),children:["(",E.length," matches)"]}),f.jsx("button",{className:ee("resume-picker-close"),onClick:n,title:r("common.close"),children:"ESC"})]}),f.jsx("div",{className:ee("resume-picker-search"),children:p?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:ee("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),f.jsx("input",{className:ee("resume-picker-search-input"),value:x,onChange:T=>{g(T.target.value),m(0)},autoFocus:!0,placeholder:""})]}):x?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:ee("resume-picker-search-label"),children:[r("resume.filter"),":"," "]}),f.jsx("span",{className:ee("resume-picker-search-value"),children:x})]}):f.jsx("span",{className:ee("resume-picker-search-hint"),children:y||r(u?"release.releasing":a?"common.loading":"release.pressSearch")})}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsxs("div",{className:ee("resume-picker-list"),ref:C,children:[a&&f.jsx("div",{className:ee("resume-picker-empty"),children:r("common.loading")}),!a&&E.length===0&&f.jsx("div",{className:ee("resume-picker-empty"),children:x?r("release.noMatch",{query:x}):r("release.none")}),!a&&E.map((T,O)=>{const z=T.sessionId===c,I=(T.clientCount??0)>0||T.hasActivePrompt===!0,j=z||!I;return f.jsxs("div",{className:ee("resume-picker-item","resume-picker-session-item",O===h&&!p?"selected":void 0,j?"resume-picker-item-current":void 0,j?"disabled":void 0),onClick:()=>{m(O),j||S(T)},children:[f.jsxs("div",{className:ee("resume-picker-item-row"),children:[f.jsx("span",{className:ee("resume-picker-item-prefix"),children:O===h&&!p?"›":" "}),f.jsx("span",{className:ee("resume-picker-item-title"),children:T.displayName||T.sessionId.slice(0,8)}),z&&f.jsx("span",{className:ee("resume-picker-item-badge"),children:r("resume.current")}),!z&&!I&&f.jsx("span",{className:ee("resume-picker-item-badge"),children:r("release.inactiveBadge")})]}),f.jsxs("div",{className:ee("resume-picker-item-meta"),children:[f.jsx("span",{children:(T.updatedAt||T.createdAt)&&r5(T.updatedAt||T.createdAt||"",r)}),f.jsx("span",{className:ee("resume-picker-item-detail"),children:r("common.clients",{count:T.clientCount??0})}),T.hasActivePrompt&&f.jsx("span",{className:ee("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},T.sessionId)})]}),f.jsx("div",{className:ee("resume-picker-sep")}),f.jsx("div",{className:ee("resume-picker-footer"),children:r(p?"dialog.footer.search":"release.footer")})]})}function wve(t){return[{name:"help",description:t("local.help")},{name:"theme",description:t("local.theme"),argumentHint:"light|dark",subcommands:["light","dark"]},{name:"language",description:t("local.language"),argumentHint:"ui [en|zh-CN]",subcommands:["ui"]},{name:"plan",description:t("local.plan"),argumentHint:"<prompt>"},{name:"btw",description:t("local.btw"),argumentHint:"<your question>"},{name:"copy",description:t("local.copy"),argumentHint:"[code|<lang>|latex|inline-latex] [index]"},{name:"delete",description:t("local.delete")},{name:"release",description:t("local.release")},{name:"auth",description:t("local.auth")},{name:"approval-mode",description:t("local.approvalMode"),argumentHint:"<mode>"},{name:"model",description:t("local.model"),argumentHint:"[--fast] [<model>]"},{name:"mcp",description:t("local.mcp"),argumentHint:"desc|nodesc|schema|auth|noauth"},{name:"skills",description:t("local.skills")},{name:"status",description:t("local.status")},{name:"stats",description:t("local.stats"),argumentHint:"[model|tools]",subcommands:["model","tools"]},{name:"tools",description:t("local.tools"),argumentHint:"[desc]"},{name:"memory",description:t("local.memory")},{name:"context",description:t("local.context"),argumentHint:"[detail]"},{name:"agents",description:t("local.agents"),argumentHint:"manage|create"},{name:"goal",description:t("local.goal"),argumentHint:"[<condition> | clear]"},{name:"tasks",description:t("local.tasks")},{name:"recap",description:t("local.recap")},{name:"clear",description:t("local.clear")},{name:"new",description:t("local.new")},{name:"reset",description:t("local.reset")},{name:"rename",description:t("local.rename"),argumentHint:"[--auto] [<name>]"},{name:"resume",description:t("local.resume"),argumentHint:"<session-id>"},{name:"settings",description:t("local.settings")},{name:"extensions",description:t("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(n=>({...n,source:"builtin-command"}))}function kve(...t){const e=new Map;for(const n of t)for(const r of n){const i=e.get(r.name);i?e.set(r.name,{...i,...r,description:r.description||i.description,argumentHint:r.argumentHint??i.argumentHint}):e.set(r.name,r)}return[...e.values()]}function _ve(t){const[e,n]=v.useState(t);return v.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(t)});return()=>window.cancelAnimationFrame(r)},[t]),e}const Sve=3e3,Tve=2;function ZT(t){return t.some(e=>e.status==="running"||e.status==="paused")}function Cve(t,e){const n=k3(),[r,i]=v.useState([]),[s,a]=v.useState(!1),[o,l]=v.useState(!1),c=v.useRef(0),u=v.useRef(!1);v.useEffect(()=>{if(!e){i([]),a(!1),c.current=0;return}},[e]),v.useEffect(()=>{!e||!t||(c.current=0,a(!0))},[e,t]),v.useEffect(()=>{if(o||!e||!s)return;let h=!1;const m=()=>{u.current||(u.current=!0,n.getTasks().then(b=>{if(!h){if(i(b.tasks),b.tasks.length===0){c.current+=1,c.current>=Tve&&a(!1);return}c.current=0,ZT(b.tasks)||a(!1)}}).catch(b=>{h||console.warn("[web-shell] failed to refresh tasks:",b)}).finally(()=>{u.current=!1}))};m();const p=setInterval(m,Sve);return()=>{h=!0,clearInterval(p)}},[n,e,s,o]);const d=v.useRef(r);return d.current=r,v.useEffect(()=>{const h=m=>{const p=m.detail,b=(p==null?void 0:p.active)===!0;l(b),!b&&ZT(d.current)&&a(!0)};return window.addEventListener(Ld,h),()=>window.removeEventListener(Ld,h)},[]),r}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Eve(t){const e=t.flatMap((n,r)=>{const i=Bi(n),s=Ii(i,"content");return s?[{id:Ii(i,"id")??`plan-${r}`,content:s,status:Ove(Ii(i,"status")),...(()=>{const o=jve(Ii(i,"priority"));return o?{priority:o}:{}})()}]:[]});return e.length>0?e:void 0}function Ave(t,e){if(!t)return e;if(!e)return t;const n=(t.cachedTokens??0)+(e.cachedTokens??0);return{inputTokens:t.inputTokens+e.inputTokens,outputTokens:t.outputTokens+e.outputTokens,...n>0?{cachedTokens:n}:{}}}function Mve(t,e={}){var l;const n=[],r=((l=e.labels)==null?void 0:l.promptCancelled)??"Request cancelled.",i=new Map,s=new Map;let a=null,o=!1;for(let c=0;c<t.length;c++){const u=t[c],d=u.serverTimestamp??u.clientReceivedAt;switch(u.kind){case"user":{a=null,o=!1;const h=u,m={id:u.id,role:"user",content:h.text,timestamp:d};h.images&&h.images.length>0&&(m.images=h.images.map(p=>({data:p.data,mimeType:p.mimeType||"image/*"}))),n.push(m);break}case"assistant":{const h=u,m=h.parentToolCallId?i.get(h.parentToolCallId):void 0;if(m){e9(m,h.text);break}const p=Kve(h.text);if(p){let x=null,g=!1,y=0,w=0;for(const C of p)C.kind==="insight"?C.data.type==="insight_progress"?x=C.data:C.data.type==="insight_ready"?(g=!0,n.push({id:`${u.id}-ir-${y++}`,role:"insight_ready",path:C.data.path,timestamp:d})):C.data.type==="insight_error"&&(g=!0,n.push({id:`${u.id}-ie-${w++}`,role:"insight_error",error:C.data.error,timestamp:d})):(n.push({id:`${u.id}-t-${n.length}`,role:"assistant",content:C.text,timestamp:d}),a=n.length-1);x&&!g&&n.push({id:`${u.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:d}),o=!0;break}const b=a!==null?n[a]:void 0;if(b&&b.role==="assistant"&&!o){const x=Ave(b.usage,h.usage);n[a]={...b,content:b.content+h.text,isStreaming:h.streaming,...x?{usage:x}:{}},o=!1}else n.push({id:u.id,role:"assistant",content:h.text,isStreaming:h.streaming,timestamp:d,...h.usage?{usage:h.usage}:{}}),a=n.length-1,o=!1;break}case"thought":{const h=u,m=h.parentToolCallId?i.get(h.parentToolCallId):void 0;if(m){e9(m,h.text);break}const p=a!==null?n[a]:void 0;p&&p.role==="assistant"&&!o&&!p.content?(n[a]={...p,thinking:(p.thinking||"")+h.text,isStreaming:h.streaming},o=!1):(n.push({id:u.id,role:"assistant",content:"",thinking:h.text,isStreaming:h.streaming,timestamp:d}),a=n.length-1,o=!1);break}case"tool":{const m=Lve(u),p=s.get(m.callId);p!=null&&p.title&&(m.title=p.title),!m.args&&(p!=null&&p.args)&&(m.args=p.args);const b=m.parentToolCallId?i.get(m.parentToolCallId):void 0,x=i.get(m.callId);if(x){t9(x,m);break}if(b){Nve(b,m),i.set(m.callId,m);break}l4(n,u.id,m,d),i.set(m.callId,m),o=!0;break}case"shell":{const h=u,m=n[n.length-1];if(m&&m.role==="tool_group"){const p=Dve(m.tools),b=m.tools[p];if(b){const x=typeof b.rawOutput=="string"?b.rawOutput:"",g={...b,rawOutput:x+h.text};n[n.length-1]={...m,tools:[...m.tools.slice(0,p),g,...m.tools.slice(p+1)]},i.get(b.callId)===b&&i.set(b.callId,g)}}else n.push({id:u.id,role:"tool_group",tools:[{callId:u.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:h.text}],timestamp:d}),o=!0;break}case"user_shell":{const h=u;n.push({id:u.id,role:"user_shell",command:h.command,output:h.text,...h.cwd?{cwd:h.cwd}:{},timestamp:d}),o=!0;break}case"permission":{const h=u;zve(h,s);const m=Bve(h);if(!m)break;const p=QO(m);if(!h.resolved)break;const b=i.get(m.callId);if(b){const x=b.status;m.toolName=b.toolName,h.resolved&&(c4(h.resolved)?m.status=p?m.status:"in_progress":(m.status="failed",m.endTime=h.updatedAt)),t9(b,m),h.resolved&&p&&c4(h.resolved)&&(b.status=x);break}if(h.resolved){c4(h.resolved)?(p||(m.status="in_progress"),l4(n,u.id,m,d),i.set(m.callId,m),o=!0):(m.status="failed",m.endTime=h.updatedAt,l4(n,u.id,m,d),i.set(m.callId,m),o=!0);break}break}case"status":case"debug":{const h=u,m=h.text,p=Rve(m);if(p){n.push({id:u.id,role:"plan",todos:p,timestamp:d}),o=!0;break}n.push({id:u.id,role:"system",content:m,variant:"info",timestamp:d,...h.source?{source:h.source}:{},...h.data!==void 0?{data:h.data}:{}}),o=!0;break}case"error":{const h=u;n.push({id:u.id,role:"system",content:h.text,variant:"error",retryable:h.source==="turn_error",timestamp:d,...h.source?{source:h.source}:{},...h.data!==void 0?{data:h.data}:{}}),o=!0;break}case"prompt_cancelled":n.push({id:u.id,role:"system",content:r,variant:"info",timestamp:d}),o=!0;break}}return n}function Nve(t,e){t.subTools||(t.subTools=[]),t.subTools.push(e)}function e9(t,e){t.subContent=(t.subContent||"")+e}function l4(t,e,n,r){const i=a=>QO(a)||lh(a.toolName),s=t[t.length-1];if(s&&s.role==="tool_group"&&s.id.startsWith("tg-")&&!i(n)&&!s.tools.some(i)){s.tools.push(n);return}t.push({id:`tg-${e}`,role:"tool_group",tools:[n],timestamp:r})}function Dve(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.kind==="execute"&&n.status==="in_progress")return e}for(let e=t.length-1;e>=0;e--)if(t[e].kind==="execute")return e;return t.length-1}function t9(t,e){t.status=e.status??t.status,t.title=e.title??t.title,t.toolName=e.toolName??t.toolName,t.kind=e.kind??t.kind,t.content=e.content??t.content,t.endTime=e.endTime??t.endTime,t.rawOutput=e.rawOutput??t.rawOutput,t.args=e.args??t.args,t.locations=e.locations??t.locations}function QO(t){var n;const e=t.toolName.toLowerCase();return e==="agent"||e==="task"||t.subTools||t.subContent||Ive(t.rawOutput)?!0:!!((n=t.args)!=null&&n.subagent_type)}function Ive(t){return!!t&&typeof t=="object"&&t.type==="task_execution"}function Rve(t){const e=t.startsWith("plan: ")?t.slice(6):void 0;if(e)try{const n=JSON.parse(e),r=Bi(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:Eve(r.entries)}catch{return}}function Bi(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function Ii(t,e){const n=t==null?void 0:t[e];return typeof n=="string"&&n.length>0?n:void 0}function Ove(t){return t==="completed"||t==="in_progress"||t==="pending"?t:"pending"}function jve(t){return t==="high"||t==="medium"||t==="low"?t:void 0}function Lve(t){const e=$ve(t),n=Pve(t,e),r=Uve(t.content),i={running:"in_progress",pending:"pending",confirming:"pending",background:"pending",completed:"completed",failed:"failed",cancelled:"completed",canceled:"completed",in_progress:"in_progress"},s=t.status==="completed"||t.status==="failed"||t.status==="cancelled"||t.status==="canceled";return{callId:t.toolCallId,toolName:t.toolName||"unknown",title:t.title,status:(n?"pending":i[t.status])||t.status||"in_progress",kind:ZO(t.toolName,t.toolKind),rawOutput:e,args:t.rawInput,parentToolCallId:t.parentToolCallId,startTime:t.createdAt,endTime:s&&!n?t.updatedAt:void 0,...r?{content:r}:{}}}function Bve(t){const e=Bi(t.toolCall);if(!e)return;const n=JO(e);if(Array.isArray(n==null?void 0:n.questions))return;const r=Bi(e._meta),i=Ii(e,"kind"),s=Ii(r,"toolName")??Ii(e,"toolName")??Ii(e,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(i==="fetch"?"web_fetch":i),a=Ii(e,"toolCallId")??Ii(e,"id");return!a||!s?void 0:{callId:a,toolName:s,title:Ii(e,"title")??t.title,status:"pending",kind:ZO(s,i),args:n,startTime:t.createdAt}}function zve(t,e){const n=Bi(t.toolCall),r=Ii(n,"toolCallId")??Ii(n,"id");if(!r)return;const i=Ii(n,"title")??t.title,s=n?JO(n):void 0;Array.isArray(s==null?void 0:s.questions)&&e.set(r,{...i?{title:i}:{},...s?{args:s}:{}})}function c4(t){const[e="",n=""]=t.toLowerCase().split(":",2);return n9(e)?!0:e!=="selected"?!1:n9(n.trim())}function n9(t){return t==="allow"||t==="allowed"||t==="approve"||t==="approved"||t==="accept"||t==="accepted"||t==="confirm"||t==="confirmed"||t==="proceed"||t==="proceed_once"||t==="proceed_always_project"||t==="proceed_always_user"||t==="allow_once"||t==="allow_always"||t==="success"||t==="succeeded"}function JO(t){return Bi(t.rawInput)??Bi(t.input)??Bi(t.args)}function Pve(t,e){var i;const n=(i=t.toolName)==null?void 0:i.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=Bi(e);return(r==null?void 0:r.status)==="background"}function $ve(t){return Hve(t)&&t.status==="failed"?qve(t)??t.details??t.rawOutput:!Fve(t.status)||!t.details?t.rawOutput??t.details:t.rawOutput&&typeof t.rawOutput=="object"&&!Array.isArray(t.rawOutput)?{...t.rawOutput,status:t.status,reason:t.details}:{status:t.status,reason:t.details,text:typeof t.rawOutput=="string"&&t.rawOutput?t.rawOutput:t.details}}function Uve(t){if(!Array.isArray(t))return;const e=t.flatMap(n=>{const r=Bi(n);if(!r)return[];const i=r.type;if(i==="content"){const s=Bi(r.content);return!s||typeof s.type!="string"?[]:[{type:"content",content:{...s,type:s.type}}]}if(i==="diff"){const s=r.newText;if(typeof s!="string")return[];const a=r.path,o=r.oldText;return[{type:"diff",...typeof a=="string"?{path:a}:{},...typeof o=="string"?{oldText:o}:{},newText:s}]}if(i==="terminal"){const s=r.terminalId;return[{type:"terminal",...typeof s=="string"?{terminalId:s}:{}}]}return[]});return e.length>0?e:void 0}function Hve(t){if(!t.toolName)return!1;const e=t.toolName.toLowerCase();return e==="ask_user_question"||e==="askuserquestion"}function qve(t){if(!Array.isArray(t.content))return;const e=t.content.map(n=>{var r;return(r=n==null?void 0:n.content)==null?void 0:r.text}).filter(n=>!!n);if(!(!e||e.length===0))return e.join(`
`)}function Fve(t){return t==="cancelled"||t==="canceled"}const Vve=['"insight_progress":','"insight_ready":','"insight_error":'];function Gve(t){try{const e=JSON.parse(t),n=Bi(e.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const r=Bi(e.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const i=Bi(e.insight_error);if(i&&typeof i.error=="string")return{type:"insight_error",error:i.error}}catch{}return null}function Wve(t,e){if(t[e]!=="{")return null;let n=0,r=!1,i=!1;for(let s=e;s<t.length;s++){const a=t[s];if(i){i=!1;continue}if(a==="\\"&&r){i=!0;continue}if(a==='"'){r=!r;continue}if(!r){if(a==="{")n++;else if(a==="}"&&(n--,n===0))return t.slice(e,s+1)}}return null}function Kve(t){const e=[];let n=0,r=0,i=!1;for(;r<t.length;){const a=t.indexOf("{",r);if(a===-1)break;const o=t.slice(a+1).trimStart();if(!Vve.some(h=>o.startsWith(h))){r=a+1;continue}const c=Wve(t,a);if(!c){r=a+1;continue}const u=Gve(c);if(!u){r=a+1;continue}i=!0;const d=t.slice(n,a).trim();d&&e.push({kind:"text",text:d}),e.push({kind:"insight",data:u}),n=a+c.length,r=n}if(!i)return null;const s=t.slice(n).trim();return s&&e.push({kind:"text",text:s}),e.length>0?e:null}function ZO(t,e){if(e)return e;if(!t)return;const n=t.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 Yve(t){const e=N1();return v.useMemo(()=>Mve(e,{labels:{promptCancelled:t("request.cancelled")}}),[e,t])}function tl(t){const[e,n]=v.useState(null);return v.useEffect(()=>{const r=i=>{const s=i.detail;if(!(s!=null&&s.id)&&(s==null?void 0:s.active)===!1){n(null);return}s!=null&&s.id&&(s.active?n(s.id):n(a=>a===s.id?null:a))};return window.addEventListener(t,r),()=>window.removeEventListener(t,r)},[t]),e!==null}function Xve(t,e){if(t===e)return!0;if(t==null||e==null||typeof t!="object"||typeof e!="object")return!1;if(Array.isArray(t))return!Array.isArray(e)||t.length!==e.length?!1:t.every((s,a)=>s===e[a]);const n=Object.keys(t),r=e,i=t;return n.length!==Object.keys(r).length?!1:n.every(s=>{const a=i[s],o=r[s];return a===o?!0:Array.isArray(a)&&Array.isArray(o)?a.length===o.length&&a.every((l,c)=>l===o[c]):!1})}function Qve(t){const e=v.useRef(t);return Xve(e.current,t)||(e.current=t),e.current}function Jve(t,e){const n=v.useRef(t);return t.length!==n.current.length?(n.current=t,t):(t.some((i,s)=>e(i)!==e(n.current[s]))&&(n.current=t),n.current)}const Tr={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"},r9=1024,Zve=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${r9}}\S\$)([^$\n]{1,${r9}})\$(?![\w$])`,"g");function e4e(t){var c,u,d;const e=[],n=t.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,i=new Map;let s=null,a=null,o=null,l=[];for(const h of n){const m=h.match(r);if(!s){if(m){if(s=m[1]??null,a=((u=(c=m[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:u.toLowerCase())||null,a){const p=(i.get(a)??0)+1;i.set(a,p),o=p}else o=null;l=[]}continue}if(m&&((d=m[1])!=null&&d.startsWith(s[0]??""))&&m[1].length>=s.length){e.push({lang:a,content:l.join(`
`),index:e.length+1,langIndex:o}),s=null,a=null,o=null,l=[];continue}l.push(h)}return e}function t4e(t){var l;const e=[],n=t.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,i=/^ *\$\$ *$/;let s=null,a=!1,o=[];for(const c of n){const u=c.match(r);if(s){u&&((l=u[1])!=null&&l.startsWith(s[0]??""))&&u[1].length>=s.length&&(s=null);continue}if(!a){if(u){s=u[1]??null;continue}i.test(c)&&(a=!0,o=[]);continue}if(i.test(c)){e.push({content:o.join(`
`),index:e.length+1}),a=!1,o=[];continue}o.push(c)}return e}function n4e(t){var o;const e=[],n=t.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,i=/^ *\$\$ *$/;let s=null,a=!1;for(const l of n){const c=l.match(r);if(s){c&&((o=c[1])!=null&&o.startsWith(s[0]??""))&&c[1].length>=s.length&&(s=null);continue}if(a){i.test(l)&&(a=!1);continue}if(c){s=c[1]??null;continue}if(i.test(l)){a=!0;continue}for(const u of l.matchAll(Zve)){const d=u[1];d&&e.push({content:d,index:e.length+1})}}return e}function i9(t,e){return e&&t.langIndex!==null?`${e} code block ${t.langIndex}`:`Code block ${t.index}`}function r4e(t,e){var u;const n=e.trim().split(/\s+/).filter(Boolean),r=(u=n[0])==null?void 0:u.toLowerCase();if(!r)return;const i=e4e(t);if(i.length===0)return null;let s=null,a=null;const o=r==="code"?n.slice(1):n.map(d=>d);r!=="code"&&(s=r);for(const d of o)/^\d+$/.test(d)?a=Number(d):d.toLowerCase()!=="code"&&(s=d.toLowerCase());const l=s?i.filter(d=>d.lang===s):i;if(l.length===0)return null;if(a!==null){const d=s?l.find(h=>h.langIndex===a):i.find(h=>h.index===a);return d?{content:d.content,label:i9(d,s)}:null}const c=l[l.length-1];return c?{content:c.content,label:i9(c,s)}:null}function s9(t,e){const n=n4e(t);if(n.length===0)return null;let r=null;for(const s of e)/^\d+$/.test(s)&&(r=Number(s));const i=r!==null?n.find(s=>s.index===r):n[n.length-1];return i?{content:i.content,label:`Inline LaTeX expression ${i.index}`}:null}function i4e(t,e){var c;const n=e.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 s9(t,n.slice(1));const i=n.slice(1),s=i.findIndex(u=>u.toLowerCase()==="inline");if(s!==-1)return s9(t,i.filter((u,d)=>d!==s));const a=t4e(t);if(a.length===0)return null;let o=null;for(const u of i)/^\d+$/.test(u)&&(o=Number(u));const l=o!==null?a.find(u=>u.index===o):a[a.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function s4e(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role==="assistant"&&n.content)return n.content}return null}function a4e(t){var e;return typeof navigator>"u"||!((e=navigator.clipboard)!=null&&e.writeText)?Promise.reject(new Error("Clipboard API is not available")):navigator.clipboard.writeText(t)}async function o4e(t,e,n=a4e){const r=s4e(t);if(r===null)return{status:"info",message:Tr.NO_OUTPUT};if(!r)return{status:"info",message:Tr.NO_TEXT};try{const i=i4e(r,e);if(i===null)return{status:"info",message:e.trim().split(/\s+/).some(l=>l==="inline")||e.trim().toLowerCase().startsWith("inline-latex")?Tr.INLINE_LATEX_MISSING:Tr.LATEX_MISSING};if(i!==void 0)return await n(i.content),{status:"info",message:`${i.label}${Tr.COPIED_SUFFIX}`};const s=r4e(r,e);if(s===null)return{status:"info",message:Tr.CODE_MISSING};const a=(s==null?void 0:s.content)??r;return await n(a),{status:"info",message:s?`${s.label}${Tr.COPIED_SUFFIX}`:Tr.OUTPUT_COPIED}}catch(i){const s=i instanceof Error?i.message:String(i);return{status:"error",message:`${Tr.CLIPBOARD_PREFIX}${s}`}}}function a9(t,e){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(t)for(const r of t.cells){const i=r.detail;r.kind==="node_version"&&(i!=null&&i.version)?n.nodeVersion=i.version:r.kind==="npm"&&(i!=null&&i.version)?n.npmVersion=String(i.version).replace(/^npm\s*/i,""):r.kind==="auth"&&(i!=null&&i.source)&&(n.authSource=i.source)}if(e)for(const r of e.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 l4e(t){return t.cmd!=="tasks"?!1:(t.getTasks().then(e=>{t.dispatch([{type:"status",text:Qre({snapshot:e})}])}).catch(e=>{t.reportError(e,"Failed to load tasks")}),!0)}const c4e="_app_14rk3_1",u4e="_themeDark_14rk3_24",d4e="_themeLight_14rk3_61",h4e="_dialogOverlay_14rk3_98",f4e="_content_14rk3_107",m4e="_contentHasMessages_14rk3_115",p4e="_footer_14rk3_119",g4e="_footerHidden_14rk3_124",y4e="_bottomPanels_14rk3_128",b4e="_tasksBottomPanel_14rk3_135",v4e="_btwPanel_14rk3_143",x4e="_composer_14rk3_149",w4e="_queuedPrompts_14rk3_154",k4e="_queuedPrompt_14rk3_154",_4e="_queuedHint_14rk3_172",jr={app:c4e,themeDark:u4e,themeLight:d4e,dialogOverlay:h4e,content:f4e,contentHasMessages:m4e,footer:p4e,footerHidden:g4e,bottomPanels:y4e,tasksBottomPanel:b4e,btwPanel:v4e,composer:x4e,queuedPrompts:w4e,queuedPrompt:k4e,queuedHint:_4e},dh=v.createContext(!1),o5=v.createContext(new Map),ej=v.createContext(new Map);function S4e({timeline:t,details:e,children:n}){return f.jsx(o5.Provider,{value:t,children:f.jsx(ej.Provider,{value:e,children:n})})}const ip=u3,u4=3,o9=240,l9="ui.compactMode",T4e="ui.hideTips";function c9(t){return t.trim().replace(/^\/+/,"").toLowerCase()}const tj=new Set(["clear","stop","off","reset","none","cancel"]);function C4e(t){const e=t.replace(/^\/goal\b/i,"").trim().toLowerCase();return tj.has(e)}function E4e(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.kind!=="status")continue;const r=n,i=r.source==="goal"?Hg(r.data):Hg(r.text);if(i)return i.kind==="set"||i.kind==="checking"?{condition:i.condition,setAt:i.setAt??n.serverTimestamp??n.createdAt}:null}return null}const u9={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}};function d9(t,e){if(t){if(typeof t=="function"){t(e);return}t.current=e}}function A4e(t){if(typeof window>"u")return;const e=new URL(window.location.href);e.pathname=`/session/${encodeURIComponent(t)}`,e.searchParams.delete("token"),e.searchParams.delete("daemon"),window.history.replaceState(null,"",e)}function M4e(){if(typeof window>"u")return"en";const t=new URLSearchParams(window.location.search);return Rl(t.get("language")??t.get("lang")??navigator.language)}function N4e(t,e){return t instanceof Error?t.message:e}function d4(t){return t instanceof DOMException&&t.name==="AbortError"||t instanceof Error&&t.name==="AbortError"}function $h(t){return typeof t=="object"&&t!==null&&t._alreadyDispatched===!0}function D4e(t){t.length>0&&console.info("[web-shell] useSessionNotices()",{notices:t})}function I4e(t){return t.category==="validation"||t.category==="user_action"||t.category==="system"}function R4e(t){return t.severity==="warning"?"warning":t.severity==="info"?"info":"error"}function h4(t){return typeof t=="object"&&t!==null}function O4e(t){const e=t.trim();return e.startsWith("USE_")?e.slice(4).toLowerCase().replace(/_/g,"-"):e.toLowerCase()}function j4e(t){if(!h4(t))return null;const e=t._meta;if(!h4(e))return null;const n=e.qwenModelSwitch;if(!h4(n))return null;const r=n.authType,i=n.modelId,s=n.baseUrl,a=n.apiKey;return typeof r!="string"||typeof i!="string"||typeof s!="string"||typeof a!="string"?null:{authType:r,modelId:i,baseUrl:s,apiKey:a,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function L4e(t){return`● authType: ${O4e(t.authType)}
  Using ${t.isRuntime?"runtime ":""}model: ${t.modelId}
  Base URL: ${t.baseUrl}
  API key: ${t.apiKey}`}function B4e(t){const e="Model switched: ";return t.startsWith(e)?t.slice(e.length).trim().replace(/\([^()]+\)$/,""):null}function z4e(t){var n;if(!t.startsWith("● authType:"))return null;const e=t.match(/\n {2}Using (?:runtime )?model: ([^\n]+)/);return((n=e==null?void 0:e[1])==null?void 0:n.trim())||null}function h9(t){const e=new Set;for(const n of t){if(n.role!=="system"||n.variant!=="info")continue;const r=z4e(n.content);r&&e.add(r)}return e.size===0?[...t]:t.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=B4e(n.content);return!r||!e.has(r)})}function P4e(t){return t.some(e=>e.role==="system"&&e.variant==="info"&&hI(e.content)!==null)}function f9(t){return u3.includes(t)}function $4e(t){return t.toolKind==="edit"}function U4e(t){const e=t.trim().replace(/[\r\n]+/g," ");return e?e==="--"?{type:"manual",displayName:""}:e.startsWith("-- ")?{type:"manual",displayName:e.slice(3).trim()}:e.toLowerCase()==="--auto"?{type:"auto"}:e.startsWith("--")?{type:"delegate"}:{type:"manual",displayName:e}:{type:"auto"}}function H4e(t){var n;if(((n=t.args)==null?void 0:n.is_background)!==!0)return!1;const e=t.toolName.toLowerCase();return e==="shell"||e==="bash"||e==="run_shell_command"||e==="exec"}function q4e(t){const e=[];for(const n of t)if(n.role==="tool_group")for(const r of n.tools)(XA(r)||H4e(r))&&e.push(`${r.callId}:${r.status}`);return e.join("|")}function F4e(t){const e={id:t.id,label:t.label,description:t.description,runtimeMs:t.runtimeMs,startTime:t.startTime,endTime:t.endTime,error:t.error};switch(t.kind){case"agent":return{...e,kind:"agent",status:t.status,subagentType:t.subagentType,isBackgrounded:t.isBackgrounded,prompt:t.prompt};case"shell":return{...e,kind:"shell",status:t.status,command:t.command,cwd:t.cwd,pid:t.pid,exitCode:t.exitCode};case"monitor":return{...e,kind:"monitor",status:t.status,command:t.command,pid:t.pid,exitCode:t.exitCode};default:return t}}function V4e(t,e){return t===Tr.NO_OUTPUT?e("copy.noOutput"):t===Tr.NO_TEXT?e("copy.noText"):t===Tr.CODE_MISSING?e("copy.codeMissing"):t===Tr.LATEX_MISSING?e("copy.latexMissing"):t===Tr.INLINE_LATEX_MISSING?e("copy.inlineLatexMissing"):t===Tr.OUTPUT_COPIED?e("copy.outputCopied"):t.startsWith(Tr.CLIPBOARD_PREFIX)?`${e("copy.failedFallback")}. ${t.slice(Tr.CLIPBOARD_PREFIX.length)}`:t.endsWith(Tr.COPIED_SUFFIX)?e("copy.toClipboard",{label:t.slice(0,-Tr.COPIED_SUFFIX.length)}):t}function G4e({prompts:t,t:e}){return t.length===0?null:f.jsxs("div",{className:jr.queuedPrompts,children:[t.slice(0,u4).map(n=>{var a;const r=n.text.replace(/\s+/g," ").trim(),i=r.length>o9?`${r.slice(0,o9)}...`:r,s=((a=n.images)==null?void 0:a.length)??0;return f.jsxs("div",{className:jr.queuedPrompt,children:[i,s>0?` ${e("queue.imageCount",{count:s})}`:""]},n.id)}),t.length>u4&&f.jsx("div",{className:jr.queuedPrompt,children:e("queue.more",{count:t.length-u4})}),f.jsx("div",{className:jr.queuedHint,children:e("queue.footer")})]})}function W4e({onSessionIdChange:t,theme:e,onThemeChange:n,language:r,onLanguageChange:i,className:s,style:a,onConnectionChange:o,onStreamingStateChange:l,onError:c,onBugReport:u,hiddenSlashCommands:d,slashCommandCategoryOrder:h,renderToolHeaderExtra:m,renderWelcomeHeader:p,renderFooter:b,compactThinking:x=!1,collapseCompletedTurns:g=!0,virtualScrollThreshold:y,markdown:w,onTranscriptChange:C,onToast:E,composerRef:S,composerInput:T,composerInputVersion:O}={}){var T5;const[z,I]=v.useState(()=>r===void 0?M4e():Rl(r)),j=v.useMemo(()=>ZD(z),[z]),N=v.useMemo(()=>({renderToolHeaderExtra:m,renderWelcomeHeader:p,renderFooter:b,compactThinking:x,collapseCompletedTurns:g,markdown:w}),[m,p,b,x,g,w]),B=b,P=x3(),J=N1(),q=uu(),Y=k3(),{notices:$,dismissNotice:Z}=rU(),M=Zl(),X=v.useRef(E);X.current=E;const H=v.useRef(0),[R,ae]=v.useState([]),xe=v.useCallback(L=>{ae(Q=>Q.filter(ue=>ue.id!==L))},[]),ye=v.useCallback((L,Q)=>{if(X.current){X.current(L,Q);return}const ue={id:`web-shell-toast-${Date.now()}-${++H.current}`,tone:L,message:Q};ae(Xe=>[...Xe.filter(Ke=>Ke.tone!==L||Ke.message!==Q),ue].slice(-4))},[]),Ae=Yve(j),Fe=v.useRef(Ae);Fe.current=Ae;const[vt,Nt]=v.useState(null),[pt,Qe]=v.useState(null),Ge=v.useRef(1),$t=v.useRef(1),Je=v.useRef(null),re=v.useRef(null),ce=v.useRef(q.sessionId),Ie=v.useMemo(()=>{const L=[vt].filter(ue=>ue!==null);if(L.length===0)return h9(Ae);const Q=[...Ae];for(const ue of L.sort((Xe,at)=>Xe.anchorIndex-at.anchorIndex)){const Xe=ue.anchorAfterId?Q.findIndex(Ke=>Ke.id===ue.anchorAfterId):-1,at=Xe>=0?Xe+1:Math.min(ue.anchorIndex,Q.length);Q.splice(at,0,ue.message)}return h9(Q)},[Ae,vt]),We=v.useMemo(()=>P4e(Ie),[Ie]);v.useEffect(()=>{We||window.dispatchEvent(new CustomEvent(Zf,{detail:{active:!1}}))},[We]);const me=_ve(J),rt=v.useMemo(()=>bU(me),[me]),oe=Qve(rt),Oe=v.useRef(oe);Oe.current=oe;const Re=oe!==null,$e=v.useMemo(()=>mae(Ae),[Ae]),ne=v.useRef(null),ge=v.useMemo(()=>{const L=gae(Ae),Q=ne.current;if(Q&&Q.signature===L)return Q.timeline;const ue=pae(Ae);return ne.current={signature:L,timeline:ue},ue},[Ae]),ke=v.useRef(null),ze=v.useMemo(()=>{const L=yae(Ae),Q=ke.current;if(Q&&Q.signature===L)return Q.details;const ue=Sae(Ae);return ke.current={signature:L,details:ue},ue},[Ae]),ot=Jve($e.todos,L=>`${L.id}:${L.status}:${L.content}`),Ut=$e.allCompleted,[Xt,En]=v.useState("hidden"),Dn=q.catchingUp||ot.length===0?"hidden":Ut?Xt==="hidden"?"hidden":"completed":"active";Dn!==Xt&&En(Dn);const Yn=Dn!=="hidden",wn=v.useMemo(()=>q4e(Ae),[Ae]),nr=Cve(wn,q.status==="connected"),fe=v.useMemo(()=>b?nr.map(F4e):[],[nr,b]),G=v.useRef(null),te=v.useRef(null),Ue=v.useCallback(L=>{te.current=L,d9(S,L??u9)},[S]);v.useEffect(()=>{d9(S,te.current??u9)},[S]);const Gt=v.useRef(null),xt=v.useCallback(()=>{var L;$e.sourceMessageId&&((L=Gt.current)==null||L.scrollToMessage($e.sourceMessageId,$e.sourceCallId??void 0))},[$e.sourceMessageId,$e.sourceCallId]),[zt,Tt]=v.useState(null),sn=v.useRef(null);sn.current=zt;const{followupState:Vn,onAcceptFollowup:Hi,onDismissFollowup:qi,clear:ps}=gU({onAccept:L=>{var Q;(Q=te.current)==null||Q.insertText(L)}}),lt=v.useCallback((L,Q,ue)=>{ps();const Xe=!L.trimStart().startsWith("/");!(ue!=null&&ue.retry)&&Xe&&(Vs.current=L,ua.current=Q,Ya.current=null),da(!1);const at={images:Q,optimisticUserMessage:ue==null?void 0:ue.optimisticUserMessage,retry:ue==null?void 0:ue.retry};return Y.sendPrompt(L,at)},[ps,Y]),an=w3(),cr=v.useRef(an),Vs=v.useRef(""),ua=v.useRef(void 0),Gs=v.useRef(null),Ya=v.useRef(null),[Xa,da]=v.useState(!1),rc=v.useRef(Xa);rc.current=Xa;const Rr=q.status==="connected",[ic,gs]=v.useState([]);v.useEffect(()=>{Rr&&M.loadSkillsStatus().then(L=>{gs(((L==null?void 0:L.skills)??[]).map(Q=>({name:Q.name,description:Q.description??""})).sort((Q,ue)=>Q.name.localeCompare(ue.name)))}).catch(()=>{})},[Rr,M]);const[wr,Ws]=v.useState(null),[ys,Go]=v.useState(!1),[yu,Ks]=v.useState(!1),[Qa,sc]=v.useState(!1),[Fi,Ja]=v.useState(!1),[It,In]=v.useState(!1),[kr,Za]=v.useState(!1),[W,se]=v.useState(!1),[le,Pe]=v.useState(!1),[St,ct]=v.useState(!1),[Ct,Xn]=v.useState(!1),[tn,Or]=v.useState(!1),[ac,wy]=v.useState(0),[ky,Wo]=v.useState(0),ur=cu(),hh=v.useRef((ur==null?void 0:ur.extensionsVersion)??0);v.useEffect(()=>{const L=(ur==null?void 0:ur.extensionsVersion)??0;if(L!==hh.current){hh.current=L;const Q=ur==null?void 0:ur.lastExtensionChange;if((Q==null?void 0:Q.status)==="failed"){P.dispatch([{type:"error",text:j("extensions.action.failed",{name:Q.name??"",source:Q.source??"",error:Q.error??j("error.unknown")})}]);return}if((Q==null?void 0:Q.status)==="installed"){const ue=Q.name??Q.source??j("extensions.label");P.dispatch([{type:"status",text:Q.version?j("extensions.install.installedWithVersion",{name:ue,version:Q.version}):j("extensions.install.installed",{name:ue})}])}else if(Q!=null&&Q.status){const ue=Q.name??Q.source??j("extensions.label"),Xe=Q.status==="updated"&&Q.version?"extensions.manage.updatedWithVersion":`extensions.manage.${Q.status}`;P.dispatch([{type:"status",text:j(Xe,{name:ue,version:Q.version??""})}])}Y.refreshCommands().catch(()=>{P.dispatch([{type:"error",text:j("extensions.commands.refreshFailed")}])})}},[ur==null?void 0:ur.extensionsVersion,ur==null?void 0:ur.lastExtensionChange,Y,P,j]);const[be,it]=v.useState("workspace"),[wt,Pt]=v.useState(null),[ft,Rt]=v.useState(null),[Qt,An]=v.useState(!1),[bs,eo]=v.useState(!1),Ys=v.useRef(0),Vi=v.useRef(null),q0=tl(FO),[to,Ko]=v.useState(null),_y=tl(Zf),Sy=tl(Ld),sj=tl(VO),aj=tl(WO),oj=tl(KO),lj=tl(YO),cj=tl(iw),[Ty,Cy]=v.useState(e??Oi.Dark),[fh,F0]=v.useState(""),l5=v.useRef(fh);l5.current=fh;const V0=v.useRef(q);V0.current=q;const uj=q.displayName,[Yo,Ey]=v.useState("default"),[bu,vu]=v.useState([]),oi=v.useRef([]),dj=v.useRef(1),G0=v.useRef(!1),Ay=yu||Qa||Fi||It||kr||W||le,Gi=Ay||(ys||tn||wt!==null||Ct||wr!==null||St)||q0||_y||Sy||sj||aj||oj||lj||cj,gt=v.useCallback((L,Q)=>{if(d4(L))return;if(yA(L)){console.debug("[web-shell] turn error rendered in transcript",L);return}if($h(L)){console.debug("[web-shell] error already handled by notice",L);return}const ue=N4e(L,Q);console.error("[web-shell]",ue,L),ye("error",ue)},[ye]);v.useEffect(()=>{D4e($);for(const L of $)I4e(L)?ye(R4e(L),L.message):L.category==="lifecycle"?console.debug("[web-shell] daemon notice",L):console.warn("[web-shell] daemon notice",L),Z(L.id)},[Z,$,ye]);const My=v.useRef(u);My.current=u,v.useEffect(()=>{var L;ce.current=q.sessionId,(L=Je.current)==null||L.abort(),Je.current=null,Nt(null),Qe(null),Ko(null),Y0.current=0},[q.sessionId]);const c5=v.useCallback(()=>{var at;const L=`local-recap-${Ge.current++}`,Q=Ae.length,ue=(at=Ae.at(-1))==null?void 0:at.id,Xe=q.sessionId;Nt({anchorAfterId:ue,anchorIndex:Q,message:{id:L,role:"system",content:`※ recap: ${j("recap.loading")}`,variant:"info"}}),Y.recapSession().then(Ke=>{ce.current===Xe&&Nt({anchorAfterId:ue,anchorIndex:Q,message:{id:L,role:"system",content:Ke.recap?`※ recap: ${Ke.recap}`:j("recap.empty"),variant:"info"}})},Ke=>{ce.current===Xe&&(Nt(null),!d4(Ke)&&!$h(Ke)&&console.warn("[web-shell] unhandled recap failure",Ke))})},[q.sessionId,Ae,Y,j]),u5=v.useCallback(L=>{var Ke;const Q=L.trim();if(!Q){ye("error",j("btw.empty"));return}const ue=`local-btw-${$t.current++}`,Xe=q.sessionId;(Ke=Je.current)==null||Ke.abort();const at=new AbortController;Je.current=at,Qe({id:ue,role:"btw",question:Q,answer:"",isPending:!0}),Y.btwSession(Q,{signal:at.signal}).then(_e=>{ce.current===Xe&&Je.current===at&&(Je.current=null,Qe({id:ue,role:"btw",question:Q,answer:_e.answer||j("btw.emptyAnswer"),isPending:!1}))},_e=>{ce.current===Xe&&Je.current===at&&(Je.current=null,Qe(null),!d4(_e)&&!$h(_e)&&console.warn("[web-shell] unhandled btw failure",_e))})},[q.sessionId,ye,Y,j]),d5=v.useCallback(()=>{var L;(L=Je.current)==null||L.abort(),Je.current=null,Qe(null)},[]);v.useEffect(()=>{const L=Q=>{var _e;if(Gi||oe)return;const ue=pt;if(!ue||ue.role!=="btw")return;const Xe=Q.key.toLowerCase(),at=Q.key==="Escape"&&!Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!Q.shiftKey,Ke=Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!Q.shiftKey&&(Xe==="c"||Xe==="d");if(ue.isPending){if(!at&&!Ke)return}else{const Ne=((_e=te.current)==null?void 0:_e.hasInput())??!1;if(!(!Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!Q.shiftKey&&(Q.key==="Escape"||!Ne&&(Q.key==="Enter"||Q.key===" "))))return}Q.preventDefault(),Q.stopPropagation(),d5()};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[Gi,pt,d5,oe]),v.useEffect(()=>{oi.current=bu},[bu]);const Xs=v.useCallback((L,Q,ue)=>{const Xe=L.trim();if(!Xe)return!0;const at=!!Q&&Q.length>0,Ke={id:dj.current++,text:Xe,images:Q?[...Q]:void 0,onComplete:ue};if(oi.current=[...oi.current,Ke],vu(oi.current),!at){let _e=re.current;_e||(_e=new AbortController,re.current=_e),Y.enqueueMidTurnMessage(Xe,{signal:_e.signal})}return!0},[Y]);v.useEffect(()=>{if(an!=="idle")return;const L=re.current;L&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),L.abort(),re.current=null)},[an]);const h5=v.useCallback(()=>{const[L,...Q]=oi.current;return L?(oi.current=Q,vu(Q),L):null},[]),hj=v.useCallback(()=>{const L=oi.current;return L.length===0?null:(oi.current=[],vu([]),L.map(Q=>Q.text).join(`

`))},[]),Ny=v.useCallback(()=>oi.current.length===0?!1:(oi.current=[],vu([]),P.dispatch([{type:"status",text:j("queue.cleared")}]),!0),[P,j]),{batches:mh,consume:f5}=yU();v.useEffect(()=>{const L=q.sessionId;if(!L||mh.length===0)return;q.clientId===void 0&&mh.some(ue=>ue.sessionId===L&&ue.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const Q=kU(oi.current,mh,L,q.clientId);Q&&(oi.current=Q,vu(Q)),f5(mh.filter(ue=>ue.sessionId===L))},[mh,q.sessionId,q.clientId,f5]);const W0=v.useCallback(L=>{Cy(L),n==null||n(L)},[n]),ph=v.useCallback(L=>{I(L),i==null||i(L)},[i]),m5=v.useCallback(()=>{An(L=>!L)},[]),fj=v.useCallback(()=>{An(!1)},[]),p5=hU({autoLoad:!0}),{settings:gh,setValue:g5,reload:y5}=p5,xu=gh.find(L=>L.key===l9),wu=gh.find(L=>L.key===_c),ku=gh.find(L=>L.key===T4e),_u=gh.find(L=>L.key===Qu),mj=noe(gh),[Dy,Iy]=v.useState(!1),Ry=v.useRef(Dy);Ry.current=Dy,v.useEffect(()=>{const L=xu==null?void 0:xu.values.effective;typeof L=="boolean"&&Iy(L)},[xu==null?void 0:xu.values.effective]),v.useEffect(()=>{if(e){Cy(e);return}const L=S3(wu==null?void 0:wu.values.effective);L&&Cy(L)},[e,wu==null?void 0:wu.values.effective]),v.useEffect(()=>{if(r!==void 0){I(Rl(r));return}const L=yk(_u==null?void 0:_u.values.effective);L&&I(L)},[r,_u==null?void 0:_u.values.effective]);const pj=v.useCallback(L=>{const Q=z,ue=`/language ui ${L}`;ph(L);const Xe=()=>Promise.all([Y.refreshCommands(),y5()]);if(cr.current!=="idle"){Xs(ue,void 0,Xe);return}lt(ue).then(Xe).catch(at=>{ph(Q),gt(at,"Failed to sync /language command")})},[Xs,ph,y5,gt,lt,z,Y]),b5=v.useCallback(()=>{if(cr.current!=="idle"){P.dispatch([{type:"status",text:j("clear.blocked")}]);return}P.reset()},[P,j]),v5=v.useCallback(()=>{const L=Ry.current,Q=!Ry.current;Iy(Q),g5("workspace",l9,Q).catch(ue=>{Iy(L),gt(ue,j("compact.saveFailed"))})},[gt,g5,j]),Su=v.useCallback(L=>{if(!f9(L)){gt(new Error(`Unsupported approval mode: ${L}`),j("local.approvalMode"));return}Y.setApprovalMode(L).then(Q=>{const ue=Q.mode||L;Ey(ue),ue==="auto"&&P.dispatch([{type:"status",text:j("mode.auto.notice")}]);const Xe=Oe.current;if(!Xe)return;if(L==="yolo"||L==="auto-edit"&&$4e(Xe)){const Ke=Xe.options.find(_e=>_e.kind==="allow_once");if(Ke){const _e=Xe.title||"";P.dispatch([{type:"status",text:j("mode.autoApproved",{tool:_e})}]),Y.submitPermission(Xe.id,Ke.id).catch(Ne=>{gt(Ne,"Failed to auto-approve tool call")})}}}).catch(Q=>{gt(Q,j("local.approvalMode"))})},[Y,gt,P,j]);v.useEffect(()=>{cr.current=an},[an]),v.useEffect(()=>{let L=null;for(let ue=J.length-1;ue>=0;ue--){const Xe=J[ue];if((Xe==null?void 0:Xe.kind)==="user")break;if((Xe==null?void 0:Xe.kind)==="error"&&Xe.source==="turn_error"){L=Xe.id;break}if((Xe==null?void 0:Xe.kind)!=="debug")break}const Q=Rr&&L!==null&&L!==Ya.current&&Vs.current.length>0;Gs.current=Q?L:null,da(Q)},[J,Rr]),v.useEffect(()=>{l==null||l(an)},[an,l]),v.useEffect(()=>{o==null||o(q.status)},[q.status,o]),v.useEffect(()=>{C==null||C(J)},[J,C]),v.useEffect(()=>{if(q.error){const L=new Error(q.error);c==null||c(L)}},[q.error,c]),v.useEffect(()=>{q.currentModel&&F0(q.currentModel)},[q.currentModel]),v.useEffect(()=>{q.currentMode&&Ey(q.currentMode)},[q.currentMode]),v.useEffect(()=>{q.sessionId&&(Tt(null),t==null||t(q.sessionId),t||A4e(q.sessionId))},[q.sessionId,t]),v.useEffect(()=>{const L=E4e(J);Tt(Q=>L?(Q==null?void 0:Q.condition)===L.condition&&Q.setAt===L.setAt?Q:L:Q&&null)},[J]),v.useEffect(()=>{const L=Q=>{const ue=Q.detail;if(!(ue!=null&&ue.active)){Tt(null);return}ue.condition&&Tt({condition:ue.condition,setAt:ue.setAt??Date.now()})};return window.addEventListener(d2,L),()=>window.removeEventListener(d2,L)},[]);const K0=v.useRef(null),Y0=v.useRef(0);v.useEffect(()=>{Y0.current=0},[q.sessionId]),v.useEffect(()=>{function ue(){if(document.hidden){K0.current===null&&(K0.current=Date.now());return}const Xe=K0.current;if(K0.current=null,Xe===null||Date.now()-Xe<18e4||cr.current!=="idle"||!q.sessionId)return;const at=P.getSnapshot().blocks.length;at-Y0.current<4||(Y0.current=at,Y.recapSession().then(Ke=>{Ke.recap&&P.dispatch([{type:"status",text:`※ recap: ${Ke.recap}`}])},Ke=>{console.error("[auto-recap] failed:",Ke)}))}return document.addEventListener("visibilitychange",ue),()=>document.removeEventListener("visibilitychange",ue)},[q.sessionId,Y,P]);const Oy=v.useCallback(()=>{const L=f9(Yo)?ip.indexOf(Yo):-1,Q=ip[(L+1)%ip.length];Su(Q)},[Yo,Su]),yh=v.useCallback((L,Q)=>{P.appendLocalUserMessage(L),Y.getContextUsage({detail:Q}).then(ue=>{P.dispatch([{type:"status",text:Dte(ue)}])}).catch(ue=>{gt(ue,"Failed to load context usage")})},[P,Y,gt]),gj=v.useCallback(()=>{yh("/context detail",!0)},[yh]),yj=v.useCallback(()=>{Y.getTasks().then(L=>{Ko({snapshot:L})}).catch(L=>{gt(L,"Failed to load tasks")})},[gt,Y]),x5=v.useCallback((L,Q)=>{Tt({condition:L,setAt:Q}),P.dispatch([{type:"status",text:J7({kind:"set",condition:L,setAt:Q})}])},[P]),w5=v.useCallback(L=>{L&&(P.dispatch([{type:"status",text:J7({kind:"cleared",condition:L.condition,durationMs:Date.now()-L.setAt})}]),Tt(null))},[P]),X0=v.useCallback(L=>(P.appendLocalUserMessage(L),Y.clearGoal().catch(Q=>{gt(Q,"Failed to clear /goal")}),!0),[gt,Y,P]),k5=v.useCallback((L,Q,ue)=>{const Xe=L.replace(/^\/goal\b/i,"").trim(),at=Xe.toLowerCase(),Ke=(ue==null?void 0:ue.sendToDaemon)??!0;return Xe&&tj.has(at)?Ke?X0(L):(P.appendLocalUserMessage(L),w5(sn.current),!0):Xe?(P.appendLocalUserMessage(L),Ke?(lt(L,Q,{optimisticUserMessage:!1}).catch(_e=>{gt(_e,"Failed to send /goal command")}),!0):(x5(Xe,Date.now()),!0)):(P.appendLocalUserMessage(L),Ke&&lt(L,Q,{optimisticUserMessage:!1}).catch(_e=>gt(_e,"Failed to send /goal command")),!0)},[w5,x5,X0,gt,lt,P]),jy=v.useMemo(()=>new Set((d??[]).map(c9).filter(Boolean)),[d]),Ly=jy.has("settings"),By=v.useCallback((L,Q)=>{var Xe;const ue=cr.current!=="idle";if(L.startsWith("/")){const at=L.match(/^\/([\w-]+)/);if(at){const Ke=at[1];if(Ke==="help")return In(!0),!0;if(Ke==="tasks")return P.appendLocalUserMessage(L),l4e({cmd:Ke,getTasks:Y.getTasks,dispatch:_e=>P.dispatch(_e),reportError:gt}),!0;if(Ke==="goal")return ue?C4e(L)?X0(L):Xs(L,Q):k5(L,Q);if(Ke==="theme"){const _e=L.slice(at[0].length).trim().toLowerCase();return _e==="dark"||_e==="light"?W0(_e):_e?ye("error",j("error.unsupportedTheme")):Za(!0),!0}if(Ke==="language"){const _e=L.slice(at[0].length).trim(),[Ne,hn]=_e.split(/\s+/);if(!_e)return P.dispatch([{type:"status",text:[j("language.current",{language:bk(z)}),j("language.usage"),j("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Ne==null?void 0:Ne.toLowerCase())==="ui"){if(!hn)return P.dispatch([{type:"status",text:[j("language.set"),"",j("language.usage"),"",j("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Ot=hn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Ot))return ye("error",j("language.invalid")),!0;const dr=Rl(hn);return ph(dr),ue||lt(`/language ui ${dr}`).then(()=>Y.refreshCommands()).catch(vs=>{gt(vs,"Failed to sync /language command")}),!0}}if(Ke==="copy"){const _e=L.slice(at[0].length).trim();return o4e(Fe.current,_e).then(Ne=>{P.dispatch([{type:Ne.status==="error"?"error":"status",text:V4e(Ne.message,j)}])}).catch(Ne=>{gt(Ne,j("copy.failedFallback"))}),!0}if(Ke==="delete")return sc(!0),!0;if(Ke==="release")return Ja(!0),!0;if(Ke==="auth")return P.appendLocalUserMessage(L),Or(!0),!0;if(Ke==="model"){const _e=L.slice(at[0].length).trim();return _e==="--fast"?(P.appendLocalUserMessage(L),Ws("fast"),!0):_e.startsWith("--fast ")?ue?Xs(L,Q):(lt(L,Q).catch(Ne=>gt(Ne,"Failed to send /model --fast")),!0):(_e?Y.setModel(_e).then(()=>{F0(_e)}).catch(Ne=>{gt(Ne,j("model.switch"))}):(P.appendLocalUserMessage(L),Ws("main")),!0)}if(Ke==="plan"){if(ue)return Xs(L,Q);const _e=L.slice(at[0].length).trim();return Y.setApprovalMode("plan").then(()=>{Ey("plan"),_e&&lt(_e,Q).catch(Ne=>gt(Ne,"Failed to send plan prompt"))}).catch(Ne=>{gt(Ne,j("mode.plan"))}),!0}if(Ke==="approval-mode"){const _e=L.slice(at[0].length).trim();return _e?Su(_e):(P.appendLocalUserMessage(L),Go(!0)),!0}if(Ke==="mcp"){const _e=L.slice(at[0].length).trim().toLowerCase();return P.appendLocalUserMessage(L),M.loadMcpStatus().then(async Ne=>{const hn={};await Promise.all(((Ne==null?void 0:Ne.servers)??[]).map(async Ot=>{try{hn[Ot.name]=await M.loadMcpTools(Ot.name)}catch{}})),P.dispatch([{type:"status",text:gre({status:Ne,toolsByServer:hn,showDescriptions:_e==="desc",showSchema:_e==="schema",showTips:!_e})}])}).catch(Ne=>{gt(Ne,"Failed to load MCP status")}),!0}if(Ke==="skills"){if(L.slice(at[0].length).trim()){if(ue)return Xs(L,Q);lt(L,Q).catch(Ne=>gt(Ne,"Failed to send /skills command"))}else P.appendLocalUserMessage(L),M.loadSkillsStatus().then(Ne=>{const hn=((Ne==null?void 0:Ne.skills)??[]).map(Ot=>({name:Ot.name,description:Ot.description??""})).sort((Ot,rr)=>Ot.name.localeCompare(rr.name));if(gs(hn),hn.length===0)P.dispatch([{type:"status",text:j("skills.none")}]);else{const Ot=hn.map(rr=>`- ${rr.name}`).join(`
`);P.dispatch([{type:"status",text:`${j("skills.available")}

${Ot}`}])}}).catch(Ne=>{gt(Ne,"Failed to load skills")});return!0}if(Ke==="tools"){const _e=L.slice(at[0].length).trim().toLowerCase();return _e==="desc"||_e==="descriptions"?se(!0):(P.appendLocalUserMessage(L),M.loadToolsStatus().then(Ne=>{const hn=(Ne==null?void 0:Ne.tools)??[];if(hn.length===0)P.dispatch([{type:"status",text:j("tools.none")}]);else{const Ot=hn.map(rr=>`- ${rr.displayName||rr.name}`).join(`
`);P.dispatch([{type:"status",text:`${j("tools.available")}

${Ot}`}])}}).catch(Ne=>{gt(Ne,"Failed to load tools")})),!0}if(Ke==="settings")return Ly?(P.appendLocalUserMessage(L),P.dispatch([{type:"status",text:j("command.hidden")}]),!0):(P.appendLocalUserMessage(L),ct(!0),!0);if(Ke==="context"){const _e=L.slice(at[0].length).trim().toLowerCase();if(_e===""||_e==="detail"||_e==="-d")return yh(L,_e==="detail"||_e==="-d"),!0}if(Ke==="memory"){const _e=L.slice(at[0].length).trim().toLowerCase();if(P.appendLocalUserMessage(L),_e==="refresh")wy(Ne=>Ne+1);else if(_e==="add"||_e.startsWith("add ")){const Ne=_e.slice(3).trim();it(Ne==="user"||Ne==="global"?"global":"workspace"),Wo(hn=>hn+1)}return Xn(!0),!0}if(Ke==="agents"){const _e=L.slice(at[0].length).trim().toLowerCase();P.appendLocalUserMessage(L);let Ne="menu";return _e==="create"?Ne="create":_e==="create user"||_e==="create global"?Ne="create-user":_e==="create project"||_e==="create workspace"?Ne="create-project":_e==="manage"&&(Ne="manage"),Pt(Ne),!0}if(Ke==="extensions"){const _e=L.slice(at[0].length).trim(),Ne=(Xe=_e.split(/\s+/)[0])==null?void 0:Xe.toLowerCase();if(!Ne||Ne==="manage")return P.appendLocalUserMessage(L),Pe(!0),!0;if(Ne==="install"){const hn=_e.slice(7).trim().split(/\s+/);let Ot="",rr,dr,vs,oc,ha=null;for(let xs=0;xs<hn.length;xs++){const li=hn[xs];if(li)if(li==="--auto-update")vs=!0;else if(li==="--pre-release"||li==="--allow-pre-release")oc=!0;else if(li==="--ref"||li==="--registry"){const lc=hn[xs+1];if(!lc||lc.startsWith("--")){ha=j("extensions.install.missingOptionValue",{option:li});break}li==="--ref"?rr=lc:dr=lc,xs+=1}else if(li.startsWith("--")){ha=j("extensions.install.unknownOption",{option:li});break}else if(!Ot)Ot=li;else{ha=j("extensions.install.usage");break}}if(ha)return P.appendLocalUserMessage(L),P.dispatch([{type:"error",text:ha}]),!0;if(!Ot)return P.appendLocalUserMessage(L),P.dispatch([{type:"error",text:j("extensions.install.usage")}]),!0;if(ue)return P.appendLocalUserMessage(L),P.dispatch([{type:"error",text:j("extensions.install.waitForTurn")}]),!0;const fa=V0.current.clientId;return fa?(P.appendLocalUserMessage(L),P.dispatch([{type:"status",text:j("extensions.install.started",{source:Ot})}]),M.installExtension({source:Ot,...rr?{ref:rr}:{},...dr?{registry:dr}:{},...vs!==void 0?{autoUpdate:vs}:{},...oc!==void 0?{allowPreRelease:oc}:{},consent:!0},fa).then(()=>{}).catch(xs=>{gt(xs,j("extensions.install.requestFailed"))}),!0):(P.appendLocalUserMessage(L),P.dispatch([{type:"error",text:j("extensions.install.waitForSession")}]),!0)}return P.appendLocalUserMessage(L),P.dispatch([{type:"error",text:j("extensions.install.usage")}]),!0}if(Ke==="clear")return Y.newSession().catch(_e=>{gt(_e,"Failed to create a new session")}),!0;if(Ke==="new"||Ke==="reset")return Y.newSession().catch(_e=>{gt(_e,"Failed to create a new session")}),!0;if(Ke==="rename"){const _e=U4e(L.slice(at[0].length));if(_e.type==="auto"||_e.type==="delegate")return ue?Xs(L,Q):(lt(L,Q).catch(hn=>gt(hn,"Failed to send /rename command")),!0);const Ne=_e.displayName;return Ne?(Y.renameSession(Ne).then(()=>{P.dispatch([{type:"status",text:j("rename.success",{name:Ne})}])}).catch(hn=>{gt(hn,"Failed to rename session")}),!0):(ye("error",j("rename.empty")),!0)}if(Ke==="resume"){const _e=L.slice(at[0].length).trim();return _e?Y.loadSession(_e).catch(Ne=>{gt(Ne,"Failed to load session")}):Ks(!0),!0}if(Ke==="recap")return c5(),!0;if(Ke==="btw")return u5(L.slice(at[0].length)),!0;if(Ke==="stats"){const _e=L.slice(at[0].length).trim().toLowerCase();let Ne="overview";return _e==="model"?Ne="model":_e==="tools"&&(Ne="tools"),P.appendLocalUserMessage(L),Y.getStats().then(hn=>{P.dispatch([{type:"status",text:pne(hn,Ne)}])}).catch(()=>{}),!0}if(Ke==="status"||Ke==="about")return P.appendLocalUserMessage(L),Promise.all([M.loadPreflight().catch(()=>null),M.loadProviders().catch(()=>null),M.loadEnv().catch(()=>null)]).then(([_e,Ne,hn])=>{var lc,C5,E5,A5,M5,N5;const Ot=a9(_e,hn);let rr=Ot.authSource;!rr&&((lc=Ne==null?void 0:Ne.current)!=null&&lc.authType)&&(rr=Ne.current.authType);const dr=[];Ot.nodeVersion&&dr.push(`Node.js v${Ot.nodeVersion}`),Ot.npmVersion&&dr.push(`npm ${Ot.npmVersion}`);let vs="";rr&&(rr.startsWith("oauth")||rr==="qwen-oauth"?vs="Qwen OAuth":vs=`API Key - ${rr}`);const oc=`${Ot.platform} ${Ot.arch}`.trim(),ha=l5.current,fa=V0.current,li={cliVersion:((C5=fa.capabilities)==null?void 0:C5.qwenCodeVersion)||"",runtime:dr.join(" / "),platform:oc,auth:vs,baseUrl:((E5=Ne==null?void 0:Ne.current)==null?void 0:E5.baseUrl)||"",model:ha||fa.currentModel||((A5=Ne==null?void 0:Ne.current)==null?void 0:A5.modelId)||"",fastModel:((M5=Ne==null?void 0:Ne.current)==null?void 0:M5.fastModelId)||ha||fa.currentModel||((N5=Ne==null?void 0:Ne.current)==null?void 0:N5.modelId)||"",sessionId:fa.sessionId||"",sandbox:Ot.sandbox,proxy:Ot.proxy,memoryUsage:Ot.memoryUsage};P.dispatch([{type:"status",text:Ine(li)}])}),!0;if(Ke==="bug"){const _e=L.slice(at[0].length).trim();return P.appendLocalUserMessage(L),Promise.all([M.loadPreflight().catch(()=>null),M.loadEnv().catch(()=>null)]).then(([Ne,hn])=>{var vs;const Ot=a9(Ne,hn),rr=((vs=V0.current.capabilities)==null?void 0:vs.qwenCodeVersion)||"",dr={};if(rr&&(dr.cliVersion=rr),Ot.nodeVersion&&(dr.nodeVersion=Ot.nodeVersion),Ot.npmVersion&&(dr.npmVersion=Ot.npmVersion),Ot.platform&&(dr.platform=Ot.platform),Ot.arch&&(dr.arch=Ot.arch),Ot.sandbox&&(dr.sandbox=Ot.sandbox),Ot.memoryUsage&&(dr.memoryUsage=Ot.memoryUsage),My.current)My.current({title:_e,systemInfo:dr}),P.dispatch([{type:"status",text:j("bug.submitted")}]);else{const oc=Object.entries(dr).filter(([,xs])=>xs).map(([xs,li])=>`${xs}: ${li}`).join(`
`),ha=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(_e)}&info=${encodeURIComponent(`
`+oc+`
`)}`,fa=window.open(ha,"_blank");fa?(fa.opener=null,P.dispatch([{type:"status",text:j("bug.submitted")}])):ye("error",j("bug.popupBlocked"))}}).catch(Ne=>{gt(Ne,j("bug.failed"))}),!0}}return ue?Xs(L,Q):(lt(L,Q).catch(Ke=>gt(Ke,"Failed to send command")),!0)}else if(L.startsWith("!")){if(ue)return Xs(L,Q);const at=L.slice(1).trim();return at?(Y.sendShellCommand(at).catch(Ke=>{gt(Ke,"Failed to execute shell command")}),!0):!1}else return ue?Xs(L,Q):(lt(L,Q).catch(at=>gt(at,"Failed to send message")),!0)},[lt,Y,P,Xs,X0,k5,W0,Su,ph,Ly,ye,gt,c5,u5,z,yh,j,M]);v.useEffect(()=>{if(G0.current||!Rr||an!=="idle"||Gi||oe||bu.length===0)return;const L=h5();if(!L)return;G0.current=!0;let Q=!1;const ue=window.setTimeout(()=>{var Xe;Q=!0;try{By(L.text,L.images),(Xe=L.onComplete)==null||Xe.call(L)}finally{G0.current=!1}},0);return()=>{Q||(oi.current=[L,...oi.current],vu(oi.current)),window.clearTimeout(ue),G0.current=!1}},[Rr,Gi,By,oe,h5,bu,an]);const bj=v.useCallback((L,Q,ue)=>{Y.submitPermission(L,Q,ue).catch(Xe=>{gt(Xe,"Failed to submit permission choice")})},[Y,gt]),_5=v.useCallback(()=>{Y.cancel().catch(L=>{gt(L,"Failed to cancel request")})},[Y,gt]),vj=v.useCallback(()=>{var L;return Gi?!1:((L=G.current)==null?void 0:L.focusTaskPill())??!1},[Gi]),Q0=v.useCallback(L=>{var Q,ue;if(L){(Q=te.current)==null||Q.insertText(L);return}(ue=te.current)==null||ue.focus()},[]),zy=v.useCallback(()=>{rc.current&&Rr&&cr.current==="idle"&&Gs.current&&Vs.current?(Ya.current=Gs.current,da(!1),lt(Vs.current,ua.current,{optimisticUserMessage:!1,retry:!0}).catch(L=>gt(L,"Failed to retry prompt"))):P.dispatch([{type:"status",text:j("retry.none")}])},[Rr,lt,gt,P,j]);v.useEffect(()=>{const L=Q=>{if(!Gi&&Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!Q.shiftKey){if(Q.key==="l"){Q.preventDefault(),b5();return}if(Q.key==="o"){Q.preventDefault(),v5();return}if(Q.key==="y"){Q.preventDefault(),zy();return}}};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[Gi,b5,v5,zy,P,j]),v.useEffect(()=>{const L=()=>{Ys.current=0,eo(!1),Vi.current&&(clearTimeout(Vi.current),Vi.current=null)},Q=ue=>{var Xe,at;if(!(ue.defaultPrevented||ue.isComposing)){if(ue.key!=="Escape"){Ys.current>0&&L(),ue.key==="Tab"&&ue.shiftKey&&!Gi&&(ue.preventDefault(),Oy());return}if(!(oe||Gi)){if(to){ue.preventDefault(),ue.stopPropagation(),Ko(null),Q0(),L();return}if(Ny()){ue.preventDefault(),L();return}if((Xe=te.current)!=null&&Xe.hasInput()){ue.preventDefault(),Ys.current===0?(Ys.current=1,eo(!0),Vi.current&&clearTimeout(Vi.current),Vi.current=setTimeout(()=>{L()},500)):((at=te.current)==null||at.clear(),L());return}if(an!=="idle"){ue.preventDefault(),_5(),L();return}}}};return window.addEventListener("keydown",Q),()=>{window.removeEventListener("keydown",Q),Ys.current=0,eo(!1),Vi.current&&(clearTimeout(Vi.current),Vi.current=null)}},[an,_5,Oy,oe,Gi,to,Q0,Ny]);const xj=!Rr,wj=v.useCallback(L=>{Y.setModel(L).then(Q=>{const ue=j4e(Q);F0((ue==null?void 0:ue.modelId)??L),ue&&P.dispatch({type:"debug",text:L4e(ue)})}).catch(Q=>{gt(Q,j("model.switch"))})},[Y,P,gt,j]),kj=v.useCallback(L=>{an==="idle"&&lt(`/model --fast ${L}`).catch(Q=>{gt(Q,"Failed to switch fast model")})},[lt,an,gt]),S5=v.useMemo(()=>{const L=new Set(q.skills??[]);return kve(q.commands??[],wve(j)).filter(Q=>!jy.has(c9(Q.name))).map(Q=>L.has(Q.name)?{...Q,displayCategory:"skill",description:Q.description||j("skills.run")}:Q)},[q.commands,q.skills,jy,j]),Py=v.useMemo(()=>{var L;return{version:((L=q.capabilities)==null?void 0:L.qwenCodeVersion)||"",cwd:q.workspaceCwd||"",currentModel:fh,currentMode:Yo,hideTips:(ku==null?void 0:ku.values.effective)===!0}},[(T5=q.capabilities)==null?void 0:T5.qwenCodeVersion,q.workspaceCwd,fh,Yo,ku==null?void 0:ku.values.effective]),_j=v.useMemo(()=>p?p(Py):f.jsx(zge,{...Py}),[p,Py]),Sj=[jr.app,Ty===Oi.Light?jr.themeLight:jr.themeDark,s].filter(Boolean).join(" ");return f.jsx(VU,{value:Ty,children:f.jsx(oee,{language:z,children:f.jsxs("div",{className:Sj,style:a,"data-web-shell-root":!0,children:[!E&&f.jsx(Vpe,{toasts:R,onDismiss:xe}),Ay&&f.jsxs("div",{className:jr.dialogOverlay,"data-keyboard-scope":!0,children:[yu&&f.jsx(Zge,{onSelect:L=>{Y.loadSession(L).catch(Q=>{gt(Q,"Failed to load session")})},onClose:()=>Ks(!1)}),Qa&&f.jsx(vve,{onDeleted:L=>{P.dispatch([{type:"status",text:L.length===1?`${j("delete.deleted")} (${L[0].slice(0,8)})`:j("delete.deletedCount",{count:L.length})}])},onError:L=>{if($h(L))return;const Q=L instanceof Error?L.message:String(L);ye("error",j("delete.failed",{reason:Q}))},onClose:()=>sc(!1)}),Fi&&f.jsx(xve,{onReleased:L=>{P.dispatch([{type:"status",text:`${j("release.released")} (${L.slice(0,8)})`}])},onError:L=>{if($h(L))return;const Q=L instanceof Error?L.message:String(L);ye("error",j("release.failed",{reason:Q}))},onClose:()=>Ja(!1)}),It&&f.jsx(yve,{commands:S5,onClose:()=>In(!1)}),kr&&f.jsx(bve,{currentTheme:Ty,onSelect:W0,onClose:()=>Za(!1)}),W&&f.jsx(rbe,{onClose:()=>se(!1)}),le&&f.jsx(sbe,{onClose:()=>Pe(!1)})]}),f.jsx($U,{value:N,children:f.jsx(dh.Provider,{value:Dy,children:f.jsxs(S4e,{timeline:ge,details:ze,children:[f.jsxs("div",{className:Yn?`${jr.content} ${jr.contentHasMessages}`:jr.content,style:Ay?{visibility:"hidden"}:void 0,children:[f.jsx(mce,{ref:Gt,messages:Ie,pendingApproval:oe,onConfirm:bj,onShowContextDetail:gj,catchingUp:q.catchingUp,isResponding:an!=="idle",workspaceCwd:q.workspaceCwd||"",shellOutputMaxLines:mj,showRetryHint:Xa,onRetryClick:zy,welcomeHeader:_j,tailContent:wt||Ct||wr||tn||ys||St?f.jsxs(f.Fragment,{children:[tn&&f.jsx(nbe,{onMessage:(L,Q="status")=>{P.dispatch([Q==="error"?{type:"error",text:L}:{type:"status",text:L}])},onClose:()=>Or(!1)}),ys&&f.jsx(Yge,{currentMode:Yo,onSelect:Su,onClose:()=>Go(!1)}),wr&&f.jsx(Lye,{mode:wr,onSelect:wr==="fast"?kj:wj,onClose:()=>Ws(null)}),wt&&f.jsx(q1e,{mode:wt,onMessage:L=>P.dispatch([{type:"status",text:L}]),onClose:()=>Pt(null)}),Ct&&f.jsx(mye,{refreshSignal:ac,addSignal:ky,addScope:be,portalHost:ft,onMessage:(L,Q="status")=>{P.dispatch([{type:Q,text:L}])},onClose:()=>Xn(!1)}),St&&f.jsx(Pbe,{settingsState:p5,onClose:()=>ct(!1),onLanguageChange:pj,onThemeChange:W0,onSubDialog:L=>{ct(!1),L==="fastModel"?Ws("fast"):L==="tools.approvalMode"&&Go(!0)}})]}):void 0,tailKey:wt||Ct||wr||tn||ys||St?`inline-${tn?"auth":"none"}-${wr??"none"}-${wt??"none"}-${Ct?"memory":"none"}-${ys?"approval":"none"}-${St?"settings":"none"}`:void 0,autoScrollTailIntoView:ys||wr!==null||St,virtualScrollThreshold:y}),(pt==null?void 0:pt.role)==="btw"&&f.jsx("div",{className:jr.btwPanel,children:f.jsx(TI,{question:pt.question,answer:pt.answer,isPending:pt.isPending})}),f.jsx(jpe,{})]}),f.jsx("div",{ref:Rt,"data-web-shell-overlay-root":!0})]})})}),f.jsxs("div",{className:Gi?`${jr.footer} ${jr.footerHidden}`:jr.footer,children:[Yn&&!to&&f.jsx("div",{className:jr.bottomPanels,children:f.jsx(mge,{todos:ot,onLocateSource:$e.sourceMessageId?xt:void 0})}),!Re&&f.jsxs("div",{className:jr.composer,children:[f.jsx(G4e,{prompts:bu,t:j}),f.jsx(Hme,{ref:Ue,onSubmit:By,onCycleMode:Oy,onToggleShortcuts:m5,disabled:xj,commands:S5,skills:ic,slashCommandCategoryOrder:h,queuedMessages:bu.map(L=>L.text),onFocusFooter:vj,onPopQueuedMessages:hj,onClearQueuedMessages:Ny,currentMode:Yo,sessionName:uj,dialogOpen:Gi||to!==null,followupState:Vn,onAcceptFollowup:Hi,onDismissFollowup:qi,composerInput:T,composerInputVersion:O,placeholderText:j(Rr?an!=="idle"?"editor.processing":"editor.placeholder":"common.loading")})]}),to&&f.jsx("div",{className:jr.tasksBottomPanel,children:f.jsx(gI,{message:to,manageActiveEvent:!1,onClose:()=>{Ko(null),Q0()}})}),!Re&&!to&&(Qt?f.jsx(Spe,{onClose:fj}):B?f.jsx(B,{connected:Rr,mode:Yo,model:fh,streamingState:an,contextUsageRatio:(q.contextWindow??0)>0?(q.tokenCount??0)/(q.contextWindow??0):0,activeGoal:zt,tasks:fe,availableModes:ip,availableModels:(q.models??[]).map(L=>({id:L.id,label:L.label,contextWindow:L.contextWindow})),skills:ic,onSelectMode:L=>Su(L),onSelectModel:L=>{Y.setModel(L).then(()=>{F0(L)})}}):f.jsx(gpe,{escapeHint:bs,onSelectMode:()=>Go(L=>!L),onSelectModel:()=>Ws(L=>L?null:"main"),onShowContext:()=>yh("/context",!1),onOpenSettings:()=>ct(L=>!L),ref:G,onOpenTasks:()=>yj(),onReturnToInput:Q0,tasks:nr,activeGoal:zt,hideSettings:Ly,onToggleShortcuts:m5}))]})]})})})}function K4e(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search).get("daemon")||"";return t?Q4e(t):""}let sp;function Y4e(){return sp||(typeof window>"u"?void 0:(sp=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,sp))}function X4e(){if(typeof window>"u")return;const t=new URL(window.location.href);let e=!1;if(t.searchParams.has("token")&&(t.searchParams.delete("token"),e=!0),t.hash){const n=new URLSearchParams(t.hash.replace(/^#/,""));if(n.has("token")){n.delete("token");const r=n.toString();t.hash=r?`#${r}`:"",e=!0}}e&&window.history.replaceState(null,"",t)}function Q4e(t){try{const e=new URL(t,window.location.origin);if(!(e.protocol==="http:"||e.protocol==="https:"))return"";if(e.origin===window.location.origin)return e.origin;if(!(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="::1"||e.hostname==="[::1]"))return"";const i=window.location.port||(window.location.protocol==="https:"?"443":"80");return(e.port||(e.protocol==="https:"?"443":"80"))!==i?"":e.origin}catch{return""}}const J4e=K4e(),Z4e=Y4e();X4e();const nj="qwen-code-web-shell-language",rj="qwen-code-web-shell-theme";function ij(t){if(t===Oi.Dark||t===Oi.Light)return t}function exe(){const t=new URLSearchParams(window.location.search).get("theme");return ij(t)}function txe(){try{return ij(window.localStorage.getItem(rj))}catch{return}}function nxe(t){try{window.localStorage.setItem(rj,t)}catch{}}function rxe(){return exe()??txe()??Oi.Dark}function ixe(){try{const t=window.localStorage.getItem(nj);return t?Rl(t):void 0}catch{return}}function sxe(t){try{window.localStorage.setItem(nj,t)}catch{}}function axe(){const t=new URLSearchParams(window.location.search),e=t.get("language")??t.get("lang");return Rl(e||(ixe()??navigator.language))}function oxe(){const t=window.location.pathname.match(/\/session\/([^/]+)/);if(t)try{return decodeURIComponent(t[1])}catch{return}}function lxe(){const[t,e]=v.useState(()=>rxe()),[n,r]=v.useState(()=>axe()),i=v.useMemo(()=>oxe(),[]),s=J4e||window.location.origin,a=v.useCallback(l=>{e(l),nxe(l)},[]),o=v.useCallback(l=>{r(l),sxe(l)},[]);return f.jsx(B$,{baseUrl:s,token:Z4e,children:f.jsx(Q$,{initialSessionId:i,suppressOwnUserEcho:!0,children:f.jsx(W4e,{theme:t,onThemeChange:a,language:n,onLanguageChange:o,compactThinking:!0})})})}Sz.createRoot(document.getElementById("root")).render(f.jsx(Vj.StrictMode,{children:f.jsx(lxe,{})}));export{U as _,zp as c,l1 as g,fxe as k};
